Beispiel #1
0
beast::File Config::getValidatorsFile () const
{
    beast::String const s (VALIDATORS_FILE.native().c_str());
    if (s.isNotEmpty() && getConfigDir() != beast::File::nonexistent())
        return getConfigDir().getChildFile (s);
    return beast::File::nonexistent ();
}
Beispiel #2
0
beast::File Config::getConfigDir () const
{
    beast::String const s (CONFIG_FILE.native().c_str ());
    if (s.isNotEmpty ())
        return beast::File (s).getParentDirectory ();
    return beast::File::nonexistent ();
}
Beispiel #3
0
beast::File Config::getDatabaseDir () const
{
    beast::String const s (DATA_DIR.native().c_str());
    if (s.isNotEmpty ())
        return beast::File (s);
    return beast::File::nonexistent ();
}
Beispiel #4
0
Value::Value (beast::String const& beastString)
    : type_ ( stringValue )
    , allocated_ ( true )
{
    value_.string_ = valueAllocator ()->duplicateStringValue ( beastString.toStdString ().c_str (),
                     (unsigned int)beastString.length () );

}
Beispiel #5
0
beast::File Config::getModuleDatabasePath () const
{
    boost::filesystem::path dbPath (legacy ("database_path"));

    beast::String const s (dbPath.native ().c_str ());
    if (s.isNotEmpty ())
        return beast::File (s);
    return beast::File::nonexistent ();
}
Beispiel #6
0
Value::Value (beast::String const& beastString)
    : type_ ( stringValue )
    , allocated_ ( true )
    , comments_ ( 0 )
# ifdef JSON_VALUE_USE_INTERNAL_MAP
    , itemIsUsed_ ( 0 )
#endif
{
    value_.string_ = valueAllocator ()->duplicateStringValue ( beastString.toStdString ().c_str (),
                     (unsigned int)beastString.length () );

}
Beispiel #7
0
beast::StringPairArray
parseKeyValueSection (Section& secSource, beast::String const& strSection)
{
    beast::StringPairArray result;

    // yuck.
    std::string const stdStrSection (strSection.toStdString ());

    typedef Section::mapped_type Entries;

    Entries* const entries = SectionEntries (secSource, stdStrSection);

    if (entries != nullptr)
    {
        for (Entries::const_iterator iter = entries->begin (); iter != entries->end (); ++iter)
        {
            beast::String const line (iter->c_str ());

            int const equalPos = line.indexOfChar ('=');

            if (equalPos != -1)
            {
                beast::String const key = line.substring (0, equalPos);
                beast::String const value = line.substring (equalPos + 1, line.length ());

                result.set (key, value);
            }
        }
    }

    return result;
}
Beispiel #8
0
void Config::setRpcIpAndOptionalPort (std::string const& newAddress)
{
    beast::String const s (newAddress.c_str ());
    
    int const colonPosition = s.lastIndexOfChar (':');

    if (colonPosition != -1)
    {
        beast::String const ipPart = s.substring (0, colonPosition);
        beast::String const portPart = s.substring (colonPosition + 1, s.length ());

        setRpcIP (ipPart.toRawUTF8 ());
        setRpcPort (portPart.getIntValue ());
    }
    else
    {
        setRpcIP (newAddress);
    }
}