CSIBCString Class Reference

General purpose string class. More...

#include <SIBCString.h>

List of all members.

Public Member Functions

  CSIBCString ()
  CSIBCString (const CSIBCString &in_pString)
  CSIBCString (const SI_Char *in_pString)
SI_Int  GetLength ()
SI_Char *  GetText ()
void  Clear ()
SI_Error  Concat (CSIBCString *in_pString)
SI_Error  Concat (const SI_Char *in_pString)
SI_Error  Concat (const SI_Int in_lInt)
SI_Error  Concat (const SI_Float in_fFloat)
SI_Error  SetText (CSIBCString *in_pString)
SI_Error  SetText (const SI_Char *in_pString)
SI_Error  SetText (const SI_Int in_lInt)
SI_Error  SetText (const SI_Float in_fFloat)
SI_Int  Compare (CSIBCString *in_pString)
SI_Int  Compare (const SI_Char *in_pString)
SI_Int  Compare (const SI_Int in_lInt)
SI_Int  Compare (const SI_Float in_fFloat)
SI_Error  LowerCase ()
SI_Error  UpperCase ()
SI_Error  RemoveIllegalXSICharacters ()
SI_Bool  IsXSILegalName ()
CSIBCString operator= (const CSIBCString &i_pString)
CSIBCString operator= (const SI_Char *i_pString)
bool  operator== (CSIBCString &i_pString)
bool  operator== (const SI_Char *i_pString)
bool  operator!= (CSIBCString &i_pString)
void  Dump ()
SI_UInt  UsedMemory ()
SI_UInt  AllocatedMemory ()


Detailed Description

General purpose string class.

This class is used throughout the Crosswalk SDK as a standard method in dealing with strings. The strings are NULL-terminated strings. It supports many methods that perform useful string operations.


Constructor & Destructor Documentation

CSIBCString (  ) 

Default Constructor. Constructs an empty string (length zero).

CSIBCString ( const CSIBCString in_pString  ) 

Copy Constructor. Constructs a string idential to in_pString

Parameters:
[in]  in_pString  String to duplicate. Must not be of zero length.

CSIBCString ( const SI_Char *  in_pString  ) 

Constructor Constructs a string object containing the NULL-terminated character string pointer to by in_pString.

Parameters:
[in]  in_pString  Pointer to the string to use for the new string. Cannot be NULL.


Member Function Documentation

SI_Int GetLength (  ) 

Returns the length of the string.

Returns:
length of the string.

SI_Char* GetText (  ) 

Returns a character buffer with the contents of the string. This buffer should not be modified, and does not need to be freed after use. This function is generally used to output the text contained within the string.

Returns:
Pointer to a character buffer containing the string text.
Example:
Demonstrating good and bad usage of GetText
        SIBCString * t_pMyString = new SIBCString("Crosswalk SDK");

        // This is OK.
        printf("I think that %s is the best!\n", t_pMyString->GetText());

        // This is wrong.
        printf("I think that %s is the best!\n", t_pMyString);

void Clear (  ) 

Deletes the internal character buffer of the string, and sets the length to zero.

SI_Error Concat ( CSIBCString in_pString  ) 

Concatenate in_pString to the end of this string.

Parameters:
[in]  in_pString  Pointer to the string to concatenate.
Return values:
SI_Error::SI_SUCCESS  The string was concatenated properly.

SI_Error Concat ( const SI_Char *  in_pString  ) 

Concatenate in_pString to the end of this string.

Parameters:
[in]  in_pString  Pointer to a character buffer to concatenate.
Return values:
SI_Error::SI_SUCCESS  The string was concatenated properly.

SI_Error Concat ( const SI_Int  in_lInt  ) 

Concatenate in_lInt to the end of this string, in string format.

Parameters:
[in]  in_lInt  Integer to concatenate to the end of this string.
Return values:
SI_Error::SI_SUCCESS  The string was concatenated properly.
Example:
Demonstrates how to concatenate integers with a string
        SIBCString * t_pMyString = SIBCString("Crosswalk v");
        t_pMyString->Concat(3);
        t_pMyString->Concat(".");
        t_pMyString->Concat(6);
        printf("This is %s\n", t_pMyString.GetText());

        // output is "This is Crosswalk v3.6"

SI_Error Concat ( const SI_Float  in_fFloat  ) 

Concatenate in_fFloat to the end of this string, in string format.

Parameters:
[in]  in_fFloat  Floating-point number to concatenate to the end of this string.
Return values:
SI_Error::SI_SUCCESS  The string was concatenated properly.
Example:
Demonstrates how to concatenate floats with a string
        SIBCString * t_pMyString = SIBCString("Crosswalk v");
        t_pMyString->Concat(3.6f);
        printf("This is %s\n", t_pMyString.GetText());

        // output is "This is Crosswalk v3.6"

SI_Error SetText ( CSIBCString in_pString  ) 

Assigns the value contained in the string in_pString to this string.

Parameters:
[in]  in_pString  String containing data to assign to this string.
Return values:
SI_Error::SI_SUCCESS  The string was assigned properly.

SI_Error SetText ( const SI_Char *  in_pString  ) 

Assigns the NULL-terminated string contained in the character buffer in_pString to this string.

Parameters:
[in]  in_pString  Pointer to the character buffer containing the NULL-terminated string to assign.
Return values:
SI_Error::SI_SUCCESS  The string was assigned properly.

SI_Error SetText ( const SI_Int  in_lInt  ) 

Assigns the string representation of in_lInt to this string.

Parameters:
[in]  in_lInt  Integer whose string representation should be assigned to this string
Return values:
SI_Error::SI_SUCCESS  The string was assigned properly.

SI_Error SetText ( const SI_Float  in_fFloat  ) 

Assigns the string representation of in_fFloat to this string.

Parameters:
[in]  in_fFloat  Floating-point number whose string representation should be assigned to this string
Return values:
SI_Error::SI_SUCCESS  The string was assigned properly.

SI_Int Compare ( CSIBCString in_pString  ) 

Returns a value indicating the lexicographic difference between this string and in_pString. Negative values indicate this string is less than in_pString, Positive values indicate this string is greater than in_pString, and zero values indicate the strings are the same.

Parameters:
[in]  in_pString  The string to compare this string with.
Return values:
\c  <positive_integer_value> indicating the difference when this string is greater than in_pString
\c  <negative_integer_value> indicating the difference when this string is less than in_pString
\c  0 if in_pString and this string are the same (including when both buffers are NULL)
\c  1 if in_pString's buffer is NULL and this string's buffer is not NULL
\c  -1 if this string's buffer is NULL and in_pString's buffer is not NULL

SI_Int Compare ( const SI_Char *  in_pString  ) 

Returns a value indicating the lexicographic difference between this string and in_pString. Negative values indicate this string is less than in_pString, Positive values indicate this string is greater than in_pString, and zero values indicate the strings are the same.

Parameters:
[in]  in_pString  The string to compare this string with.
Return values:
\c  <positive_integer_value> indicating the difference when this string is greater than in_pString
\c  <negative_integer_value> indicating the difference when this string is less than in_pString
\c  0 if in_pString and this string are the same (including when both buffers are NULL)
\c  0 if in_pString and this string's buffers are NULL
\c  1 if in_pString's buffer is NULL and this string's buffer is not NULL
\c  -1 if this string's buffer is NULL and in_pString's buffer is not NULL

SI_Int Compare ( const SI_Int  in_lInt  ) 

Returns a value indicating the differences between this string and the string representation of in_lInt.

Parameters:
[in]  in_lInt  The integer value whose string representation is compared with this string.
Return values:
\c  <positive_integer_value> indicating the difference when this string is greater than in_lInt
\c  <negative_integer_value> indicating the difference when this string is less than in_lInt
\c  0 if in_lInt and this string are the same

SI_Int Compare ( const SI_Float  in_fFloat  ) 

Returns a value indicated the differences between this string and the string representation of in_fFloat.

Parameters:
[in]  in_fFloat  The floating-pointer number whose string representation is compared with this string.
Return values:
\c  <positive_integer_value> indicating the difference when this string is greater than in_fFloat
\c  <negative_integer_value> indicating the difference when this string is less than in_fFloat
\c  0 if in_fFloat and this string are the same

SI_Error LowerCase (  ) 

Converts all alphabetic characters contained within this string to lower-case characters.

Return values:
SI_Error::SI_SUCCESS  The string was assigned properly.

SI_Error UpperCase (  ) 

Converts all alphabetic characters contained within this string to upper-case characters.

Return values:
SI_Error::SI_SUCCESS  The string was assigned properly.

SI_Error RemoveIllegalXSICharacters (  ) 

Removes all characters considered illegal by Softimage

Returns:
success/failure

SI_Bool IsXSILegalName (  ) 

Returns whether the string is a legal Softimage name

Return values:
SI_Bool::TRUE  if the string is legal
SI_Bool::FALSE  otherwise

CSIBCString& operator= ( const CSIBCString i_pString  ) 

Assignment operator. Copies the value of i_pString into this string.

Parameters:
[in]  i_pString  String whose value is copied into this string.
Returns:
Reference to this string.

CSIBCString& operator= ( const SI_Char *  i_pString  ) 

Assignment operator. Copies the value of i_pString into this string.

Parameters:
[in]  i_pString  Pointer to the character buffer containing a NULL-terminated string whose value is copied into this string.
Returns:
Reference to this string.

bool operator== ( CSIBCString i_pString  ) 

Equality operator. Determines whether i_pString and this string contain the same text.

Parameters:
[in]  i_pString  Reference to the string to compare to.
Return values:
true  if strings contain the same text
false  otherwise

bool operator== ( const SI_Char *  i_pString  ) 

Equality operator. Determines whether i_pString and this string contain the same text.

Parameters:
[in]  i_pString  Pointer to the character buffer containing the NULL-terminated string to compare to.
Return values:
true  if strings contain the same text
false  otherwise

bool operator!= ( CSIBCString i_pString  ) 

Inequality operator. Determines whether i_pString and this string contain different text.

Parameters:
[in]  i_pString  Reference to the string to compare to.
Return values:
true  if string contain different text
false  otherwise

void Dump (  ) 

Outputs debugging information for this string. This includes the address of the string, the length and contents of the string buffer.

SI_UInt UsedMemory (  ) 

Returns the amount of memory used by the string. This does not include the size of the SIBCString class, only the data contained in its character buffer. In SIBCString (but not necessarily in other classes) SIBCString::UsedMemory is equivalent to SIBCString::AllocatedMemory.

Returns:
Amount of memory used by this string (in bytes).

SI_UInt AllocatedMemory (  ) 

Returns the amount of memory allocated by the string. This does not include the size of the SIBCString class, only the data contained in its character buffer. In SIBCString (but not necessarily in other classes) SIBCString::AllocatedMemory is equivalent to SIBCString::UsedMemory.

Returns:
Amount of memory used by this string (in bytes).


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