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