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];
234inline XalanDOMString::size_type
237 return theString.
length();
249inline XalanDOMString::size_type
252 assert(theString != 0);
254 const XalanDOMChar* theBufferPointer = theString;
256 while(*theBufferPointer != 0)
272inline XalanDOMString::size_type
275 assert(theString != 0);
277 return XalanDOMString::length(theString);
307inline XalanDOMString::size_type
309 const XalanDOMChar* theString,
310 XalanDOMChar theChar)
312 assert(theString != 0);
314 const XalanDOMChar* thePointer = theString;
316 while(*thePointer != theChar && *thePointer != 0)
336inline XalanDOMString::size_type
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)
366inline XalanDOMString::size_type
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),
935WideStringToInt(const XalanDOMChar* theString);
946WideStringToLong(const XalanDOMChar* theString);
957WideStringToUnsignedLong(const XalanDOMChar* theString);
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,
1421toLowerASCII(XalanDOMChar theChar)
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)
1729compareIgnoreCaseASCII(
1730 const XalanDOMChar* theLHS,
1732 const XalanDOMChar* theRHS,
1751compareIgnoreCaseASCII(
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);
2077equalsIgnoreCaseASCII(
2078 const XalanDOMChar* theLHS,
2079 const XalanDOMChar* theRHS,
2095equalsIgnoreCaseASCII(
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);
2512CopyWideStringToVector(
2513 const XalanDOMChar* theString,
2520 const
char* theString,
2534MakeXalanDOMCharVector(
2537 bool fTranscode = true);
2549MakeXalanDOMCharVector(const XalanDOMChar* data,
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[],
2717isXMLWhitespace(const XalanDOMChar* theString)
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)
XalanDOMString::size_type indexOf(const XalanDOMChar *theString, XalanDOMChar theChar)
Simulates the java String method indexOf().
XalanDOMString & insert(XalanDOMString &theString, XalanDOMString::size_type thePosition, const XalanDOMString &theStringToInsert)
Insert a string into another string.
void releaseMemory(XalanDOMString &theString, MemoryManager &theManager)
Remove all elements from target string and frees all allocated memory.
WideStringToLong(const XalanDOMChar *theString)
Converts a wide string into a long value.
collationCompare(const XalanDOMChar *theLHS, XalanDOMString::size_type theLHSLength, const XalanDOMChar *theRHS, XalanDOMString::size_type theRHSLength)
Compare the contents of two character arrays.
void erase(XalanDOMString &theString)
Remove all elements from target string.
XalanDOMChar toUpperASCII(XalanDOMChar theChar)
Converts ASCII alphabetic characters from lower case to upper case.
XalanDOMString::size_type length(const XalanDOMString &theString)
Get the length of a XalanDOMString.
bool isXMLWhitespace(XalanDOMChar theChar)
Determines whether character represents white space.
XalanDOMString & assign(XalanDOMString &theString, const XalanDOMString &theStringToAssign)
Assign one string to another.
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 operator<(const XalanVector< Type > &theLHS, const XalanVector< Type > &theRHS)
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.
const XalanDOMChar * toCharArray(const XalanDOMString &theString)
Get the underlying representation of the target XalanDOMString as an array of XalanDOMChar,...
MakeXalanDOMCharVector(const char *data, XalanDOMCharVectorType &result, bool fTranscode=true)
Utility function to make a null-terminated vector of XMLChs, from a null-terminated array of chars,...
const XalanDOMChar * c_wstr(const XalanDOMString &theString)
Get the underlying representation of the target XalanDOMString as a null-terminated string.
bool isEmpty(const XalanDOMString &str)
Determines if the target string contains any elements.
compare(const CharVectorType &theLHS, const CharVectorType &theRHS)
Compare the contents of two strings.
OutputString(XalanOutputStream &theStream, const CharVectorType &theString)
Outputs the target string to the specified stream.
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)
lastIndexOf(const XalanDOMChar *theString, XalanDOMChar theChar)
Simulates the java String method lastIndexOf().
OutputIteratorType XalanTransform(InputIteratorType begin, InputIteratorType end, OutputIteratorType iterator, UnaryFunction function)
double DOMStringToDouble(const XalanDOMString &theString, MemoryManager &theMemoryManager)
Converts a XalanDOMString into a double value.
WideStringToUnsignedLong(const XalanDOMChar *theString)
Converts a wide string into an unsigned long value.
NumberToDOMString(double theValue, XalanDOMString &theResult)
Converts a double value into a XalanDOMString.
const char * c_str(const CharVectorType &theString)
Get the underlying representation of the target CharVectorType as a null-terminated string.
startsWith(const XalanDOMChar *theString, XalanDOMString::size_type theStringLength, const XalanDOMChar *theSubstring, XalanDOMString::size_type theSubstringLength)
Simulates the java String method startsWith().
compareIgnoreCaseASCII(const XalanDOMChar *theLHS, XalanDOMString::size_type theLHSLength, const XalanDOMChar *theRHS, XalanDOMString::size_type theRHSLength)
Compare the contents of two arrays in a case insensitive manner.
XalanDOMString & append(XalanDOMString &theString, const XalanDOMString &theStringToAppend)
Concatenate two strings.
bool isXMLDigit(XalanDOMChar theChar)
Determines whether character represents a digit.
WideStringToDouble(const XalanDOMChar *theString, MemoryManager &theMemoryManager)
Converts a wide string into a double value.
NumberToHexDOMString(XMLUInt64 theValue, XalanDOMString &theResult)
Converts an 64-bit unsigned int value into a XalanDOMString.
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.
endsWith(const XalanDOMChar *theString, XalanDOMString::size_type theStringLength, const XalanDOMChar *theSubstring, XalanDOMString::size_type theSubstringLength)
Simulates the java String method endsWith().
equalsIgnoreCaseASCII(const XalanDOMChar *theLHS, const XalanDOMChar *theRHS, XalanDOMString::size_type theLength)
Compare the contents of two arrays for equality, without regard for case.
equals(const XalanDOMChar *theLHS, const XalanDOMChar *theRHS, XalanDOMString::size_type theLength)
Compare the contents of two arrays for equality.
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.