XFcStringToolkit class Reference

Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members File Members

# XFcStringToolkit Class Reference

String toolkit. Contains static functions used to manipulate zero-terminated character strings. More...

List of all members.

## Static Public Member Functions

XFCIMPORT INT32 | format (CHAR *aTarget, const CHAR *aFormat,...)
| Formats string using standard printf-like format string.
XFCIMPORT INT32 | formatVarArgs (CHAR *aTarget, const CHAR *aFormat, va_list aVaList)
| va_list version of format()
XFCIMPORT INT32 | format (CHAR *aTarget, INT32 aBufferLength, const CHAR *aFormat,...)
| Format() call that also makes sure target buffer is not overrun.
XFCIMPORT INT32 | formatVarArgs (CHAR *aTarget, INT32 aBufferLength, const CHAR *aFormat, va_list aVaList)
| Format() call that also makes sure target buffer is not overrun (va_list version).
XFCIMPORT CHAR * | allocatedFormat (const CHAR *aFormat,...)
| Format() call that also allocates the target buffer.
XFCIMPORT CHAR * | allocatedFormatVarArgs (const CHAR *aFormat, va_list aVaList)
| Format() call that also allocates the target buffer (va_list version).
XFCIMPORT UINT32 | match (const CHAR *aMask, const CHAR *aData)
| Calculates the amount of matches of a mask in a string.
XFCIMPORT UINT32 | matchIgnoreCase (const CHAR *aMask, const CHAR *aData)
| Calculates the amount of matches of a mask in a string, ignore case -version.
XFCIMPORT INT | matchWildcard (const CHAR *aMask, const CHAR *aData)
| Matches wildcards (? and * supported).
XFCIMPORT INT | matchWildcardIgnoreCase (const CHAR *aMask, const CHAR *aData)
| Matches wildcards (? and * supported), ignore case -version.
XFCIMPORT CHAR * | copy (const CHAR8 *aString)
| Duplicates string from 8-bit characters to internal format.
XFCIMPORT CHAR * | copy (const CHAR16 *aString)
| Duplicates string from 16-bit characters to internal format.
XFCIMPORT CHAR8 * | copyToCHAR8 (const CHAR *aString)
| Duplicates string from internal format to 8-bit format.
XFCIMPORT CHAR16 * | copyToCHAR16 (const CHAR *aString)
| Duplicates string from internal format to 16-bit format.
XFCIMPORT INT | compare (const CHAR *aString1, const CHAR *aString2)
| Compares two strings (0 = equal).
XFCIMPORT INT | compareIgnoreCase (const CHAR *aString1, const CHAR *aString2)
| Compares two strings in a case-insensitive way (0 = equal).
XFCIMPORT const CHAR * | find (const CHAR *aStringSrc, const CHAR *aStringToFind)
| Finds string in string, returns NULL if not found.
XFCIMPORT INT32 | getLength (const CHAR *aString)
| Returns length of string, in characters.
XFCIMPORT INT32 | getLengthInBytes (const CHAR *aString)
| Returns length of string, in bytes.
XFCIMPORT CHAR * | findLast (const CHAR *aString, const CHAR aChar)
| Returns a pointer to the last occurrence of a character, or NULL if not found.
XFCIMPORT CHAR * | concat (const CHAR *aString1, const CHAR *aString2, CHAR aDelimiter=0)
| Joins two strings, allocating new buffer.
XFCIMPORT INT32 | toINT32 (const CHAR *aString, INT *aSuccess=NULL)
| Converts string to an integer.
XFCIMPORT FLOAT32 | toFLOAT32 (const CHAR *aString, INT *aSuccess=NULL)
| Converts string to a float.
XFCIMPORT void | toLowerCase (CHAR *aString)
| Converts a string to lower case.
XFCIMPORT void | toUpperCase (CHAR *aString)
| Converts a string to upper case.
XFCIMPORT CHAR * | unescape (const CHAR *aStr)
| Converts escaped character string to literal one.

## Detailed Description

String toolkit. Contains static functions used to manipulate zero-terminated character strings.

## Member Function Documentation

XFCIMPORT CHAR* XFcStringToolkit::allocatedFormat | ( | const CHAR * | aFormat,
|  | ... |
| ) | `[static]`

Format() call that also allocates the target buffer.

Note:
  Application must delete[] the buffer after use.

See also:
  format()

XFCIMPORT CHAR* XFcStringToolkit::allocatedFormatVarArgs | ( | const CHAR * | aFormat,
|  | va_list | aVaList
| ) | `[static]`

Format() call that also allocates the target buffer (va_list version).

Note:
  Application must delete[] the buffer after use.

See also:
  format()

XFCIMPORT INT XFcStringToolkit::compare | ( | const CHAR * | aString1,
|  | const CHAR * | aString2
| ) | `[static]`

Compares two strings (0 = equal).

This method can also be used to sort strings, as the result can be negative or positive depending on the characters compared.

See also:
  compareIgnoreCase

XFCIMPORT INT XFcStringToolkit::compareIgnoreCase | ( | const CHAR * | aString1,
|  | const CHAR * | aString2
| ) | `[static]`

Compares two strings in a case-insensitive way (0 = equal).

See also:
  compare

XFCIMPORT CHAR* XFcStringToolkit::concat | ( | const CHAR * | aString1,
|  | const CHAR * | aString2,
|  | CHAR | aDelimiter = 0
| ) | `[static]`

Joins two strings, allocating new buffer.

Note:
  The newly allocated buffer must be cleaned by the application by using the delete[] operator.

XFCIMPORT CHAR* XFcStringToolkit::copy | ( | const CHAR16 * | aString | ) | `[static]`

Duplicates string from 16-bit characters to internal format.

Note:
  The newly allocated buffer must be cleaned up by the application by using the delete[] operator.

XFCIMPORT CHAR* XFcStringToolkit::copy | ( | const CHAR8 * | aString | ) | `[static]`

Duplicates string from 8-bit characters to internal format.

Note:
  The newly allocated buffer must be cleaned up by the application by using the delete[] operator.

XFCIMPORT CHAR16* XFcStringToolkit::copyToCHAR16 | ( | const CHAR * | aString | ) | `[static]`

Duplicates string from internal format to 16-bit format.

Note:
  The newly allocated buffer must be cleaned up by the application by using the delete[] operator.

XFCIMPORT CHAR8* XFcStringToolkit::copyToCHAR8 | ( | const CHAR * | aString | ) | `[static]`

Duplicates string from internal format to 8-bit format.

Note:
  The newly allocated buffer must be cleaned up by the application by using the delete[] operator.

XFCIMPORT const CHAR* XFcStringToolkit::find | ( | const CHAR * | aStringSrc,
|  | const CHAR * | aStringToFind
| ) | `[static]`

| Finds string in string, returns NULL if not found. Returned pointer points at the beginning of the found string, not a newly-allocated one.

XFCIMPORT CHAR* XFcStringToolkit::findLast | ( | const CHAR * | aString,
|  | const CHAR | aChar
| ) | `[static]`

| Returns a pointer to the last occurrence of a character, or NULL if not found.

XFCIMPORT INT32 XFcStringToolkit::format | ( | CHAR * | aTarget,
|  | INT32 | aBufferLength,
|  | const CHAR * | aFormat,
|  | ... |
| ) | `[static]`

Format() call that also makes sure target buffer is not overrun.

See also:
  format()

XFCIMPORT INT32 XFcStringToolkit::format | ( | CHAR * | aTarget,
|  | const CHAR * | aFormat,
|  | ... |
| ) | `[static]`

Formats string using standard printf-like format string.

Supported commands:
  - : output '%' char
  - n : store out CHAR count to a pointer to INT
  - s : string
  - c : CHAR
  - d : signed decimal integer
  - i : signed decimal integer
  - u : unsigned decimal integer
  - x : hexadecimal lowercase unsigned integer
  - X : hexadecimal uppercase unsigned integer
  - o : octal unsigned integer
  - b : binary unsigned integer (xfc extension)
  - f : floating point (double) using nnn.nnnn notation
  - e : floating point (double) using n.nnnne+nnn notation
  - E : floating point (double) using n.nnnnE+nnn notation
  - g : floating point (double) chooses between f and e modes
  - G : floating point (double) chooses between f and E modes

Supported formatting flags:
  - + : prefix sign even if positive
  - - : left align (as opposed to right align)
  - 0 : pad with zeros
  - * : read width and/or precision from parameter
  - nnn.nnn : width and/or precision
  - # : read but ignored

Supported prefixes:
  - l : read but ignored
  - L : read but ignored
  - h : read but ignored

Returns:
  number of characters outputted

Note:
  Floating point output is not accurate, but should be able to output values of sane ranges (16.16 digits).

See also:
  Standard C library printf documentation.

XFCIMPORT INT32 XFcStringToolkit::formatVarArgs | ( | CHAR * | aTarget,
|  | INT32 | aBufferLength,
|  | const CHAR * | aFormat,
|  | va_list | aVaList
| ) | `[static]`

Format() call that also makes sure target buffer is not overrun (va_list version).

See also:
  format()

XFCIMPORT INT32 XFcStringToolkit::formatVarArgs | ( | CHAR * | aTarget,
|  | const CHAR * | aFormat,
|  | va_list | aVaList
| ) | `[static]`

va_list version of format()

See also:
  Standard C library vsprintf documentation

  format()

XFCIMPORT INT32 XFcStringToolkit::getLength | ( | const CHAR * | aString | ) | `[static]`

Returns length of string, in characters.

String must be zero-terminated.

See also:
  getLengthInBytes

XFCIMPORT INT32 XFcStringToolkit::getLengthInBytes | ( | const CHAR * | aString | ) | `[static]`

Returns length of string, in bytes.

Returns the byte size of the character string regardless of the internal character format.

See also:
  getLength

XFCIMPORT UINT32 XFcStringToolkit::match | ( | const CHAR * | aMask,
|  | const CHAR * | aData
| ) | `[static]`

Calculates the amount of matches of a mask in a string.

Checks how many times the given mask string is found in another string.

See also:
  matchIgnoreCase

XFCIMPORT UINT32 XFcStringToolkit::matchIgnoreCase | ( | const CHAR * | aMask,
|  | const CHAR * | aData
| ) | `[static]`

Calculates the amount of matches of a mask in a string, ignore case -version.

Checks how many times the given mask string is found in another string.

See also:
  match

XFCIMPORT INT XFcStringToolkit::matchWildcard | ( | const CHAR * | aMask,
|  | const CHAR * | aData
| ) | `[static]`

Matches wildcards (? and * supported).

Checks whether the given string matches a wildcard mask. ? (question mark) is a single-character wildcard while * (asterisk) matches zero or more characters. "foo?ar" matches "foobar" but not "foobaar"; "f*r" matches all strings that start with f and end with r, including "fr" and "foobar".

See also:
  matchWildcardIgnoreCase

XFCIMPORT INT XFcStringToolkit::matchWildcardIgnoreCase | ( | const CHAR * | aMask,
|  | const CHAR * | aData
| ) | `[static]`

Matches wildcards (? and * supported), ignore case -version.

See also:
  matchWildcard

XFCIMPORT FLOAT32 XFcStringToolkit::toFLOAT32 | ( | const CHAR * | aString,
|  | INT * | aSuccess = NULL
| ) | `[static]`

Converts string to a float.

String to be converted must contain a string representation of numerical value in range of FLOAT32. The string can contain only characters '0' to '9' with optionally '-' or '+' sign on the front, '.' as decimal separator and the exponent symbol 'e' or 'E' possibly suffixed with the '+' or '-' sign.

Note:
  Result is zero if the argument string is not valid. Also aSuccess is zero.

Parameters:

  aString | string to return as a number
  aSuccess | a pointer to an INT that indicates if the parsing was successfull.

Returns:
  0 if aString is NULL.

  numerical value the aString represents.

XFCIMPORT INT32 XFcStringToolkit::toINT32 | ( | const CHAR * | aString,
|  | INT * | aSuccess = NULL
| ) | `[static]`

Converts string to an integer.

String to be converted must contain a string representation of numerical value in range of INT32. String format may be in decimal, octal, binary or hexadecimal. There may be an optional '-' or '+' sign prefix. Values that have prefix 0o are considered octal, and values prefixed by 0x or # are considered hexadecimal, and values prefixed by 0b are considered binary.

Note:
  Result is zero if the argument string is not valid. Also aSuccess is zero.

Parameters:

  aString | string to return as a number
  aSuccess | a pointer to an INT that indicates if the parsing was successfull.

Returns:
  0 if aString is NULL.

  numerical value the aString represents.

XFCIMPORT void XFcStringToolkit::toLowerCase | ( | CHAR * | aString | ) | `[static]`

Converts a string to lower case.

Character conversion supports only characters from A to Z. All other characters are to be considered as non-convertable.

Parameters:

  aString | string to be converted.

XFCIMPORT void XFcStringToolkit::toUpperCase | ( | CHAR * | aString | ) | `[static]`

Converts a string to upper case.

Character conversion supports only characters from A to Z. All other characters are to be considered as non-convertable.

Parameters:

  aString | string to be converted.

XFCIMPORT CHAR* XFcStringToolkit::unescape | ( | const CHAR * | aStr | ) | `[static]`

Converts escaped character string to literal one.

Note:
  The newly allocated buffer must be cleaned up by the application by using the delete[] operator.

|  | X-Forge Documentation Confidential Copyright © 2002-2003 Fathammer |  | Documentation generated with doxygen by Dimitri van Heesch