22#if !defined(XERCESC_INCLUDE_GUARD_XMLSTRING_HPP) 
   23#define XERCESC_INCLUDE_GUARD_XMLSTRING_HPP 
   25#include <xercesc/util/BaseRefVectorOf.hpp> 
   26#include <xercesc/framework/XMLBuffer.hpp> 
   70        , 
const char* 
const     src
 
   88        , 
const XMLCh* 
const    src
 
  107        const   char* 
const     str1
 
  108        , 
const char* 
const     str2
 
  123        const   XMLCh* 
const    str1
 
  124        , 
const XMLCh* 
const    str2
 
  140        const   XMLCh* 
const    str1
 
  141        , 
const XMLCh* 
const    str2
 
  161        const   char* 
const     str1
 
  162        , 
const char* 
const     str2
 
  181        const   XMLCh* 
const    str1
 
  182        , 
const XMLCh* 
const    str2
 
  202        const   char* 
const     str1
 
  203        , 
const char* 
const     str2
 
  223        const   XMLCh* 
const    str1
 
  224        , 
const XMLCh* 
const    str2
 
  242        const   char* 
const     str1
 
  243        , 
const char* 
const     str2
 
  259        const   XMLCh* 
const    str1
 
  260        , 
const XMLCh* 
const    str2
 
  343        const   XMLCh* 
const    str1
 
  345        , 
const XMLCh* 
const    str2
 
  379        const   XMLCh* 
const    str1
 
  381        , 
const XMLCh* 
const    str2
 
  402        , 
const char* 
const     src
 
  418        , 
const XMLCh* 
const    src
 
  436        , 
const XMLCh* 
const   src
 
  451        const   char* 
const     toHash
 
  463        const   XMLCh* 
const    toHash
 
  477        const   XMLCh* 
const    toHash
 
  494    static int indexOf(
const char* 
const toSearch, 
const char ch);
 
  519        const   char* 
const     toSearch
 
  520        , 
const char            chToFind
 
  538        const   XMLCh* 
const    toSearch
 
  539        , 
const XMLCh           chToFind
 
  552    static int lastIndexOf(
const char* 
const toSearch, 
const char ch);
 
  562    static int lastIndexOf(
const XMLCh* 
const toSearch, 
const XMLCh ch);
 
  576        , 
const XMLCh* 
const toSearch
 
  593        const   char* 
const     toSearch
 
  594        , 
const char            chToFind
 
  612        const   XMLCh* 
const    toSearch
 
  626    static void moveChars
 
  628                XMLCh* 
const    targetStr
 
  629        , 
const XMLCh* 
const    srcStr
 
  648                char* 
const    targetStr
 
  649        , 
const char* 
const    srcStr
 
  666                XMLCh* 
const    targetStr
 
  667        , 
const XMLCh* 
const    srcStr
 
  685                XMLCh* 
const    targetStr
 
  686        , 
const XMLCh* 
const    srcStr
 
  720    static XMLCh* replicate(
const XMLCh* 
const toRep,
 
  735        const   char* 
const     toTest
 
  736        , 
const char* 
const     prefix
 
  745    static bool startsWith
 
  747        const   XMLCh* 
const    toTest
 
  748        , 
const XMLCh* 
const    prefix
 
  761        const   char* 
const     toTest
 
  762        , 
const char* 
const     prefix
 
  774    static bool startsWithI
 
  776        const   XMLCh* 
const    toTest
 
  777        , 
const XMLCh* 
const    prefix
 
  788        const   XMLCh* 
const    toTest
 
  789        , 
const XMLCh* 
const    suffix
 
  803        const   XMLCh* 
const    toSearch
 
  804        , 
const XMLCh* 
const    searchList
 
  817                XMLCh* 
const    toSearch
 
  818        , 
const XMLCh* 
const    searchList
 
  829          const XMLCh* 
const    toSearch
 
  830        , 
const XMLCh* 
const    pattern
 
  919        , 
const unsigned int        radix
 
  937        ,       
XMLCh* 
const        toFill
 
  939        , 
const unsigned int        radix
 
  956        const   unsigned int    toFormat
 
  959        , 
const unsigned int    radix
 
  976        const   unsigned int    toFormat
 
  977        ,       
XMLCh* 
const    toFill
 
  979        , 
const unsigned int    radix
 
  996        const   unsigned long   toFormat
 
  999        , 
const unsigned int    radix
 
 1016        const   unsigned long   toFormat
 
 1017        ,       
XMLCh* 
const    toFill
 
 1019        , 
const unsigned int    radix
 
 1037        ,       
char* 
const     toFill
 
 1039        , 
const unsigned int    radix
 
 1057        ,       
XMLCh* 
const    toFill
 
 1059        , 
const unsigned int    radix
 
 1077        ,       
char* 
const     toFill
 
 1079        , 
const unsigned int    radix
 
 1097        ,       
XMLCh* 
const    toFill
 
 1099        , 
const unsigned int    radix
 
 1116        const   XMLCh* 
const    toConvert
 
 1117        ,       
unsigned int&   toFill
 
 1136        const   XMLCh* 
const    toConvert
 
 1147                XMLCh* 
const    toCutFrom
 
 1164        const   XMLCh* 
const         toTranscode
 
 1185        const   XMLCh* 
const    toTranscode
 
 1186        ,       
char* 
const     toFill
 
 1204        const   char* 
const          toTranscode
 
 1220        const   char* 
const     toTranscode
 
 1221        ,       
XMLCh* 
const    toFill
 
 1231    static void trim(
char* 
const toTrim);
 
 1275        const   XMLCh* 
const    pszURI
 
 1276        , 
const XMLCh* 
const    pszName
 
 1297                XMLCh* 
const    errText
 
 1299        , 
const XMLCh* 
const    text1
 
 1300        , 
const XMLCh* 
const    text2
 
 1301        , 
const XMLCh* 
const    text3
 
 1302        , 
const XMLCh* 
const    text4
 
 1373                         , 
const XMLCh&           toRemove
 
 1374                         ,       XMLBuffer&       dstBuffer);
 
 1432    static void termString();
 
 1439    static bool validateRegion(
const XMLCh* 
const str1, 
const int offset1,
 
 1440                        const XMLCh* 
const str2, 
const int offset2,
 
 
 1454                                , 
const XMLCh* 
const srcStr
 
 1457    memmove(targetStr, srcStr, count * 
sizeof(
XMLCh));
 
 
 1465    const XMLCh* pszTmp = src;
 
 1469    return (pszTmp - src - 1);
 
 
 1481        memcpy(ret, toRep, (len + 1) * 
sizeof(
XMLCh));
 
 
 1487                                    , 
const XMLCh* 
const    prefix)
 
 
 1493                                    , 
const XMLCh* 
const    prefix)
 
 
 1499                                const XMLCh* 
const suffix)
 
 1505                         suffix, 0, suffixLen);
 
 
 1508inline bool XMLString::validateRegion(
const XMLCh* 
const str1,
 
 1510                                      const XMLCh* 
const str2,
 
 1515    if (offset1 < 0 || offset2 < 0 ||
 
 1524                               , 
const XMLCh* str2)
 
 1529    if (str1 == 0 || str2 == 0)
 
 1530        return ((!str1 || !*str1) && (!str2 || !*str2));
 
 1533        if(*str1++ != *str2++)  
 
 
 1544    if (str1 == str2 || n == 0)
 
 1547    if (str1 == 0 || str2 == 0)
 
 1548        return ((!str1 || !*str1) && (!str2 || !*str2));
 
 1550    for (; n != 0 && *str1 && *str2; --n, ++str1, ++str2)
 
 1554    return n == 0 || *str1 == *str2; 
 
 
 1563    if (str1 == 0 || str2 == 0)
 
 1564        return ((!str1 || !*str1) && (!str2 || !*str2));
 
 1567        if(*str1++ != *str2++)  
 
 
 1578    if (str1 == str2 || n == 0)
 
 1581    if (str1 == 0 || str2 == 0)
 
 1582        return ((!str1 || !*str1) && (!str2 || !*str2));
 
 1584    for (; n != 0 && *str1 && *str2; --n, ++str1, ++str2)
 
 1588    return n == 0 || *str1 == *str2; 
 
 
 1599    if (tohash == 0 || *tohash == 0)
 
 1602    const XMLCh* curCh = tohash;
 
 1606        hashVal = (hashVal * 38) + (hashVal >> 24) + (
XMLSize_t)(*curCh++);
 
 1609    return hashVal % hashModulus;
 
 
 1616  if (tohash == 0 || n == 0)
 
 1619  const XMLCh* curCh = tohash;
 
 1623    hashVal = (hashVal * 38) + (hashVal >> 24) + (
XMLSize_t)(*curCh++);
 
 1626  return hashVal % hashModulus;
 
 
#define XERCES_CPP_NAMESPACE_BEGIN
Definition XercesDefs.hpp:112
#define XMLUTIL_EXPORT
Definition XercesDefs.hpp:162
#define XERCES_CPP_NAMESPACE_END
Definition XercesDefs.hpp:113
size_t XMLSize_t
Definition Xerces_autoconf_config.hpp:112
char16_t XMLCh
Definition Xerces_autoconf_config.hpp:120
Configurable memory manager.
Definition MemoryManager.hpp:40
virtual void * allocate(XMLSize_t size)=0
This method allocates requested memory.
Definition TransService.hpp:389
Class for representing native character strings and handling common string operations.
Definition XMLString.hpp:46
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 r...
static XMLSize_t hash(const char *const toHash, const XMLSize_t hashModulus)
Hashes a string given a modulus.
static BaseRefVectorOf< XMLCh > * tokenizeString(const XMLCh *const tokenizeSrc, XMLCh delimiter, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
Break a string into tokens with the given character as delimiter, and stored in a string vector.
static void cut(XMLCh *const toCutFrom, const XMLSize_t count)
Cut leading chars from a string.
static XMLSize_t stringLen(const char *const src)
Get the length of the string.
static bool regionMatches(const XMLCh *const str1, const int offset1, const XMLCh *const str2, const int offset2, const XMLSize_t charCount)
Lexicographically compares str1 and str2 regions and returns true if they are equal,...
static void copyString(XMLCh *const target, const XMLCh *const src)
Copies src, including the terminating null character, to the location specified by target.
static int lastIndexOf(const char *const toSearch, const char chToFind, const XMLSize_t fromIndex, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
Provides the index of the last occurrence of a character within a string starting backward from a giv...
static void removeChar(const XMLCh *const srcString, const XMLCh &toRemove, XMLBuffer &dstBuffer)
Remove character.
static bool startsWith(const char *const toTest, const char *const prefix)
Tells if the sub-string appears within a string at the beginning.
static int indexOf(const XMLCh *const toSearch, const XMLCh ch)
Provides the index of the first occurrence of a character within a string.
static void binToText(const long toFormat, char *const toFill, const XMLSize_t maxChars, const unsigned int radix, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
Converts binary data to a text string based a given radix.
static void subString(XMLCh *const targetStr, const XMLCh *const srcStr, const XMLSize_t startIndex, const XMLSize_t endIndex, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
Create a substring of a given string.
static void trim(XMLCh *const toTrim)
Trims off extra space characters from the start and end of the string, moving the non-space string co...
static void fixURI(const XMLCh *const str, XMLCh *const target)
Fixes a platform dependent absolute path filename to standard URI form.
static void moveChars(XMLCh *const targetStr, const XMLCh *const srcStr, const XMLSize_t count)
Moves X number of chars.
Definition XMLString.hpp:1453
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 int compareString(const XMLCh *const str1, const XMLCh *const str2)
Lexicographically compares str1 and str2 and returns a value indicating their relationship.
static int lastIndexOf(const char *const toSearch, const char ch)
Provides the index of the last occurrence of a character within a string.
static int indexOf(const XMLCh *const toSearch, const XMLCh chToFind, const XMLSize_t fromIndex, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
Provides the index of the first occurrence of a character within a string starting from a given index...
static BaseRefVectorOf< XMLCh > * tokenizeString(const XMLCh *const tokenizeSrc, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
Break a string into tokens with space as delimiter, and stored in a string vector.
static char * replicate(const char *const toRep, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
Replicates a string NOTE: The returned buffer is allocated with the MemoryManager.
static bool transcode(const char *const toTranscode, XMLCh *const toFill, const XMLSize_t maxChars, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
Transcodes a string to native code-page (DEPRECATED)
static bool copyNString(XMLCh *const target, const XMLCh *const src, const XMLSize_t maxChars)
Copies src, upto a fixed number of characters, to the location specified by target.
static bool isHex(XMLCh const theChar)
Checks whether a character is within [0-9a-fA-F].
static int compareNIString(const XMLCh *const str1, const XMLCh *const str2, const XMLSize_t count)
Lexicographically compares, at most, the first count characters in str1 and str2 without regard to ca...
static void upperCase(XMLCh *const toUpperCase)
Converts a string to uppercase.
static char * transcode(const XMLCh *const toTranscode, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
Transcodes a string to native code-page.
static const XMLCh * findAny(const XMLCh *const toSearch, const XMLCh *const searchList)
Tells if a string has any occurrence of any character of another string within itself.
static void binToText(const unsigned long toFormat, char *const toFill, const XMLSize_t maxChars, const unsigned int radix, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
Converts binary data to a text string based a given radix.
static bool isDigit(XMLCh const theChar)
Checks whether a character is within [0-9].
static XMLCh * transcode(const char *const toTranscode, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
Transcodes a string to native code-page.
static XMLCh * makeUName(const XMLCh *const pszURI, const XMLCh *const pszName)
Creates a UName from a URI and base name.
static void catString(char *const target, const char *const src)
Concatenates two strings.
static void trim(char *const toTrim)
Trims off extra space characters from the start and end of the string, moving the non-space string co...
static XMLSize_t hashN(const XMLCh *const toHash, const XMLSize_t numChars, const XMLSize_t hashModulus)
Hashes a string given a modulus taking a maximum number of characters as the limit.
Definition XMLString.hpp:1612
static bool equals(const XMLCh *str1, const XMLCh *str2)
compares str1 and str2
Definition XMLString.hpp:1523
static bool equalsN(const XMLCh *str1, const XMLCh *str2, XMLSize_t n)
compares str1 and str2
Definition XMLString.hpp:1540
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 sizeToText(const XMLSize_t toFormat, char *const toFill, const XMLSize_t maxChars, const unsigned int radix, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
Converts size to a text string based a given radix.
static void binToText(const unsigned long toFormat, XMLCh *const toFill, const XMLSize_t maxChars, const unsigned int radix, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
Converts binary data to a text string based a given radix.
static int compareString(const char *const str1, const char *const str2)
Lexicographically compares str1 and str2 and returns a value indicating their relationship.
static void release(XMLCh **buf, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
Release the parameter string that was allocated by XMLString::transcode and XMLString::replicate.
static bool transcode(const XMLCh *const toTranscode, char *const toFill, const XMLSize_t maxChars, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
Transcodes a string to native code-page (DEPRECATED)
static void removeWS(XMLCh *toConvert, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
Remove whitespace.
static int compareNIString(const char *const str1, const char *const str2, const XMLSize_t count)
Lexicographically compares, at most, the first count characters in str1 and str2 without regard to ca...
static int compareNString(const XMLCh *const str1, const XMLCh *const str2, const XMLSize_t count)
Lexicographically compares, at most, the first count characters in str1 and str2 and returns a value ...
static void subString(XMLCh *const targetStr, const XMLCh *const srcStr, const XMLSize_t startIndex, const XMLSize_t endIndex, const XMLSize_t srcStrLength, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
Create a substring of a given string.
static int compareNString(const char *const str1, const char *const str2, const XMLSize_t count)
Lexicographically compares, at most, the first count characters in str1 and str2 and returns a value ...
static bool isWSCollapsed(const XMLCh *const toCheck)
Check if string is WhiteSpace:collapse.
static void lowerCaseASCII(XMLCh *const toLowerCase)
Converts a string to lowercase The routine only lowercases a to z (other characters not changed).
static int lastIndexOf(const XMLCh ch, const XMLCh *const toSearch, const XMLSize_t toSearchLen)
Provides the index of the last occurrence of a character within a string.
static bool isValidNOTATION(const XMLCh *const name, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
Checks whether an name is a valid NOTATION according to XML 1.0.
static void binToText(const int toFormat, XMLCh *const toFill, const XMLSize_t maxChars, const unsigned int radix, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
Converts binary data to a text string based a given radix.
static void collapseWS(XMLCh *toConvert, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
Collapse whitespace.
static int compareIStringASCII(const XMLCh *const str1, const XMLCh *const str2)
Lexicographically compares lowercase versions of str1 and str2 and returns a value indicating their r...
static bool regionIMatches(const XMLCh *const str1, const int offset1, const XMLCh *const str2, const int offset2, const XMLSize_t charCount)
Lexicographically compares str1 and str2 regions without regard to case and returns true if they are ...
static bool isInList(const XMLCh *const toFind, const XMLCh *const enumList)
Find is the string appears in the enum list.
static bool textToBin(const XMLCh *const toConvert, unsigned int &toFill, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
Converts a string of decimal chars to a binary value.
static bool isWSReplaced(const XMLCh *const toCheck)
Check if string is WhiteSpace:replace.
static void binToText(const unsigned int toFormat, XMLCh *const toFill, const XMLSize_t maxChars, const unsigned int radix, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
Converts binary data to a text string based a given radix.
static void lowerCase(XMLCh *const toLowerCase)
Converts a string to lowercase.
static bool isAlphaNum(XMLCh const theChar)
Checks whether a character is within [0-9a-zA-Z].
static void replaceWS(XMLCh *toConvert, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
Replace whitespace.
static void subString(char *const targetStr, const char *const srcStr, const XMLSize_t startIndex, const XMLSize_t endIndex, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
Create a substring of a given string.
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 r...
static bool endsWith(const XMLCh *const toTest, const XMLCh *const suffix)
Tells if the sub-string appears within a string at the end.
Definition XMLString.hpp:1498
static void binToText(const long toFormat, XMLCh *const toFill, const XMLSize_t maxChars, const unsigned int radix, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
Converts binary data to a text string based a given radix.
static void catString(XMLCh *const target, const XMLCh *const src)
Concatenates two strings.
static void binToText(const unsigned int toFormat, char *const toFill, const XMLSize_t maxChars, const unsigned int radix, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
Converts binary data to a text string based a given radix.
static int indexOf(const char *const toSearch, const char ch)
Provides the index of the first occurrence of a character within a string.
static void binToText(const int toFormat, char *const toFill, const XMLSize_t maxChars, const unsigned int radix, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
Converts binary data to a text string based a given radix.
static int parseInt(const XMLCh *const toConvert, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
Converts a string of decimal chars to a binary value.
static XMLSize_t replaceTokens(XMLCh *const errText, const XMLSize_t maxChars, const XMLCh *const text1, const XMLCh *const text2, const XMLCh *const text3, const XMLCh *const text4, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
Internal function to perform token replacement for strings.
static XMLCh * findAny(XMLCh *const toSearch, const XMLCh *const searchList)
Tells if a string has any occurrence of any character of another string within itself.
static bool isValidEncName(const XMLCh *const name)
Checks whether an name is a valid EncName.
static void upperCaseASCII(XMLCh *const toUpperCase)
Converts a string to uppercase The routine only uppercases A to Z (other characters not changed).
static int indexOf(const char *const toSearch, const char chToFind, const XMLSize_t fromIndex, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
Provides the index of the first occurrence of a character within a string starting from a given index...
static void release(char **buf, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
Release the parameter string that was allocated by XMLString::transcode and XMLString::replicate.
static int lastIndexOf(const XMLCh *const toSearch, const XMLCh ch, const XMLSize_t fromIndex, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
Provides the index of the last occurrence of a character within a string starting backward from a giv...
static int patternMatch(const XMLCh *const toSearch, const XMLCh *const pattern)
Tells if a string has pattern within itself.
static void sizeToText(const XMLSize_t toFormat, XMLCh *const toFill, const XMLSize_t maxChars, const unsigned int radix, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
Converts size to a text string based a given radix.
static bool isAlpha(XMLCh const theChar)
Checks whether a character is within [a-zA-Z].