FDO API Reference Feature Data Objects
Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

FdoStringP Class Reference

#include <StringP.h>

List of all members.


Detailed Description

FdoStringP is smart pointer wrapper around strings. Provides memory management,plus conversion of strings between unicode and utf8 and various string manipulation functions.

Definition at line 29 of file StringP.h.


Public Member Functions

FDO_API_COMMON bool Contains (FdoString *subString) const
 Checks for a sub-string.
FDO_API_COMMON FdoStringP (const char *sValue)
 Creates a string from a utf8 string.
FDO_API_COMMON FdoStringP (FdoString *wValue, FdoBoolean bAttach=false)
 Creates a string from a unicode (FdoString) string.
FDO_API_COMMON FdoStringP (const FdoStringP &oValue)
 Creates a string from another string pointer.
FDO_API_COMMON FdoStringP (void)
 Creates an empty string with value L"".
FDO_API_COMMON size_t GetLength () const
FDO_API_COMMON int ICompare (const FdoStringP str2) const
 Case-insensitive string comparison.
FDO_API_COMMON bool IsNumber () const
FDO_API_COMMON FdoStringP Left (FdoString *delimiter) const
 Gets the characters to the left of the given sub-string.
FDO_API_COMMON FdoStringP Lower () const
FDO_API_COMMON FdoStringP Mid (size_t first, size_t count, bool useUTF8=false)
 Extracts a sub-string of this string.
FDO_API_COMMON operator const char * () const
FDO_API_COMMON operator FdoString * () const
FDO_API_COMMON bool operator!= (const FdoString *str2) const
 Not Equals comparison operator.
FDO_API_COMMON const FdoStringP operator+ (const FdoStringP str2) const
 Appends the contents of another string onto this string.
FDO_API_COMMON const FdoStringP operator+ (FdoString *str2) const
 Various operators for concatenating str2 to this. Appends a unicode string onto this string.
FDO_API_COMMON FdoStringP operator+= (const FdoStringP str2)
 Appends the contents of another string onto this string.
FDO_API_COMMON FdoStringP operator+= (FdoString *str2)
 Appends a unicode string onto this string.
FDO_API_COMMON bool operator< (const FdoStringP str2) const
 Less than comparison operator.
FDO_API_COMMON bool operator<= (const FdoStringP str2) const
 Less than or Equals comparison operator.
FDO_API_COMMON FdoStringPoperator= (FdoString *wString)
 Copies a string from a unicode string.
FDO_API_COMMON FdoStringPoperator= (const char *sString)
 Copies a string from a utf8 string.
FDO_API_COMMON FdoStringPoperator= (const FdoStringP &oString)
 Operators to copy from other strings in various forms Copies a string from a string pointer.
FDO_API_COMMON bool operator== (const FdoString *str2) const
 Equals comparison operator.
FDO_API_COMMON bool operator== (const FdoStringP str2) const
 Equals comparison operator.
FDO_API_COMMON bool operator> (const FdoStringP str2) const
 Various comparison operators. Greater than comparison operator.
FDO_API_COMMON bool operator>= (const FdoStringP str2) const
 Greater than or equal comparison operator.
FDO_API_COMMON FdoStringP Replace (FdoString *pOld, FdoString *pNew) const
 Replaces sub-strings.
FDO_API_COMMON FdoStringP Right (FdoString *delimiter) const
 Gets the characters to the right of the given sub-string.
FDO_API_COMMON FdoBoolean ToBoolean (FdoBoolean defaultValue=false) const
 Converts this string to a boolean.
FDO_API_COMMON FdoDouble ToDouble () const
 Converts this string to a double precision number.
FDO_API_COMMON long ToLong () const
 Converts this string to a long integer.
FDO_API_COMMON FdoStringP Upper () const
FDO_API_COMMON ~FdoStringP (void)
 Destroys this string and releases its contents.

Static Public Member Functions

FDO_API_COMMON FdoStringP Format (FdoString *wValue,...)
 Create a formatted string.
FDO_API_COMMON int Utf8FromUnicode (const wchar_t *Wtext, char *str_out, int out_max_size, bool thrown_exception=true)
FDO_API_COMMON int Utf8FromUnicode (const wchar_t *Wtext, int in_size, char *str_out, int out_max_size, bool thrown_exception=true)
 DOXYGEN-IGNORE
int Utf8Len (const char *utf8String)
 Return the length (in Unicode characters) of a UTF8 string.
FDO_API_COMMON int Utf8ToUnicode (const char *str_in, wchar_t *Wtext, int out_size, bool thrown_exception=true)
FDO_API_COMMON int Utf8ToUnicode (const char *str_in, int in_size, wchar_t *Wtext, int out_size, bool thrown_exception=true)

Static Public Attributes

FDO_API_COMMON const wchar_t * mEmptyString
 Constant representing a zero-length string.

Constructor & Destructor Documentation

FDO_API_COMMON FdoStringP::FdoStringP void   ) 
 

Creates an empty string with value L"".

FDO_API_COMMON FdoStringP::FdoStringP const FdoStringP oValue  ) 
 

Creates a string from another string pointer.

Parameters:
oValue Source string to set this string from.

FDO_API_COMMON FdoStringP::FdoStringP FdoString wValue,
FdoBoolean  bAttach = false
 

Creates a string from a unicode (FdoString) string.

Parameters:
wValue the unicode string
bAttach true: just point to the given string without copying it to an internal buffer. The caller is responsible for ensuring that the given string is not deleted before this object. false: copy the given string to an internal buffer

FDO_API_COMMON FdoStringP::FdoStringP const char *  sValue  ) 
 

Creates a string from a utf8 string.

Parameters:
sValue the utf8 string

FDO_API_COMMON FdoStringP::~FdoStringP void   ) 
 

Destroys this string and releases its contents.


Member Function Documentation

FDO_API_COMMON bool FdoStringP::Contains FdoString subString  )  const
 

Checks for a sub-string.

Parameters:
subString the sub-string to check
Returns:
Returns true if this string has at least 1 occurrence of subString

FDO_API_COMMON FdoStringP FdoStringP::Format FdoString wValue,
  ...
[static]
 

Create a formatted string.

Parameters:
wValue the formatting template. Can contain "sprintf" style formatting specs. <param name="..."> substitution parms to format into string. wValue must have one formatting spec per parm. </param>
Returns:
Returns the formatted string.

Referenced by operator+().

FDO_API_COMMON size_t FdoStringP::GetLength  )  const
 

Returns:
Returns the length (in wide characters) of the Unicode version of this string

Referenced by FdoXmlAttribute::GetQName().

FDO_API_COMMON int FdoStringP::ICompare const FdoStringP  str2  )  const
 

Case-insensitive string comparison.

Parameters:
str2 String to compare.
Returns:
Returns:
  • -1 if this is less than str2
  • 0 if this is equal to str2
  • 1 if this is greater than str2

FDO_API_COMMON bool FdoStringP::IsNumber  )  const
 

Returns:
Returns true if this string represents a number.

FDO_API_COMMON FdoStringP FdoStringP::Left FdoString delimiter  )  const
 

Gets the characters to the left of the given sub-string.

Parameters:
delimiter The substring.
Returns:
Returns all of the characters to the left of the first occurance of the delimiter string. All of this string is returned if the delimiter is not in this string. An empty string(L"") is returned if the delimiter is is NULL or L"".

FDO_API_COMMON FdoStringP FdoStringP::Lower  )  const
 

Returns:
Returns a copy of this string with all characters in lower case.

FDO_API_COMMON FdoStringP FdoStringP::Mid size_t  first,
size_t  count,
bool  useUTF8 = false
 

Extracts a sub-string of this string.

Parameters:
first the 0-based position of the first character to return. Negative values are treated as 0.
count the number of characters to return. If negative then all characters up to the end of this string are returned.
useUTF8 true: perform Mid against the UTF8 representation of this string. false (default): perform it against the Unicode representation.
Returns:
The extracted sub-string

FDO_API_COMMON FdoStringP::operator const char *  )  const
 

Returns:
Returns the UTF8 version of this string that the caller does not have to destroy

FDO_API_COMMON FdoStringP::operator FdoString *  )  const
 

Returns:
Returns the Unicode version of this string that the caller does not have to destroy

FDO_API_COMMON bool FdoStringP::operator!= const FdoString str2  )  const [inline]
 

Not Equals comparison operator.

Parameters:
str2 Unicode string to compare
Returns:
Returns true if this string is not lexically equal to str2

Definition at line 233 of file StringP.h.

References FDO_API_COMMON.

FDO_API_COMMON const FdoStringP FdoStringP::operator+ const FdoStringP  str2  )  const [inline]
 

Appends the contents of another string onto this string.

Parameters:
str2 string to concatenate
Returns:
Returns the concatenation of this string plus str2

Definition at line 131 of file StringP.h.

References FDO_API_COMMON, and FdoString.

FDO_API_COMMON const FdoStringP FdoStringP::operator+ FdoString str2  )  const [inline]
 

Various operators for concatenating str2 to this. Appends a unicode string onto this string.

Parameters:
str2 Unicode string to concatenate
Returns:
Returns the concatenation of this string plus str2

Definition at line 117 of file StringP.h.

References FDO_API_COMMON, and Format().

Here is the call graph for this function:

FDO_API_COMMON FdoStringP FdoStringP::operator+= const FdoStringP  str2  )  [inline]
 

Appends the contents of another string onto this string.

Parameters:
str2 string to concatenate
Returns:
Returns the concatenation of this string plus str2

Definition at line 160 of file StringP.h.

References FDO_API_COMMON, and FdoString.

FDO_API_COMMON FdoStringP FdoStringP::operator+= FdoString str2  )  [inline]
 

Appends a unicode string onto this string.

Parameters:
str2 Unicode string to concatenate
Returns:
Returns the concatenation of this string plus str2

Definition at line 145 of file StringP.h.

References FDO_API_COMMON.

FDO_API_COMMON bool FdoStringP::operator< const FdoStringP  str2  )  const [inline]
 

Less than comparison operator.

Parameters:
str2 String to compare
Returns:
Returns true if this string is lexically less than str2

Definition at line 261 of file StringP.h.

References FDO_API_COMMON.

FDO_API_COMMON bool FdoStringP::operator<= const FdoStringP  str2  )  const [inline]
 

Less than or Equals comparison operator.

Parameters:
str2 String to compare
Returns:
Returns true if this string is lexically less than or equal to str2

Definition at line 247 of file StringP.h.

References FDO_API_COMMON.

FDO_API_COMMON FdoStringP& FdoStringP::operator= FdoString wString  ) 
 

Copies a string from a unicode string.

Parameters:
wString Unicode string to copy from.
Returns:
Returns the copied string

FDO_API_COMMON FdoStringP& FdoStringP::operator= const char *  sString  ) 
 

Copies a string from a utf8 string.

Parameters:
sString Utf8 string to copy from.
Returns:
Returns the copied string

FDO_API_COMMON FdoStringP& FdoStringP::operator= const FdoStringP oString  ) 
 

Operators to copy from other strings in various forms Copies a string from a string pointer.

Parameters:
oString Source string to copy from.
Returns:
Returns the copied string

FDO_API_COMMON bool FdoStringP::operator== const FdoString str2  )  const [inline]
 

Equals comparison operator.

Parameters:
str2 Unicode string to compare
Returns:
Returns true if this string is lexically equal to str2

Definition at line 219 of file StringP.h.

References FDO_API_COMMON.

FDO_API_COMMON bool FdoStringP::operator== const FdoStringP  str2  )  const [inline]
 

Equals comparison operator.

Parameters:
str2 string to compare
Returns:
Returns true if this string is lexically equal to str2

Definition at line 205 of file StringP.h.

References FDO_API_COMMON.

FDO_API_COMMON bool FdoStringP::operator> const FdoStringP  str2  )  const [inline]
 

Various comparison operators. Greater than comparison operator.

Parameters:
str2 string to compare
Returns:
Returns true if this string is lexically greater than str2

Definition at line 177 of file StringP.h.

References FDO_API_COMMON.

FDO_API_COMMON bool FdoStringP::operator>= const FdoStringP  str2  )  const [inline]
 

Greater than or equal comparison operator.

Parameters:
str2 string to compare
Returns:
Returns true if this string is lexically greater or equal to str2

Definition at line 191 of file StringP.h.

References FDO_API_COMMON.

FDO_API_COMMON FdoStringP FdoStringP::Replace FdoString pOld,
FdoString pNew
const
 

Replaces sub-strings.

Parameters:
pOld the sub-string to replace
pNew the string to replace pOld by
Returns:
Returns a copy of this string, with all occurrences of pOld replaced by pNew. This string itself is not modified

FDO_API_COMMON FdoStringP FdoStringP::Right FdoString delimiter  )  const
 

Gets the characters to the right of the given sub-string.

Parameters:
delimiter The substring.
Returns:
Returns all of the characters to the right of the first occurance of the delimiter string. an empty string(L"") is returned if the delimiter is not in this string. All of this string is returned if the delimiter is NULL or L"".

FDO_API_COMMON FdoBoolean FdoStringP::ToBoolean FdoBoolean  defaultValue = false  )  const
 

Converts this string to a boolean.

Parameters:
defaultValue value returned when string is not recognized as boolean
Returns:
Returns true if the string in lower case is "t", "true", "y", "yes", or "1". Returns false if the string in lower case is "f", "false", "n", "no", or "0". Otherwise returns defaultValue.

FDO_API_COMMON FdoDouble FdoStringP::ToDouble  )  const
 

Converts this string to a double precision number.

Returns:
Returns double (0 if the string is not numeric).

FDO_API_COMMON long FdoStringP::ToLong  )  const
 

Converts this string to a long integer.

Returns:
Returns the long integer (0 if the string is not numeric).

FDO_API_COMMON FdoStringP FdoStringP::Upper  )  const
 

Returns:
Returns a copy of this string with all characters in upper case.

FDO_API_COMMON int FdoStringP::Utf8FromUnicode const wchar_t *  Wtext,
char *  str_out,
int  out_max_size,
bool  thrown_exception = true
[static]
 

Utility function for converting from unicode to utf8. returned value is allocated and must be deleted by caller.

FDO_API_COMMON int FdoStringP::Utf8FromUnicode const wchar_t *  Wtext,
int  in_size,
char *  str_out,
int  out_max_size,
bool  thrown_exception = true
[static]
 

DOXYGEN-IGNORE

Utility function for converting from unicode to utf8. returned value is allocated and must be deleted by caller.

int FdoStringP::Utf8Len const char *  utf8String  )  [static]
 

Return the length (in Unicode characters) of a UTF8 string.

FDO_API_COMMON int FdoStringP::Utf8ToUnicode const char *  str_in,
wchar_t *  Wtext,
int  out_size,
bool  thrown_exception = true
[static]
 

Utility function for converting from utf8 to unicode. returned value is allocated and must be deleted by caller.

FDO_API_COMMON int FdoStringP::Utf8ToUnicode const char *  str_in,
int  in_size,
wchar_t *  Wtext,
int  out_size,
bool  thrown_exception = true
[static]
 

Utility function for converting from utf8 to unicode. returned value is allocated and must be deleted by caller.


Member Data Documentation

FDO_API_COMMON const wchar_t* FdoStringP::mEmptyString [static]
 

Constant representing a zero-length string.

Definition at line 441 of file StringP.h.


The documentation for this class was generated from the following file:
Comments or suggestions? Send us feedback.