# TMCString Class Reference
[MCCore]

Inheritance diagram for TMCString:

List of all members.

## Public Types
enum | ELineFeed { kMacLineFeed, kUnixLineFeed, kWinLineFeed }
| Converts line feed (\r, \n or \r\n) to mac format \r. More...
## Public Member Functions
virtual | ~TMCString (void)
virtual TMCString & | operator= (const TMCString &ss)
virtual TMCString & | operator+= (const TMCString &ss)
virtual TMCString & | operator+= (uint16 c)
virtual boolean | operator< (const TMCString &ss) const
virtual boolean | operator> (const TMCString &ss) const
virtual boolean | operator<= (const TMCString &ss) const
virtual boolean | operator>= (const TMCString &ss) const
virtual boolean | operator== (const TMCString &ss) const
virtual boolean | operator!= (const TMCString &ss) const
virtual void | InsertStr (const TMCString &ss, uint32 nIndex)
boolean | EraseStr (uint32 nIndex, uint32 nCount)
void | SubString (uint32 nIndex, uint32 nCount)
uint32 | SearchStr (const TMCString &ss, uint32 nIndex=kStartIndex) const
uint32 | ReplaceStr (const TMCString &ss, const TMCString &replace, uint32 nIndex=kStartIndex)
uint32 | FindCharPos (uint16 c, uint32 nIndex=kStartIndex) const
uint32 | FindCharPosFromRight (uint16 c) const
uint32 | FindCharPosFromRight (uint16 c, uint32 nIndex) const
const int8 * | StrGet (void) const
uint32 | GetSubStringByteLength (uint32 inIndex, uint32 inLength) const
uint32 | ByteLength (void) const
uint32 | Length (void) const
void | SetLength (uint32 inLength)
void | SetCharAt (uint16 c, uint32 nIndex)
uint16 | GetCharAt (uint32 nIndex) const
void | ToCPtr (int8 *data) const
void | ToPPtr (uint8 *data) const
void | FromUTF8Ptr (const uint8 *data)
void | ToUTF8Ptr (uint8 *data) const
void | FromCPtr (const int8 *data)
void | FromCAsciiPtr (const int8 *data)
void | FromPPtr (const uint8 *data)
void | FromEncodedPtr (const uint8 *data, ITranscoder *transcoder)
void | FromUnicode (const uint16 *data)
void | ToUnicode (uint16 *data, int32 dataSize) const
void | FromText (const int8 *data, uint32 length)
void | FromFourCharT (const FourCharT inCode, boolean inDontCheckValue)
FourCharT | ToFourCharT (void) const
boolean | IsEqualNotCaseSensitive (const TMCString &other) const
int8 | CompareQuick (const TMCString &other) const
void | ToUpper (void)
void | ToLower (void)
void | Capitalize (void)
void | FromInt32 (int32 x)
int32 | ToInt32 (void) const
void | FromReal32 (real32 inValue, uint8 inDecimals)
real32 | ToReal32 (void) const
void | FromReal64 (real64 inValue, uint8 inPrecision)
void | FromReal64 (real64 xx)
real64 | ToReal64 (void) const
boolean | IsNumericString (void) const
uint16 | operator[] (uint32 inIndex) const
void | TranslateAscii (boolean inverse)
void | TranslateBeforeWrite (TMCString &translatedString)
void | TranslateAfterRead (void)
void | ConvertLineFeed (ELineFeed toType=kMacLineFeed)
uint32 | MaxLength (void) const
void | TranslateSBAfterRead (void)
uint32 | SearchSBStr (const TMCString &ss, uint32 nIndex=kStartIndex) const
uint32 | FindSBCharPos (int8 c, uint32 nIndex=kStartIndex) const
int8 | GetSBCharAt (uint32 nIndex) const
boolean | EraseSBStr (const uint32 nIndex, uint32 nCount)
## Protected Member Functions
| TMCString (void)
void | Initialize (int8 *myData, uint32 maxLength, const int8 *ss, uint32 ll)
void | SetSBCharAt (int8 c, int32 nIndex)
virtual void | SetByteLength (uint32 byteLength)
virtual void | SetMaxLength (uint32 maxLength)
virtual int8 * | GetString () const =0
## Protected Attributes
uint32 | fLength
uint32 | fByteLength
uint32 | fMaxLength

## Detailed Description

TMCString is the base class from which all the different classes that represent strings are derived.
TMCString15, TMCString31, TMCString63, TMCString255 and TMCString1023 use a fix sized buffer (in bytes) to store their content.
On the other hand, TMCDynamicString reallocates its buffer whenever it needs to.

When the application is compiled in double byte mode (for asian systems), strings use characters that can be encoded over two bytes (but not every character is). The documentation precises which methods are "double byte aware".

## Member Enumeration Documentation

enum TMCString::ELineFeed

Converts line feed (\r, \n or \r\n) to mac format \r.

Enumerator:

  kMacLineFeed | \r
  kUnixLineFeed | \n
  kWinLineFeed | \r\n

## Constructor & Destructor Documentation

virtual TMCString::~TMCString | ( | void |  | ) | `[inline, virtual]`

Virtual Destructor for clean destructions

TMCString::TMCString | ( | void |  | ) | `[protected]`

## Member Function Documentation

uint32 TMCString::ByteLength | ( | void |  | ) | const`[inline]`

Return the number of bytes used in this string.

void TMCString::Capitalize | ( | void |  | ) |

Make the string lowercase and then make the first character (if it is a letter) uppercase.

Note:
  This routine is double-byte aware (meaning it won't do anything to a double-byte string).

int8 TMCString::CompareQuick | ( | const TMCString & | other | ) | const

Compare this string to another disregarding the current language.
Returns negative if this is less than other.
Returns zero if this is equal to other.
Returns positive if this is greater than other.

void TMCString::ConvertLineFeed | ( | ELineFeed | toType = `kMacLineFeed` | ) |

boolean TMCString::EraseSBStr | ( | const uint32 | nIndex,
|  | uint32 | nCount |
| ) |  |  |

boolean TMCString::EraseStr | ( | uint32 | nIndex,
|  | uint32 | nCount |
| ) |  |  |

Erase nCount characters from this string starting from nIndex.

Note:
  nIndex is 0 based & this routine is double-byte aware.

uint32 TMCString::FindCharPos | ( | uint16 | c,
|  | uint32 | nIndex = `kStartIndex` |
| ) |  |  | const

Search forward for the location of character c in this, start the search at nIndex.

Note:
  nIndex is 0 based, this routine is double-byte aware.

uint32 TMCString::FindCharPosFromRight | ( | uint16 | c,
|  | uint32 | nIndex |
| ) |  |  | const

Search backwards for the location of character c in this, start the search at nIndex

Note:
  nIndex is 0 based, this routine is double-byte aware.

uint32 TMCString::FindCharPosFromRight | ( | uint16 | c | ) | const`[inline]`

Search backwards for the location of character c in this, start the search at the end of the string.

Note:
  This routine is double-byte aware.

uint32 TMCString::FindSBCharPos | ( | int8 | c,
|  | uint32 | nIndex = `kStartIndex` |
| ) |  |  | const

void TMCString::FromCAsciiPtr | ( | const int8 * | data | ) |

void TMCString::FromCPtr | ( | const int8 * | data | ) | `[inline]`

Fill in this string from an existing c-style (NULL terminated) string.

Note:
  If this is a static length string, trying to assign more characters than were declared for storage will ignore the extra characters

void TMCString::FromEncodedPtr | ( | const uint8 * | data,
|  | ITranscoder * | transcoder |
| ) |  |  |

Fill in this string from an exsiting NULL terminated string that is encoded with the given encoding

Note:
  If this is a static length string, trying to assign more characters than were declared for storage will ignore the extra characters

void TMCString::FromFourCharT | ( | const FourCharT | inCode,
|  | boolean | inDontCheckValue |
| ) |  |  |

Assign string data from a FourCharT.

void TMCString::FromInt32 | ( | int32 | x | ) |

Fill in this string by convering the passed in value to a string.

void TMCString::FromPPtr | ( | const uint8 * | data | ) |

Fill in this string from an existing pascal-style (length prefixed) string.

Note:
  If this is a static length string, trying to assign more characters than were declared for storage will ignore the extra characters

void TMCString::FromReal32 | ( | real32 | inValue,
|  | uint8 | inDecimals |
| ) |  |  |

Fill in this string by converting the passed in real32 to a string, using the number of decimals passed in.

void TMCString::FromReal64 | ( | real64 | xx | ) |

Fill in this string by convering the passed in value to a string.

Note:
  The value will be truncated to 2 places of decimal precision (%.2f format);

void TMCString::FromReal64 | ( | real64 | inValue,
|  | uint8 | inPrecision |
| ) |  |  |

Assign the character representation of the real64 value passed in with a %.pG print format (p= inPrecision)

void TMCString::FromText | ( | const int8 * | data,
|  | uint32 | length |
| ) |  |  |

Fill in this string from a memory buffer and a length.

Note:
  If this is a static length string, trying to assign more characters than were declared for storage will ignore the extra characters

void TMCString::FromUnicode | ( | const uint16 * | data | ) |

Fill in this string from an existing UCS (Unicode NULL terminated) string.

Note:
  If this is a static length string, trying to assign more characters than were declared for storage will ignore the extra characters

void TMCString::FromUTF8Ptr | ( | const uint8 * | data | ) | `[inline]`

Fill in this string from an existing c-style (NULL terminated) string.

Note:
  If this is a static length string, trying to assign more characters than were declared for storage will ignore the extra characters

uint16 TMCString::GetCharAt | ( | uint32 | nIndex | ) | const

Retrieve the nIndex character of this string.

Note:
  nIndex is 0 based, trying to get an out of range character returns zero This routine is double-byte aware.

int8 TMCString::GetSBCharAt | ( | uint32 | nIndex | ) | const

virtual int8* TMCString::GetString | ( |  | ) | const`[protected, pure virtual]`

Implemented in TMCDynamicString.

uint32 TMCString::GetSubStringByteLength | ( | uint32 | inIndex,
|  | uint32 | inLength |
| ) |  |  | const

Calculate the bytelength of a sub-string.

void TMCString::Initialize | ( | int8 * | myData,
|  | uint32 | maxLength,
|  | const int8 * | ss,
|  | uint32 | ll |
| ) |  |  | `[protected]`

virtual void TMCString::InsertStr | ( | const TMCString & | ss,
|  | uint32 | nIndex |
| ) |  |  | `[virtual]`

Insert string ss at nIndex(1,String Length).

Reimplemented in TMCDynamicString.

boolean TMCString::IsEqualNotCaseSensitive | ( | const TMCString & | other | ) | const

Compare this string to another disregarding the case of the string.

Returns:
  true if the strings are equivalent, false if not.

Note:
  This routine is double-byte aware, and SLOW.

boolean TMCString::IsNumericString | ( | void |  | ) | const

Returns true if this string represents a numerical value, false otherwise.

uint32 TMCString::Length | ( | void |  | ) | const`[inline]`

Return the number of characters in this string.

Note:
  This routine is double-byte aware.

uint32 TMCString::MaxLength | ( | void |  | ) | const`[inline]`

virtual boolean TMCString::operator!= | ( | const TMCString & | ss | ) | const`[virtual]`

virtual TMCString& TMCString::operator+= | ( | uint16 | c | ) | `[virtual]`

Reimplemented in TMCDynamicString.

virtual TMCString& TMCString::operator+= | ( | const TMCString & | ss | ) | `[virtual]`

Reimplemented in TMCDynamicString.

virtual boolean TMCString::operator< | ( | const TMCString & | ss | ) | const`[virtual]`

virtual boolean TMCString::operator<= | ( | const TMCString & | ss | ) | const`[virtual]`

virtual TMCString& TMCString::operator= | ( | const TMCString & | ss | ) | `[virtual]`

Reimplemented in TMCDynamicString.

virtual boolean TMCString::operator== | ( | const TMCString & | ss | ) | const`[virtual]`

virtual boolean TMCString::operator> | ( | const TMCString & | ss | ) | const`[virtual]`

virtual boolean TMCString::operator>= | ( | const TMCString & | ss | ) | const`[virtual]`

uint16 TMCString::operator[] | ( | uint32 | inIndex | ) | const`[inline]`

Returns the character at inIndex position in the string.

Note:
  inIndex is 0 based.

uint32 TMCString::ReplaceStr | ( | const TMCString & | ss,
|  | const TMCString & | replace,
|  | uint32 | nIndex = `kStartIndex` |
| ) |  |  |

Replace each occurence of ss by replace, start the search at nIndex. Return the number of occurence replaced.

Note:
  nIndex is 0 based.

uint32 TMCString::SearchSBStr | ( | const TMCString & | ss,
|  | uint32 | nIndex = `kStartIndex` |
| ) |  |  | const

uint32 TMCString::SearchStr | ( | const TMCString & | ss,
|  | uint32 | nIndex = `kStartIndex` |
| ) |  |  | const

Return the location of string ss in this, start the search at nIndex.

Note:
  nIndex is 0 based.

virtual void TMCString::SetByteLength | ( | uint32 | byteLength | ) | `[protected, virtual]`

Reimplemented in TMCDynamicString.

void TMCString::SetCharAt | ( | uint16 | c,
|  | uint32 | nIndex |
| ) |  |  |

Assign c to the nIndex character of this string.

Note:
  nIdex is 0 based, trying to set an out of range character does nothing. This routine is double-byte aware.

void TMCString::SetLength | ( | uint32 | inLength | ) |

Set the number of characters in this string.

Note:
  This routine is double-byte aware.

virtual void TMCString::SetMaxLength | ( | uint32 | maxLength | ) | `[inline, protected, virtual]`

Reimplemented in TMCDynamicString.

void TMCString::SetSBCharAt | ( | int8 | c,
|  | int32 | nIndex |
| ) |  |  | `[protected]`

const int8* TMCString::StrGet | ( | void |  | ) | const

Return a const pointer to the string data contained in this string.

void TMCString::SubString | ( | uint32 | nIndex,
|  | uint32 | nCount |
| ) |  |  |

Make this string into a substring consisting of nCount characters starting at nIndex.

Note:
  nIndex is 0 based & this routine is double-byte aware.

void TMCString::ToCPtr | ( | int8 * | data | ) | const

Fill in data as a c-style (NULL terminated) copy of this string.

Note:
  Data MUST be large enough to hold the string or you will corrupt memory.

FourCharT TMCString::ToFourCharT | ( | void |  | ) | const

Convert string to a FourCharT.

int32 TMCString::ToInt32 | ( | void |  | ) | const

Return this string as an int32 value.

void TMCString::ToLower | ( | void |  | ) |

Convert the contents of this string to lower case.

Note:
  This routine is double-byte aware.

void TMCString::ToPPtr | ( | uint8 * | data | ) | const

Fill in data as a pascal-style (length prefixed) copy of this string.

Note:
  Data MUST be large enough to hold the string or you will corrupt memory.

real32 TMCString::ToReal32 | ( | void |  | ) | const

Return this string as a real32 value.

real64 TMCString::ToReal64 | ( | void |  | ) | const

Return this string as a double value.

void TMCString::ToUnicode | ( | uint16 * | data,
|  | int32 | dataSize |
| ) |  |  | const

Fill in data as a UCS (Unicode NULL terminated) copy of this string.

Note:
  if the buffer is too small, the function will assert and clip the string

void TMCString::ToUpper | ( | void |  | ) |

Convert the contents of this string to upper case.

Note:
  This routine is double-byte aware.

void TMCString::ToUTF8Ptr | ( | uint8 * | data | ) | const

Fill in data as a UTF-8 encoded (NULL terminated) copy of this string.

Note:
  Data MUST be large enough to hold the string or you will corrupt memory

void TMCString::TranslateAfterRead | ( | void |  | ) |

void TMCString::TranslateAscii | ( | boolean | inverse | ) |

void TMCString::TranslateBeforeWrite | ( | TMCString & | translatedString | ) |

void TMCString::TranslateSBAfterRead | ( | void |  | ) |

## Member Data Documentation

uint32 TMCString::fByteLength`[protected]`

uint32 TMCString::fLength`[protected]`

uint32 TMCString::fMaxLength`[protected]`

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

- MCString.h