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 (); }
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 (); }
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 (); }
Value::Value (beast::String const& beastString) : type_ ( stringValue ) , allocated_ ( true ) { value_.string_ = valueAllocator ()->duplicateStringValue ( beastString.toStdString ().c_str (), (unsigned int)beastString.length () ); }
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 (); }
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 () ); }
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; }
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); } }