XMLString.hpp
Go to the documentation of this file.
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* $Id$
*/
#if !defined(XERCESC_INCLUDE_GUARD_XMLSTRING_HPP)
#define XERCESC_INCLUDE_GUARD_XMLSTRING_HPP
#include <xercesc/util/BaseRefVectorOf.hpp>
#include <xercesc/framework/XMLBuffer.hpp>
#include <xercesc/framework/MemoryManager.hpp>
#include <string.h>
#include <assert.h>
XERCES_CPP_NAMESPACE_BEGIN
class XMLLCPTranscoder;
class XMLUTIL_EXPORT XMLString
{
public:
/* Static methods for native character mode string manipulation */
static void catString
(
char* const target
, const char* const src
);
static void catString
(
XMLCh* const target
, const XMLCh* const src
);
static int compareIString
(
const char* const str1
, const char* const str2
);
static int compareIString
(
const XMLCh* const str1
, const XMLCh* const str2
);
static int compareIStringASCII
(
const XMLCh* const str1
, const XMLCh* const str2
);
static int compareNString
(
const char* const str1
, const char* const str2
, const XMLSize_t count
);
static int compareNString
(
const XMLCh* const str1
, const XMLCh* const str2
, const XMLSize_t count
);
static int compareNIString
(
const char* const str1
, const char* const str2
, const XMLSize_t count
);
static int compareNIString
(
const XMLCh* const str1
, const XMLCh* const str2
, const XMLSize_t count
);
static int compareString
(
const char* const str1
, const char* const str2
);
static int compareString
(
const XMLCh* const str1
, const XMLCh* const str2
);
static bool equals
(
const XMLCh* str1
, const XMLCh* str2
);
static bool equalsN
(
const XMLCh* str1
, const XMLCh* str2
, XMLSize_t n
);
static bool equals
(
const char* str1
, const char* str2
);
static bool equalsN
(
const char* str1
, const char* str2
, XMLSize_t n
);
static bool regionMatches
(
const XMLCh* const str1
, const int offset1
, const XMLCh* const str2
, const int offset2
, const XMLSize_t charCount
);
static bool regionIMatches
(
const XMLCh* const str1
, const int offset1
, const XMLCh* const str2
, const int offset2
, const XMLSize_t charCount
);
static void copyString
(
char* const target
, const char* const src
);
static void copyString
(
XMLCh* const target
, const XMLCh* const src
);
static bool copyNString
(
XMLCh* const target
, const XMLCh* const src
, const XMLSize_t maxChars
);
static XMLSize_t hash
(
const char* const toHash
, const XMLSize_t hashModulus
);
static XMLSize_t hash
(
const XMLCh* const toHash
, const XMLSize_t hashModulus
);
static XMLSize_t hashN
(
const XMLCh* const toHash
, const XMLSize_t numChars
, const XMLSize_t hashModulus
);
static int indexOf(const char* const toSearch, const char ch);
static int indexOf(const XMLCh* const toSearch, const XMLCh ch);
static int indexOf
(
const char* const toSearch
, const char chToFind
, const XMLSize_t fromIndex
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
);
static int indexOf
(
const XMLCh* const toSearch
, const XMLCh chToFind
, const XMLSize_t fromIndex
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
);
static int lastIndexOf(const char* const toSearch, const char ch);
static int lastIndexOf(const XMLCh* const toSearch, const XMLCh ch);
static int lastIndexOf
(
const XMLCh ch
, const XMLCh* const toSearch
, const XMLSize_t toSearchLen
);
static int lastIndexOf
(
const char* const toSearch
, const char chToFind
, const XMLSize_t fromIndex
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
);
static int lastIndexOf
(
const XMLCh* const toSearch
, const XMLCh ch
, const XMLSize_t fromIndex
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
);
static void moveChars
(
XMLCh* const targetStr
, const XMLCh* const srcStr
, const XMLSize_t count
);
static void subString
(
char* const targetStr
, const char* const srcStr
, const XMLSize_t startIndex
, const XMLSize_t endIndex
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
);
static void subString
(
XMLCh* const targetStr
, const XMLCh* const srcStr
, const XMLSize_t startIndex
, const XMLSize_t endIndex
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
);
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
);
static char* replicate(const char* const toRep,
MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
static XMLCh* replicate(const XMLCh* const toRep,
MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
static bool startsWith
(
const char* const toTest
, const char* const prefix
);
static bool startsWith
(
const XMLCh* const toTest
, const XMLCh* const prefix
);
static bool startsWithI
(
const char* const toTest
, const char* const prefix
);
static bool startsWithI
(
const XMLCh* const toTest
, const XMLCh* const prefix
);
static bool endsWith
(
const XMLCh* const toTest
, const XMLCh* const suffix
);
static const XMLCh* findAny
(
const XMLCh* const toSearch
, const XMLCh* const searchList
);
static XMLCh* findAny
(
XMLCh* const toSearch
, const XMLCh* const searchList
);
static int patternMatch
(
const XMLCh* const toSearch
, const XMLCh* const pattern
);
static XMLSize_t stringLen(const char* const src);
static XMLSize_t stringLen(const XMLCh* const src);
static bool isValidNOTATION(const XMLCh* const name
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
static bool isValidEncName(const XMLCh* const name);
static bool isAlpha(XMLCh const theChar);
static bool isDigit(XMLCh const theChar);
static bool isAlphaNum(XMLCh const theChar);
static bool isHex(XMLCh const theChar);
static bool isInList(const XMLCh* const toFind, const XMLCh* const enumList);
static void sizeToText
(
const XMLSize_t toFormat
, char* const toFill
, const XMLSize_t maxChars
, const unsigned int radix
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
);
static void sizeToText
(
const XMLSize_t toFormat
, XMLCh* const toFill
, const XMLSize_t maxChars
, const unsigned int radix
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
);
static void binToText
(
const unsigned int toFormat
, char* const toFill
, const XMLSize_t maxChars
, const unsigned int radix
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
);
static void binToText
(
const unsigned int toFormat
, XMLCh* const toFill
, const XMLSize_t maxChars
, const unsigned int radix
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
);
static void binToText
(
const unsigned long toFormat
, char* const toFill
, const XMLSize_t maxChars
, const unsigned int radix
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
);
static void binToText
(
const unsigned long toFormat
, XMLCh* const toFill
, const XMLSize_t maxChars
, const unsigned int radix
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
);
static void binToText
(
const int toFormat
, char* const toFill
, const XMLSize_t maxChars
, const unsigned int radix
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
);
static void binToText
(
const int toFormat
, XMLCh* const toFill
, const XMLSize_t maxChars
, const unsigned int radix
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
);
static void binToText
(
const long toFormat
, char* const toFill
, const XMLSize_t maxChars
, const unsigned int radix
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
);
static void binToText
(
const long toFormat
, XMLCh* const toFill
, const XMLSize_t maxChars
, const unsigned int radix
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
);
static bool textToBin
(
const XMLCh* const toConvert
, unsigned int& toFill
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
);
static int parseInt
(
const XMLCh* const toConvert
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
);
static void cut
(
XMLCh* const toCutFrom
, const XMLSize_t count
);
static char* transcode
(
const XMLCh* const toTranscode
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
);
static bool transcode
(
const XMLCh* const toTranscode
, char* const toFill
, const XMLSize_t maxChars
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
);
static XMLCh* transcode
(
const char* const toTranscode
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
);
static bool transcode
(
const char* const toTranscode
, XMLCh* const toFill
, const XMLSize_t maxChars
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
);
static void trim(char* const toTrim);
static void trim(XMLCh* const toTrim);
static BaseRefVectorOf<XMLCh>* tokenizeString(const XMLCh* const tokenizeSrc
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
static BaseRefVectorOf<XMLCh>* tokenizeString(const XMLCh* const tokenizeSrc
, XMLCh delimiter
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
static XMLCh* makeUName
(
const XMLCh* const pszURI
, const XMLCh* const pszName
);
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
);
static void upperCase(XMLCh* const toUpperCase);
static void upperCaseASCII(XMLCh* const toUpperCase);
static void lowerCase(XMLCh* const toLowerCase);
static void lowerCaseASCII(XMLCh* const toLowerCase);
static bool isWSReplaced(const XMLCh* const toCheck);
static bool isWSCollapsed(const XMLCh* const toCheck);
static void replaceWS(XMLCh* toConvert
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
static void collapseWS(XMLCh* toConvert
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
static void removeWS(XMLCh* toConvert
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
static void removeChar(const XMLCh* const srcString
, const XMLCh& toRemove
, XMLBuffer& dstBuffer);
static void fixURI(const XMLCh* const str, XMLCh* const target);
static void release
(
char** buf
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
);
static void release
(
XMLCh** buf
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
);
private :
XMLString();
~XMLString();
static void initString(XMLLCPTranscoder* const defToUse,
MemoryManager* const manager);
static void termString();
static bool validateRegion(const XMLCh* const str1, const int offset1,
const XMLCh* const str2, const int offset2,
const XMLSize_t charCount);
static MemoryManager* fgMemoryManager;
friend class XMLPlatformUtils;
};
// ---------------------------------------------------------------------------
// Inline some methods that are either just passthroughs to other string
// methods, or which are key for performance.
// ---------------------------------------------------------------------------
inline void XMLString::moveChars( XMLCh* const targetStr
, const XMLCh* const srcStr
, const XMLSize_t count)
{
memmove(targetStr, srcStr, count * sizeof(XMLCh));
}
inline XMLSize_t XMLString::stringLen(const XMLCh* const src)
{
if (src == 0)
return 0;
const XMLCh* pszTmp = src;
while (*pszTmp++) ;
return (pszTmp - src - 1);
}
inline XMLCh* XMLString::replicate(const XMLCh* const toRep,
MemoryManager* const manager)
{
// If a null string, return a null string!
XMLCh* ret = 0;
if (toRep)
{
const XMLSize_t len = stringLen(toRep);
ret = (XMLCh*) manager->allocate((len+1) * sizeof(XMLCh)); //new XMLCh[len + 1];
memcpy(ret, toRep, (len + 1) * sizeof(XMLCh));
}
return ret;
}
inline bool XMLString::startsWith( const XMLCh* const toTest
, const XMLCh* const prefix)
{
return (compareNString(toTest, prefix, stringLen(prefix)) == 0);
}
inline bool XMLString::startsWithI( const XMLCh* const toTest
, const XMLCh* const prefix)
{
return (compareNIString(toTest, prefix, stringLen(prefix)) == 0);
}
inline bool XMLString::endsWith(const XMLCh* const toTest,
const XMLCh* const suffix)
{
XMLSize_t suffixLen = XMLString::stringLen(suffix);
return regionMatches(toTest, (int)(XMLString::stringLen(toTest) - suffixLen),
suffix, 0, suffixLen);
}
inline bool XMLString::validateRegion(const XMLCh* const str1,
const int offset1,
const XMLCh* const str2,
const int offset2,
const XMLSize_t charCount)
{
if (offset1 < 0 || offset2 < 0 ||
(offset1 + charCount) > XMLString::stringLen(str1) ||
(offset2 + charCount) > XMLString::stringLen(str2) )
return false;
return true;
}
inline bool XMLString::equals( const XMLCh* str1
, const XMLCh* str2)
{
if (str1 == str2)
return true;
if (str1 == 0 || str2 == 0)
return ((!str1 || !*str1) && (!str2 || !*str2));
while (*str1)
if(*str1++ != *str2++) // they are different (or str2 is shorter and we hit the NULL)
return false;
// either both ended (and *str2 is 0 too), or str2 is longer
return (*str2==0);
}
inline bool XMLString::equalsN(const XMLCh* str1,
const XMLCh* str2,
XMLSize_t n)
{
if (str1 == str2 || n == 0)
return true;
if (str1 == 0 || str2 == 0)
return ((!str1 || !*str1) && (!str2 || !*str2));
for (; n != 0 && *str1 && *str2; --n, ++str1, ++str2)
if(*str1 != *str2)
break;
return n == 0 || *str1 == *str2; // either equal or both ended premat.
}
inline bool XMLString::equals( const char* str1
, const char* str2)
{
if (str1 == str2)
return true;
if (str1 == 0 || str2 == 0)
return ((!str1 || !*str1) && (!str2 || !*str2));
while (*str1)
if(*str1++ != *str2++) // they are different (or str2 is shorter and we hit the NULL)
return false;
// either both ended (and *str2 is 0 too), or str2 is longer
return (*str2==0);
}
inline bool XMLString::equalsN(const char* str1,
const char* str2,
XMLSize_t n)
{
if (str1 == str2 || n == 0)
return true;
if (str1 == 0 || str2 == 0)
return ((!str1 || !*str1) && (!str2 || !*str2));
for (; n != 0 && *str1 && *str2; --n, ++str1, ++str2)
if(*str1 != *str2)
break;
return n == 0 || *str1 == *str2; // either equal or both ended premat.
}
inline int XMLString::lastIndexOf(const XMLCh* const toSearch, const XMLCh ch)
{
return XMLString::lastIndexOf(ch, toSearch, stringLen(toSearch));
}
inline XMLSize_t XMLString::hash(const XMLCh* const tohash
, const XMLSize_t hashModulus)
{
if (tohash == 0 || *tohash == 0)
return 0;
const XMLCh* curCh = tohash;
XMLSize_t hashVal = (XMLSize_t)(*curCh++);
while (*curCh)
hashVal = (hashVal * 38) + (hashVal >> 24) + (XMLSize_t)(*curCh++);
// Divide by modulus
return hashVal % hashModulus;
}
inline XMLSize_t XMLString::hashN(const XMLCh* const tohash
, const XMLSize_t n
, const XMLSize_t hashModulus)
{
if (tohash == 0 || n == 0)
return 0;
const XMLCh* curCh = tohash;
XMLSize_t hashVal = (XMLSize_t)(*curCh++);
for(XMLSize_t i=0;i<n;i++)
hashVal = (hashVal * 38) + (hashVal >> 24) + (XMLSize_t)(*curCh++);
// Divide by modulus
return hashVal % hashModulus;
}
XERCES_CPP_NAMESPACE_END
#endif
MemoryManager.hpp
XERCES_CPP_NAMESPACE_BEGIN
#define XERCES_CPP_NAMESPACE_BEGIN
Definition XercesDefs.hpp:112
XMLUTIL_EXPORT
#define XMLUTIL_EXPORT
Definition XercesDefs.hpp:162
XERCES_CPP_NAMESPACE_END
#define XERCES_CPP_NAMESPACE_END
Definition XercesDefs.hpp:113
XMLSize_t
size_t XMLSize_t
Definition Xerces_autoconf_config.hpp:112
XMLCh
char16_t XMLCh
Definition Xerces_autoconf_config.hpp:120
MemoryManager
Configurable memory manager.
Definition MemoryManager.hpp:40
MemoryManager::allocate
virtual void * allocate(XMLSize_t size)=0
This method allocates requested memory.
XMLLCPTranscoder
Definition TransService.hpp:389
XMLPlatformUtils
Utilities that must be implemented in a platform-specific way.
Definition PlatformUtils.hpp:69
XMLPlatformUtils::fgMemoryManager
static MemoryManager * fgMemoryManager
The configurable memory manager.
Definition PlatformUtils.hpp:121
XMLString
Class for representing native character strings and handling common string operations.
Definition XMLString.hpp:46
XMLString::compareIString
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...
XMLString::hash
static XMLSize_t hash(const char *const toHash, const XMLSize_t hashModulus)
Hashes a string given a modulus.
XMLString::tokenizeString
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.
XMLString::cut
static void cut(XMLCh *const toCutFrom, const XMLSize_t count)
Cut leading chars from a string.
XMLString::stringLen
static XMLSize_t stringLen(const char *const src)
Get the length of the string.
XMLString::regionMatches
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,...
XMLString::copyString
static void copyString(XMLCh *const target, const XMLCh *const src)
Copies src, including the terminating null character, to the location specified by target.
XMLString::lastIndexOf
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...
XMLString::removeChar
static void removeChar(const XMLCh *const srcString, const XMLCh &toRemove, XMLBuffer &dstBuffer)
Remove character.
XMLString::startsWith
static bool startsWith(const char *const toTest, const char *const prefix)
Tells if the sub-string appears within a string at the beginning.
XMLString::indexOf
static int indexOf(const XMLCh *const toSearch, const XMLCh ch)
Provides the index of the first occurrence of a character within a string.
XMLString::binToText
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.
XMLString::subString
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.
XMLString::trim
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...
XMLString::fixURI
static void fixURI(const XMLCh *const str, XMLCh *const target)
Fixes a platform dependent absolute path filename to standard URI form.
XMLString::moveChars
static void moveChars(XMLCh *const targetStr, const XMLCh *const srcStr, const XMLSize_t count)
Moves X number of chars.
Definition XMLString.hpp:1453
XMLString::startsWithI
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.
XMLString::compareString
static int compareString(const XMLCh *const str1, const XMLCh *const str2)
Lexicographically compares str1 and str2 and returns a value indicating their relationship.
XMLString::lastIndexOf
static int lastIndexOf(const char *const toSearch, const char ch)
Provides the index of the last occurrence of a character within a string.
XMLString::indexOf
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...
XMLString::tokenizeString
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.
XMLString::replicate
static char * replicate(const char *const toRep, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
Replicates a string NOTE: The returned buffer is allocated with the MemoryManager.
XMLString::transcode
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)
XMLString::copyNString
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.
XMLString::isHex
static bool isHex(XMLCh const theChar)
Checks whether a character is within [0-9a-fA-F].
XMLString::compareNIString
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...
XMLString::upperCase
static void upperCase(XMLCh *const toUpperCase)
Converts a string to uppercase.
XMLString::transcode
static char * transcode(const XMLCh *const toTranscode, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
Transcodes a string to native code-page.
XMLString::findAny
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.
XMLString::binToText
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.
XMLString::isDigit
static bool isDigit(XMLCh const theChar)
Checks whether a character is within [0-9].
XMLString::transcode
static XMLCh * transcode(const char *const toTranscode, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
Transcodes a string to native code-page.
XMLString::makeUName
static XMLCh * makeUName(const XMLCh *const pszURI, const XMLCh *const pszName)
Creates a UName from a URI and base name.
XMLString::catString
static void catString(char *const target, const char *const src)
Concatenates two strings.
XMLString::trim
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...
XMLString::hashN
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
XMLString::equals
static bool equals(const XMLCh *str1, const XMLCh *str2)
compares str1 and str2
Definition XMLString.hpp:1523
XMLString::equalsN
static bool equalsN(const XMLCh *str1, const XMLCh *str2, XMLSize_t n)
compares str1 and str2
Definition XMLString.hpp:1540
XMLString::copyString
static void copyString(char *const target, const char *const src)
Copies src, including the terminating null character, to the location specified by target.
XMLString::sizeToText
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.
XMLString::binToText
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.
XMLString::compareString
static int compareString(const char *const str1, const char *const str2)
Lexicographically compares str1 and str2 and returns a value indicating their relationship.
XMLString::release
static void release(XMLCh **buf, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
Release the parameter string that was allocated by XMLString::transcode and XMLString::replicate.
XMLString::transcode
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)
XMLString::removeWS
static void removeWS(XMLCh *toConvert, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
Remove whitespace.
XMLString::compareNIString
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...
XMLString::compareNString
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 ...
XMLString::subString
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.
XMLString::compareNString
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 ...
XMLString::isWSCollapsed
static bool isWSCollapsed(const XMLCh *const toCheck)
Check if string is WhiteSpace:collapse.
XMLString::lowerCaseASCII
static void lowerCaseASCII(XMLCh *const toLowerCase)
Converts a string to lowercase The routine only lowercases a to z (other characters not changed).
XMLString::lastIndexOf
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.
XMLString::isValidNOTATION
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.
XMLString::binToText
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.
XMLString::collapseWS
static void collapseWS(XMLCh *toConvert, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
Collapse whitespace.
XMLString::compareIStringASCII
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...
XMLString::regionIMatches
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 ...
XMLString::isInList
static bool isInList(const XMLCh *const toFind, const XMLCh *const enumList)
Find is the string appears in the enum list.
XMLString::textToBin
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.
XMLString::isWSReplaced
static bool isWSReplaced(const XMLCh *const toCheck)
Check if string is WhiteSpace:replace.
XMLString::binToText
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.
XMLString::lowerCase
static void lowerCase(XMLCh *const toLowerCase)
Converts a string to lowercase.
XMLString::isAlphaNum
static bool isAlphaNum(XMLCh const theChar)
Checks whether a character is within [0-9a-zA-Z].
XMLString::replaceWS
static void replaceWS(XMLCh *toConvert, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
Replace whitespace.
XMLString::subString
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.
XMLString::compareIString
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...
XMLString::endsWith
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
XMLString::binToText
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.
XMLString::catString
static void catString(XMLCh *const target, const XMLCh *const src)
Concatenates two strings.
XMLString::binToText
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.
XMLString::indexOf
static int indexOf(const char *const toSearch, const char ch)
Provides the index of the first occurrence of a character within a string.
XMLString::binToText
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.
XMLString::parseInt
static int parseInt(const XMLCh *const toConvert, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
Converts a string of decimal chars to a binary value.
XMLString::replaceTokens
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.
XMLString::findAny
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.
XMLString::isValidEncName
static bool isValidEncName(const XMLCh *const name)
Checks whether an name is a valid EncName.
XMLString::upperCaseASCII
static void upperCaseASCII(XMLCh *const toUpperCase)
Converts a string to uppercase The routine only uppercases A to Z (other characters not changed).
XMLString::indexOf
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...
XMLString::release
static void release(char **buf, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
Release the parameter string that was allocated by XMLString::transcode and XMLString::replicate.
XMLString::lastIndexOf
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...
XMLString::patternMatch
static int patternMatch(const XMLCh *const toSearch, const XMLCh *const pattern)
Tells if a string has pattern within itself.
XMLString::sizeToText
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.
XMLString::isAlpha
static bool isAlpha(XMLCh const theChar)
Checks whether a character is within [a-zA-Z].