OWBI1::String Class Reference

This String class is an abstract data type that represents as NULL terminated string of characters. More...

#include <OWBI1_String.hpp>

Collaboration diagram for OWBI1::String:

Collaboration graph
[legend]
List of all members.

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.
Stringconcat (const char *arg)
 Append a C string to this String object.
Stringconcat (const String &arg)
 Append another String object to this String object.
Stringconcat (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
StringtoLowerCase ()
 Convert this String object to lower case characters.
StringtoUpperCase ()
 Convert this String object to upper case characters.
Stringltrim ()
 Strip all leading space characters from this String object.
Stringrtrim ()
 Strip all trailing space characters from this String object.
Stringtrim ()
 Strip all leading and trailing space characters from this String object.
Stringerase ()
 Delete all the characters of the string.
Stringerase (size_t idx, size_t len=npos)
 Erases, at most, len characters of *this, starting at index idx.
Stringoperator= (const String &arg)
 Assignment operator.
const char & operator[] (size_t ndx) const
 Operator [].
char & operator[] (size_t ndx)
Stringoperator+= (const String &arg)
 Concatination operator.
Stringoperator+= (const char *arg)
 Concatination operator.
Stringoperator+= (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

Detailed Description

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 63 of file OWBI1_String.hpp.


Member Typedef Documentation

typedef COWIntrusiveReference<ByteBuf> OWBI1::String::buf_t
 

Definition at line 698 of file OWBI1_String.hpp.


Member Enumeration Documentation

enum OWBI1::String::EEmptyTokenReturnFlag
 

Enumerator:
E_SKIP_EMPTY_TOKENS 
E_RETURN_EMPTY_TOKENS 

Definition at line 215 of file OWBI1_String.hpp.

enum OWBI1::String::EIgnoreCaseFlag
 

Enumerator:
E_CASE_SENSITIVE 
E_CASE_INSENSITIVE 

Definition at line 303 of file OWBI1_String.hpp.

enum OWBI1::String::EReturnDelimitersFlag
 

Enumerator:
E_DISCARD_DELIMITERS 
E_RETURN_DELIMITERS 

Definition at line 210 of file OWBI1_String.hpp.

enum OWBI1::String::ETakeOwnershipFlag
 

Enumerator:
E_TAKE_OWNERSHIP 

Definition at line 136 of file OWBI1_String.hpp.


Constructor & Destructor Documentation

OWBI1::String::String  ) 
 

Create a new String object with a length of 0.

Definition at line 157 of file OWBI1_String.cpp.

Referenced by substring(), tokenize(), and trim().

OWBI1::String::String Int32  val  )  [explicit]
 

Create a new String object that will hold the string representation of the given Int32 value.

Parameters:
val The 32 bit value this String will hold the string representation of.

Definition at line 165 of file OWBI1_String.cpp.

References OWBI1::AutoPtrVec< X >::get(), and m_buf.

OWBI1::String::String UInt32  val  )  [explicit]
 

Create a new String object that will hold the string representation of the given UInt32 value.

Parameters:
val The 32 bit value this String will hold the string representation of.

Definition at line 175 of file OWBI1_String.cpp.

References OWBI1::AutoPtrVec< X >::get(), and m_buf.

OWBI1::String::String Int64  val  )  [explicit]
 

Create a new String object that will hold the string representation of the given Int64 value.

Parameters:
val The 64 bit value this String will hold the string representation of.

Definition at line 210 of file OWBI1_String.cpp.

References m_buf.

OWBI1::String::String UInt64  val  )  [explicit]
 

Create a new String object that will hold the string representation of the given UInt64 value.

Parameters:
val The 64 bit value this String will hold the string representation of.

Definition at line 218 of file OWBI1_String.cpp.

References m_buf.

OWBI1::String::String Real32  val  )  [explicit]
 

Create a new String object that will hold the string representation of the given Real32 value.

Parameters:
val The real value this String will hold the string representation of.

Definition at line 235 of file OWBI1_String.cpp.

References m_buf, and SNPRINTF.

OWBI1::String::String Real64  val  )  [explicit]
 

Create a new String object that will hold the string representation of the given Real64 value.

Parameters:
val The real value this String will hold the string representation of.

Definition at line 251 of file OWBI1_String.cpp.

References m_buf, and SNPRINTF.

OWBI1::String::String const char *  str  ) 
 

Create a new String object that will contain a copy of the given character string.

Parameters:
str The null terminated string to make a copy of.

Definition at line 267 of file OWBI1_String.cpp.

References m_buf.

OWBI1::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.

Parameters:
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 273 of file OWBI1_String.cpp.

References m_buf, and OW_ASSERT.

OWBI1::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.

Parameters:
str The character array to copy from.
len The number of bytes to copy from the str param.

Definition at line 281 of file OWBI1_String.cpp.

References OWBI1::AutoPtrVec< X >::get(), and m_buf.

OWBI1::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)

Parameters:
arg The String object to make a copy of.

Definition at line 297 of file OWBI1_String.cpp.

OWBI1::String::String char  c  )  [explicit]
 

Create a new String object that contains a single character.

Parameters:
c The character that this string will contain.

Definition at line 302 of file OWBI1_String.cpp.

References m_buf.

OWBI1::String::~String  ) 
 

Destroy this String object.

Definition at line 318 of file OWBI1_String.cpp.


Member Function Documentation

char * OWBI1::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().

Returns:
A pointer to the newly allocated buffer that contains the contents of this String object.

Definition at line 329 of file OWBI1_String.cpp.

References c_str(), and length().

const char * OWBI1::String::c_str  )  const
 

Returns:
The c string representation of this String object. This will be a null terminated character array.

Definition at line 894 of file OWBI1_String.cpp.

References m_buf.

Referenced by allocateCString(), OWBI1::StringBuffer::append(), OWBI1::Char16::Char16(), compareTo(), compareToIgnoreCase(), concat(), OWBI1::CIMValue::createSimpleValue(), endsWith(), equals(), equalsIgnoreCase(), OWBI1::CIMObjectPath::escape(), OWBI1::CIMValue::get(), OWBI1::CIMDataType::getDataType(), OWBI1::BI1SimpleInstanceProviderIFC::getInstance(), OWBI1::CIMObjectPath::getKeyT(), OWBI1::CIMInstance::getPropertyT(), OWBI1::CIMProperty::getQualifierT(), indexOf(), lastIndexOf(), OWBI1::operator<<(), OWBI1::CIMName::operator=(), OWBI1::operator==(), OWBI1::TempFileEnumerationImplBase::readSize(), OWBI1::CIMQualifier::setLanguage(), OWBI1::CIMInstance::setLanguage(), OWBI1::CIMNameSpace::setNameSpace(), startsWith(), OWBI1::StringBuffer::StringBuffer(), OWBI1::CIMDataType::strToSimpleType(), toBool(), OWBI1::CIMValue::toString(), OWBI1::CIMObjectPath::unEscape(), and UTF8Length().

char OWBI1::String::charAt size_t  ndx  )  const
 

Get the character at a specified index.

Parameters:
ndx The index of the character to return within the char array.
Returns:
The character at the given index within the array. If the index is out of bounds, then a 0 is returned.

Definition at line 383 of file OWBI1_String.cpp.

References m_buf.

int OWBI1::String::compareTo const char *  arg  )  const
 

Compare another string with this one.

Parameters:
arg The string to compare with this one.
Returns:
0 if this String object is equal to arg. Greater than 0 if this String object is greater than arg. Less than 0 if this String object is less than arg.

Definition at line 389 of file OWBI1_String.cpp.

References m_buf.

int OWBI1::String::compareTo const String arg  )  const
 

Compare another String object with this one.

Parameters:
arg The String object to compare with this one.
Returns:
0 if this String object is equal to arg. Greater than 0 if this String object is greater than arg. Less than 0 if this String object is less than arg.

Definition at line 400 of file OWBI1_String.cpp.

References c_str().

Referenced by equals(), OWBI1::operator!=(), OWBI1::operator<(), OWBI1::operator<=(), OWBI1::operator==(), OWBI1::operator>(), OWBI1::operator>=(), and OWBI1::strncmpi().

int OWBI1::String::compareToIgnoreCase const char *  arg  )  const
 

Compare another string with this one ignoring case.

Parameters:
arg The string to compare with this one.
Returns:
0 if this String object is equal to arg. Greater than 0 if this String object is greater than arg. Less than 0 if this String object is less than arg.

Definition at line 406 of file OWBI1_String.cpp.

References OW_NAMESPACE::UTF8Utils::compareToIgnoreCase(), and m_buf.

int OWBI1::String::compareToIgnoreCase const String arg  )  const
 

Compare another string with this one ignoring case.

Parameters:
arg The string to compare with this one.
Returns:
0 if this String object is equal to arg. Greater than 0 if this String object is greater than arg. Less than 0 if this String object is less than arg.

Definition at line 417 of file OWBI1_String.cpp.

References c_str().

Referenced by equalsIgnoreCase().

String & OWBI1::String::concat char  arg  ) 
 

Append a char to this String object.

Parameters:
arg The char to append to this String object.
Returns:
A reference to this String object.

Definition at line 443 of file OWBI1_String.cpp.

References OWBI1::AutoPtrVec< X >::get(), length(), and m_buf.

String& OWBI1::String::concat const String arg  )  [inline]
 

Append another String object to this String object.

Parameters:
arg The String object to append to this String object.
Returns:
A reference to this String object.

Definition at line 292 of file OWBI1_String.hpp.

References c_str().

String & OWBI1::String::concat const char *  arg  ) 
 

Append a C string to this String object.

Parameters:
arg The C string to append to this String object.
Returns:
A reference to this String object.

Definition at line 424 of file OWBI1_String.cpp.

References length(), and m_buf.

bool OWBI1::String::empty  )  const [inline]
 

Returns:
True if empty string, false otherwise

Definition at line 200 of file OWBI1_String.hpp.

Referenced by OWBI1::CIMNameSpace::CIMNameSpace(), OWBI1::CIMObjectPath::parse(), OWBI1::Logger::processLogMessage(), and tokenize().

bool OWBI1::String::endsWith char  arg  )  const
 

Determine if this String object ends with a given character.

Parameters:
arg The character to test for.
Returns:
true if this String ends with the given character. Otherwise return false.

Definition at line 460 of file OWBI1_String.cpp.

References m_buf.

bool OWBI1::String::endsWith const String arg,
EIgnoreCaseFlag  ignoreCase = E_CASE_SENSITIVE
const [inline]
 

Determine if this String object ends with the same string represented by another String object.

Parameters:
arg The String object to search the end of this String object for.
ignoreCase If true, character case will be ignored.
Returns:
true if this String ends with the given String. Otherwise return false.

Definition at line 327 of file OWBI1_String.hpp.

References c_str().

bool OWBI1::String::endsWith const char *  arg,
EIgnoreCaseFlag  ignoreCase = E_CASE_SENSITIVE
const
 

Determine if this String object ends with given C string.

Parameters:
arg The C string object to search the end of this String object for.
ignoreCase If true, character case will be ignored.
Returns:
true if this String ends with the given String. Otherwise return false.

Definition at line 469 of file OWBI1_String.cpp.

References OW_NAMESPACE::UTF8Utils::compareToIgnoreCase(), length(), and m_buf.

bool OWBI1::String::equals const char *  arg  )  const
 

Determine if another string is equal to this String object.

Parameters:
arg The string to check this String object against for equality.
Returns:
true if this String object is equal to the given String object. Otherwise return false.

Definition at line 493 of file OWBI1_String.cpp.

References compareTo().

bool OWBI1::String::equals const String arg  )  const
 

Determine if another String object is equal to this String object.

Parameters:
arg The String object to check this String object against for equality.
Returns:
true if this String object is equal to the given String object. Otherwise return false.

Definition at line 499 of file OWBI1_String.cpp.

References c_str().

Referenced by OWBI1::decodeLongMonth(), and OWBI1::operator==().

bool OWBI1::String::equalsIgnoreCase const char *  arg  )  const
 

Determine if another string is equal to this String object, ignoring case in the comparision.

Parameters:
arg The string to check this String object against for equality.
Returns:
true if this String object is equal to the given String object. Otherwise return false.

Definition at line 505 of file OWBI1_String.cpp.

References compareToIgnoreCase().

bool OWBI1::String::equalsIgnoreCase const String arg  )  const
 

Determine if another String object is equal to this String object, ignoring case in the comparision.

Parameters:
arg The String object to check this String object against for equality.
Returns:
true if this String object is equal to the given String object. Otherwise return false.

Definition at line 511 of file OWBI1_String.cpp.

References c_str().

Referenced by OWBI1::Logger::setLogLevel(), and toBool().

String & OWBI1::String::erase size_t  idx,
size_t  len = npos
 

Erases, at most, len characters of *this, starting at index idx.

if len == npos, erase to the end of the string.

Returns:
A referernce to this object.

Definition at line 817 of file OWBI1_String.cpp.

References length(), npos, and substring().

String & OWBI1::String::erase  ) 
 

Delete all the characters of the string.

Thus, the string is empty after the call.

Returns:
A referernce to this object.

Definition at line 810 of file OWBI1_String.cpp.

References m_buf.

Referenced by OWBI1::WQLSelectStatement::clear().

int OWBI1::String::format const char *  fmt,
  ...
 

Format this string according to the given format and variable argument list (printf style).

Parameters:
fmt The format to use during the operation
... A variable argument list to be applied to the format
Returns:
The length of the string after the operation on success. npos on error.

Definition at line 353 of file OWBI1_String.cpp.

References OWBI1::AutoPtrVec< X >::get(), length(), and m_buf.

static String OWBI1::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.

Returns:
an String containing the line.

UInt32 OWBI1::String::hashCode  )  const
 

Returns:
a 32 bit hashcode of this String object.

Definition at line 517 of file OWBI1_String.cpp.

References i, length(), and m_buf.

size_t OWBI1::String::indexOf const String arg,
size_t  fromIndex = 0
const [inline]
 

Find the first occurence of a string in this String object.

Parameters:
arg The string to search for.
fromIndex The index to start the search from.
Returns:
The index of the given string in the underlying array if it was found. npos if the string was not found at or after the fromIndex.

Definition at line 402 of file OWBI1_String.hpp.

References c_str().

size_t OWBI1::String::indexOf const char *  arg,
size_t  fromIndex = 0
const
 

Find the first occurence of a C string in this String object.

Parameters:
arg The C string to search for.
fromIndex The index to start the search from.
Returns:
The index of the given string in the underlying array if it was found. npos if the string was not found at or after the fromIndex.

Definition at line 559 of file OWBI1_String.cpp.

References length(), m_buf, and npos.

size_t OWBI1::String::indexOf char  ch,
size_t  fromIndex = 0
const
 

Find the first occurence of a given character in this String object.

Parameters:
ch The character to search for.
fromIndex The index to start the search from.
Returns:
The index of the given character in the underlying array if it was found. npos if the character was not found at or after the given fromIndex.

Definition at line 538 of file OWBI1_String.cpp.

References length(), m_buf, npos, and strchr().

bool OWBI1::String::isSpaces  )  const
 

Returns:
true if this String object contains nothing but space characters.

Definition at line 715 of file OWBI1_String.cpp.

References m_buf.

size_t OWBI1::String::lastIndexOf const String arg,
size_t  fromIndex = npos
const [inline]
 

Find the last occurence of a string in this String object.

Parameters:
arg The string to search for.
fromIndex The index to start the search from.
Returns:
The index of the last occurence of the string in the underlying array if it was found. npos if the this String does not contain the given substring before the fromIndex.

Definition at line 433 of file OWBI1_String.hpp.

References c_str().

size_t OWBI1::String::lastIndexOf const char *  arg,
size_t  fromIndex = npos
const
 

Find the last occurence of a C string in this String object.

Parameters:
arg The C string to search for.
fromIndex The index to start the search from.
Returns:
The index of the last occurence of the string in the underlying array if it was found. npos if the this String does not contain the given substring before the fromIndex.

Definition at line 612 of file OWBI1_String.cpp.

References length(), m_buf, and npos.

size_t OWBI1::String::lastIndexOf char  ch,
size_t  fromIndex = npos
const
 

Find the last occurence of a character in this String object.

Parameters:
ch The character to search for.
fromIndex The index to start the search from.
Returns:
The index of the last occurence of the given character in the underlying array if it was found. npos if this String object does not contain the character before the given fromIndex.

Definition at line 585 of file OWBI1_String.cpp.

References i, length(), m_buf, and npos.

size_t OWBI1::String::length  )  const
 

Returns:
The number of bytes in this String.

Definition at line 338 of file OWBI1_String.cpp.

References m_buf.

Referenced by allocateCString(), OWBI1::StringBuffer::append(), concat(), OWBI1::DateTime::DateTime(), endsWith(), erase(), OWBI1::CIMObjectPath::escape(), format(), OWBI1::getTimeZoneOffset(), hashCode(), indexOf(), lastIndexOf(), OWBI1::operator<<(), operator[](), rtrim(), startsWith(), substring(), toLowerCase(), toUpperCase(), trim(), and OWBI1::CIMObjectPath::unEscape().

String & OWBI1::String::ltrim  ) 
 

Strip all leading space characters from this String object.

Returns:
A reference to this String object after the operation has taken place.

Definition at line 730 of file OWBI1_String.cpp.

References m_buf.

String& OWBI1::String::operator+= char  arg  )  [inline]
 

Character concatination operator.

Parameters:
arg The character to append to the end of this String.
Returns:
A reference to this String object after the concatination has taken place.

Definition at line 562 of file OWBI1_String.hpp.

String& OWBI1::String::operator+= const char *  arg  )  [inline]
 

Concatination operator.

Parameters:
arg The C string to append to the end of this String.
Returns:
A reference to this String object after the concatination has taken place.

Definition at line 555 of file OWBI1_String.hpp.

String& OWBI1::String::operator+= const String arg  )  [inline]
 

Concatination operator.

Parameters:
arg The String to append to the end of this String.
Returns:
A reference to this String object after the concatination has taken place.

Definition at line 548 of file OWBI1_String.hpp.

String & OWBI1::String::operator= const String arg  ) 
 

Assignment operator.

Parameters:
arg The String object to assign to this String.
Returns:
A reference to this String object after the assignment has taken place.

Definition at line 887 of file OWBI1_String.cpp.

References m_buf.

char & OWBI1::String::operator[] size_t  ndx  ) 
 

Definition at line 928 of file OWBI1_String.cpp.

References length(), m_buf, and OW_ASSERT.

const char & OWBI1::String::operator[] size_t  ndx  )  const
 

Operator [].

Parameters:
ndx The index of the character to retrieve from the underlying character array.
Returns:
The character at the given index within the underlying character array. If ndx is out of bounds, 0 is returned.

Definition at line 908 of file OWBI1_String.cpp.

References length(), m_buf, and OW_ASSERT.

void OWBI1::String::readObject std::istream &  istrm  ) 
 

Read this String object from the given istream.

An String must have been previously written to this location of the stream.

Parameters:
istrm The input stream to read this String from.
Exceptions:
IOException 

String & OWBI1::String::rtrim  ) 
 

Strip all trailing space characters from this String object.

Returns:
A reference to this String object after the operation has taken place.

Definition at line 750 of file OWBI1_String.cpp.

References length(), and m_buf.

bool OWBI1::String::startsWith char  arg  )  const
 

Determine if this String object starts with a given character.

Parameters:
arg The character to test for.
Returns:
true if this String object starts with the given character. Otherwise false.

Definition at line 645 of file OWBI1_String.cpp.

References m_buf.

bool OWBI1::String::startsWith const String arg,
EIgnoreCaseFlag  ignoreCase = E_CASE_SENSITIVE
const [inline]
 

Determine if this String object starts with a given substring.

Parameters:
arg The String object to search the beginning of this String object for.
ignoreCase If true, case of the characters will be ignored.
Returns:
true if this String object starts with the given string. Otherwise false.

Definition at line 455 of file OWBI1_String.hpp.

References c_str().

bool OWBI1::String::startsWith const char *  arg,
EIgnoreCaseFlag  ignoreCase = E_CASE_SENSITIVE
const
 

Determine if this String object starts with a given substring.

Parameters:
arg The String object to search the beginning of this String object for.
ignoreCase If true, case of the characters will be ignored.
Returns:
true if this String object starts with the given string. Otherwise false.

Definition at line 654 of file OWBI1_String.cpp.

References length(), m_buf, and OWBI1::strncmpi().

const char * OWBI1::String::strchr const char *  theStr,
int  c
[static]
 

Find the first occurrence of a character in a null terminated string.

Parameters:
theStr The string to search for the given character.
c The character to to search for.
Returns:
a pointer to the first occurrence of the character c in the string theStr if found. Otherwise a NULL pointer.

Definition at line 1494 of file OWBI1_String.cpp.

Referenced by indexOf(), tokenize(), and trim().

long long int OWBI1::String::strtoll const char *  nptr,
char **  endptr,
int  base
[static]
 

Convert a null terminated string to an signed 64 bit value.

Parameters:
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.
Returns:
The signed 64 bit value of the number represented in string form pointed to by nptr.

Definition at line 1198 of file OWBI1_String.cpp.

References LLONG_MAX, LLONG_MIN, and s.

Referenced by OWBI1::convertToInt64Type().

unsigned long long int OWBI1::String::strtoull const char *  nptr,
char **  endptr,
int  base
[static]
 

Convert a null terminated string to an unsigned 64 bit value.

Parameters:
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.
Returns:
The unsigned 64 bit value of the number represented in string form pointed to by nptr.

Definition at line 1341 of file OWBI1_String.cpp.

References s, and ULLONG_MAX.

Referenced by OWBI1::convertToUInt64Type().

String OWBI1::String::substring size_t  beginIndex,
size_t  length = npos
const
 

Create another String object that is comprised of a substring of this String object.

Parameters:
beginIndex The start index of the substring.
length The length of the substring to use.
Returns:
A new String object representing the substring of this String object.

Definition at line 684 of file OWBI1_String.cpp.

References length(), m_buf, npos, and String().

Referenced by erase().

void OWBI1::String::swap String x  ) 
 

Swap this instance with another.

Definition at line 323 of file OWBI1_String.cpp.

References m_buf, and OWBI1::COWIntrusiveReference< T >::swap().

Referenced by OWBI1::Logger::swap().

bool OWBI1::String::toBool  )  const
 

Returns:
The boolean value of this String object. The string is assumed to be the value of "TRUE"/"FALSE" ignoring case.
Exceptions:
StringConversionException if the conversion is impossible.

Definition at line 999 of file OWBI1_String.cpp.

References c_str(), equalsIgnoreCase(), and OWBI1::throwStringConversion().

int OWBI1::String::toInt int  base = 10  )  const
 

Returns:
The int value of this String object.
Exceptions:
StringConversionException if the conversion is impossible.

Definition at line 1121 of file OWBI1_String.cpp.

References m_buf.

Int16 OWBI1::String::toInt16 int  base = 10  )  const
 

Returns:
The Int16 value of this String object.
Exceptions:
StringConversionException if the conversion is impossible.

Definition at line 1085 of file OWBI1_String.cpp.

References m_buf.

Int32 OWBI1::String::toInt32 int  base = 10  )  const
 

Returns:
The Int32 value of this String object.
Exceptions:
StringConversionException if the conversion is impossible.

Definition at line 1097 of file OWBI1_String.cpp.

References m_buf.

Int64 OWBI1::String::toInt64 int  base = 10  )  const
 

Returns:
The Int64 value of this String object.
Exceptions:
StringConversionException if the conversion is impossible.

Definition at line 1109 of file OWBI1_String.cpp.

References m_buf.

Int8 OWBI1::String::toInt8 int  base = 10  )  const
 

Returns:
The Int8 value of this String object.
Exceptions:
StringConversionException if the conversion is impossible.

Definition at line 1073 of file OWBI1_String.cpp.

References m_buf.

StringArray OWBI1::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.

Parameters:
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.
Returns:
An StringArray that contains the tokens from this String object. If there are no tokens the StringArray will be empty.

Definition at line 1127 of file OWBI1_String.cpp.

References OWBI1::Array< T >::append(), E_RETURN_DELIMITERS, E_RETURN_EMPTY_TOKENS, empty(), i, m_buf, strchr(), and String().

String & OWBI1::String::toLowerCase  ) 
 

Convert this String object to lower case characters.

Returns:
A reference to this String object after the conversion has taken place.

Definition at line 837 of file OWBI1_String.cpp.

References i, length(), and m_buf.

Real32 OWBI1::String::toReal32  )  const
 

Returns:
The Real32 value of this String object.
Exceptions:
StringConversionException if the conversion is impossible.

Definition at line 979 of file OWBI1_String.cpp.

References m_buf.

Real64 OWBI1::String::toReal64  )  const
 

Returns:
The Real64 value of this String object.
Exceptions:
StringConversionException if the conversion is impossible.

Definition at line 989 of file OWBI1_String.cpp.

References m_buf.

String OWBI1::String::toString  )  const
 

Returns:
A copy of this String object.

Definition at line 939 of file OWBI1_String.cpp.

Referenced by OWBI1::CIMObjectPath::getClassName(), OWBI1::CIMProperty::getQualifierT(), OWBI1::operator<<(), OWBI1::CIMValue::toString(), and OWBI1::CIMParameter::toString().

UInt16 OWBI1::String::toUInt16 int  base = 10  )  const
 

Returns:
The UInt16 value of this String object.
Exceptions:
StringConversionException if the conversion is impossible.

Definition at line 1079 of file OWBI1_String.cpp.

References m_buf.

UInt32 OWBI1::String::toUInt32 int  base = 10  )  const
 

Returns:
The UInt32 value of this String object.
Exceptions:
StringConversionException if the conversion is impossible.

Definition at line 1091 of file OWBI1_String.cpp.

References m_buf.

UInt64 OWBI1::String::toUInt64 int  base = 10  )  const
 

Returns:
The UInt64 value of this String object.
Exceptions:
StringConversionException if the conversion is impossible.

Definition at line 1103 of file OWBI1_String.cpp.

References m_buf.

UInt8 OWBI1::String::toUInt8 int  base = 10  )  const
 

Returns:
The UInt8 value of this String object.
Exceptions:
StringConversionException if the conversion is impossible.

Definition at line 1067 of file OWBI1_String.cpp.

References m_buf.

unsigned int OWBI1::String::toUnsignedInt int  base = 10  )  const
 

Returns:
The unsigned int value of this String object.
Exceptions:
StringConversionException if the conversion is impossible.

Definition at line 1115 of file OWBI1_String.cpp.

References m_buf.

String & OWBI1::String::toUpperCase  ) 
 

Convert this String object to upper case characters.

Returns:
A reference to this String object after the conversion has taken place.

Definition at line 852 of file OWBI1_String.cpp.

References i, length(), and m_buf.

Referenced by OWBI1::strncmpi().

String & OWBI1::String::trim  ) 
 

Strip all leading and trailing space characters from this String object.

Returns:
A reference to this String object after the operation has taken place.

Definition at line 776 of file OWBI1_String.cpp.

References length(), m_buf, strchr(), and String().

Referenced by OWBI1::CIMObjectPath::parse(), and OWBI1::CIMNameSpace::setNameSpace().

size_t OWBI1::String::UTF8Length  )  const
 

If the string is not valid UTF-8, then the result of this function is undefined.

Returns:
The number of UTF-8 chars in this String.

Definition at line 344 of file OWBI1_String.cpp.

References c_str(), and OW_NAMESPACE::UTF8Utils::charCount().

void OWBI1::String::writeObject std::ostream &  ostrm  )  const
 

Write this String object to the given ostream.

Parameters:
ostrm The output stream to write this String to.
Exceptions:
IOException 


Member Data Documentation

buf_t OWBI1::String::m_buf [private]
 

Definition at line 700 of file OWBI1_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 OWBI1::String::npos = ~0 [static]
 

Definition at line 690 of file OWBI1_String.hpp.

Referenced by OWBI1::CIMUrl::checkRef(), erase(), indexOf(), lastIndexOf(), and substring().


The documentation for this class was generated from the following files:
Generated on Thu Feb 9 09:18:44 2006 for openwbem by  doxygen 1.4.6