blocxx
|
This String class is an abstract data type that represents as NULL terminated string of characters. More...
#include <String.hpp>
Classes | |
class | ByteBuf |
Public Types | |
enum | ETakeOwnershipFlag { E_TAKE_OWNERSHIP } |
enum | EReturnDelimitersFlag { E_DISCARD_TOKENS, E_RETURN_TOKENS, E_DISCARD_DELIMITERS, E_RETURN_DELIMITERS } |
enum | EEmptyTokenReturnFlag { E_SKIP_EMPTY_TOKENS, E_RETURN_EMPTY_TOKENS } |
enum | EIgnoreCaseFlag { E_CASE_SENSITIVE, E_CASE_INSENSITIVE } |
typedef COWIntrusiveReference < ByteBuf > | buf_t |
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 (const Char16Array &ra) BLOCXX_DEPRECATED | |
DEPRECATED in 3.1.0. | |
String (Bool parm) BLOCXX_DEPRECATED | |
DEPRECATED in favor of Bool::toString() in 3.1.0. | |
String (const Char16 &parm) BLOCXX_DEPRECATED | |
DEPRECATED in favor of Char16::toString() in 3.1.0. | |
String (const std::string &str) | |
Create a new String object that will contain a copy of the given std::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 | size () 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 |
BLOCXX_DEPRECATED const char * | getBytes () const |
DEPRECATED in favor of c_str() in 3.1.0. | |
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 (as defined by the C function isspace()) from this String object. | |
String & | rtrim () |
Strip all trailing space characters (as defined by the C function isspace()) from this String object. | |
String & | trim () |
Strip all leading and trailing space characters (as defined by the C function isspace()) 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::streambuf &istrm) |
Read this String object from the given istream. | |
void | writeObject (std::streambuf &ostrm) const |
Write this String object to the given ostream. | |
String | toString () const |
Char16 | toChar16 () const BLOCXX_DEPRECATED |
DEPRECATED in favor of Char16::Char16(const String&) in 3.1.0. | |
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 = size_t(~0) |
Private Attributes | |
buf_t | m_buf |
This String class is an abstract data type that represents as NULL terminated string of characters.
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 66 of file String.hpp.
Definition at line 750 of file String.hpp.
Definition at line 254 of file String.hpp.
Definition at line 347 of file String.hpp.
Definition at line 247 of file String.hpp.
Definition at line 167 of file String.hpp.
BLOCXX_NAMESPACE::String::String | ( | ) |
Create a new String object with a length of 0.
Definition at line 139 of file String.cpp.
Referenced by ltrim(), rtrim(), substring(), tokenize(), and trim().
BLOCXX_NAMESPACE::String::String | ( | Int32 | val | ) | [explicit] |
Create a new String object that will hold the string representation of the given Int32 value.
val | The 32 bit value this String will hold the string representation of. |
Definition at line 162 of file String.cpp.
References BLOCXX_NAMESPACE::AutoPtrVec< X >::get(), and m_buf.
BLOCXX_NAMESPACE::String::String | ( | UInt32 | val | ) | [explicit] |
Create a new String object that will hold the string representation of the given UInt32 value.
val | The 32 bit value this String will hold the string representation of. |
Definition at line 172 of file String.cpp.
References BLOCXX_NAMESPACE::AutoPtrVec< X >::get(), and m_buf.
BLOCXX_NAMESPACE::String::String | ( | Int64 | val | ) | [explicit] |
Create a new String object that will hold the string representation of the given Int64 value.
val | The 64 bit value this String will hold the string representation of. |
Definition at line 207 of file String.cpp.
References BLOCXX_NAMESPACE::OStringStream::c_str(), and m_buf.
BLOCXX_NAMESPACE::String::String | ( | UInt64 | val | ) | [explicit] |
Create a new String object that will hold the string representation of the given UInt64 value.
val | The 64 bit value this String will hold the string representation of. |
Definition at line 215 of file String.cpp.
References BLOCXX_NAMESPACE::OStringStream::c_str(), and m_buf.
BLOCXX_NAMESPACE::String::String | ( | Real32 | val | ) | [explicit] |
BLOCXX_NAMESPACE::String::String | ( | Real64 | val | ) | [explicit] |
BLOCXX_NAMESPACE::String::String | ( | const char * | str | ) |
Create a new String object that will contain a copy of the given character string.
str | The null terminated string to make a copy of. |
Definition at line 264 of file String.cpp.
References m_buf.
BLOCXX_NAMESPACE::String::String | ( | const Char16Array & | ra | ) | [explicit] |
DEPRECATED in 3.1.0.
Create a new String object that will contain a single byte character representation of the Char16Array.
ra | The Char16Array to use to construct the string |
Definition at line 299 of file String.cpp.
References i, m_buf, BLOCXX_NAMESPACE::StringBuffer::releaseString(), and BLOCXX_NAMESPACE::Array< T >::size().
BLOCXX_NAMESPACE::String::String | ( | Bool | parm | ) | [explicit] |
DEPRECATED in favor of Bool::toString() in 3.1.0.
Create a new String object that will contain the representation of a Bool value ("TRUE" "FALSE").
parm | The Bool value this string will represent. |
Definition at line 144 of file String.cpp.
BLOCXX_NAMESPACE::String::String | ( | const Char16 & | parm | ) | [explicit] |
DEPRECATED in favor of Char16::toString() in 3.1.0.
Create a new String object that will contain the representation of an Char16 object
parm | The Char16 object this string will represent. |
Definition at line 149 of file String.cpp.
BLOCXX_NAMESPACE::String::String | ( | const std::string & | str | ) | [explicit] |
Create a new String object that will contain a copy of the given std::string.
str | The std::string this String object will be a copy of. |
Definition at line 154 of file String.cpp.
BLOCXX_NAMESPACE::String::String | ( | ETakeOwnershipFlag | , |
char * | allocatedMemory, | ||
size_t | len | ||
) | [explicit] |
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.
takeOwnerShipTag | This parm is not used. It is here to differentiate this constructor from the others. |
allocatedMemory | The dynamically allocated string that will be used by this String. Must not be NULL. |
len | The length of the string allocatedMemory. |
Definition at line 270 of file String.cpp.
References BLOCXX_ASSERT, and m_buf.
BLOCXX_NAMESPACE::String::String | ( | const char * | str, |
size_t | len | ||
) | [explicit] |
Create s new String object that will contain a copy of the given character string for the given length.
str | The character array to copy from. It does not need to be null terminated. |
len | The number of bytes to copy from the str param. The count should not include a terminating null. |
Definition at line 278 of file String.cpp.
References BLOCXX_NAMESPACE::AutoPtrVec< X >::get(), and m_buf.
BLOCXX_NAMESPACE::String::String | ( | const String & | arg | ) |
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)
arg | The String object to make a copy of. |
Definition at line 294 of file String.cpp.
BLOCXX_NAMESPACE::String::String | ( | char | c | ) | [explicit] |
Create a new String object that contains a single character.
c | The character that this string will contain. |
Definition at line 318 of file String.cpp.
References m_buf.
BLOCXX_NAMESPACE::String::~String | ( | ) |
Destroy this String object.
Definition at line 334 of file String.cpp.
char * BLOCXX_NAMESPACE::String::allocateCString | ( | ) | const |
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 345 of file String.cpp.
const char * BLOCXX_NAMESPACE::String::c_str | ( | ) | const |
Definition at line 905 of file String.cpp.
References m_buf.
Referenced by allocateCString(), BLOCXX_NAMESPACE::StringBuffer::append(), BLOCXX_NAMESPACE::FileSystem::canRead(), BLOCXX_NAMESPACE::FileSystem::canWrite(), BLOCXX_NAMESPACE::FileSystem::changeDirectory(), BLOCXX_NAMESPACE::FileSystem::changeFileOwner(), BLOCXX_NAMESPACE::ServerSocketImpl::close(), BLOCXX_NAMESPACE::CmdLineParser::CmdLineParser(), compareTo(), compareToIgnoreCase(), concat(), BLOCXX_NAMESPACE::SocketBaseImpl::connect(), BLOCXX_NAMESPACE::FileSystem::createAutoDeleteTempFile(), BLOCXX_NAMESPACE::FileSystem::createFile(), BLOCXX_NAMESPACE::LogAppender::createLogAppender(), BLOCXX_NAMESPACE::FileSystem::createTempFile(), BLOCXX_NAMESPACE::SocketBaseImpl::disconnect(), BLOCXX_NAMESPACE::ServerSocketImpl::doListenUDS(), BLOCXX_NAMESPACE::MultiProcessFileAppender::doProcessLogMessage(), BLOCXX_NAMESPACE::FileAppender::doProcessLogMessage(), endsWith(), equals(), equalsIgnoreCase(), BLOCXX_NAMESPACE::Exec::executeProcessAndGatherOutput(), BLOCXX_NAMESPACE::FileSystem::exists(), BLOCXX_NAMESPACE::FileAppender::FileAppender(), BLOCXX_NAMESPACE::DelayedFormat::format(), BLOCXX_NAMESPACE::DelayedFormat::formatWithString(), BLOCXX_NAMESPACE::SocketAddress::getByName(), BLOCXX_NAMESPACE::FileSystem::getDirectoryContents(), BLOCXX_NAMESPACE::FileSystem::getFileContents(), BLOCXX_NAMESPACE::FileSystem::getFileSize(), BLOCXX_NAMESPACE::StackTrace::getStackTrace(), BLOCXX_NAMESPACE::SocketAddress::getUDS(), BLOCXX_NAMESPACE::UserUtils::getUserId(), indexOf(), BLOCXX_NAMESPACE::FileSystem::isDirectory(), BLOCXX_NAMESPACE::FileSystem::isExecutable(), BLOCXX_NAMESPACE::FileSystem::isLink(), BLOCXX_NAMESPACE::IStringStreamBuf::IStringStreamBuf(), lastIndexOf(), BLOCXX_NAMESPACE::FileSystem::makeDirectory(), BLOCXX_NAMESPACE::MultiProcessFileAppender::MultiProcessFileAppender(), BLOCXX_NAMESPACE::FileSystem::openFile(), BLOCXX_NAMESPACE::FileSystem::openForAppendOrCreateFile(), BLOCXX_NAMESPACE::FileSystem::openOrCreateFile(), BLOCXX_NAMESPACE::operator<<(), BLOCXX_NAMESPACE::operator==(), BLOCXX_NAMESPACE::SocketBaseImpl::read(), BLOCXX_NAMESPACE::FileSystem::readSymbolicLink(), BLOCXX_NAMESPACE::FileSystem::Path::realPath(), BLOCXX_NAMESPACE::FileSystem::removeDirectory(), BLOCXX_NAMESPACE::FileSystem::removeFile(), BLOCXX_NAMESPACE::FileSystem::renameFile(), BLOCXX_NAMESPACE::FileSystem::Path::security(), startsWith(), BLOCXX_NAMESPACE::StringBuffer::StringBuffer(), BLOCXX_NAMESPACE::SyslogAppender::SyslogAppender(), toBool(), toChar16(), BLOCXX_NAMESPACE::MD5::update(), UTF8Length(), BLOCXX_NAMESPACE::SocketBaseImpl::write(), and BLOCXX_NAMESPACE::UnnamedPipe::writeString().
char BLOCXX_NAMESPACE::String::charAt | ( | size_t | ndx | ) | const |
Get the character at a specified index.
ndx | The index of the character to return within the char array. |
Definition at line 401 of file String.cpp.
References m_buf.
int BLOCXX_NAMESPACE::String::compareTo | ( | const String & | arg | ) | const |
Compare another String object with this one.
arg | The String object to compare with this one. |
Definition at line 418 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>=().
int BLOCXX_NAMESPACE::String::compareTo | ( | const char * | arg | ) | const |
Compare another string with this one.
arg | The string to compare with this one. |
Definition at line 407 of file String.cpp.
References m_buf.
int BLOCXX_NAMESPACE::String::compareToIgnoreCase | ( | const String & | arg | ) | const |
Compare another string with this one ignoring case.
arg | The string to compare with this one. |
Definition at line 435 of file String.cpp.
References c_str().
Referenced by compareToIgnoreCase(), endsWith(), equalsIgnoreCase(), and BLOCXX_NAMESPACE::strncmpi().
int BLOCXX_NAMESPACE::String::compareToIgnoreCase | ( | const char * | arg | ) | const |
Compare another string with this one ignoring case.
arg | The string to compare with this one. |
Definition at line 424 of file String.cpp.
References compareToIgnoreCase(), and m_buf.
String & BLOCXX_NAMESPACE::String::concat | ( | const char * | arg | ) |
String & BLOCXX_NAMESPACE::String::concat | ( | char | arg | ) |
Append a char to this String object.
arg | The char to append to this String object. |
Definition at line 461 of file String.cpp.
References BLOCXX_NAMESPACE::AutoPtrVec< X >::get(), length(), and m_buf.
bool BLOCXX_NAMESPACE::String::empty | ( | ) | const [inline] |
Definition at line 237 of file String.hpp.
Referenced by BLOCXX_NAMESPACE::CmdLineParser::CmdLineParser(), BLOCXX_NAMESPACE::SocketBaseImpl::connect(), BLOCXX_NAMESPACE::FileSystem::createAutoDeleteTempFile(), BLOCXX_NAMESPACE::LogAppender::createLogAppender(), BLOCXX_NAMESPACE::FileSystem::createTempFile(), BLOCXX_NAMESPACE::DateTime::DateTime(), BLOCXX_NAMESPACE::SocketBaseImpl::disconnect(), BLOCXX_NAMESPACE::Format::Format(), BLOCXX_NAMESPACE::Logger::processLogMessage(), BLOCXX_NAMESPACE::SocketBaseImpl::read(), BLOCXX_NAMESPACE::SyslogAppender::SyslogAppender(), tokenize(), and BLOCXX_NAMESPACE::SocketBaseImpl::write().
bool BLOCXX_NAMESPACE::String::endsWith | ( | const char * | arg, |
EIgnoreCaseFlag | ignoreCase = E_CASE_SENSITIVE |
||
) | const |
Determine if this String object ends with given C string.
arg | The C string object to search the end of this String object for. |
ignoreCase | If true, character case will be ignored. |
Definition at line 487 of file String.cpp.
References compareToIgnoreCase(), length(), and m_buf.
Referenced by BLOCXX_NAMESPACE::FileSystem::createAutoDeleteTempFile(), BLOCXX_NAMESPACE::FileSystem::createTempFile(), and BLOCXX_NAMESPACE::FileSystem::getDirectoryContents().
bool BLOCXX_NAMESPACE::String::endsWith | ( | const String & | arg, |
EIgnoreCaseFlag | ignoreCase = E_CASE_SENSITIVE |
||
) | const [inline] |
bool BLOCXX_NAMESPACE::String::endsWith | ( | char | arg | ) | const |
Determine if this String object ends with a given character.
arg | The character to test for. |
Definition at line 478 of file String.cpp.
References m_buf.
bool BLOCXX_NAMESPACE::String::equals | ( | const String & | arg | ) | const |
Determine if another String object is equal to this String object.
Definition at line 517 of file String.cpp.
References c_str().
Referenced by BLOCXX_NAMESPACE::operator==(), and BLOCXX_NAMESPACE::SyslogAppender::SyslogAppender().
bool BLOCXX_NAMESPACE::String::equals | ( | const char * | arg | ) | const |
Determine if another string is equal to this String object.
arg | The string to check this String object against for equality. |
Definition at line 511 of file String.cpp.
References compareTo().
bool BLOCXX_NAMESPACE::String::equalsIgnoreCase | ( | const String & | arg | ) | const |
Determine if another String object is equal to this String object, ignoring case in the comparision.
Definition at line 529 of file String.cpp.
References c_str().
Referenced by BLOCXX_NAMESPACE::LogAppender::createLogAppender(), BLOCXX_NAMESPACE::SyslogAppender::doProcessLogMessage(), BLOCXX_NAMESPACE::Logger::stringToLogLevel(), and toBool().
bool BLOCXX_NAMESPACE::String::equalsIgnoreCase | ( | const char * | arg | ) | const |
Determine if another string is equal to this String object, ignoring case in the comparision.
arg | The string to check this String object against for equality. |
Definition at line 523 of file String.cpp.
References compareToIgnoreCase().
String & BLOCXX_NAMESPACE::String::erase | ( | ) |
Delete all the characters of the string.
Thus, the string is empty after the call.
Definition at line 824 of file String.cpp.
References m_buf.
Referenced by BLOCXX_NAMESPACE::FileSystem::createTempFile(), BLOCXX_NAMESPACE::cpp::getKeyValue(), BLOCXX_NAMESPACE::Format::process(), and BLOCXX_NAMESPACE::TempFileBuffer::releaseFileAndReset().
Erases, at most, len characters of *this, starting at index idx.
if len == npos, erase to the end of the string.
Definition at line 831 of file String.cpp.
References length(), npos, and substring().
int BLOCXX_NAMESPACE::String::format | ( | const char * | fmt, |
... | |||
) |
Format this string according to the given format and variable argument list (printf style)
fmt | The format to use during the operation |
... | A variable argument list to be applied to the format |
Definition at line 369 of file String.cpp.
References BLOCXX_NAMESPACE::AutoPtrVec< X >::get(), length(), m_buf, and size().
BLOCXX_DEPRECATED const char* BLOCXX_NAMESPACE::String::getBytes | ( | ) | const [inline] |
DEPRECATED in favor of c_str() in 3.1.0.
Definition at line 284 of file String.hpp.
static String BLOCXX_NAMESPACE::String::getLine | ( | std::istream & | istr | ) | [static] |
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::getStackTrace().
UInt32 BLOCXX_NAMESPACE::String::hashCode | ( | ) | const |
size_t BLOCXX_NAMESPACE::String::indexOf | ( | char | ch, |
size_t | fromIndex = 0 |
||
) | const |
Find the first occurence of a given character in this String object.
ch | The character to search for. |
fromIndex | The index to start the search from. |
Definition at line 556 of file String.cpp.
References length(), m_buf, npos, and strchr().
Referenced by BLOCXX_NAMESPACE::CmdLineParser::CmdLineParser(), BLOCXX_NAMESPACE::SocketAddress::getAnyLocalHost(), and BLOCXX_NAMESPACE::CmdLineParser::getUsage().
size_t BLOCXX_NAMESPACE::String::indexOf | ( | const char * | arg, |
size_t | fromIndex = 0 |
||
) | const |
Find the first occurence of a C string in this String object.
arg | The C string to search for. |
fromIndex | The index to start the search from. |
Definition at line 577 of file String.cpp.
size_t BLOCXX_NAMESPACE::String::indexOf | ( | const String & | arg, |
size_t | fromIndex = 0 |
||
) | const [inline] |
Find the first occurence of a string in this String object.
arg | The string to search for. |
fromIndex | The index to start the search from. |
Definition at line 446 of file String.hpp.
References c_str().
bool BLOCXX_NAMESPACE::String::isSpaces | ( | ) | const |
Definition at line 729 of file String.cpp.
References m_buf.
Referenced by BLOCXX_NAMESPACE::SyslogAppender::SyslogAppender().
size_t BLOCXX_NAMESPACE::String::lastIndexOf | ( | const String & | arg, |
size_t | fromIndex = npos |
||
) | const [inline] |
Find the last occurence of a string in this String object.
arg | The string to search for. |
fromIndex | The index to start the search from. |
Definition at line 477 of file String.hpp.
References c_str().
size_t BLOCXX_NAMESPACE::String::lastIndexOf | ( | char | ch, |
size_t | fromIndex = npos |
||
) | const |
Find the last occurence of a character in this String object.
ch | The character to search for. |
fromIndex | The index to start the search from. |
Definition at line 603 of file String.cpp.
References i, length(), m_buf, and npos.
Referenced by BLOCXX_NAMESPACE::FileSystem::Path::basename(), and BLOCXX_NAMESPACE::FileSystem::Path::dirname().
size_t BLOCXX_NAMESPACE::String::lastIndexOf | ( | const char * | arg, |
size_t | fromIndex = npos |
||
) | const |
Find the last occurence of a C string in this String object.
arg | The C string to search for. |
fromIndex | The index to start the search from. |
Definition at line 630 of file String.cpp.
size_t BLOCXX_NAMESPACE::String::length | ( | ) | const |
Definition at line 354 of file String.cpp.
References m_buf.
Referenced by allocateCString(), BLOCXX_NAMESPACE::StringBuffer::append(), BLOCXX_NAMESPACE::FileSystem::Path::basename(), BLOCXX_NAMESPACE::CmdLineParser::CmdLineParser(), concat(), BLOCXX_NAMESPACE::FileSystem::createAutoDeleteTempFile(), BLOCXX_NAMESPACE::FileSystem::createTempFile(), BLOCXX_NAMESPACE::DateTime::DateTime(), BLOCXX_NAMESPACE::FileSystem::Path::dirname(), BLOCXX_NAMESPACE::MultiProcessFileAppender::doProcessLogMessage(), endsWith(), erase(), format(), BLOCXX_NAMESPACE::SocketAddress::getUDS(), hashCode(), indexOf(), BLOCXX_NAMESPACE::IStringStreamBuf::IStringStreamBuf(), lastIndexOf(), BLOCXX_NAMESPACE::Logger::Logger(), BLOCXX_NAMESPACE::operator<<(), operator[](), BLOCXX_NAMESPACE::Format::process(), rtrim(), startsWith(), substring(), trim(), BLOCXX_NAMESPACE::MD5::update(), BLOCXX_NAMESPACE::UnnamedPipe::writeString(), and BLOCXX_NAMESPACE::TempFileBuffer::~TempFileBuffer().
String & BLOCXX_NAMESPACE::String::ltrim | ( | ) |
String& BLOCXX_NAMESPACE::String::operator+= | ( | const char * | arg | ) | [inline] |
Concatination operator.
arg | The C string to append to the end of this String. |
Definition at line 601 of file String.hpp.
Concatination operator.
Definition at line 594 of file String.hpp.
String& BLOCXX_NAMESPACE::String::operator+= | ( | char | arg | ) | [inline] |
Character concatination operator.
arg | The character to append to the end of this String. |
Definition at line 608 of file String.hpp.
const char & BLOCXX_NAMESPACE::String::operator[] | ( | size_t | ndx | ) | const |
Operator [].
ndx | The index of the character to retrieve from the underlying character array. |
Definition at line 919 of file String.cpp.
References BLOCXX_ASSERT, BLOCXX_NAMESPACE::cnullChar, length(), and m_buf.
char & BLOCXX_NAMESPACE::String::operator[] | ( | size_t | ndx | ) |
Definition at line 934 of file String.cpp.
References BLOCXX_ASSERT, length(), m_buf, and BLOCXX_NAMESPACE::nullChar.
void BLOCXX_NAMESPACE::String::readObject | ( | std::streambuf & | istrm | ) |
Read this String object from the given istream.
An String must have been previously written to this location of the stream.
istrm | The input stream to read this String from. |
IOException |
Definition at line 63 of file Bool.cpp.
References BLOCXX_NAMESPACE::Bool::m_val, and BLOCXX_NAMESPACE::BinarySerialization::read().
Referenced by BLOCXX_NAMESPACE::BinarySerialization::read(), and BLOCXX_NAMESPACE::BinarySerialization::readString().
String & BLOCXX_NAMESPACE::String::rtrim | ( | ) |
size_t BLOCXX_NAMESPACE::String::size | ( | ) | const [inline] |
Definition at line 227 of file String.hpp.
Referenced by format().
bool BLOCXX_NAMESPACE::String::startsWith | ( | const char * | arg, |
EIgnoreCaseFlag | ignoreCase = E_CASE_SENSITIVE |
||
) | const |
Determine if this String object starts with a given substring.
arg | The substring to test for. NULL is considered an empty string. |
ignoreCase | If true, case of the characters will be ignored. |
Definition at line 672 of file String.cpp.
References E_CASE_INSENSITIVE, length(), m_buf, and BLOCXX_NAMESPACE::strncmpi().
Referenced by BLOCXX_NAMESPACE::isPathAbsolute(), and BLOCXX_NAMESPACE::FileSystem::Path::realPath().
bool BLOCXX_NAMESPACE::String::startsWith | ( | const String & | arg, |
EIgnoreCaseFlag | ignoreCase = E_CASE_SENSITIVE |
||
) | const [inline] |
Determine if this String object starts with a given substring.
arg | The substring to test for. |
ignoreCase | If true, case of the characters will be ignored. |
Definition at line 499 of file String.hpp.
References c_str().
bool BLOCXX_NAMESPACE::String::startsWith | ( | char | arg | ) | const |
Determine if this String object starts with a given character.
arg | The character to test for. |
Definition at line 663 of file String.cpp.
References m_buf.
const char * BLOCXX_NAMESPACE::String::strchr | ( | const char * | theStr, |
int | c | ||
) | [static] |
Find the first occurrence of a character in a null terminated string.
theStr | The string to search for the given character. |
c | The character to to search for. |
Definition at line 1514 of file String.cpp.
Referenced by indexOf(), tokenize(), and trim().
long long int BLOCXX_NAMESPACE::String::strtoll | ( | const char * | nptr, |
char ** | endptr, | ||
int | base | ||
) | [static] |
Convert a null terminated string to an signed 64 bit value.
nptr | A pointer to beginning of string to convert. |
endptr | If not NULL, this function stores the address of the 1st invalid character in *endptr. |
base | A number that specifies the base for the number pointed to by nptr. |
Definition at line 1218 of file String.cpp.
References LLONG_MAX, and LLONG_MIN.
Referenced by BLOCXX_NAMESPACE::convertToInt64Type().
unsigned long long int BLOCXX_NAMESPACE::String::strtoull | ( | const char * | nptr, |
char ** | endptr, | ||
int | base | ||
) | [static] |
Convert a null terminated string to an unsigned 64 bit value.
nptr | A pointer to beginning of string to convert. |
endptr | If not NULL, this function stores the address of the 1st invalid character in *endptr. |
base | A number that specifies the base for the number pointed to by nptr. |
Definition at line 1361 of file String.cpp.
References ULLONG_MAX.
Referenced by BLOCXX_NAMESPACE::convertToUInt64Type().
Create another String object that is comprised of a substring of this String object.
beginIndex | The start index of the substring. |
length | The length of the substring to use. |
Definition at line 698 of file String.cpp.
References length(), m_buf, npos, and String().
Referenced by BLOCXX_NAMESPACE::FileSystem::Path::basename(), BLOCXX_NAMESPACE::CmdLineParser::CmdLineParser(), BLOCXX_NAMESPACE::DateTime::DateTime(), BLOCXX_NAMESPACE::FileSystem::Path::dirname(), erase(), BLOCXX_NAMESPACE::LogMessagePatternFormatter::Converter::formatMessage(), BLOCXX_NAMESPACE::CmdLineParser::getUsage(), and BLOCXX_NAMESPACE::Format::process().
void BLOCXX_NAMESPACE::String::swap | ( | String & | x | ) |
Swap this instance with another.
Definition at line 339 of file String.cpp.
References m_buf, and BLOCXX_NAMESPACE::COWIntrusiveReference< T >::swap().
Referenced by BLOCXX_NAMESPACE::Logger::swap().
bool BLOCXX_NAMESPACE::String::toBool | ( | ) | const |
StringConversionException | if the conversion is impossible. |
Definition at line 1017 of file String.cpp.
References c_str(), equalsIgnoreCase(), and BLOCXX_NAMESPACE::throwStringConversion().
Char16 BLOCXX_NAMESPACE::String::toChar16 | ( | ) | const |
DEPRECATED in favor of Char16::Char16(const String&) in 3.1.0.
StringConversionException | if the conversion is impossible. |
Definition at line 966 of file String.cpp.
References c_str(), BLOCXX_NAMESPACE::throwStringConversion(), and UTF8Length().
int BLOCXX_NAMESPACE::String::toInt | ( | int | base = 10 | ) | const |
StringConversionException | if the conversion is impossible. |
Definition at line 1141 of file String.cpp.
References m_buf.
Int16 BLOCXX_NAMESPACE::String::toInt16 | ( | int | base = 10 | ) | const |
StringConversionException | if the conversion is impossible. |
Definition at line 1105 of file String.cpp.
References m_buf.
Int32 BLOCXX_NAMESPACE::String::toInt32 | ( | int | base = 10 | ) | const |
StringConversionException | if the conversion is impossible. |
Definition at line 1117 of file String.cpp.
References m_buf.
Referenced by BLOCXX_NAMESPACE::DateTime::DateTime().
Int64 BLOCXX_NAMESPACE::String::toInt64 | ( | int | base = 10 | ) | const |
StringConversionException | if the conversion is impossible. |
Definition at line 1129 of file String.cpp.
References m_buf.
Int8 BLOCXX_NAMESPACE::String::toInt8 | ( | int | base = 10 | ) | const |
StringConversionException | if the conversion is impossible. |
Definition at line 1093 of file String.cpp.
References m_buf.
StringArray BLOCXX_NAMESPACE::String::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.
delims | A pointer to a char array of delimeters that separate the tokens in this String object. |
returnDelimitersAsTokens | If this flag is E_RETURN_DELIMITERS, then the delimiter characters are also returned as tokens, otherwise the delimiters are removed. |
returnEmptyTokens | If this flag is E_RETURN_EMPTY_TOKENS, then two sequential delimiters will result in an empty token being returned. |
Definition at line 1147 of file String.cpp.
References BLOCXX_NAMESPACE::Array< T >::append(), E_RETURN_DELIMITERS, E_RETURN_EMPTY_TOKENS, E_RETURN_TOKENS, empty(), BLOCXX_NAMESPACE::AutoPtrVec< X >::get(), i, m_buf, strchr(), and String().
Referenced by BLOCXX_NAMESPACE::DateTime::DateTime(), BLOCXX_NAMESPACE::SyslogAppender::doProcessLogMessage(), and BLOCXX_NAMESPACE::FileSystem::getFileLines().
String & BLOCXX_NAMESPACE::String::toLowerCase | ( | ) |
Convert this String object to lower case characters.
Definition at line 849 of file String.cpp.
References m_buf, and BLOCXX_NAMESPACE::UTF8Utils::toLowerCaseInPlace().
Real32 BLOCXX_NAMESPACE::String::toReal32 | ( | ) | const |
StringConversionException | if the conversion is impossible. |
Definition at line 997 of file String.cpp.
References m_buf.
Real64 BLOCXX_NAMESPACE::String::toReal64 | ( | ) | const |
StringConversionException | if the conversion is impossible. |
Definition at line 1007 of file String.cpp.
References m_buf.
String BLOCXX_NAMESPACE::String::toString | ( | ) | const |
Definition at line 948 of file String.cpp.
UInt16 BLOCXX_NAMESPACE::String::toUInt16 | ( | int | base = 10 | ) | const |
StringConversionException | if the conversion is impossible. |
Definition at line 1099 of file String.cpp.
References m_buf.
UInt32 BLOCXX_NAMESPACE::String::toUInt32 | ( | int | base = 10 | ) | const |
StringConversionException | if the conversion is impossible. |
Definition at line 1111 of file String.cpp.
References m_buf.
UInt64 BLOCXX_NAMESPACE::String::toUInt64 | ( | int | base = 10 | ) | const |
StringConversionException | if the conversion is impossible. |
Definition at line 1123 of file String.cpp.
References m_buf.
UInt8 BLOCXX_NAMESPACE::String::toUInt8 | ( | int | base = 10 | ) | const |
StringConversionException | if the conversion is impossible. |
Definition at line 1087 of file String.cpp.
References m_buf.
unsigned int BLOCXX_NAMESPACE::String::toUnsignedInt | ( | int | base = 10 | ) | const |
StringConversionException | if the conversion is impossible. |
Definition at line 1135 of file String.cpp.
References m_buf.
String & BLOCXX_NAMESPACE::String::toUpperCase | ( | ) |
Convert this String object to upper case characters.
Definition at line 863 of file String.cpp.
References m_buf, and BLOCXX_NAMESPACE::UTF8Utils::toUpperCaseInPlace().
String & BLOCXX_NAMESPACE::String::trim | ( | ) |
size_t BLOCXX_NAMESPACE::String::UTF8Length | ( | ) | const |
If the string is not valid UTF-8, then the result of this function is undefined.
Definition at line 360 of file String.cpp.
References c_str(), and BLOCXX_NAMESPACE::UTF8Utils::charCount().
Referenced by toChar16().
void BLOCXX_NAMESPACE::String::writeObject | ( | std::streambuf & | ostrm | ) | const |
Write this String object to the given ostream.
ostrm | The output stream to write this String to. |
IOException |
Definition at line 56 of file Bool.cpp.
References BLOCXX_NAMESPACE::Bool::m_val, and BLOCXX_NAMESPACE::BinarySerialization::write().
Referenced by BLOCXX_NAMESPACE::BinarySerialization::write(), and BLOCXX_NAMESPACE::BinarySerialization::writeString().
buf_t BLOCXX_NAMESPACE::String::m_buf [private] |
Definition at line 752 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().
const size_t BLOCXX_NAMESPACE::String::npos = size_t(~0) [static] |
Definition at line 742 of file String.hpp.
Referenced by BLOCXX_NAMESPACE::FileSystem::Path::basename(), BLOCXX_NAMESPACE::CmdLineParser::CmdLineParser(), BLOCXX_NAMESPACE::DateTime::DateTime(), BLOCXX_NAMESPACE::FileSystem::Path::dirname(), erase(), BLOCXX_NAMESPACE::SocketAddress::getAnyLocalHost(), BLOCXX_NAMESPACE::CmdLineParser::getUsage(), indexOf(), lastIndexOf(), and substring().