BString Class Reference

#include <BString.h>

Inheritance diagram for BString:

Inheritance graph
[legend]

List of all members.


Detailed Description

A string class.

Public Member Functions

const char * Ascii (void) const
 Returns a representation of this BString object as a null-terminated character string.
 BString (const BString &str)
 Copy constructor.
 BString (const wchar_t *pwsz)
 Constructs a BString that is a copy of a null-terminated wide-character string.
 BString (const char *pszStr)
 Constructs a BString that is a copy of a null-terminated character string.
 BString (const std::wstring &str)
 Constructs a BString that is a copy of a std::wstring.
 BString (const std::string &str)
 Constructs a BString that is a copy of a std::string.
 BString ()
 Constructs an empty string.
virtual size_t ComputeSize (void) const
 Computes the size of the BByteArray required to store this object.
void Empty (void)
 Clears the contents of this BString.
virtual void FromByteArray (const BByteArray &bytes, size_t &startPos)
 Initializes an instance of this object from a BByteArray.
bool IsEmpty (void) const
 Indicates whether or not this BString is an empty string.
BString Left (size_t len) const
 Copys the leftmost characters from this BString into a new BString.
 operator const char * (void) const
 Casts this string object to a const char* so it can be used where a null- terminated character string is required.
 operator const wchar_t * (void) const
 Casts this string object to a const wchar_t* so it can be used where a null- terminated wide-character string is required.
BStringoperator+= (const std::string &str)
 Append operator.
BStringoperator+= (const BString &str)
 Append operator.
BStringoperator+= (const std::wstring &str)
 Append operator.
BStringoperator+= (wchar_t wch)
 Append operator.
BStringoperator+= (char ch)
 Append operator.
BStringoperator+= (const wchar_t *psz)
 Append operator.
BStringoperator+= (const char *psz)
 Append operator.
BStringoperator= (const std::string &str)
 Assignment operator.
BStringoperator= (const BString &str)
 Assignment operator.
BStringoperator= (const std::wstring &str)
 Assignment operator.
BStringoperator= (const wchar_t *psz)
 Assignment operator.
BStringoperator= (const char *psz)
 Assignment operator.
BStringRemove (const BString &str)
 Removes the first instance of the specified string from this BString.
BStringRemoveAll (const BString &str)
 Remove all instances of the specified string from this BString.
BStringRemoveAllChars (const BString &charList)
 Removes all instances of the individual characters in the specified string from this BString.
BStringReplaceAll (const BString &findStr, const BString &replStr)
 Replaces all occurrances of the find string with the replace string.
BString Right (size_t len) const
 Copys the rightmost characters from this BString into a new BString.
std::string StdStr (void) const
 Returns a representation of this BString object as a std::string.
virtual BByteArray ToByteArray (void) const
 Stores this object in a BByteArray.
BStringToLower (void)
 Converts the contents of this BString to lower case charcters.
const UInt16ToUcs2Buffer () const
 Converts this BString to an array of UCS2 characters.
BStringToUpper (void)
 Converts the contents of this BString to upper case characters.
BStringTrim (void)
 Trims leading and trailing whitespace characters from this BString.
BStringTrimLeft (void)
 Trims leading whitespace characters from this BString.
BStringTrimRight (void)
 Trim trailing whitespace characters from this BString.
const char * Utf8 (void) const
 Casts this string object to a const char* so it can be used where a null- terminated character string is required.
virtual ~BString ()
 Destructor.

Static Public Member Functions

static BString Format (const wchar_t *pszFormat,...)
 Creates a BString formated using printf syntax.
static BString Format (const char *pszFormat,...)
 Creates a BString formated using printf syntax.
static double FromFormattedDegrees (const wchar_t *format, BString formattedString)
 Returns a decimal degree value based on a BString iwith the specified formatting.
static BString FromUcs2Buffer (const UInt16 *pUcs2, size_t len)
 Creates a BString from an array of UCS2 characters.
static BString ToFormattedDegrees (double degrees, const wchar_t *format)
 Creates a string from a numerical value in degrees, using the specified formatting.
static void Tokenize (const BString &str, std::vector< BString > &tokens, const BString &delimiters=" ")
 Splits a BString into a vector of substrings.

Constructor & Destructor Documentation

BString (  ) 

Constructs an empty string.

BString ( const std::string &  str  ) 

Constructs a BString that is a copy of a std::string.

Parameters:
str A std::string from which to construct the BString object.

BString ( const std::wstring &  str  ) 

Constructs a BString that is a copy of a std::wstring.

Parameters:
str A std::wstring from which to construct the BString object.

BString ( const char *  pszStr  ) 

Constructs a BString that is a copy of a null-terminated character string.

Parameters:
pszStr A null-terminated character string from which to construct the BString object.

BString ( const wchar_t *  pwsz  ) 

Constructs a BString that is a copy of a null-terminated wide-character string.

Parameters:
pwsz A null-terminated wide-character string from which to construct this BString object.

BString ( const BString str  ) 

Copy constructor.

Parameters:
str The BString to copy.

virtual ~BString (  )  [virtual]

Destructor.


Member Function Documentation

const char* Ascii ( void   )  const

Returns a representation of this BString object as a null-terminated character string.

Returns:
The null-terminated character string that represents this BString. This pointer may be temporary, and should not be modified, stored, or deleted.

virtual size_t ComputeSize ( void   )  const [inline, virtual]

Computes the size of the BByteArray required to store this object.

Returns:
The size of the BByteArray.

Implements BByteStreamable.

void Empty ( void   ) 

Clears the contents of this BString.

static BString Format ( const wchar_t *  pszFormat,
  ... 
) [static]

Creates a BString formated using printf syntax.

Parameters:
pszFormat A printf-style format string.
Returns:
A new BString containing the formatted string.

static BString Format ( const char *  pszFormat,
  ... 
) [static]

Creates a BString formated using printf syntax.

Parameters:
pszFormat A printf-style format string.
Returns:
A new BString containing the formatted string.

virtual void FromByteArray ( const BByteArray bytes,
size_t &  startPos 
) [virtual]

Initializes an instance of this object from a BByteArray.

Parameters:
bytes The BByteArray containing the byte representation of the object.
startPos The position in the BByteArray where the byte representation begins. This value will be updated to point to the byte past the end of this object in the byte array.

Implements BByteStreamable.

static double FromFormattedDegrees ( const wchar_t *  format,
BString  formattedString 
) [static]

Returns a decimal degree value based on a BString iwith the specified formatting.

Parameters:
format A format string.
formattedString A BString that expreses an angular value in the specified format.
Returns:
The decimal degree value that was expressed in the formatted BString.

static BString FromUcs2Buffer ( const UInt16 pUcs2,
size_t  len 
) [static]

Creates a BString from an array of UCS2 characters.

Parameters:
pUcs2 Pointer to a buffer that contains the UCS2 characters.
len Length of the buffer, in characters.
Returns:
A BString representation of the UCS2 character string.

bool IsEmpty ( void   )  const [inline]

Indicates whether or not this BString is an empty string.

Returns:
True if this BString is empty and false otherwise.

BString Left ( size_t  len  )  const

Copys the leftmost characters from this BString into a new BString.

Parameters:
len The number of characters to copy.
Returns:
A new BString containing the copied characters.

operator const char * ( void   )  const [inline]

Casts this string object to a const char* so it can be used where a null- terminated character string is required.

Returns:
The null-terminated character string that represents this BString object. Note that this pointer may be temporary, and should not be modified, stored, or deleted.

operator const wchar_t * ( void   )  const [inline]

Casts this string object to a const wchar_t* so it can be used where a null- terminated wide-character string is required.

Returns:
The null-terminated wide-character string that represents this BString object. Note that this pointer may be temporary, and should not be updated, stored, or deleted.

BString& operator+= ( const std::string &  str  )  [inline]

Append operator.

Parameters:
str A std::string to be appended to this BString.
Returns:
A reference to this BString.

BString& operator+= ( const BString str  ) 

Append operator.

Parameters:
str A BString object to be appended to this BString.
Returns:
A reference to this BString.

BString& operator+= ( const std::wstring &  str  )  [inline]

Append operator.

Parameters:
str A std::wstring to be appended to this BString.
Returns:
A reference to this BString.

BString& operator+= ( wchar_t  wch  ) 

Append operator.

Parameters:
wch A single wide character to be appended to this BString.
Returns:
A reference to this BString.

BString& operator+= ( char  ch  ) 

Append operator.

Parameters:
ch A single character to be appended to this BString.
Returns:
A reference to this BString.

BString& operator+= ( const wchar_t *  psz  ) 

Append operator.

Parameters:
psz A null-terminated wide-character string to be appended to this BString.
Returns:
A reference to this BString.

BString& operator+= ( const char *  psz  ) 

Append operator.

Parameters:
psz A null-terminated character string to be appended to this BString.
Returns:
A reference to this BString.

BString& operator= ( const std::string &  str  )  [inline]

Assignment operator.

Parameters:
str A std::string whose value will be copied into this BString object.
Returns:
A reference to this BString.

BString& operator= ( const BString str  ) 

Assignment operator.

Parameters:
str A BString object whose value will be copied into this BString object.
Returns:
A reference to this BString.

BString& operator= ( const std::wstring &  str  )  [inline]

Assignment operator.

Parameters:
str A std::widestring whose value will be copied into this BString object.
Returns:
A reference to this BString.

BString& operator= ( const wchar_t *  psz  ) 

Assignment operator.

Parameters:
psz A null-terminated wide-character string whose value will be copied into this BString object.
Returns:
A reference to this BString.

BString& operator= ( const char *  psz  ) 

Assignment operator.

Parameters:
psz A null-terminated character string whose value will be copied into this BString object.
Returns:
A reference to this BString.

BString& Remove ( const BString str  ) 

Removes the first instance of the specified string from this BString.

Parameters:
str The character string to be removed.
Returns:
A reference to this BString.

BString& RemoveAll ( const BString str  ) 

Remove all instances of the specified string from this BString.

Parameters:
str The character string to be removed.
Returns:
A reference to this BString.

BString& RemoveAllChars ( const BString charList  ) 

Removes all instances of the individual characters in the specified string from this BString.

Parameters:
charList The list of characters to be removed.
Returns:
A reference to this BString.

BString& ReplaceAll ( const BString findStr,
const BString replStr 
)

Replaces all occurrances of the find string with the replace string.

Parameters:
findStr The string to be replaced.
replStr The string that will replace the findStr.
Returns:
A reference to this BString.

BString Right ( size_t  len  )  const

Copys the rightmost characters from this BString into a new BString.

Parameters:
len The number of characters to copy.
Returns:
A new BString containing the copied characters.

std::string StdStr ( void   )  const

Returns a representation of this BString object as a std::string.

Returns:
The standard library character string that represents this string object.

virtual BByteArray ToByteArray ( void   )  const [virtual]

Stores this object in a BByteArray.

The byte representation for a BString contains the string length not including null terminator (4 bytes), and the string data including a null-terminator (wide characters).

Returns:
A BByteArray that stores the contents of this object.

Implements BByteStreamable.

static BString ToFormattedDegrees ( double  degrees,
const wchar_t *  format 
) [static]

Creates a string from a numerical value in degrees, using the specified formatting.

Parameters:
degrees The decimal value in degrees.
format A format string.
Returns:
A new BString that expresses the specified angular value using the specified format.

static void Tokenize ( const BString str,
std::vector< BString > &  tokens,
const BString delimiters = " " 
) [static]

Splits a BString into a vector of substrings.

Parameters:
str The BString to split.
tokens The returned vector of BString tokens.
delimiters The set of characters that separate tokens.

BString& ToLower ( void   ) 

Converts the contents of this BString to lower case charcters.

Returns:
A reference to this BString.

const UInt16* ToUcs2Buffer (  )  const

Converts this BString to an array of UCS2 characters.

Note:
The contents of this pointer will not be kept in sync with the contents of the BString. If you call this method and then change the source BString, it will not be reflected in your pointer.

The pointer received by this method will be invalid if the source BString goes out of scope or is destroyed.

Returns:
A pointer to a buffer containing a UCS2 representation of this BString.

BString& ToUpper ( void   ) 

Converts the contents of this BString to upper case characters.

Returns:
A reference to this BString.

BString& Trim ( void   ) 

Trims leading and trailing whitespace characters from this BString.

Returns:
A reference to this BString.

BString& TrimLeft ( void   ) 

Trims leading whitespace characters from this BString.

Returns:
A reference to this BString.

BString& TrimRight ( void   ) 

Trim trailing whitespace characters from this BString.

Returns:
A reference to this BString.

const char* Utf8 ( void   )  const

Casts this string object to a const char* so it can be used where a null- terminated character string is required.

Returns:
The null-terminated character string that represents this BString object. Note that this pointer may be temporary, and should not be modified, stored, or deleted.


The documentation for this class was generated from the following file:

GeoTranslate 5.0 From Blue Marble Geographics