|
Yate
|
A C-style string handling class. More...
#include <yateclass.h>
Public Types | |
| enum | Align { Left = 0 , Center , Right } |
Public Member Functions | |
| String () | |
| String (const char *value, int len=-1) | |
| String (char value, unsigned int repeat=1) | |
| String (int32_t value) | |
| String (uint32_t value) | |
| String (int64_t value) | |
| String (uint64_t value) | |
| String (bool value) | |
| String (double value) | |
| String (const String &value) | |
| String (const String *value) | |
| virtual | ~String () |
| virtual void * | getObject (const String &name) const |
| const char * | c_str () const |
| const char * | safe () const |
| const char * | safe (const char *defStr) const |
| unsigned int | length () const |
| bool | null () const |
| int | lenUtf8 (uint32_t maxChar=0x10ffff, bool overlong=false) const |
| int | fixUtf8 (const char *replace=0, uint32_t maxChar=0x10ffff, bool overlong=false) |
| unsigned int | encodeFlags (const TokenDict *tokens) const |
| uint64_t | encodeFlags (const TokenDict64 *tokens) const |
| const String & | decodeFlags (unsigned int flags, const TokenDict *tokens, bool unknownflag=true) |
| const String & | decodeFlags (uint64_t flags, const TokenDict64 *tokens, bool unknownflag=true) |
| bool | checkBOM () const |
| bool | stripBOM () |
| unsigned int | hash () const |
| void | clear () |
| char | at (int index) const |
| String | substr (int offs, int len=-1) const |
| String & | trimBlanks () |
| String & | trimSpaces () |
| virtual const String & | toString () const |
| int | toInteger (int defvalue=0, int base=0, int minvalue=INT_MIN, int maxvalue=INT_MAX, bool clamp=true) const |
| int | toInteger (const TokenDict *tokens, int defvalue=0, int base=0) const |
| long int | toLong (long int defvalue=0, int base=0, long int minvalue=LONG_MIN, long int maxvalue=LONG_MAX, bool clamp=true) const |
| int64_t | toInt64 (int64_t defvalue=0, int base=0, int64_t minvalue=LLONG_MIN, int64_t maxvalue=LLONG_MAX, bool clamp=true) const |
| uint64_t | toUInt64 (uint64_t defvalue=0, int base=0, uint64_t minvalue=0, uint64_t maxvalue=ULLONG_MAX, bool clamp=true) const |
| double | toDouble (double defvalue=0.0) const |
| bool | toBoolean (bool defvalue=false) const |
| bool | isBoolean () const |
| String & | toUpper () |
| String & | toLower () |
| char | operator[] (signed int index) const |
| char | operator[] (unsigned int index) const |
| operator const char * () const | |
| String & | assign (const char *value, int len=-1) |
| String & | assign (char value, unsigned int repeat=1) |
| String & | hexify (void *data, unsigned int len, char sep=0, bool upCase=false) |
| String & | operator= (const String &value) |
| String & | operator= (const String *value) |
| String & | operator= (const char *value) |
| String & | operator= (char value) |
| String & | operator= (int32_t value) |
| String & | operator= (uint32_t value) |
| String & | operator= (int64_t value) |
| String & | operator= (uint64_t value) |
| String & | operator= (bool value) |
| String & | operator= (double value) |
| String & | operator+= (const char *value) |
| String & | operator+= (char value) |
| String & | operator+= (int32_t value) |
| String & | operator+= (uint32_t value) |
| String & | operator+= (int64_t value) |
| String & | operator+= (uint64_t value) |
| String & | operator+= (bool value) |
| String & | operator+= (double value) |
| bool | operator== (const char *value) const |
| bool | operator!= (const char *value) const |
| bool | operator== (const String &value) const |
| bool | operator!= (const String &value) const |
| bool | operator&= (const char *value) const |
| bool | operator|= (const char *value) const |
| String & | operator<< (const char *value) |
| String & | operator<< (char value) |
| String & | operator<< (int32_t value) |
| String & | operator<< (uint32_t value) |
| String & | operator<< (int64_t value) |
| String & | operator<< (uint64_t value) |
| String & | operator<< (bool value) |
| String & | operator<< (double value) |
| String & | operator>> (const char *skip) |
| String & | operator>> (char &store) |
| String & | operator>> (UChar &store) |
| String & | operator>> (int &store) |
| String & | operator>> (unsigned int &store) |
| String & | operator>> (bool &store) |
| String & | append (const char *value, int len) |
| String & | append (const char *value, const char *separator=0, bool force=false) |
| String & | append (const ObjList *list, const char *separator=0, bool force=false) |
| String & | append (const ObjList &list, const char *separator=0, bool force=false) |
| String & | append (double value, unsigned int decimals=3) |
| String & | printf (const char *format,...) |
| String & | printf (unsigned int length, const char *format,...) |
| String & | appendFixed (unsigned int fixedLength, const char *str, unsigned int len=-1, char fill=' ', int align=Left) |
| String & | appendFixed (unsigned int fixedLength, const String &str, char fill=' ', int align=Left) |
| int | find (char what, unsigned int offs=0) const |
| int | find (const char *what, unsigned int offs=0) const |
| int | rfind (char what) const |
| int | rfind (const char *what) const |
| bool | startsWith (const char *what, bool wordBreak=false, bool caseInsensitive=false) const |
| bool | endsWith (const char *what, bool wordBreak=false, bool caseInsensitive=false) const |
| bool | startSkip (const char *what, bool wordBreak=true, bool caseInsensitive=false) |
| String & | extractTo (const char *sep, String &store) |
| String & | extractTo (const char *sep, bool &store) |
| String & | extractTo (const char *sep, int &store, int base=0) |
| String & | extractTo (const char *sep, int &store, const TokenDict *tokens, int base=0) |
| String & | extractTo (const char *sep, double &store) |
| virtual bool | matches (const String &value) const |
| bool | matches (const Regexp &rexp) |
| int | matchOffset (int index=0) const |
| int | matchLength (int index=0) const |
| String | matchString (int index=0) const |
| String | replaceMatches (const String &templ) const |
| int | matchCount () const |
| ObjList * | split (char separator, bool emptyOK=true) const |
| ObjList * | split (const Regexp ®, bool emptyOK=true) const |
| String | msgEscape (char extraEsc=0) const |
| String | msgUnescape (int *errptr=0, char extraEsc=0) const |
| String | sqlEscape (char extraEsc=0) const |
| String | uriEscape (char extraEsc=0, const char *noEsc=0) const |
| String | uriUnescape (int *errptr=0) const |
Public Member Functions inherited from GenObject | |
| GenObject () | |
| virtual | ~GenObject () |
| virtual bool | alive () const |
| virtual void | destruct () |
| virtual const String & | traceId () const |
| NamedCounter * | getObjCounter () const |
| NamedCounter * | setObjCounter (NamedCounter *counter) |
Static Public Member Functions | |
| static const String & | empty () |
| static const char * | boolText (bool value) |
| static int | lenUtf8 (const char *value, uint32_t maxChar=0x10ffff, bool overlong=false) |
| static bool | checkBOM (const char *str) |
| static bool | stripBOM (const char *&str) |
| static bool | stripBOM (char *&str) |
| static unsigned int | hash (const char *value, unsigned int h=0) |
| static String | msgEscape (const char *str, char extraEsc=0) |
| static String | msgUnescape (const char *str, int *errptr=0, char extraEsc=0) |
| static String | sqlEscape (const char *str, char extraEsc=0) |
| static String | uriEscape (const char *str, char extraEsc=0, const char *noEsc=0) |
| static String | uriEscape (const char *str, const char *extraEsc, const char *noEsc=0) |
| static String | uriUnescape (const char *str, int *errptr=0) |
| static const String * | atom (const String *&str, const char *val) |
Static Public Member Functions inherited from GenObject | |
| static void * | getObject (const String &name, const GenObject *obj) |
| static bool | getObjCounting () |
| static void | setObjCounting (bool enable) |
| static NamedCounter * | getObjCounter (const String &name, bool create=true) |
| static ObjList & | getObjCounters () |
Protected Member Functions | |
| virtual void | changed () |
A C-style string handling class.
A simple string handling class for C style (one byte) strings. For simplicity and read speed no copy-on-write is performed. Strings have hash capabilities and comparations are using the hash for fast inequality check.
| String | ( | ) |
Creates a new, empty string.
Referenced by SignallingCircuitRange::add(), MimeHeaderLine::addQuotes(), UIWidget::addTableRow(), Configuration::addValue(), append(), append(), append(), append(), append(), appendFixed(), appendFixed(), assign(), assign(), atom(), JabberID::bare(), ClientSound::build(), UIFactory::build(), XMPPFeatureCompress::build(), MimeHeaderLine::buildHeaders(), JBEntityCaps::buildId(), MimeAuthLine::buildLine(), MimeHeaderLine::buildLine(), JGStreamHost::buildRsp(), UIFactory::canBuild(), CapturedEvent::CapturedEvent(), CapturedEvent::CapturedEvent(), URI::changed(), Configuration::clearKey(), NamedList::clearParam(), ClientAccountList::ClientAccountList(), ClientSound::ClientSound(), Compressor::Compressor(), CallInfo::copyParam(), NamedList::copyParam(), CallInfo::copyParams(), NamedList::copyParams(), NamedList::copySubParams(), UIFactory::create(), Configuration::createSection(), DataFormat::DataFormat(), DataFormat::DataFormat(), Message::decode(), JGCrypto::decodeEncryption(), decodeFlags(), decodeFlags(), MimeHeaderLine::delQuotes(), UIWidget::delTableRow(), ClientSound::device(), Message::dispatched(), JabberID::domain(), NamedList::dump(), empty(), Message::encode(), Message::encode(), ExpOperation::ExpOperation(), ExpOperation::ExpOperation(), extractTo(), extractTo(), extractTo(), extractTo(), extractTo(), ClientSound::file(), ClientSound::find(), ClientAccountList::findAccount(), ClientAccountList::findAnyContact(), ClientAccountList::findContact(), ClientAccountList::findContact(), ClientAccountList::findContactByInstance(), ClientAccountList::findContactByUri(), ClientAccountList::findRoom(), ClientAccountList::findRoomByMember(), ClientAccountList::findSingleRegAccount(), Compressor::format(), SDPMedia::format(), SDPMedia::formats(), SIPDialog::fromTag(), SIPDialog::fromURI(), JGRtpCandidate::fromXml(), JGRtpCandidateP2P::fromXml(), NamedList::getBoolValue(), Configuration::getBoolValue(), URI::getDescription(), NamedList::getDoubleValue(), Configuration::getDoubleValue(), URI::getExtra(), URI::getHost(), NamedList::getIndex(), NamedList::getInt64Value(), Configuration::getInt64Value(), NamedList::getIntValue(), NamedList::getIntValue(), Configuration::getIntValue(), Configuration::getIntValue(), Configuration::getKey(), ExpWrapper::getObject(), NamedList::getObject(), NamedString::getObject(), getObject(), Message::getObject(), MimeAuthLine::getObject(), MimeHeaderLine::getObject(), NamedList::getParam(), URI::getProtocol(), Configuration::getSection(), UIWidget::getSelect(), UIWidget::getTableRow(), UIWidget::getText(), NamedList::getUInt64Value(), URI::getUser(), NamedList::getValue(), Configuration::getValue(), XMPPFeatureCompress::hasMethod(), hexify(), SDPMedia::id(), UIWidget::insertTableRow(), ClientAccountList::isLocalContact(), JabberID::JabberID(), JabberID::JabberID(), JBEntityCaps::JBEntityCaps(), JBRemoteDomainDef::JBRemoteDomainDef(), JGCrypto::JGCrypto(), JGRtpCandidate::JGRtpCandidate(), JGSentStanza::JGSentStanza(), JGStreamHost::JGStreamHost(), JGStreamHost::JGStreamHost(), SDPMedia::localCrypto(), SDPMedia::localPort(), NamedInt::lookup(), NamedInt::lookupName(), SDPMedia::mappings(), matches(), matchString(), XMPPFeatureCompress::methods(), MimeAuthLine::MimeAuthLine(), MimeHeaderLine::MimeHeaderLine(), msgEscape(), msgEscape(), msgUnescape(), msgUnescape(), NamedString::name(), UIWidget::name(), NamedCounter::NamedCounter(), NamedInt::NamedInt(), NamedInt::NamedInt(), NamedList::NamedList(), JabberID::node(), JabberID::operator!=(), operator!=(), operator+=(), operator+=(), operator+=(), operator+=(), operator+=(), operator+=(), operator+=(), operator+=(), operator<<(), operator<<(), operator<<(), operator<<(), operator<<(), operator<<(), operator<<(), operator<<(), JabberID::operator=(), JabberID::operator=(), SIPDialog::operator=(), operator=(), operator=(), operator=(), operator=(), operator=(), operator=(), operator=(), operator=(), operator=(), operator=(), Configuration::operator=(), URI::operator=(), JabberID::operator==(), operator==(), operator>>(), operator>>(), operator>>(), operator>>(), operator>>(), operator>>(), NamedList::operator[](), SDPMedia::payloadMapping(), printf(), printf(), MimeHeaderLine::quote(), Compressor::readDecomp(), SDPMedia::remoteCrypto(), SDPMedia::remotePort(), ClientAccountList::removeAccount(), replaceMatches(), NamedList::replaceParams(), JabberID::resource(), Message::retValue(), Message::retValue(), SDPMedia::rfc2833(), MessageHandler::safeNowInternal(), Configuration::save(), SignallingCircuitRange::set(), ClientSound::setChannel(), UIWidget::setMultipleRows(), NamedList::setParam(), UIWidget::setSelect(), UIWidget::setTableRow(), UIWidget::setText(), Configuration::setValue(), Configuration::setValue(), Configuration::setValue(), SignallingCircuitRange::SignallingCircuitRange(), SIPDialog::SIPDialog(), sqlEscape(), sqlEscape(), ClientSound::start(), ClientSound::started(), ClientSound::stop(), String(), String(), substr(), SDPMedia::suffix(), toLower(), ISDNQ931IE::toString(), NamedString::toString(), toString(), SIPDialog::toTag(), toUpper(), SIPDialog::toURI(), MessageHandler::trackName(), SDPMedia::transport(), trimBlanks(), trimSpaces(), UIWidget::UIWidget(), MimeHeaderLine::unquote(), URI::URI(), uriEscape(), uriEscape(), uriEscape(), uriUnescape(), uriUnescape(), Message::userObject(), JabberID::valid(), Compressor::writeComp(), Compressor::writeDecomp(), XMPPFeature::XMPPFeature(), XMPPFeature::XMPPFeature(), and XMPPFeatureCompress::XMPPFeatureCompress().
| String | ( | const char * | value, |
| int | len = -1 ) |
Creates a new initialized string.
| value | Initial value of the string |
| len | Length of the data to copy, -1 for full string |
|
explicit |
Creates a new initialized string.
| value | Character to fill the string |
| repeat | How many copies of the character to use |
|
explicit |
Creates a new initialized string from a 32 bit integer.
| value | Value to convert to string |
|
explicit |
Creates a new initialized string from a 32 bit unsigned int.
| value | Value to convert to string |
|
explicit |
Creates a new initialized string from a 64 bit integer.
| value | Value to convert to string |
|
explicit |
Creates a new initialized string from a 64 bit unsigned int.
| value | Value to convert to string |
|
explicit |
Creates a new initialized string from a boolean.
| value | Value to convert to string |
|
explicit |
Creates a new initialized string from a double value.
| value | Value to convert to string |
|
virtual |
Destroys the string, disposes the memory.
| String & append | ( | const char * | value, |
| const char * | separator = 0, | ||
| bool | force = false ) |
| String & append | ( | const char * | value, |
| int | len ) |
Append a string to the current string
| value | String from which to append |
| len | Length of the data to copy, -1 for full string |
References String().
Referenced by append(), Time::appendTo(), SliceVector< Complex >::dump(), SliceVector< Complex >::dump(), operator+=(), SDPMedia::parameter(), and SDPMedia::parameter().
List members appending with a separator
| list | Reference of ObjList whose toString() of the items will be appended |
| separator | Separator to insert before each item in list |
| force | True to allow appending empty strings |
List members appending with a separator
| list | Pointer to ObjList whose toString() of the items will be appended |
| separator | Separator to insert before each item in list |
| force | True to allow appending empty strings |
References String().
| String & append | ( | double | value, |
| unsigned int | decimals = 3 ) |
Explicit double append
| value | Value to append |
| decimals | Number of decimals |
References String().
| String & appendFixed | ( | unsigned int | fixedLength, |
| const char * | str, | ||
| unsigned int | len = -1, | ||
| char | fill = ' ', | ||
| int | align = Left ) |
Build a fixed aligned string from str and append it.
| fixedLength | The fixed length in which the 'str' will be aligned. |
| str | The string to align |
| len | The number of characters to use from str. |
| fill | Character to fill the empty space. |
| align | The alignment mode. |
References String().
Referenced by appendFixed().
|
inline |
Build a fixed aligned string from str and append it.
| fixedLength | The fixed length in which the 'str' will be aligned. |
| str | The string to align |
| fill | Character to fill the empty space. |
| align | The alignment mode. |
References appendFixed(), c_str(), length(), and String().
| String & assign | ( | char | value, |
| unsigned int | repeat = 1 ) |
| String & assign | ( | const char * | value, |
| int | len = -1 ) |
| char at | ( | int | index | ) | const |
Extract the caracter at a given index
| index | Index of character in string |
Referenced by operator[](), and operator[]().
Atom string support helper
| str | Reference to variable to hold the atom string |
| val | String value to allocate to the atom |
References String().
Referenced by Atom::Atom().
|
inlinestatic |
A standard text representation of boolean values
| value | Boolean value to convert |
Referenced by ExpOperation::ExpOperation(), operator+=(), operator=(), SDPMedia::rfc2833(), ClientContact::setLocal(), ClientContact::setRemote(), and ClientAccount::startup().
|
inline |
Get the value of the stored string.
Referenced by appendFixed(), ISDNQ931Message::appendIEValue(), IAXIEList::appendString(), SASL::buildAuthRspReply(), checkBOM(), DataFormat::DataFormat(), ExpWrapper::ExpWrapper(), ExpWrapper::ExpWrapper(), ISDNQ931Message::getIEValue(), Hasher::hmac(), Hasher::hmacStart(), msgEscape(), msgUnescape(), operator!=(), operator=(), operator=(), operator==(), sqlEscape(), stripBOM(), SliceVector< Complex >::unHexify(), Hasher::update(), uriEscape(), uriUnescape(), Compressor::writeComp(), Stream::writeData(), and Compressor::writeDecomp().
|
protectedvirtual |
Called whenever the value changed (except in constructors).
Reimplemented in NamedPointer, Regexp, DataFormat, and URI.
|
inline |
Check if this string starts with UTF-8 Byte Order Mark
References c_str(), and checkBOM().
|
inlinestatic |
Check if a string starts with UTF-8 Byte Order Mark
| str | String to check for BOM |
Referenced by checkBOM(), stripBOM(), stripBOM(), and stripBOM().
| void clear | ( | ) |
Clear the string and free the memory
Referenced by JabberID::clear(), CallInfo::copyParam(), and CallInfo::copyParams().
| const String & decodeFlags | ( | uint64_t | flags, |
| const TokenDict64 * | tokens, | ||
| bool | unknownflag = true ) |
Decode flags from dictionary values
| flags | The flags |
| tokens | The dictionary containing the flags |
| unknownflag | True (default) to add unknown flags |
References String().
| const String & decodeFlags | ( | unsigned int | flags, |
| const TokenDict * | tokens, | ||
| bool | unknownflag = true ) |
Decodoe flags from dictionary values
| flags | The flags |
| tokens | The dictionary containing the flags |
| unknownflag | True (default) to add unknown flags |
References String().
|
static |
A static null String
References String().
Referenced by ClientContact::accountName(), Window::addOption(), SDPSession::addRtpParams(), StringArray::at(), JBStream::authenticated(), ClientContact::buildContactInstanceId(), ClientContact::buildIdHash(), ClientContact::buildInstanceId(), JGSession::buildTransfer(), ClientLogic::callStart(), DefaultLogic::callStart(), ClientLogic::cdrRemoteParty(), CallEndpoint::clearEndpoint(), ClientChannel::ClientChannel(), JBClientEngine::create(), Client::createDefaultLogic(), Client::createDialog(), Window::createDialog(), XMPPUtils::createElement(), XMPPUtils::createElement(), Client::createWindowSafe(), ScriptRun::currentFileName(), Client::decodeFlags(), MucRoom::destroyChatWindow(), Client::emitDigit(), Client::emitDigits(), IAXEngine::enableTrunking(), Client::generateGuid(), ClientContact::getContactSection(), SIPTransaction::getMethod(), Client::getOptions(), SignallingCircuit::getParams(), SIPTransaction::getURI(), IAXTrunkInfo::init(), UDPSession::initGroup(), IAXEngine::initTrunkIn(), IAXTrunkInfo::initTrunking(), DefaultLogic::joinRoom(), NamedInt::lookupName(), DefaultLogic::notifyGenericError(), SDPParser::parse(), SDPParser::parse(), Client::removeLastNameInPath(), ClientContact::removeShared(), JBClientStream::requestRegister(), RTPGroup::RTPGroup(), XmlDocument::saveFile(), JsParser::scriptChanged(), Client::select(), ClientLogic::select(), DefaultLogic::select(), ClientContact::sendChat(), ClientDriver::setActive(), ClientDriver::setAudioTransfer(), ClientContact::setChatInput(), MucRoom::setChatInput(), ClientChannel::setConference(), JGRtpMediaList::setMedia(), Client::setMultipleRows(), UIWidget::setMultipleRows(), Window::setMultipleRows(), SDPSession::setSdpDebug(), ClientResource::setStatusText(), ClientChannel::setTransfer(), XmlElement::setXmlns(), XMPPUtils::setXmlns(), JBServerStream::startComp(), XMPPUtils::subject(), XmlElementOut::toBuffer(), XmlCData::toString(), XmlComment::toString(), XmlDoctype::toString(), XmlDocument::toString(), XmlElement::toString(), XmlFragment::toString(), XmlText::toString(), SIPEvent::traceId(), Engine::trackParam(), IAXTrunkInfo::updateTrunking(), and XmlDocument::write().
| unsigned int encodeFlags | ( | const TokenDict * | tokens | ) | const |
Encode flags from dictionary values
| tokens | The dictionary containing the flags |
| uint64_t encodeFlags | ( | const TokenDict64 * | tokens | ) | const |
Encode flags from dictionary values
| tokens | The dictionary containing the flags |
| bool endsWith | ( | const char * | what, |
| bool | wordBreak = false, | ||
| bool | caseInsensitive = false ) const |
Checks if the string ends with a substring
| what | Substring to search for |
| wordBreak | Check if a word boundary precedes the substring |
| caseInsensitive | Compare case-insensitive if set |
| String & extractTo | ( | const char * | sep, |
| bool & | store ) |
Extract a boolean substring up to a separator
| sep | Separator string to match after extracted fragment |
| store | Reference to boolean variable to store extracted fragment |
References String().
| String & extractTo | ( | const char * | sep, |
| double & | store ) |
Extract a double value substring up to a separator
| sep | Separator string to match after extracted fragment |
| store | Reference to double variable to store extracted fragment |
References String().
Extract an integer or token value substring up to a separator
| sep | Separator string to match after extracted fragment |
| store | Reference to integer variable to store extracted fragment |
| tokens | Pointer to an array of tokens to lookup first |
| base | Numeration base, 0 to autodetect |
References String().
| String & extractTo | ( | const char * | sep, |
| int & | store, | ||
| int | base = 0 ) |
Extract an integer value substring up to a separator
| sep | Separator string to match after extracted fragment |
| store | Reference to integer variable to store extracted fragment |
| base | Numeration base, 0 to autodetect |
References String().
| int find | ( | char | what, |
| unsigned int | offs = 0 ) const |
Locate the first instance of a character in the string
| what | Character to search for |
| offs | Offset in string to start searching from |
Referenced by ClientContact::splitContactId().
| int find | ( | const char * | what, |
| unsigned int | offs = 0 ) const |
Locate the first instance of a substring in the string
| what | Substring to search for |
| offs | Offset in string to start searching from |
| int fixUtf8 | ( | const char * | replace = 0, |
| uint32_t | maxChar = 0x10ffff, | ||
| bool | overlong = false ) |
Fix an UTF-8 encoded string by replacing invalid sequences
| replace | String to replace invalid sequences, use U+FFFD if null |
| maxChar | Maximum accepted Unicode character code |
| overlong | Accept overlong UTF-8 sequences (dangerous!) |
|
virtual |
Get a pointer to a derived class given that class name
| name | Name of the class we are asking for |
Reimplemented from GenObject.
Reimplemented in ExpWrapper, NamedList, NamedPointer, NamedString, Message, MimeAuthLine, and MimeHeaderLine.
References String().
|
inline |
Get the hash of the contained string.
References hash().
Referenced by HashList::getHashList(), hash(), operator!=(), and operator==().
|
static |
Get the hash of an arbitrary string.
| value | C string to hash |
| h | Old hash value for incremental hashing |
| String & hexify | ( | void * | data, |
| unsigned int | len, | ||
| char | sep = 0, | ||
| bool | upCase = false ) |
Build a hexadecimal representation of a buffer of data
| data | Pointer to data to dump |
| len | Length of the data buffer |
| sep | Separator character to use between octets |
| upCase | Set to true to use upper case characters in hexa |
References String().
Referenced by SliceVector< Complex >::hexify(), and OctetString::toHexString().
| bool isBoolean | ( | ) | const |
Check if the string can be converted to a boolean value.
|
inline |
Get the length of the stored string.
Referenced by appendFixed(), IAXIEList::appendString(), SASL::buildAuthRspReply(), SliceVector< Complex >::dump(), Hasher::hmac(), Hasher::hmacStart(), printf(), SliceVector< Complex >::unHexify(), Hasher::update(), Compressor::writeComp(), Stream::writeData(), and Compressor::writeDecomp().
|
static |
Get the number of characters in a string assuming UTF-8 encoding
| value | C string to compute Unicode length |
| maxChar | Maximum accepted Unicode character code |
| overlong | Accept overlong UTF-8 sequences (dangerous!) |
Referenced by lenUtf8().
|
inline |
Get the number of characters in the string assuming UTF-8 encoding
| maxChar | Maximum accepted Unicode character code |
| overlong | Accept overlong UTF-8 sequences (dangerous!) |
References lenUtf8().
| int matchCount | ( | ) | const |
Get the total number of submatches from the last match, 0 if no match
| bool matches | ( | const Regexp & | rexp | ) |
Checks if matches a regular expression and fill the match substrings
| rexp | Regular expression to check for match |
|
inlinevirtual |
Checks if matches another string
| value | String to check for match |
Reimplemented in Regexp.
References operator==(), and String().
| int matchLength | ( | int | index = 0 | ) | const |
Get the length of the last match
| index | Index of the submatch to return, 0 for full match |
Referenced by matchString().
| int matchOffset | ( | int | index = 0 | ) | const |
Get the offset of the last match
| index | Index of the submatch to return, 0 for full match |
Referenced by matchString().
|
inline |
Get a copy of a matched (sub)string
| index | Index of the submatch to return, 0 for full match |
References matchLength(), matchOffset(), String(), and substr().
|
inline |
Create an escaped string suitable for use in messages
| extraEsc | Character to escape other than the default ones |
References c_str(), msgEscape(), and String().
|
static |
Create an escaped string suitable for use in messages
| str | String to convert to escaped format |
| extraEsc | Character to escape other than the default ones |
References String().
Referenced by msgEscape().
|
static |
Decode an escaped string back to its raw form
| str | String to convert to unescaped format |
| errptr | Pointer to an integer to receive the place of 1st error |
| extraEsc | Character to unescape other than the default ones |
References String().
Referenced by msgUnescape().
|
inline |
Decode an escaped string back to its raw form
| errptr | Pointer to an integer to receive the place of 1st error |
| extraEsc | Character to unescape other than the default ones |
References c_str(), msgUnescape(), and String().
|
inline |
Checks if the string holds a NULL pointer.
Referenced by JBServerStream::hasRemoteDomain(), JsParser::isEmpty(), JabberID::match(), and JabberID::valid().
|
inline |
Conversion to "const char *" operator.
| bool operator!= | ( | const char * | value | ) | const |
Inequality operator.
Referenced by operator!=().
|
inline |
Fast inequality operator.
References c_str(), hash(), operator!=(), and String().
| bool operator&= | ( | const char * | value | ) | const |
Case-insensitive equality operator.
|
inline |
Appending operator for booleans.
| value | Value to append to the string |
References boolText(), operator+=(), and String().
| String & operator+= | ( | char | value | ) |
Appending operator for single characters.
| value | Value to append to the string |
References String().
|
inline |
Appending operator for strings.
| value | Value to assign to the string |
References append(), and String().
Referenced by operator+=(), operator<<(), operator<<(), operator<<(), operator<<(), operator<<(), operator<<(), operator<<(), and operator<<().
| String & operator+= | ( | double | value | ) |
| String & operator+= | ( | int32_t | value | ) |
Appending operator for 32 bit integers.
| value | Value to append to the string |
References String().
| String & operator+= | ( | int64_t | value | ) |
Appending operator for 64 bit integers.
| value | Value to append to the string |
References String().
| String & operator+= | ( | uint32_t | value | ) |
Appending operator for 32 bit unsigned integers.
| value | Value to append to the string |
References String().
| String & operator+= | ( | uint64_t | value | ) |
Appending operator for 64 bit unsigned integers.
| value | Value to append to the string |
References String().
|
inline |
Stream style appending operator for booleans
References operator+=(), and String().
|
inline |
Stream style appending operator for single characters
References operator+=(), and String().
|
inline |
Stream style appending operator for C strings
References operator+=(), and String().
|
inline |
Stream style appending operator for double
References operator+=(), and String().
|
inline |
Stream style appending operator for 32 bit integers
References operator+=(), and String().
|
inline |
Stream style appending operator for 64 bit integers
References operator+=(), and String().
|
inline |
Stream style appending operator for 32 bit unsigned integers
References operator+=(), and String().
|
inline |
Stream style appending operator for 64 bit unsigned integers
References operator+=(), and String().
|
inline |
Assignment operator for booleans.
| value | Value to assign to the string |
References boolText(), operator=(), and String().
| String & operator= | ( | char | value | ) |
Assignment operator for single characters.
| value | Value to assign to the string |
References String().
| String & operator= | ( | const char * | value | ) |
Assignment from char* operator.
| value | Value to assign to the string |
References String().
Assignment operator.
| value | Value to assign to the string |
References c_str(), operator=(), and String().
Referenced by ExpOperation::operator=(), NamedString::operator=(), Regexp::operator=(), operator=(), operator=(), operator=(), Configuration::operator=(), Message::operator=(), URI::operator=(), URI::operator=(), and URI::operator=().
Assignment from String* operator.
| value | Value to assign to the string |
References c_str(), operator=(), and String().
| String & operator= | ( | double | value | ) |
| String & operator= | ( | int32_t | value | ) |
Assignment operator for 32 bit integers.
| value | Value to assign to the string |
References String().
| String & operator= | ( | int64_t | value | ) |
Assignment operator for 64 bit integers.
| value | Value to assign to the string |
References String().
| String & operator= | ( | uint32_t | value | ) |
Assignment operator for 32 bit unsigned integers.
| value | Value to assign to the string |
References String().
| String & operator= | ( | uint64_t | value | ) |
Assignment operator for 64 bit unsigned integers.
| value | Value to assign to the string |
References String().
| bool operator== | ( | const char * | value | ) | const |
Equality operator.
Referenced by matches(), and operator==().
|
inline |
Fast equality operator.
References c_str(), hash(), operator==(), and String().
| String & operator>> | ( | bool & | store | ) |
| String & operator>> | ( | char & | store | ) |
| String & operator>> | ( | const char * | skip | ) |
| String & operator>> | ( | int & | store | ) |
| String & operator>> | ( | unsigned int & | store | ) |
|
inline |
Indexing operator with signed int
| index | Index of character in string |
References at().
|
inline |
Indexing operator with unsigned int
| index | Index of character in string |
References at().
| bool operator|= | ( | const char * | value | ) | const |
Case-insensitive inequality operator.
| String & printf | ( | const char * | format, |
| ... ) |
| String & printf | ( | unsigned int | length, |
| const char * | format, | ||
| ... ) |
Create a string by replacing matched strings in a template
| templ | Template of the string to generate |
References String().
| int rfind | ( | char | what | ) | const |
Locate the last instance of a character in the string
| what | Character to search for |
Referenced by AsnMib::getParent().
| int rfind | ( | const char * | what | ) | const |
Locate the last instance of a substring in the string
| what | Substring to search for |
|
inline |
Get a valid non-NULL C string.
Referenced by Regexp::matches().
|
inline |
Get a valid non-NULL C string with a provided default.
| defStr | Default C string to return if stored is NULL |
| ObjList * split | ( | char | separator, |
| bool | emptyOK = true ) const |
Splits the string at a delimiter character
| separator | Character where to split the string |
| emptyOK | True if empty strings should be inserted in list |
|
inline |
Create an escaped string suitable for use in SQL queries
| extraEsc | Character to escape other than the default ones |
References c_str(), sqlEscape(), and String().
|
static |
Create an escaped string suitable for use in SQL queries
| str | String to convert to escaped format |
| extraEsc | Character to escape other than the default ones |
References String().
Referenced by sqlEscape().
| bool startSkip | ( | const char * | what, |
| bool | wordBreak = true, | ||
| bool | caseInsensitive = false ) |
Checks if the string starts with a substring and removes it
| what | Substring to search for |
| wordBreak | Check if a word boundary follows the substring; this parameter defaults to True because the intended use of this method is to separate commands from their parameters |
| caseInsensitive | Compare case-insensitive if set |
Referenced by ClientContact::getContactSection().
| bool startsWith | ( | const char * | what, |
| bool | wordBreak = false, | ||
| bool | caseInsensitive = false ) const |
Checks if the string starts with a substring
| what | Substring to search for |
| wordBreak | Check if a word boundary follows the substring |
| caseInsensitive | Compare case-insensitive if set |
Referenced by XmlElement::isXmlns().
|
inline |
Strip an UTF-8 Byte Order Mark from the start of this string
References c_str(), and checkBOM().
|
inlinestatic |
Advance a string past an UTF-8 Byte Order Mark
| str | String to check for and strip BOM |
References checkBOM().
|
inlinestatic |
Advance a const string past an UTF-8 Byte Order Mark
| str | String to check for and strip BOM |
References checkBOM().
| String substr | ( | int | offs, |
| int | len = -1 ) const |
Substring extraction
| offs | Offset of the substring, negative to count from end |
| len | Length of the substring, -1 for everything possible |
References String().
Referenced by matchString(), and ClientContact::splitContactId().
| bool toBoolean | ( | bool | defvalue = false | ) | const |
Convert the string to a boolean value.
| defvalue | Default to return if the string is not a bool |
Referenced by ExpOperation::ExpOperation().
| double toDouble | ( | double | defvalue = 0.0 | ) | const |
Convert the string to a floating point value.
| defvalue | Default to return if the string is not a number |
| int64_t toInt64 | ( | int64_t | defvalue = 0, |
| int | base = 0, | ||
| int64_t | minvalue = LLONG_MIN, | ||
| int64_t | maxvalue = LLONG_MAX, | ||
| bool | clamp = true ) const |
Convert the string to an 64 bit integer value.
| defvalue | Default to return if the string is not a number |
| base | Numeration base, 0 to autodetect |
| minvalue | Minimum value allowed |
| maxvalue | Maximum value allowed |
| clamp | Control the out of bound values: true to adjust to the nearest bound, false to return the default value |
Referenced by ExpOperation::ExpOperation().
| int toInteger | ( | const TokenDict * | tokens, |
| int | defvalue = 0, | ||
| int | base = 0 ) const |
Convert the string to an integer value looking up first a token table.
| tokens | Pointer to an array of tokens to lookup first |
| defvalue | Default to return if the string is not a token or number |
| base | Numeration base, 0 to autodetect |
| int toInteger | ( | int | defvalue = 0, |
| int | base = 0, | ||
| int | minvalue = INT_MIN, | ||
| int | maxvalue = INT_MAX, | ||
| bool | clamp = true ) const |
Convert the string to an integer value.
| defvalue | Default to return if the string is not a number |
| base | Numeration base, 0 to autodetect |
| minvalue | Minimum value allowed |
| maxvalue | Maximum value allowed |
| clamp | Control the out of bound values: true to adjust to the nearest bound, false to return the default value |
Referenced by XMPPUtils::childTextInt().
| long int toLong | ( | long int | defvalue = 0, |
| int | base = 0, | ||
| long int | minvalue = LONG_MIN, | ||
| long int | maxvalue = LONG_MAX, | ||
| bool | clamp = true ) const |
Convert the string to an long integer value.
| defvalue | Default to return if the string is not a number |
| base | Numeration base, 0 to autodetect |
| minvalue | Minimum value allowed |
| maxvalue | Maximum value allowed |
| clamp | Control the out of bound values: true to adjust to the nearest bound, false to return the default value |
| String & toLower | ( | ) |
Turn the string to an all-lowercase string
References String().
Referenced by ClientContact::buildContactId(), and JBStream::buildSha1Digest().
|
virtual |
Override GenObject's method to return this String
Reimplemented from GenObject.
Reimplemented in NamedString.
References String().
Referenced by ClientContact::accountName(), and UIWidget::name().
| uint64_t toUInt64 | ( | uint64_t | defvalue = 0, |
| int | base = 0, | ||
| uint64_t | minvalue = 0, | ||
| uint64_t | maxvalue = ULLONG_MAX, | ||
| bool | clamp = true ) const |
Convert the string to an unsigned 64 bit integer value.
| defvalue | Default to return if the string is not a number |
| base | Numeration base, 0 to autodetect |
| minvalue | Minimum value allowed |
| maxvalue | Maximum value allowed |
| clamp | Control the out of bound values: true to adjust to the nearest bound, false to return the default value |
| String & toUpper | ( | ) |
| String & trimSpaces | ( | ) |
Strip off leading and trailing whitespace characters (blank, tabs, form-feed, newlines)
References String().
|
inline |
Create an escaped string suitable for use in URI
| extraEsc | Character to escape other than the default ones |
| noEsc | Optional pointer to string of characters that shouldn't be escaped |
References c_str(), String(), and uriEscape().
|
static |
Create an escaped string suitable for use in URIs
| str | String to convert to escaped format |
| extraEsc | Character to escape other than the default ones |
| noEsc | Optional pointer to string of characters that shouldn't be escaped |
References String().
Referenced by ClientContact::buildContactId(), ClientContact::buildContactInstanceId(), and uriEscape().
|
static |
Create an escaped string suitable for use in URIs
| str | String to convert to escaped format |
| extraEsc | Pointer to string of characters to escape other than the defaults |
| noEsc | Optional pointer to string of characters that shouldn't be escaped |
References String().
|
static |
Decode an URI escaped string back to its raw form
| str | String to convert to unescaped format |
| errptr | Pointer to an integer to receive the place of 1st error |
References String().
Referenced by ClientContact::getContactSection(), ClientContact::splitContactId(), and uriUnescape().
|
inline |
Decode an URI escaped string back to its raw form
| errptr | Pointer to an integer to receive the place of 1st error |
References c_str(), String(), and uriUnescape().