#include <String.hpp>
Collaboration diagram for BLOCXX_NAMESPACE::String:

Public Types | |
| typedef COWIntrusiveReference< ByteBuf > | buf_t |
| enum | ETakeOwnershipFlag { E_TAKE_OWNERSHIP } |
| enum | EReturnDelimitersFlag { E_DISCARD_DELIMITERS, E_RETURN_DELIMITERS } |
| enum | EEmptyTokenReturnFlag { E_SKIP_EMPTY_TOKENS, E_RETURN_EMPTY_TOKENS } |
| enum | EIgnoreCaseFlag { E_CASE_SENSITIVE, E_CASE_INSENSITIVE } |
Public Member Functions | |
| String () | |
| Create a new String object with a length of 0. | |
| String (Int32 val) | |
| Create a new String object that will hold the string representation of the given Int32 value. | |
| String (UInt32 val) | |
| Create a new String object that will hold the string representation of the given UInt32 value. | |
| String (Int64 val) | |
| Create a new String object that will hold the string representation of the given Int64 value. | |
| String (UInt64 val) | |
| Create a new String object that will hold the string representation of the given UInt64 value. | |
| String (Real32 val) | |
| Create a new String object that will hold the string representation of the given Real32 value. | |
| String (Real64 val) | |
| Create a new String object that will hold the string representation of the given Real64 value. | |
| String (const char *str) | |
| Create a new String object that will contain a copy of the given character string. | |
| String (ETakeOwnershipFlag, char *allocatedMemory, size_t len) | |
| Create a new string object from a dynamically allocated buffer. | |
| String (const char *str, size_t len) | |
| Create s new String object that will contain a copy of the given character string for the given length. | |
| String (const String &arg) | |
| Create a new String object that is a copy of another String object. | |
| String (char c) | |
| Create a new String object that contains a single character. | |
| ~String () | |
| Destroy this String object. | |
| void | swap (String &x) |
| Swap this instance with another. | |
| char * | allocateCString () const |
| Create a null terminated string that contains the contents of this String. | |
| size_t | length () const |
| size_t | UTF8Length () const |
| If the string is not valid UTF-8, then the result of this function is undefined. | |
| bool | empty () const |
| int | format (const char *fmt,...) |
| Format this string according to the given format and variable argument list (printf style). | |
| StringArray | tokenize (const char *delims=" \n\r\t\v", EReturnDelimitersFlag returnDelimitersAsTokens=E_DISCARD_DELIMITERS, EEmptyTokenReturnFlag returnEmptyTokens=E_SKIP_EMPTY_TOKENS) const |
| Tokenize this String object using the given delimeters. | |
| const char * | c_str () const |
| char | charAt (size_t ndx) const |
| Get the character at a specified index. | |
| int | compareTo (const String &arg) const |
| Compare another String object with this one. | |
| int | compareTo (const char *arg) const |
| Compare another string with this one. | |
| int | compareToIgnoreCase (const String &arg) const |
| Compare another string with this one ignoring case. | |
| int | compareToIgnoreCase (const char *arg) const |
| Compare another string with this one ignoring case. | |
| String & | concat (const char *arg) |
| Append a C string to this String object. | |
| String & | concat (const String &arg) |
| Append another String object to this String object. | |
| String & | concat (char arg) |
| Append a char to this String object. | |
| bool | endsWith (const char *arg, EIgnoreCaseFlag ignoreCase=E_CASE_SENSITIVE) const |
| Determine if this String object ends with given C string. | |
| bool | endsWith (const String &arg, EIgnoreCaseFlag ignoreCase=E_CASE_SENSITIVE) const |
| Determine if this String object ends with the same string represented by another String object. | |
| bool | endsWith (char arg) const |
| Determine if this String object ends with a given character. | |
| bool | equals (const String &arg) const |
| Determine if another String object is equal to this String object. | |
| bool | equals (const char *arg) const |
| Determine if another string is equal to this String object. | |
| bool | equalsIgnoreCase (const String &arg) const |
| Determine if another String object is equal to this String object, ignoring case in the comparision. | |
| bool | equalsIgnoreCase (const char *arg) const |
| Determine if another string is equal to this String object, ignoring case in the comparision. | |
| UInt32 | hashCode () const |
| size_t | indexOf (char ch, size_t fromIndex=0) const |
| Find the first occurence of a given character in this String object. | |
| size_t | indexOf (const char *arg, size_t fromIndex=0) const |
| Find the first occurence of a C string in this String object. | |
| size_t | indexOf (const String &arg, size_t fromIndex=0) const |
| Find the first occurence of a string in this String object. | |
| size_t | lastIndexOf (char ch, size_t fromIndex=npos) const |
| Find the last occurence of a character in this String object. | |
| size_t | lastIndexOf (const char *arg, size_t fromIndex=npos) const |
| Find the last occurence of a C string in this String object. | |
| size_t | lastIndexOf (const String &arg, size_t fromIndex=npos) const |
| Find the last occurence of a string in this String object. | |
| bool | startsWith (const char *arg, EIgnoreCaseFlag ignoreCase=E_CASE_SENSITIVE) const |
| Determine if this String object starts with a given substring. | |
| bool | startsWith (const String &arg, EIgnoreCaseFlag ignoreCase=E_CASE_SENSITIVE) const |
| Determine if this String object starts with a given substring. | |
| bool | startsWith (char arg) const |
| Determine if this String object starts with a given character. | |
| String | substring (size_t beginIndex, size_t length=npos) const |
| Create another String object that is comprised of a substring of this String object. | |
| bool | isSpaces () const |
| String & | toLowerCase () |
| Convert this String object to lower case characters. | |
| String & | toUpperCase () |
| Convert this String object to upper case characters. | |
| String & | ltrim () |
| Strip all leading space characters from this String object. | |
| String & | rtrim () |
| Strip all trailing space characters from this String object. | |
| String & | trim () |
| Strip all leading and trailing space characters from this String object. | |
| String & | erase () |
| Delete all the characters of the string. | |
| String & | erase (size_t idx, size_t len=npos) |
| Erases, at most, len characters of *this, starting at index idx. | |
| String & | operator= (const String &arg) |
| Assignment operator. | |
| const char & | operator[] (size_t ndx) const |
| Operator []. | |
| char & | operator[] (size_t ndx) |
| String & | operator+= (const String &arg) |
| Concatination operator. | |
| String & | operator+= (const char *arg) |
| Concatination operator. | |
| String & | operator+= (char arg) |
| Character concatination operator. | |
| void | readObject (std::istream &istrm) |
| Read this String object from the given istream. | |
| void | writeObject (std::ostream &ostrm) const |
| Write this String object to the given ostream. | |
| String | toString () const |
| Real32 | toReal32 () const |
| Real64 | toReal64 () const |
| bool | toBool () const |
| UInt8 | toUInt8 (int base=10) const |
| Int8 | toInt8 (int base=10) const |
| UInt16 | toUInt16 (int base=10) const |
| Int16 | toInt16 (int base=10) const |
| UInt32 | toUInt32 (int base=10) const |
| Int32 | toInt32 (int base=10) const |
| UInt64 | toUInt64 (int base=10) const |
| Int64 | toInt64 (int base=10) const |
| unsigned int | toUnsignedInt (int base=10) const |
| int | toInt (int base=10) const |
Static Public Member Functions | |
| static unsigned long long int | strtoull (const char *nptr, char **endptr, int base) |
| Convert a null terminated string to an unsigned 64 bit value. | |
| static long long int | strtoll (const char *nptr, char **endptr, int base) |
| Convert a null terminated string to an signed 64 bit value. | |
| static const char * | strchr (const char *theStr, int c) |
| Find the first occurrence of a character in a null terminated string. | |
| static String | getLine (std::istream &istr) |
| Reads from in input stream until a newline is encountered. | |
Static Public Attributes | |
| static const size_t | npos = ~0 |
Private Attributes | |
| buf_t | m_buf |
Classes | |
| class | ByteBuf |
String objects are ref counted and copy on write. Internal representation is UTF-8. Conversion to/from Char16 (UCS-2) is performed correctly. All operations that return/take an offset are based on the character array as if this were an ASCII string. The class does not enforce or maintain the integrity of any UTF-8 chars. length() returns the size in bytes of the string. Use UTF8Length() to get the number of chars in the string.
Definition at line 64 of file String.hpp.
|
|
Definition at line 700 of file String.hpp. |
|
|
Definition at line 217 of file String.hpp. |
|
|
Definition at line 305 of file String.hpp. |
|
|
Definition at line 212 of file String.hpp. |
|
|
Definition at line 138 of file String.hpp. |
|
|
Create a new String object with a length of 0.
Definition at line 136 of file String.cpp. Referenced by ltrim(), rtrim(), substring(), tokenize(), and trim(). |
|
|
Create a new String object that will hold the string representation of the given Int32 value.
Definition at line 144 of file String.cpp. References BLOCXX_NAMESPACE::AutoPtrVec< X >::get(), and m_buf. |
|
|
Create a new String object that will hold the string representation of the given UInt32 value.
Definition at line 154 of file String.cpp. References BLOCXX_NAMESPACE::AutoPtrVec< X >::get(), and m_buf. |
|
|
Create a new String object that will hold the string representation of the given Int64 value.
Definition at line 189 of file String.cpp. References BLOCXX_NAMESPACE::OStringStream::c_str(), and m_buf. |
|
|
Create a new String object that will hold the string representation of the given UInt64 value.
Definition at line 197 of file String.cpp. References BLOCXX_NAMESPACE::OStringStream::c_str(), and m_buf. |
|
|
Create a new String object that will hold the string representation of the given Real32 value.
Definition at line 214 of file String.cpp. |
|
|
Create a new String object that will hold the string representation of the given Real64 value.
Definition at line 230 of file String.cpp. |
|
|
Create a new String object that will contain a copy of the given character string.
Definition at line 246 of file String.cpp. References m_buf. |
|
||||||||||||||||
|
Create a new string object from a dynamically allocated buffer. The buffer is assumed to contain a valid c string and be previously allocated with the new operator. The memory given by the allocatedMemory parameter will be deallocated by the String class.
Definition at line 252 of file String.cpp. References BLOCXX_ASSERT, and m_buf. |
|
||||||||||||
|
Create s new String object that will contain a copy of the given character string for the given length.
Definition at line 260 of file String.cpp. References BLOCXX_NAMESPACE::AutoPtrVec< X >::get(), and m_buf. |
|
|
Create a new String object that is a copy of another String object. Upon return, both String objects will point to the same underlying character buffer. This state will remain until one of the 2 String objects is modified (copy on write)
Definition at line 276 of file String.cpp. |
|
|
Create a new String object that contains a single character.
Definition at line 281 of file String.cpp. References m_buf. |
|
|
Destroy this String object.
Definition at line 297 of file String.cpp. |
|
|
Create a null terminated string that contains the contents of this String. The returned pointer MUST be deleted by the caller using free().
Definition at line 308 of file String.cpp. |
|
|
|
Get the character at a specified index.
Definition at line 362 of file String.cpp. References m_buf. Referenced by BLOCXX_NAMESPACE::substitute_caps(). |
|
|
Compare another string with this one.
Definition at line 368 of file String.cpp. References m_buf. |
|
|
Compare another String object with this one.
Definition at line 379 of file String.cpp. References c_str(). Referenced by equals(), BLOCXX_NAMESPACE::operator!=(), BLOCXX_NAMESPACE::operator<(), BLOCXX_NAMESPACE::operator<=(), BLOCXX_NAMESPACE::operator==(), BLOCXX_NAMESPACE::operator>(), and BLOCXX_NAMESPACE::operator>=(). |
|
|
Compare another string with this one ignoring case.
Definition at line 385 of file String.cpp. References BLOCXX_NAMESPACE::UTF8Utils::compareToIgnoreCase(), and m_buf. |
|
|
Compare another string with this one ignoring case.
Definition at line 396 of file String.cpp. References c_str(). Referenced by equalsIgnoreCase(). |
|
|
Append a char to this String object.
Definition at line 422 of file String.cpp. References BLOCXX_NAMESPACE::AutoPtrVec< X >::get(), length(), and m_buf. |
|
|
Append another String object to this String object.
Definition at line 294 of file String.hpp. References c_str(). |
|
|
Append a C string to this String object.
Definition at line 403 of file String.cpp. References BLOCXX_NAMESPACE::AutoPtrVec< X >::get(), length(), and m_buf. |
|
|
|
Determine if this String object ends with a given character.
Definition at line 439 of file String.cpp. References m_buf. |
|
||||||||||||
|
Determine if this String object ends with the same string represented by another String object.
Definition at line 329 of file String.hpp. References c_str(). |
|
||||||||||||
|
Determine if this String object ends with given C string.
Definition at line 448 of file String.cpp. References BLOCXX_NAMESPACE::UTF8Utils::compareToIgnoreCase(), length(), and m_buf. Referenced by BLOCXX_NAMESPACE::FileSystem::getDirectoryContents(). |
|
|
Determine if another string is equal to this String object.
Definition at line 472 of file String.cpp. References compareTo(). |
|
|
Determine if another String object is equal to this String object.
Definition at line 478 of file String.cpp. References c_str(). Referenced by BLOCXX_NAMESPACE::decodeLongMonth(), BLOCXX_NAMESPACE::operator==(), and BLOCXX_NAMESPACE::SyslogAppender::SyslogAppender(). |
|
|
Determine if another string is equal to this String object, ignoring case in the comparision.
Definition at line 484 of file String.cpp. References compareToIgnoreCase(). |
|
|
Determine if another String object is equal to this String object, ignoring case in the comparision.
Definition at line 490 of file String.cpp. References c_str(). Referenced by BLOCXX_NAMESPACE::LogAppender::createLogAppender(), BLOCXX_NAMESPACE::Logger::setLogLevel(), and toBool(). |
|
||||||||||||
|
Erases, at most, len characters of *this, starting at index idx. if len == npos, erase to the end of the string.
Definition at line 796 of file String.cpp. References length(), npos, and substring(). |
|
|
Delete all the characters of the string. Thus, the string is empty after the call.
Definition at line 789 of file String.cpp. References m_buf. Referenced by BLOCXX_NAMESPACE::PosixRegEx::compile(), BLOCXX_NAMESPACE::PerlRegEx::compile(), BLOCXX_NAMESPACE::PosixRegEx::execute(), BLOCXX_NAMESPACE::PerlRegEx::execute(), BLOCXX_NAMESPACE::getKeyValue(), BLOCXX_NAMESPACE::PosixRegEx::grep(), BLOCXX_NAMESPACE::PerlRegEx::grep(), BLOCXX_NAMESPACE::PosixRegEx::match(), BLOCXX_NAMESPACE::PerlRegEx::match(), BLOCXX_NAMESPACE::PosixRegEx::operator=(), BLOCXX_NAMESPACE::PerlRegEx::operator=(), BLOCXX_NAMESPACE::Format::process(), BLOCXX_NAMESPACE::FileSystem::Path::realPath(), BLOCXX_NAMESPACE::PosixRegEx::replace(), BLOCXX_NAMESPACE::PerlRegEx::replace(), BLOCXX_NAMESPACE::PosixRegEx::split(), BLOCXX_NAMESPACE::PerlRegEx::split(), and BLOCXX_NAMESPACE::substitute_caps(). |
|
||||||||||||
|
Format this string according to the given format and variable argument list (printf style).
Definition at line 332 of file String.cpp. References BLOCXX_NAMESPACE::AutoPtrVec< X >::get(), length(), and m_buf. |
|
|
Reads from in input stream until a newline is encountered. This consumes the newline character (but doesn't put the newline in the return value), and leaves the file pointer at the char past the newline.
Referenced by BLOCXX_NAMESPACE::StackTrace::printStackTrace(). |
|
|
Definition at line 496 of file String.cpp. |
|
||||||||||||
|
Find the first occurence of a string in this String object.
Definition at line 404 of file String.hpp. References c_str(). |
|
||||||||||||
|
Find the first occurence of a C string in this String object.
Definition at line 538 of file String.cpp. |
|
||||||||||||
|
Find the first occurence of a given character in this String object.
Definition at line 517 of file String.cpp. References length(), m_buf, npos, and strchr(). Referenced by BLOCXX_NAMESPACE::SocketAddress::getAnyLocalHost(), BLOCXX_NAMESPACE::CmdLineParser::getUsage(), BLOCXX_NAMESPACE::isValidKey(), and BLOCXX_NAMESPACE::substitute_caps(). |
|
|
Definition at line 694 of file String.cpp. References m_buf. Referenced by BLOCXX_NAMESPACE::SyslogAppender::SyslogAppender(). |
|
||||||||||||
|
Find the last occurence of a string in this String object.
Definition at line 435 of file String.hpp. References c_str(). |
|
||||||||||||
|
Find the last occurence of a C string in this String object.
Definition at line 591 of file String.cpp. |
|
||||||||||||
|
Find the last occurence of a character in this String object.
Definition at line 564 of file String.cpp. References i, length(), m_buf, and npos. Referenced by BLOCXX_NAMESPACE::FileSystem::Path::dirname(), BLOCXX_NAMESPACE::CmdLineParser::getUsage(), and BLOCXX_NAMESPACE::FileSystem::Path::realPath(). |
|
|
|
Strip all leading space characters from this String object.
Definition at line 709 of file String.cpp. |
|
|
Character concatination operator.
Definition at line 564 of file String.hpp. |
|
|
Concatination operator.
Definition at line 557 of file String.hpp. |
|
|
Concatination operator.
Definition at line 550 of file String.hpp. |
|
|
Assignment operator.
Definition at line 863 of file String.cpp. References m_buf. |
|
|
Definition at line 904 of file String.cpp. References BLOCXX_ASSERT, length(), m_buf, and BLOCXX_NAMESPACE::nullChar. |
|
|
Operator [].
Definition at line 884 of file String.cpp. References BLOCXX_ASSERT, BLOCXX_NAMESPACE::cnullChar, length(), and m_buf. |
|
|
Read this String object from the given istream. An String must have been previously written to this location of the stream.
Referenced by BLOCXX_NAMESPACE::BinarySerialization::read(), and BLOCXX_NAMESPACE::BinarySerialization::readString(). |
|
|
Strip all trailing space characters from this String object.
Definition at line 729 of file String.cpp. |
|
|
Determine if this String object starts with a given character.
Definition at line 624 of file String.cpp. References m_buf. |
|
||||||||||||
|
Determine if this String object starts with a given substring.
Definition at line 457 of file String.hpp. References c_str(). |
|
||||||||||||
|
Determine if this String object starts with a given substring.
Definition at line 633 of file String.cpp. References length(), m_buf, and BLOCXX_NAMESPACE::strncmpi(). Referenced by BLOCXX_NAMESPACE::CmdLineParserException::~CmdLineParserException(). |
|
||||||||||||
|
Find the first occurrence of a character in a null terminated string.
Definition at line 1470 of file String.cpp. Referenced by indexOf(), tokenize(), and trim(). |
|
||||||||||||||||
|
Convert a null terminated string to an signed 64 bit value.
Definition at line 1160 of file String.cpp. Referenced by BLOCXX_NAMESPACE::convertToInt64Type(). |
|
||||||||||||||||
|
Convert a null terminated string to an unsigned 64 bit value.
Definition at line 1304 of file String.cpp. Referenced by BLOCXX_NAMESPACE::convertToUInt64Type(). |
|
||||||||||||
|
Create another String object that is comprised of a substring of this String object.
Definition at line 663 of file String.cpp. References length(), m_buf, npos, and String(). Referenced by BLOCXX_NAMESPACE::PosixRegEx::capture(), BLOCXX_NAMESPACE::PerlRegEx::capture(), BLOCXX_NAMESPACE::CmdLineParser::CmdLineParser(), BLOCXX_NAMESPACE::DateTime::DateTime(), BLOCXX_NAMESPACE::FileSystem::Path::dirname(), erase(), BLOCXX_NAMESPACE::LogMessagePatternFormatter::Converter::formatMessage(), BLOCXX_NAMESPACE::CmdLineParser::getUsage(), BLOCXX_NAMESPACE::Format::process(), BLOCXX_NAMESPACE::PosixRegEx::replace(), BLOCXX_NAMESPACE::PerlRegEx::replace(), BLOCXX_NAMESPACE::PosixRegEx::split(), BLOCXX_NAMESPACE::PerlRegEx::split(), and BLOCXX_NAMESPACE::substitute_caps(). |
|
|
Swap this instance with another.
Definition at line 302 of file String.cpp. References m_buf, and BLOCXX_NAMESPACE::COWIntrusiveReference< T >::swap(). Referenced by BLOCXX_NAMESPACE::Logger::swap(). |
|
|
Definition at line 975 of file String.cpp. References c_str(), equalsIgnoreCase(), and BLOCXX_NAMESPACE::throwStringConversion(). |
|
|
Definition at line 1097 of file String.cpp. References m_buf. |
|
|
Definition at line 1061 of file String.cpp. References m_buf. |
|
|
Definition at line 1073 of file String.cpp. References m_buf. Referenced by BLOCXX_NAMESPACE::DateTime::DateTime(). |
|
|
Definition at line 1085 of file String.cpp. References m_buf. |
|
|
Definition at line 1049 of file String.cpp. References m_buf. |
|
||||||||||||||||
|
Tokenize this String object using the given delimeters.
Definition at line 1103 of file String.cpp. References BLOCXX_NAMESPACE::Array< T >::append(), E_RETURN_DELIMITERS, E_RETURN_EMPTY_TOKENS, empty(), i, m_buf, strchr(), and String(). Referenced by BLOCXX_NAMESPACE::DateTime::DateTime(), BLOCXX_NAMESPACE::SyslogAppender::doProcessLogMessage(), BLOCXX_NAMESPACE::FileSystem::getFileLines(), main(), and processLine::operator()(). |
|
|
Convert this String object to lower case characters.
Definition at line 814 of file String.cpp. References m_buf, BLOCXX_NAMESPACE::UTF8Utils::toLowerCase(), and BLOCXX_NAMESPACE::UTF8Utils::toLowerCaseInPlace(). |
|
|
Definition at line 955 of file String.cpp. References m_buf. |
|
|
Definition at line 965 of file String.cpp. References m_buf. |
|
|
Definition at line 915 of file String.cpp. |
|
|
Definition at line 1055 of file String.cpp. References m_buf. |
|
|
Definition at line 1067 of file String.cpp. References m_buf. Referenced by main(). |
|
|
Definition at line 1079 of file String.cpp. References m_buf. Referenced by BLOCXX_NAMESPACE::LogAppender::createLogAppender(). |
|
|
Definition at line 1043 of file String.cpp. References m_buf. |
|
|
Definition at line 1091 of file String.cpp. References m_buf. Referenced by BLOCXX_NAMESPACE::LogAppender::createLogAppender(). |
|
|
Convert this String object to upper case characters.
Definition at line 828 of file String.cpp. References m_buf, BLOCXX_NAMESPACE::UTF8Utils::toUpperCase(), and BLOCXX_NAMESPACE::UTF8Utils::toUpperCaseInPlace(). |
|
|
Strip all leading and trailing space characters from this String object.
Definition at line 755 of file String.cpp. |
|
|
If the string is not valid UTF-8, then the result of this function is undefined.
Definition at line 323 of file String.cpp. References c_str(), and BLOCXX_NAMESPACE::UTF8Utils::charCount(). |
|
|
Write this String object to the given ostream.
Referenced by BLOCXX_NAMESPACE::BinarySerialization::write(), and BLOCXX_NAMESPACE::BinarySerialization::writeString(). |
|
|
Definition at line 702 of file String.hpp. Referenced by c_str(), charAt(), compareTo(), compareToIgnoreCase(), concat(), endsWith(), erase(), format(), hashCode(), indexOf(), isSpaces(), lastIndexOf(), length(), ltrim(), operator=(), operator[](), rtrim(), startsWith(), String(), substring(), swap(), toInt(), toInt16(), toInt32(), toInt64(), toInt8(), tokenize(), toLowerCase(), toReal32(), toReal64(), toUInt16(), toUInt32(), toUInt64(), toUInt8(), toUnsignedInt(), toUpperCase(), and trim(). |
|
1.4.4