class XMLString

Class for representing native character strings and handling common string operations This class is Unicode compliant

Inheritance:


Public

private Constructors and Destructor
XMLString ()
Unimplemented default constructor
~XMLString ()
Unimplemented destructor
Conversion functions
static void binToText ( const unsigned int toFormat, char* const toFill, const unsigned int maxChars, const unsigned int radix )
Converts binary data to a text string based a given radix
static void binToText ( const unsigned int toFormat, XMLCh* const toFill, const unsigned int maxChars, const unsigned int radix )
Converts binary data to a text string based a given radix
static void binToText ( const unsigned long toFormat, char* const toFill, const unsigned int maxChars, const unsigned int radix )
Converts binary data to a text string based a given radix
static void binToText ( const unsigned long toFormat, XMLCh* const toFill, const unsigned int maxChars, const unsigned int radix )
Converts binary data to a text string based a given radix
static void binToText ( const long toFormat, char* const toFill, const unsigned int maxChars, const unsigned int radix )
Converts binary data to a text string based a given radix
static void binToText ( const long toFormat, XMLCh* const toFill, const unsigned int maxChars, const unsigned int radix )
Converts binary data to a text string based a given radix
static void binToText ( const int toFormat, char* const toFill, const unsigned int maxChars, const unsigned int radix )
Converts binary data to a text string based a given radix
static void binToText ( const int toFormat, XMLCh* const toFill, const unsigned int maxChars, const unsigned int radix )
Converts binary data to a text string based a given radix
Conversion functions
static char* transcode ( const XMLCh* const toTranscode )
Transcodes a string to native code-page
static bool transcode ( const XMLCh* const toTranscode, char* const toFill, const unsigned int maxChars )
Transcodes a string to native code-page
static XMLCh* transcode ( const char* const toTranscode )
Transcodes a string to native code-page
static bool transcode ( const char* const toTranscode, XMLCh* const toFill, const unsigned int maxChars )
Transcodes a string to native code-page
static void trim (char* const toTrim)
Trims off extra space characters from the end of the string
static void trim (XMLCh* const toTrim)
Trims off extra space characters from the end of the string
Formatting functions
static XMLCh* makeUName ( const XMLCh* const pszURI, const XMLCh* const pszName )
Creates a UName from a URI and base name
static unsigned int replaceTokens ( XMLCh* const errText, const unsigned int maxChars, const XMLCh* const text1, const XMLCh* const text2, const XMLCh* const text3, const XMLCh* const text4 )
Internal function to perform token replacement for strings
static void upperCase (XMLCh* const toUpperCase)
Converts a string to uppercase
Hash functions
static unsigned int hash ( const char* const tohash, const unsigned int hashModulus )
Hashes a string given a modulus
static unsigned int hash ( const XMLCh* const toHash, const unsigned int hashModulus )
Hashes a string given a modulus
static unsigned int hashN ( const XMLCh* const toHash, const unsigned int numChars, const unsigned int hashModulus )
Hashes a string given a modulus taking a maximum number of characters as the limit
Initialization
static void initString (XMLLCPTranscoder* const defToUse)
Intialization function called from XMLPlatformUtils class
Replication function
static char* replicate (const char* const toRep)
Replicates a string
static XMLCh* replicate (const XMLCh* const toRep)
Replicates a string
Search functions
static int indexOf (const char* const toSearch, const char ch)
Provides the index of the first occurance of a character within a string
static int indexOf (const XMLCh* const toSearch, const XMLCh ch)
Provides the index of the first occurance of a character within a string
static int lastIndexOf (const char* const toSearch, const char ch)
Provides the index of the last occurance of a character within a string
static int lastIndexOf (const XMLCh* const toSearch, const XMLCh ch)
Provides the index of the last occurance of a character within a string
static int lastIndexOf ( const char* const toSearch, const char chToFind, const unsigned int fromIndex )
Provides the index of the last occurance of a character within a string starting backward from a given index
static int lastIndexOf ( const XMLCh* const toSearch, const XMLCh ch, const unsigned int fromIndex )
Provides the index of the last occurance of a character within a string starting backward from a given index
String comparison functions
static int compareIString ( const char* const str1, const char* const str2 )
Lexicographically compares lowercase versions of str1 and str2 and returns a value indicating their relationship
static int compareIString ( const XMLCh* const str1, const XMLCh* const str2 )
Lexicographically compares lowercase versions of str1 and str2 and returns a value indicating their relationship
static int compareNString ( const char* const str1, const char* const str2, const unsigned int count )
Lexicographically compares, at most, the first count characters in str1 and str2 and returns a value indicating the relationship between the substrings
static int compareNString ( const XMLCh* const str1, const XMLCh* const str2, const unsigned int count )
Lexicographically compares, at most, the first count characters in str1 and str2 and returns a value indicating the relationship between the substrings
static int compareNIString ( const char* const str1, const char* const str2, const unsigned int count )
Lexicographically compares, at most, the first count characters in str1 and str2 without regard to case and returns a value indicating the relationship between the substrings
static int compareNIString ( const XMLCh* const str1, const XMLCh* const str2, const unsigned int count )
Lexicographically compares, at most, the first count characters in str1 and str2 without regard to case and returns a value indicating the relationship between the substrings
static int compareString ( const char* const str1, const char* const str2 )
Lexicographically compares str1 and str2 and returns a value indicating their relationship
static int compareString ( const XMLCh* const str1, const XMLCh* const str2 )
Lexicographically compares str1 and str2 and returns a value indicating their relationship
String concatenation functions
static void catString ( char* const target, const char* const src )
Concatenates two strings
static void catString ( XMLCh* const target, const XMLCh* const src )
Concatenates two strings
String copy functions
static void copyString ( char* const target, const char* const src )
Copies src, including the terminating null character, to the location specified by target
static void copyString ( XMLCh* const target, const XMLCh* const src )
Copies src, including the terminating null character, to the location specified by target
static bool copyNString ( XMLCh* const target, const XMLCh* const src, const unsigned int maxChars )
Copies src, upto a fixed number of characters, to the location specified by target
String query function
static bool startsWith ( const char* const toTest, const char* const prefix )
Tells if the sub-string appears within a string at the beginning
static bool startsWith ( const XMLCh* const toTest, const XMLCh* const prefix )
Tells if the sub-string appears within a string at the beginning
static bool startsWithI ( const char* const toTest, const char* const prefix )
Tells if the sub-string appears within a string at the beginning without regard to case
static bool startsWithI ( const XMLCh* const toTest, const XMLCh* const prefix )
Tells if the sub-string appears within a string at the beginning without regard to case
static const XMLCh* findAny ( const XMLCh* const toSearch, const XMLCh* const searchList )
Tells if a string has any occurance of another string within itself
static XMLCh* findAny ( XMLCh* const toSearch, const XMLCh* const searchList )
Tells if a string has any occurance of another string within itself
static unsigned int stringLen (const char* const src)
Get the length of the string
static unsigned int stringLen (const XMLCh* const src)
Get the length of the string

Documentation

Class for representing native character strings and handling common string operations This class is Unicode compliant. This class is designed primarily for internal use, but due to popular demand, it is being made publicly available. Users of this class must understand that this is not an officially supported class. All public methods of this class are static functions.
Conversion functions

static void binToText( const unsigned int toFormat, char* const toFill, const unsigned int maxChars, const unsigned int radix )
Converts binary data to a text string based a given radix
Parameters:
toFormat - The beginning of the input string to convert
toFill - The buffer that will hold the output on return
maxChars - The maximum number of charcters to convert
radix - The radix of the input data, based on which the conversion will be done

static void binToText( const unsigned int toFormat, XMLCh* const toFill, const unsigned int maxChars, const unsigned int radix )
Converts binary data to a text string based a given radix
Parameters:
toFormat - The beginning of the input string to convert
toFill - The buffer that will hold the output on return
maxChars - The maximum number of charcters to convert
radix - The radix of the input data, based on which the conversion will be done

static void binToText( const unsigned long toFormat, char* const toFill, const unsigned int maxChars, const unsigned int radix )
Converts binary data to a text string based a given radix
Parameters:
toFormat - The beginning of the input string to convert
toFill - The buffer that will hold the output on return
maxChars - The maximum number of charcters to convert
radix - The radix of the input data, based on which the conversion will be done

static void binToText( const unsigned long toFormat, XMLCh* const toFill, const unsigned int maxChars, const unsigned int radix )
Converts binary data to a text string based a given radix
Parameters:
toFormat - The beginning of the input string to convert
toFill - The buffer that will hold the output on return
maxChars - The maximum number of charcters to convert
radix - The radix of the input data, based on which the conversion will be done

static void binToText( const long toFormat, char* const toFill, const unsigned int maxChars, const unsigned int radix )
Converts binary data to a text string based a given radix
Parameters:
toFormat - The beginning of the input string to convert
toFill - The buffer that will hold the output on return
maxChars - The maximum number of charcters to convert
radix - The radix of the input data, based on which the conversion will be done

static void binToText( const long toFormat, XMLCh* const toFill, const unsigned int maxChars, const unsigned int radix )
Converts binary data to a text string based a given radix
Parameters:
toFormat - The beginning of the input string to convert
toFill - The buffer that will hold the output on return
maxChars - The maximum number of charcters to convert
radix - The radix of the input data, based on which the conversion will be done

static void binToText( const int toFormat, char* const toFill, const unsigned int maxChars, const unsigned int radix )
Converts binary data to a text string based a given radix
Parameters:
toFormat - The beginning of the input string to convert
toFill - The buffer that will hold the output on return
maxChars - The maximum number of charcters to convert
radix - The radix of the input data, based on which the conversion will be done

static void binToText( const int toFormat, XMLCh* const toFill, const unsigned int maxChars, const unsigned int radix )
Converts binary data to a text string based a given radix
Parameters:
toFormat - The beginning of the input string to convert
toFill - The buffer that will hold the output on return
maxChars - The maximum number of charcters to convert
radix - The radix of the input data, based on which the conversion will be done

String concatenation functions

static void catString( char* const target, const char* const src )
Concatenates two strings. catString appends src to target and terminates the resulting string with a null character. The initial character of src overwrites the terminating character of target . No overflow checking is performed when strings are copied or appended. The behavior of catString is undefined if source and destination strings overlap.
Parameters:
target - Null-terminated destination string
src - Null-terminated source string

static void catString( XMLCh* const target, const XMLCh* const src )
Concatenates two strings. catString appends src to target and terminates the resulting string with a null character. The initial character of src overwrites the terminating character of target. No overflow checking is performed when strings are copied or appended. The behavior of catString is undefined if source and destination strings overlap.
Parameters:
target - Null-terminated destination string
src - Null-terminated source string

String comparison functions

static int compareIString( const char* const str1, const char* const str2 )
Lexicographically compares lowercase versions of str1 and str2 and returns a value indicating their relationship
Returns:
The return value indicates the relation of str1 to str2 as follows Less than 0 means str1 is less than str2 Equal to 0 means str1 is identical to str2 Greater than 0 means str1 is more than str2
Parameters:
str1 - Null-terminated string to compare
str2 - Null-terminated string to compare

static int compareIString( const XMLCh* const str1, const XMLCh* const str2 )
Lexicographically compares lowercase versions of str1 and str2 and returns a value indicating their relationship
Returns:
The return value indicates the relation of str1 to str2 as follows Less than 0 means str1 is less than str2 Equal to 0 means str1 is identical to str2 Greater than 0 means str1 is more than str2
Parameters:
str1 - Null-terminated string to compare
str2 - Null-terminated string to compare

static int compareNString( const char* const str1, const char* const str2, const unsigned int count )
Lexicographically compares, at most, the first count characters in str1 and str2 and returns a value indicating the relationship between the substrings
Returns:
The return value indicates the relation of str1 to str2 as follows Less than 0 means str1 is less than str2 Equal to 0 means str1 is identical to str2 Greater than 0 means str1 is more than str2
Parameters:
str1 - Null-terminated string to compare
str2 - Null-terminated string to compare
count - The number of characters to compare

static int compareNString( const XMLCh* const str1, const XMLCh* const str2, const unsigned int count )
Lexicographically compares, at most, the first count characters in str1 and str2 and returns a value indicating the relationship between the substrings
Returns:
The return value indicates the relation of str1 to str2 as follows Less than 0 means str1 is less than str2 Equal to 0 means str1 is identical to str2 Greater than 0 means str1 is more than str2
Parameters:
str1 - Null-terminated string to compare
str2 - Null-terminated string to compare
count - The number of characters to compare

static int compareNIString( const char* const str1, const char* const str2, const unsigned int count )
Lexicographically compares, at most, the first count characters in str1 and str2 without regard to case and returns a value indicating the relationship between the substrings.
Returns:
The return value indicates the relation of str1 to str2 as follows Less than 0 means str1 is less than str2 Equal to 0 means str1 is identical to str2 Greater than 0 means str1 is more than str2
Parameters:
str1 - Null-terminated string to compare
str2 - Null-terminated string to compare
count - The number of characters to compare

static int compareNIString( const XMLCh* const str1, const XMLCh* const str2, const unsigned int count )
Lexicographically compares, at most, the first count characters in str1 and str2 without regard to case and returns a value indicating the relationship between the substrings.
Returns:
The return value indicates the relation of str1 to str2 as follows Less than 0 means str1 is less than str2 Equal to 0 means str1 is identical to str2 Greater than 0 means str1 is more than str2
Parameters:
str1 - Null-terminated string to compare
str2 - Null-terminated string to compare
count - The number of characters to compare

static int compareString( const char* const str1, const char* const str2 )
Lexicographically compares str1 and str2 and returns a value indicating their relationship.
Returns:
The return value indicates the relation of str1 to str2 as follows Less than 0 means str1 is less than str2 Equal to 0 means str1 is identical to str2 Greater than 0 means str1 is more than str2
Parameters:
str1 - Null-terminated string to compare
str2 - Null-terminated string to compare

static int compareString( const XMLCh* const str1, const XMLCh* const str2 )
Lexicographically compares str1 and str2 and returns a value indicating their relationship.
Returns:
The return value indicates the relation of str1 to str2 as follows Less than 0 means str1 is less than str2 Equal to 0 means str1 is identical to str2 Greater than 0 means str1 is more than str2
Parameters:
str1 - Null-terminated string to compare
str2 - Null-terminated string to compare

String copy functions

static void copyString( char* const target, const char* const src )
Copies src, including the terminating null character, to the location specified by target. No overflow checking is performed when strings are copied or appended. The behavior of strcpy is undefined if the source and destination strings overlap.
Parameters:
target - Destination string
src - Null-terminated source string

static void copyString( XMLCh* const target, const XMLCh* const src )
Copies src, including the terminating null character, to the location specified by target. No overflow checking is performed when strings are copied or appended. The behavior of copyString is undefined if the source and destination strings overlap.
Parameters:
target - Destination string
src - Null-terminated source string

static bool copyNString( XMLCh* const target, const XMLCh* const src, const unsigned int maxChars )
Copies src, upto a fixed number of characters, to the location specified by target. No overflow checking is performed when strings are copied or appended. The behavior of copyNString is undefined if the source and destination strings overlap.
Parameters:
target - Destination string
src - Null-terminated source string
maxChars - The maximum number of characters to copy

Hash functions

static unsigned int hash( const char* const tohash, const unsigned int hashModulus )
Hashes a string given a modulus
Returns:
Returns the hash value
Parameters:
toHash - The string to hash
hashModulus - The divisor to be used for hashing

static unsigned int hash( const XMLCh* const toHash, const unsigned int hashModulus )
Hashes a string given a modulus
Returns:
Returns the hash value
Parameters:
toHash - The string to hash
hashModulus - The divisor to be used for hashing

static unsigned int hashN( const XMLCh* const toHash, const unsigned int numChars, const unsigned int hashModulus )
Hashes a string given a modulus taking a maximum number of characters as the limit
Returns:
Returns the hash value
Parameters:
toHash - The string to hash
numChars - The maximum number of characters to consider for hashing
hashModulus - The divisor to be used for hashing

Search functions

static int indexOf(const char* const toSearch, const char ch)
Provides the index of the first occurance of a character within a string
Returns:
If found, returns the index of the character within the string, else returns -1.
Parameters:
toSearch - The string to search
ch - The character to search within the string

static int indexOf(const XMLCh* const toSearch, const XMLCh ch)
Provides the index of the first occurance of a character within a string
Returns:
If found, returns the index of the character within the string, else returns -1.
Parameters:
toSearch - The string to search
ch - The character to search within the string

static int lastIndexOf(const char* const toSearch, const char ch)
Provides the index of the last occurance of a character within a string
Returns:
If found, returns the index of the character within the string, else returns -1.
Parameters:
toSearch - The string to search
ch - The character to search within the string

static int lastIndexOf(const XMLCh* const toSearch, const XMLCh ch)
Provides the index of the last occurance of a character within a string
Returns:
If found, returns the index of the character within the string, else returns -1.
Parameters:
toSearch - The string to search
ch - The character to search within the string

static int lastIndexOf( const char* const toSearch, const char chToFind, const unsigned int fromIndex )
Provides the index of the last occurance of a character within a string starting backward from a given index
Returns:
If found, returns the index of the character within the string, else returns -1.
Parameters:
toSearch - The string to search
chToFInd - The character to search within the string
fromIndex - The index to start backward search from

static int lastIndexOf( const XMLCh* const toSearch, const XMLCh ch, const unsigned int fromIndex )
Provides the index of the last occurance of a character within a string starting backward from a given index
Returns:
If found, returns the index of the character within the string, else returns -1.
Parameters:
toSearch - The string to search
chToFInd - The character to search within the string
fromIndex - The index to start backward search from

Replication function

static char* replicate(const char* const toRep)
Replicates a string
Returns:
Returns a pointer to the replicated string
Parameters:
toRep - The string to replicate

static XMLCh* replicate(const XMLCh* const toRep)
Replicates a string
Returns:
Returns a pointer to the replicated string
Parameters:
toRep - The string to replicate

String query function

static bool startsWith( const char* const toTest, const char* const prefix )
Tells if the sub-string appears within a string at the beginning
Returns:
Returns true if the sub-string was found at the beginning of toTest, else false
Parameters:
toTest - The string to test
prefix - The sub-string that needs to be checked

static bool startsWith( const XMLCh* const toTest, const XMLCh* const prefix )
Tells if the sub-string appears within a string at the beginning
Returns:
Returns true if the sub-string was found at the beginning of toTest, else false
Parameters:
toTest - The string to test
prefix - The sub-string that needs to be checked

static bool startsWithI( const char* const toTest, const char* const prefix )
Tells if the sub-string appears within a string at the beginning without regard to case
Returns:
Returns true if the sub-string was found at the beginning of toTest, else false
Parameters:
toTest - The string to test
prefix - The sub-string that needs to be checked

static bool startsWithI( const XMLCh* const toTest, const XMLCh* const prefix )
Tells if the sub-string appears within a string at the beginning without regard to case
Returns:
Returns true if the sub-string was found at the beginning of toTest, else false
Parameters:
toTest - The string to test
prefix - The sub-string that needs to be checked

static const XMLCh* findAny( const XMLCh* const toSearch, const XMLCh* const searchList )
Tells if a string has any occurance of another string within itself
Returns:
Returns the pointer to the location where the sub-string was found, else returns 0
Parameters:
toSearch - The string to be searched
searchList - The sub-string to be searched within the string

static XMLCh* findAny( XMLCh* const toSearch, const XMLCh* const searchList )
Tells if a string has any occurance of another string within itself
Returns:
Returns the pointer to the location where the sub-string was found, else returns 0
Parameters:
toSearch - The string to be searched
searchList - The sub-string to be searched within the string

static unsigned int stringLen(const char* const src)
Get the length of the string
Returns:
Returns the length of the string
Parameters:
src - The string whose length is to be determined

static unsigned int stringLen(const XMLCh* const src)
Get the length of the string
Returns:
Returns the length of the string
Parameters:
src - The string whose length is to be determined

Conversion functions

static char* transcode( const XMLCh* const toTranscode )
Transcodes a string to native code-page
Returns:
Returns the transcoded string
Parameters:
toTranscode - The string to be transcoded

static bool transcode( const XMLCh* const toTranscode, char* const toFill, const unsigned int maxChars )
Transcodes a string to native code-page
Returns:
Returns true if successful, false if there was an error
Parameters:
toTranscode - The string tobe transcoded
toFill - The buffer that is filled with the transcoded value
maxChars - The maximum number of characters to transcode

static XMLCh* transcode( const char* const toTranscode )
Transcodes a string to native code-page
Returns:
Returns the transcoded string
Parameters:
toTranscode - The string to be transcoded

static bool transcode( const char* const toTranscode, XMLCh* const toFill, const unsigned int maxChars )
Transcodes a string to native code-page
Returns:
Returns true if successful, false if there was an error
Parameters:
toTranscode - The string tobe transcoded
toFill - The buffer that is filled with the transcoded value
maxChars - The maximum number of characters to transcode

static void trim(char* const toTrim)
Trims off extra space characters from the end of the string
Parameters:
toTrim - The string to be trimmed. On return this contains the trimmed string

static void trim(XMLCh* const toTrim)
Trims off extra space characters from the end of the string
Parameters:
toTrim - The string to be trimmed. On return this contains the trimmed string

Formatting functions

static XMLCh* makeUName( const XMLCh* const pszURI, const XMLCh* const pszName )
Creates a UName from a URI and base name. It is in the form {url}name, and is commonly used internally to represent fully qualified names when namespaces are enabled.
Returns:
Returns the complete formatted UName
Parameters:
pszURI - The URI part of the name
pszName - The base part of the name

static unsigned int replaceTokens( XMLCh* const errText, const unsigned int maxChars, const XMLCh* const text1, const XMLCh* const text2, const XMLCh* const text3, const XMLCh* const text4 )
Internal function to perform token replacement for strings.
Returns:
Returns the count of characters that are outputted
Parameters:
errText - The text where the replacement is to be done
maxChars - The maximum number of characters to consider for replacement
text1 - Replacement text-one
text2 - Replacement text-two
text3 - Replacement text-three
text4 - Replacement text-four

static void upperCase(XMLCh* const toUpperCase)
Converts a string to uppercase
Parameters:
toUpperCase - The string which needs to be converted to uppercase. On return, this buffer also holds the converted uppercase string

private Constructors and Destructor

XMLString()
Unimplemented default constructor

~XMLString()
Unimplemented destructor

Initialization

static void initString(XMLLCPTranscoder* const defToUse)
Intialization function called from XMLPlatformUtils class


This class has no child classes.

alphabetic index hierarchy of classes


Xerces-C XML Parser for C++ Version 1.1
Copyright © 2000 The Apache Software Foundation. All Rights Reserved.

generated by doc++