Xerces-C++ 3.3.0

XMLString.hpp
Go to the documentation of this file.
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18/*
19 * $Id$
20 */
21
22#if !defined(XERCESC_INCLUDE_GUARD_XMLSTRING_HPP)
23#define XERCESC_INCLUDE_GUARD_XMLSTRING_HPP
24
25#include <xercesc/util/BaseRefVectorOf.hpp>
26#include <xercesc/framework/XMLBuffer.hpp>
27#include <xercesc/framework/MemoryManager.hpp>
28#include <string.h>
29#include <assert.h>
30
31 XERCES_CPP_NAMESPACE_BEGIN
32
33 class XMLLCPTranscoder;
45 class XMLUTIL_EXPORT XMLString
46{
47 public:
48 /* Static methods for native character mode string manipulation */
49
50
67 static void catString
68 (
69 char* const target
70 , const char* const src
71 );
72
85 static void catString
86 (
87 XMLCh* const target
88 , const XMLCh* const src
89 );
91
105 static int compareIString
106 (
107 const char* const str1
108 , const char* const str2
109 );
110
121 static int compareIString
122 (
123 const XMLCh* const str1
124 , const XMLCh* const str2
125 );
126
138 static int compareIStringASCII
139 (
140 const XMLCh* const str1
141 , const XMLCh* const str2
142 );
143
144
145
159 static int compareNString
160 (
161 const char* const str1
162 , const char* const str2
163 , const XMLSize_t count
164 );
165
179 static int compareNString
180 (
181 const XMLCh* const str1
182 , const XMLCh* const str2
183 , const XMLSize_t count
184 );
185
186
200 static int compareNIString
201 (
202 const char* const str1
203 , const char* const str2
204 , const XMLSize_t count
205 );
206
221 static int compareNIString
222 (
223 const XMLCh* const str1
224 , const XMLCh* const str2
225 , const XMLSize_t count
226 );
227
240 static int compareString
241 (
242 const char* const str1
243 , const char* const str2
244 );
245
257 static int compareString
258 (
259 const XMLCh* const str1
260 , const XMLCh* const str2
261 );
262
271 static bool equals
272 (
273 const XMLCh* str1
274 , const XMLCh* str2
275 );
276
286 static bool equalsN
287 (
288 const XMLCh* str1
289 , const XMLCh* str2
290 , XMLSize_t n
291 );
292
293 static bool equals
294 (
295 const char* str1
296 , const char* str2
297 );
298
308 static bool equalsN
309 (
310 const char* str1
311 , const char* str2
312 , XMLSize_t n
313 );
314
341 static bool regionMatches
342 (
343 const XMLCh* const str1
344 , const int offset1
345 , const XMLCh* const str2
346 , const int offset2
347 , const XMLSize_t charCount
348 );
349
377 static bool regionIMatches
378 (
379 const XMLCh* const str1
380 , const int offset1
381 , const XMLCh* const str2
382 , const int offset2
383 , const XMLSize_t charCount
384 );
386
399 static void copyString
400 (
401 char* const target
402 , const char* const src
403 );
404
415 static void copyString
416 (
417 XMLCh* const target
418 , const XMLCh* const src
419 );
420
433 static bool copyNString
434 (
435 XMLCh* const target
436 , const XMLCh* const src
437 , const XMLSize_t maxChars
438 );
440
449 static XMLSize_t hash
450 (
451 const char* const toHash
452 , const XMLSize_t hashModulus
453 );
454
461 static XMLSize_t hash
462 (
463 const XMLCh* const toHash
464 , const XMLSize_t hashModulus
465 );
466
475 static XMLSize_t hashN
476 (
477 const XMLCh* const toHash
478 , const XMLSize_t numChars
479 , const XMLSize_t hashModulus
480 );
481
483
494 static int indexOf(const char* const toSearch, const char ch);
495
504 static int indexOf(const XMLCh* const toSearch, const XMLCh ch);
505
517 static int indexOf
518 (
519 const char* const toSearch
520 , const char chToFind
521 , const XMLSize_t fromIndex
522 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
523 );
524
536 static int indexOf
537 (
538 const XMLCh* const toSearch
539 , const XMLCh chToFind
540 , const XMLSize_t fromIndex
541 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
542 );
543
552 static int lastIndexOf(const char* const toSearch, const char ch);
553
562 static int lastIndexOf(const XMLCh* const toSearch, const XMLCh ch);
563
573 static int lastIndexOf
574 (
575 const XMLCh ch
576 , const XMLCh* const toSearch
577 , const XMLSize_t toSearchLen
578 );
579
591 static int lastIndexOf
592 (
593 const char* const toSearch
594 , const char chToFind
595 , const XMLSize_t fromIndex
596 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
597 );
598
610 static int lastIndexOf
611 (
612 const XMLCh* const toSearch
613 , const XMLCh ch
614 , const XMLSize_t fromIndex
615 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
616 );
618
626 static void moveChars
627 (
628 XMLCh* const targetStr
629 , const XMLCh* const srcStr
630 , const XMLSize_t count
631 );
632
634
646 static void subString
647 (
648 char* const targetStr
649 , const char* const srcStr
650 , const XMLSize_t startIndex
651 , const XMLSize_t endIndex
652 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
653 );
654
664 static void subString
665 (
666 XMLCh* const targetStr
667 , const XMLCh* const srcStr
668 , const XMLSize_t startIndex
669 , const XMLSize_t endIndex
670 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
671 );
672
683 static void subString
684 (
685 XMLCh* const targetStr
686 , const XMLCh* const srcStr
687 , const XMLSize_t startIndex
688 , const XMLSize_t endIndex
689 , const XMLSize_t srcStrLength
690 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
691 );
692
694
707 static char* replicate(const char* const toRep,
708 MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
709
720 static XMLCh* replicate(const XMLCh* const toRep,
721 MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
722
724
733 static bool startsWith
734 (
735 const char* const toTest
736 , const char* const prefix
737 );
738
745 static bool startsWith
746 (
747 const XMLCh* const toTest
748 , const XMLCh* const prefix
749 );
750
759 static bool startsWithI
760 (
761 const char* const toTest
762 , const char* const prefix
763 );
764
774 static bool startsWithI
775 (
776 const XMLCh* const toTest
777 , const XMLCh* const prefix
778 );
779
786 static bool endsWith
787 (
788 const XMLCh* const toTest
789 , const XMLCh* const suffix
790 );
791
792
801 static const XMLCh* findAny
802 (
803 const XMLCh* const toSearch
804 , const XMLCh* const searchList
805 );
806
815 static XMLCh* findAny
816 (
817 XMLCh* const toSearch
818 , const XMLCh* const searchList
819 );
820
827 static int patternMatch
828 (
829 const XMLCh* const toSearch
830 , const XMLCh* const pattern
831 );
832
837 static XMLSize_t stringLen(const char* const src);
838
843 static XMLSize_t stringLen(const XMLCh* const src);
844
852 static bool isValidNOTATION(const XMLCh* const name
853 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
854
860 static bool isValidEncName(const XMLCh* const name);
861
868 static bool isAlpha(XMLCh const theChar);
869
875 static bool isDigit(XMLCh const theChar);
876
882 static bool isAlphaNum(XMLCh const theChar);
883
889 static bool isHex(XMLCh const theChar);
890
896 static bool isInList(const XMLCh* const toFind, const XMLCh* const enumList);
897
899
902
914 static void sizeToText
915 (
916 const XMLSize_t toFormat
917 , char* const toFill
918 , const XMLSize_t maxChars
919 , const unsigned int radix
920 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
921 );
922
934 static void sizeToText
935 (
936 const XMLSize_t toFormat
937 , XMLCh* const toFill
938 , const XMLSize_t maxChars
939 , const unsigned int radix
940 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
941 );
942
954 static void binToText
955 (
956 const unsigned int toFormat
957 , char* const toFill
958 , const XMLSize_t maxChars
959 , const unsigned int radix
960 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
961 );
962
974 static void binToText
975 (
976 const unsigned int toFormat
977 , XMLCh* const toFill
978 , const XMLSize_t maxChars
979 , const unsigned int radix
980 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
981 );
982
994 static void binToText
995 (
996 const unsigned long toFormat
997 , char* const toFill
998 , const XMLSize_t maxChars
999 , const unsigned int radix
1000 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
1001 );
1002
1014 static void binToText
1015 (
1016 const unsigned long toFormat
1017 , XMLCh* const toFill
1018 , const XMLSize_t maxChars
1019 , const unsigned int radix
1020 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
1021 );
1022
1034 static void binToText
1035 (
1036 const int toFormat
1037 , char* const toFill
1038 , const XMLSize_t maxChars
1039 , const unsigned int radix
1040 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
1041 );
1042
1054 static void binToText
1055 (
1056 const int toFormat
1057 , XMLCh* const toFill
1058 , const XMLSize_t maxChars
1059 , const unsigned int radix
1060 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
1061 );
1062
1074 static void binToText
1075 (
1076 const long toFormat
1077 , char* const toFill
1078 , const XMLSize_t maxChars
1079 , const unsigned int radix
1080 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
1081 );
1082
1094 static void binToText
1095 (
1096 const long toFormat
1097 , XMLCh* const toFill
1098 , const XMLSize_t maxChars
1099 , const unsigned int radix
1100 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
1101 );
1102
1114 static bool textToBin
1115 (
1116 const XMLCh* const toConvert
1117 , unsigned int& toFill
1118 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
1119 );
1120
1134 static int parseInt
1135 (
1136 const XMLCh* const toConvert
1137 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
1138 );
1139
1145 static void cut
1146 (
1147 XMLCh* const toCutFrom
1148 , const XMLSize_t count
1149 );
1150
1162 static char* transcode
1163 (
1164 const XMLCh* const toTranscode
1165 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
1166 );
1167
1183 static bool transcode
1184 (
1185 const XMLCh* const toTranscode
1186 , char* const toFill
1187 , const XMLSize_t maxChars
1188 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
1189 );
1190
1202 static XMLCh* transcode
1203 (
1204 const char* const toTranscode
1205 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
1206 );
1207
1218 static bool transcode
1219 (
1220 const char* const toTranscode
1221 , XMLCh* const toFill
1222 , const XMLSize_t maxChars
1223 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
1224 );
1225
1231 static void trim(char* const toTrim);
1232
1238 static void trim(XMLCh* const toTrim);
1239
1247 static BaseRefVectorOf<XMLCh>* tokenizeString(const XMLCh* const tokenizeSrc
1248 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
1249
1258 static BaseRefVectorOf<XMLCh>* tokenizeString(const XMLCh* const tokenizeSrc
1259 , XMLCh delimiter
1260 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
1262
1273 static XMLCh* makeUName
1274 (
1275 const XMLCh* const pszURI
1276 , const XMLCh* const pszName
1277 );
1278
1295 static XMLSize_t replaceTokens
1296 (
1297 XMLCh* const errText
1298 , const XMLSize_t maxChars
1299 , const XMLCh* const text1
1300 , const XMLCh* const text2
1301 , const XMLCh* const text3
1302 , const XMLCh* const text4
1303 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
1304 );
1305
1310 static void upperCase(XMLCh* const toUpperCase);
1311
1317 static void upperCaseASCII(XMLCh* const toUpperCase);
1318
1323 static void lowerCase(XMLCh* const toLowerCase);
1324
1330 static void lowerCaseASCII(XMLCh* const toLowerCase);
1331
1335 static bool isWSReplaced(const XMLCh* const toCheck);
1336
1340 static bool isWSCollapsed(const XMLCh* const toCheck);
1341
1347 static void replaceWS(XMLCh* toConvert
1348 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
1349
1355 static void collapseWS(XMLCh* toConvert
1356 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
1357
1363 static void removeWS(XMLCh* toConvert
1364 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
1365
1366
1372 static void removeChar(const XMLCh* const srcString
1373 , const XMLCh& toRemove
1374 , XMLBuffer& dstBuffer);
1375
1383 static void fixURI(const XMLCh* const str, XMLCh* const target);
1384
1386
1395 static void release
1396 (
1397 char** buf
1398 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
1399 );
1400
1408 static void release
1409 (
1410 XMLCh** buf
1411 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
1412 );
1414
1415
1416private :
1417
1421 XMLString();
1423 ~XMLString();
1425
1426
1430 static void initString(XMLLCPTranscoder* const defToUse,
1431 MemoryManager* const manager);
1432 static void termString();
1434
1439 static bool validateRegion(const XMLCh* const str1, const int offset1,
1440 const XMLCh* const str2, const int offset2,
1441 const XMLSize_t charCount);
1442
1443 static MemoryManager* fgMemoryManager;
1444
1445 friend class XMLPlatformUtils;
1446};
1447
1448
1449// ---------------------------------------------------------------------------
1450// Inline some methods that are either just passthroughs to other string
1451// methods, or which are key for performance.
1452// ---------------------------------------------------------------------------
1453 inline void XMLString::moveChars( XMLCh* const targetStr
1454 , const XMLCh* const srcStr
1455 , const XMLSize_t count)
1456{
1457 memmove(targetStr, srcStr, count * sizeof(XMLCh));
1458}
1459
1460 inline XMLSize_t XMLString::stringLen(const XMLCh* const src)
1461{
1462 if (src == 0)
1463 return 0;
1464
1465 const XMLCh* pszTmp = src;
1466
1467 while (*pszTmp++) ;
1468
1469 return (pszTmp - src - 1);
1470}
1471
1472 inline XMLCh* XMLString::replicate(const XMLCh* const toRep,
1473 MemoryManager* const manager)
1474{
1475 // If a null string, return a null string!
1476 XMLCh* ret = 0;
1477 if (toRep)
1478 {
1479 const XMLSize_t len = stringLen(toRep);
1480 ret = (XMLCh*) manager->allocate((len+1) * sizeof(XMLCh)); //new XMLCh[len + 1];
1481 memcpy(ret, toRep, (len + 1) * sizeof(XMLCh));
1482 }
1483 return ret;
1484}
1485
1486 inline bool XMLString::startsWith( const XMLCh* const toTest
1487 , const XMLCh* const prefix)
1488{
1489 return (compareNString(toTest, prefix, stringLen(prefix)) == 0);
1490}
1491
1492 inline bool XMLString::startsWithI( const XMLCh* const toTest
1493 , const XMLCh* const prefix)
1494{
1495 return (compareNIString(toTest, prefix, stringLen(prefix)) == 0);
1496}
1497
1498 inline bool XMLString::endsWith(const XMLCh* const toTest,
1499 const XMLCh* const suffix)
1500{
1501
1502 XMLSize_t suffixLen = XMLString::stringLen(suffix);
1503
1504 return regionMatches(toTest, (int)(XMLString::stringLen(toTest) - suffixLen),
1505 suffix, 0, suffixLen);
1506}
1507
1508 inline bool XMLString::validateRegion(const XMLCh* const str1,
1509 const int offset1,
1510 const XMLCh* const str2,
1511 const int offset2,
1512 const XMLSize_t charCount)
1513{
1514
1515 if (offset1 < 0 || offset2 < 0 ||
1516 (offset1 + charCount) > XMLString::stringLen(str1) ||
1517 (offset2 + charCount) > XMLString::stringLen(str2) )
1518 return false;
1519
1520 return true;
1521}
1522
1523 inline bool XMLString::equals( const XMLCh* str1
1524 , const XMLCh* str2)
1525{
1526 if (str1 == str2)
1527 return true;
1528
1529 if (str1 == 0 || str2 == 0)
1530 return ((!str1 || !*str1) && (!str2 || !*str2));
1531
1532 while (*str1)
1533 if(*str1++ != *str2++) // they are different (or str2 is shorter and we hit the NULL)
1534 return false;
1535
1536 // either both ended (and *str2 is 0 too), or str2 is longer
1537 return (*str2==0);
1538}
1539
1540 inline bool XMLString::equalsN(const XMLCh* str1,
1541 const XMLCh* str2,
1542 XMLSize_t n)
1543{
1544 if (str1 == str2 || n == 0)
1545 return true;
1546
1547 if (str1 == 0 || str2 == 0)
1548 return ((!str1 || !*str1) && (!str2 || !*str2));
1549
1550 for (; n != 0 && *str1 && *str2; --n, ++str1, ++str2)
1551 if(*str1 != *str2)
1552 break;
1553
1554 return n == 0 || *str1 == *str2; // either equal or both ended premat.
1555}
1556
1557 inline bool XMLString::equals( const char* str1
1558 , const char* str2)
1559{
1560 if (str1 == str2)
1561 return true;
1562
1563 if (str1 == 0 || str2 == 0)
1564 return ((!str1 || !*str1) && (!str2 || !*str2));
1565
1566 while (*str1)
1567 if(*str1++ != *str2++) // they are different (or str2 is shorter and we hit the NULL)
1568 return false;
1569
1570 // either both ended (and *str2 is 0 too), or str2 is longer
1571 return (*str2==0);
1572}
1573
1574 inline bool XMLString::equalsN(const char* str1,
1575 const char* str2,
1576 XMLSize_t n)
1577{
1578 if (str1 == str2 || n == 0)
1579 return true;
1580
1581 if (str1 == 0 || str2 == 0)
1582 return ((!str1 || !*str1) && (!str2 || !*str2));
1583
1584 for (; n != 0 && *str1 && *str2; --n, ++str1, ++str2)
1585 if(*str1 != *str2)
1586 break;
1587
1588 return n == 0 || *str1 == *str2; // either equal or both ended premat.
1589}
1590
1591 inline int XMLString::lastIndexOf(const XMLCh* const toSearch, const XMLCh ch)
1592{
1593 return XMLString::lastIndexOf(ch, toSearch, stringLen(toSearch));
1594}
1595
1596 inline XMLSize_t XMLString::hash(const XMLCh* const tohash
1597 , const XMLSize_t hashModulus)
1598{
1599 if (tohash == 0 || *tohash == 0)
1600 return 0;
1601
1602 const XMLCh* curCh = tohash;
1603 XMLSize_t hashVal = (XMLSize_t)(*curCh++);
1604
1605 while (*curCh)
1606 hashVal = (hashVal * 38) + (hashVal >> 24) + (XMLSize_t)(*curCh++);
1607
1608 // Divide by modulus
1609 return hashVal % hashModulus;
1610}
1611
1612 inline XMLSize_t XMLString::hashN(const XMLCh* const tohash
1613 , const XMLSize_t n
1614 , const XMLSize_t hashModulus)
1615{
1616 if (tohash == 0 || n == 0)
1617 return 0;
1618
1619 const XMLCh* curCh = tohash;
1620 XMLSize_t hashVal = (XMLSize_t)(*curCh++);
1621
1622 for(XMLSize_t i=0;i<n;i++)
1623 hashVal = (hashVal * 38) + (hashVal >> 24) + (XMLSize_t)(*curCh++);
1624
1625 // Divide by modulus
1626 return hashVal % hashModulus;
1627}
1628
1629 XERCES_CPP_NAMESPACE_END
1630
1631#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].