18#if !defined(DOMSTRINGHELPER_HEADER_GUARD_1357924680)
19#define DOMSTRINGHELPER_HEADER_GUARD_1357924680
56using xercesc::MemoryManager;
60class XalanOutputStream;
64template<
class InputIteratorType,
class OutputIteratorType>
65inline OutputIteratorType
67 InputIteratorType begin,
68 InputIteratorType end,
69 OutputIteratorType iterator)
71 return std::copy(begin, end, iterator);
76template<
class InputIteratorType,
class OutputIteratorType,
class UnaryFunction>
77inline OutputIteratorType
79 InputIteratorType begin,
80 InputIteratorType end,
81 OutputIteratorType iterator,
82 UnaryFunction function)
84 return std::transform(begin, end, iterator, function);
98inline const XalanDOMChar*
101 return theString.
c_str();
116 if (theString.
empty() ==
true)
122 const char*
const ptr = &theString[0];
124 assert(ptr[theString.
size() - 1] ==
'\0');
149inline const XalanDOMChar*
166inline const XalanDOMChar*
169 return theString.
c_str();
182inline const XalanDOMChar*
202 return theString.
empty() ==
true ? 0 : &theString[0];
237 return theString.
length();
252 assert(theString != 0);
254 const XalanDOMChar* theBufferPointer = theString;
256 while(*theBufferPointer != 0)
275 assert(theString != 0);
309 const XalanDOMChar* theString,
310 XalanDOMChar theChar)
312 assert(theString != 0);
314 const XalanDOMChar* thePointer = theString;
316 while(*thePointer != theChar && *thePointer != 0)
338 const XalanDOMChar* theString,
340 XalanDOMChar theChar)
342 assert(theString != 0);
344 const XalanDOMChar* thePointer = theString;
345 const XalanDOMChar*
const theEndPointer = theString + theStringLength;
347 while(*thePointer != theChar && thePointer != theEndPointer)
369 XalanDOMChar theChar)
389 const XalanDOMChar* theString,
391 const XalanDOMChar* theSubstring,
407 const XalanDOMChar* theString,
408 const XalanDOMChar* theSubstring)
410 assert(theString != 0 && theSubstring != 0);
445 const XalanDOMChar* theString,
446 XalanDOMChar theChar);
462 XalanDOMChar theChar)
480 const XalanDOMChar* theString,
482 const XalanDOMChar* theSubstring,
496 const XalanDOMChar* theString,
497 const XalanDOMChar* theSubstring)
499 assert(theString != 0 && theSubstring != 0);
515 const XalanDOMChar* theString,
518 assert(theString != 0);
523 theSubstring.
c_str(),
539 const XalanDOMChar* theSubstring)
541 assert(theSubstring != 0);
563 const XalanDOMChar* theSubstring,
566 assert(theSubstring != 0);
592 theSubstring.
c_str(),
607 const XalanDOMChar* theString,
609 const XalanDOMChar* theSubstring,
623 const XalanDOMChar* theString,
624 const XalanDOMChar* theSubstring)
626 assert(theString != 0 && theSubstring != 0);
652 theSubstring.
c_str(),
667 const
void* theValue,
689 MemberFunctionPtr function);
695 MemberFunctionPtr function);
701 MemberFunctionPtr function);
761 static_cast<XMLUInt64
>(theValue),
774inline XalanDOMString&
780 static_cast<XMLInt64
>(theValue),
793inline XalanDOMString&
799 static_cast<XMLUInt64
>(theValue),
812inline XalanDOMString&
818 static_cast<XMLInt64
>(theValue),
865 static_cast<XMLUInt64
>(theValue),
878inline XalanDOMString&
884 static_cast<XMLInt64
>(theValue),
897inline XalanDOMString&
903 static_cast<XMLUInt64
>(theValue),
916inline XalanDOMString&
922 static_cast<XMLInt64
>(theValue),
970 const XalanDOMChar* theString,
971 MemoryManager& theMemoryManager);
1027 MemoryManager& theMemoryManager)
1059 std::ostream& theStream,
1074 const XalanDOMChar* theString);
1087 std::ostream& theStream,
1088 const XalanDOMChar* theString,
1089 MemoryManager& theMemoryManager);
1105 if (theString.empty() ==
false)
1125 std::ostream& theStream,
1127 MemoryManager& theMemoryManager)
1167 std::ostream& theStream,
1189 const XalanDOMChar* theString)
1209 std::ostream& theStream,
1210 const XalanDOMChar* theString)
1215 XalanMemMgrs::getDefault());
1251 std::ostream& theStream,
1257 XalanMemMgrs::getDefault());
1273 std::ostream& theStream,
1300 return theString[theIndex];
1314 return XalanXMLChar::isWhitespace(theChar);
1328 return XalanXMLChar::isDigit(theChar);
1342 return XalanXMLChar::isDigit(theChar) ||
1343 XalanXMLChar::isLetter(theChar);
1365 const XalanDOMChar* theString,
1423 if (theChar >= XalanUnicode::charLetter_A && theChar <= XalanUnicode::charLetter_Z)
1425 return XalanDOMChar(theChar - (XalanUnicode::charLetter_A - XalanUnicode::charLetter_a));
1446 if (theChar >= XalanUnicode::charLetter_a && theChar <= XalanUnicode::charLetter_z)
1448 return XalanDOMChar(theChar + (XalanUnicode::charLetter_A - XalanUnicode::charLetter_a));
1468 if (theChar >= XalanUnicode::charLetter_A && theChar <= XalanUnicode::charLetter_Z)
1470 return XalanDOMChar(theChar - (XalanUnicode::charLetter_A - XalanUnicode::charLetter_a));
1472 else if (theChar >= XalanUnicode::charLetter_a && theChar <= XalanUnicode::charLetter_z)
1474 return XalanDOMChar(theChar + (XalanUnicode::charLetter_A - XalanUnicode::charLetter_a));
1495 const XalanDOMChar* theString,
1540 const XalanDOMChar* theString,
1608 const XalanDOMChar* theLHS,
1610 const XalanDOMChar* theRHS,
1628 const XalanDOMChar* theLHS,
1629 const XalanDOMChar* theRHS)
1676 const XalanDOMChar* theLHS,
1702 const XalanDOMChar* theRHS)
1730 const XalanDOMChar* theLHS,
1732 const XalanDOMChar* theRHS,
1752 const XalanDOMChar* theLHS,
1753 const XalanDOMChar* theRHS)
1805 const XalanDOMChar* theRHS)
1831 const XalanDOMChar* theLHS,
1855 const XalanDOMChar* theLHS,
1857 const XalanDOMChar* theRHS,
1874 const XalanDOMChar* theLHS,
1875 const XalanDOMChar* theRHS);
1909 const XalanDOMChar* theLHS,
1928 const XalanDOMChar* theRHS)
1949 const XalanDOMChar* theLHS,
1950 const XalanDOMChar* theRHS,
1966 const XalanDOMChar* theLHS,
1968 const XalanDOMChar* theRHS,
1971 return theLHSLength != theRHSLength ? false :
equals(theLHS, theRHS, theLHSLength);
1985 const XalanDOMChar* theLHS,
1986 const XalanDOMChar* theRHS)
1990 return theLHSLength !=
length(theRHS) ? false :
equals(theLHS, theRHS, theLHSLength);
2007 return theLHS == theRHS;
2021 const XalanDOMChar* theLHS,
2024 assert(theLHS != 0);
2027 return theRHS == theLHS;
2041 const XalanDOMChar* theRHS)
2043 return equals(theRHS, theLHS);
2059 const XalanDOMChar* theRHS,
2062 return theRHSLength != theLHS.
length() ? false :
equals(theLHS.
c_str(), theRHSLength, theRHS, theRHSLength);
2078 const XalanDOMChar* theLHS,
2079 const XalanDOMChar* theRHS,
2096 const XalanDOMChar* theLHS,
2098 const XalanDOMChar* theRHS,
2101 return theLHSLength != theRHSLength ? false :
2117 const XalanDOMChar* theLHS,
2118 const XalanDOMChar* theRHS)
2122 return theLength !=
length(theRHS) ? false :
2143 return theLength != theRHS.
length() ? false :
2162 const XalanDOMChar* theLHS,
2167 return theRHSLength !=
length(theLHS) ? false :
2187 const XalanDOMChar* theRHS)
2208 return compare(theLHS, theRHS) < 0 ? true :
false;
2227 return compare(theLHS, theRHS) < 0 ? true :
false;
2242inline XalanDOMString&
2247 theString = theStringToAssign;
2264inline XalanDOMString&
2267 const XalanDOMChar* theStringToAssign,
2270 if (theStringToAssignLength == XalanDOMString::npos)
2272 theString.
assign(theStringToAssign);
2276 theString.
assign(theStringToAssign, theStringToAssignLength);
2293inline XalanDOMString&
2298 theString.
append(theStringToAppend);
2315inline XalanDOMString&
2318 const XalanDOMChar* theStringToAppend,
2321 assert(theStringToAppend != 0);
2323 if (theStringToAppendLength == XalanDOMString::npos)
2325 theString.
append(theStringToAppend);
2329 theString.
append(theStringToAppend, theStringToAppendLength);
2347inline XalanDOMString&
2350 const char* theStringToAppend,
2373inline XalanDOMString&
2376 const XalanDOMChar theCharToAppend)
2378 theString.
append(1, theCharToAppend);
2394inline XalanDOMString&
2397 char theCharToAppend)
2400 char theTempBuffer[] = { theCharToAppend,
'\0' };
2402 return append(theString, theTempBuffer);
2417inline XalanDOMString&
2423 theString.
insert(thePosition, theStringToInsert);
2440inline XalanDOMString&
2444 const XalanDOMChar* theStringToInsert)
2446 theString.
insert(thePosition, theStringToInsert);
2513 const XalanDOMChar* theString,
2520 const
char* theString,
2537 bool fTranscode = true);
2575 return theString.
c_str();
2613 return compare(theLHS, theRHS) <= 0 ? true :
false;
2632 return compare(theLHS, theRHS) > 0 ? true :
false;
2651 return compare(theLHS, theRHS) >= 0 ? true :
false;
2674 const XalanDOMChar* theLHS,
2675 const XalanDOMChar* theRHS)
const
2704 const XalanDOMChar ch[],
2719 assert(theString != 0);
std::ostream & operator<<(std::ostream &target, const StrX &toDump)
#define XALAN_CPP_NAMESPACE
Xalan-C++ namespace, including major and minor version.
static void NumberToCharacters(double theValue, FormatterListener &formatterListener, MemberFunctionPtr function)
static void NumberToCharacters(XMLInt32 theValue, FormatterListener &formatterListener, MemberFunctionPtr function)
static void initialize(MemoryManager &theMemoryManager)
static void NumberToCharacters(XMLInt64 theValue, FormatterListener &formatterListener, MemberFunctionPtr function)
const XalanDOMChar * c_str() const
XalanDOMString & insert(size_type thePosition, const XalanDOMString &theString)
XalanDOMString & append(const XalanDOMString &theSource)
void reserve(size_type theCount=0)
iterator erase(iterator thePosition)
XalanDOMString & assign(const XalanDOMChar *theSource)
MemoryManager & getMemoryManager()
void swap(XalanDOMString &theOther)
bool startsWith(const XalanDOMString &theString, const XalanDOMString &theSubstring)
Simulates the java String method startsWith().
void clear(XalanDOMString &theString)
Remove all elements from target string.
void releaseMemory(XalanDOMString &theString, MemoryManager &theManager)
Remove all elements from target string and frees all allocated memory.
toLowerCaseASCII(XalanDOMString &theString)
Converts ASCII alphabetic characters from upper case to lower case.
int compareIgnoreCaseASCII(const XalanDOMChar *theLHS, const XalanDOMString &theRHS)
Compare the contents of two strings, in a case insensitive manner.
WideStringToLong(const XalanDOMChar *theString)
Converts a wide string into a long value.
XalanDOMString & insert(XalanDOMString &theString, XalanDOMString::size_type thePosition, const XalanDOMChar *theStringToInsert)
Insert a string into another string.
XalanDOMCharVectorType & MakeXalanDOMCharVector(const XalanDOMString &data, XalanDOMCharVectorType &result)
Utility function to make a null-terminated vector of XMLChs, from a XalanDOMString.
XalanDOMString::size_type length(const char *theString)
Get the length of a null-terminated string.
trim(const XalanDOMString &theString, XalanDOMString &theResult)
Remove leading and trailing whitespace.
void erase(XalanDOMString &theString)
Remove all elements from target string.
XalanDOMChar toUpperASCII(XalanDOMChar theChar)
Converts ASCII alphabetic characters from lower case to upper case.
CopyWideStringToVector(const XalanDOMChar *theString, CharVectorType &theVector)
XalanDOMString::size_type lastIndexOf(const XalanDOMString &theString, XalanDOMChar theChar)
Simulates the java String method lastIndexOf().
bool operator<(const XalanDOMString &theLHS, const XalanDOMString &theRHS)
Implements operator< for DOMStrings.
const XalanDOMString TranscodeFromLocalCodePage(const char *theSourceString, XalanDOMString::size_type theSourceStringLength=XalanDOMString::npos)
Convert a string to a XalanDOMString, transcoding from the default local code page.
bool endsWith(const XalanDOMString &theString, const XalanDOMString &theSubstring)
Simulates the java String method endsWith().
XalanDOMChar flipCaseASCII(XalanDOMChar theChar)
Flips the case to of the supplied character.
unsigned long DOMStringToUnsignedLong(const XalanDOMString &theString)
Converts a XalanDOMString into a long value.
int compare(const XalanDOMString &theLHS, const XalanDOMChar *theRHS)
Compare the contents of two strings.
const char * toCharArray(const CharVectorType &theString)
Get the underlying representation of the target CharVectorType as a pointer to an array of characters...
bool isEmpty(const XalanDOMString &str)
Determines if the target string contains any elements.
indexOf(const XalanDOMString &theString, const XalanDOMString &theSubstring)
Simulates the java String method indexOf().
int collationCompare(const XalanDOMString &theLHS, const XalanDOMChar *theRHS)
Compare the contents of two strings.
bool isXMLWhitespace(const XalanDOMChar *theString)
Determines if a null-terminated string contains only whitespace.
void reserve(XalanDOMString &theString, XalanDOMString::size_type theCount)
Reserve some space in the string for more efficient concatenation...
bool isXMLLetterOrDigit(XalanDOMChar theChar)
Determines whether character represents a letter or digit.
WideStringToInt(const XalanDOMChar *theString)
Converts a wide string into an integer value.
OutputIteratorType XalanCopy(InputIteratorType begin, InputIteratorType end, OutputIteratorType iterator)
bool equals(const XalanDOMString &theLHS, const XalanDOMChar *theRHS, XalanDOMString::size_type theRHSLength)
Compare the contents of two strings for equality.
OutputIteratorType XalanTransform(InputIteratorType begin, InputIteratorType end, OutputIteratorType iterator, UnaryFunction function)
XalanDOMString & assign(XalanDOMString &theString, const XalanDOMChar *theStringToAssign, XalanDOMString::size_type theStringToAssignLength=XalanDOMString::npos)
Assign one string to another.
double DOMStringToDouble(const XalanDOMString &theString, MemoryManager &theMemoryManager)
Converts a XalanDOMString into a double value.
CopyStringToVector(const char *theString, CharVectorType &theVector)
WideStringToUnsignedLong(const XalanDOMChar *theString)
Converts a wide string into an unsigned long value.
substring(const XalanDOMString &theString, XalanDOMString::size_type theStartIndex, XalanDOMString &theResult, XalanDOMString::size_type theEndIndex=XalanDOMString::npos)
Simulates the java String method substring().
PointerToDOMString(const void *theValue, XalanDOMString &theResult)
Converts a pointer into a XalanDOMString.
toUpperCaseASCII(XalanDOMString &theString)
Converts ASCII alphabetic characters from lower case to upper case.
XalanDOMString & NumberToHexDOMString(XMLInt16 theValue, XalanDOMString &theResult)
Converts a 16-bit signed int value into a XalanDOMString.
const char * c_str(const CharVectorType &theString)
Get the underlying representation of the target CharVectorType as a null-terminated string.
XalanDOMString & NumberToDOMString(XMLInt16 theValue, XalanDOMString &theResult)
Converts a 16-bit int value into a XalanDOMString.
bool isXMLDigit(XalanDOMChar theChar)
Determines whether character represents a digit.
WideStringToDouble(const XalanDOMChar *theString, MemoryManager &theMemoryManager)
Converts a wide string into a double value.
void OutputString(std::ostream &theStream, const XalanDOMString &theString, MemoryManager &theMemoryManager)
Outputs the target string to the specified stream.
bool equalsIgnoreCaseASCII(const XalanDOMString &theLHS, const XalanDOMChar *theRHS)
Compare the contents of two strings for equality, without regard for case.
const XalanDOMChar * c_wstr(const XalanDOMChar *theString)
Get the underlying representation of the wide string as a UNICODE null-terminated string.
XalanDOMChar charAt(const XalanDOMString &theString, XalanDOMString::size_type theIndex)
Retrieves a character at a specified index in the target string.
long DOMStringToLong(const XalanDOMString &theString)
Converts a XalanDOMString into a long value.
XalanDOMChar toLowerASCII(XalanDOMChar theChar)
Converts ASCII alphabetic characters from upper case to lower case.
XalanDOMString & append(XalanDOMString &theString, char theCharToAppend)
Concatenate a string and a character.
int DOMStringToInt(const XalanDOMString &theString)
Converts a XalanDOMString into an integer value.
Greater than functor for DOMStrings.
Greater than or equal functor for DOMStrings.
Less than functor for DOMStrings which ignores case for the characters a-z and A-Z.
Less than or equal functor for DOMStrings.
This functor is designed to compare 0-terminated wide strings in a case-insensitive manner.
bool operator()(const XalanDOMChar *theLHS, const XalanDOMChar *theRHS) const
Compare the values of two objects.