Xalan-C++ API Reference 1.12.0
DOMStringHelper.hpp
Go to the documentation of this file.
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18#if !defined(DOMSTRINGHELPER_HEADER_GUARD_1357924680)
19#define DOMSTRINGHELPER_HEADER_GUARD_1357924680
20
21
22
23// Base include file. Must be first.
25
26
27
28#include <algorithm>
29#include <cassert>
30#include <functional>
31#include <iosfwd>
32
33
34
39
40
41
43
44
45
49
50
51
52namespace XALAN_CPP_NAMESPACE {
53
54
55
56using xercesc::MemoryManager;
57
58
59
60class XalanOutputStream;
61
62
63
64template<class InputIteratorType, class OutputIteratorType>
65inline OutputIteratorType
69 OutputIteratorType iterator)
70{
71 return std::copy(begin, end, iterator);
72}
73
74
75
76template<class InputIteratorType, class OutputIteratorType, class UnaryFunction>
77inline OutputIteratorType
81 OutputIteratorType iterator,
82 UnaryFunction function)
83{
84 return std::transform(begin, end, iterator, function);
85}
86
87
88
89/**
90 * Get the underlying representation of the target XalanDOMString as a
91 * null-terminated string
92 *
93 * @deprecated This function is deprecated.
94 *
95 * @param theString target string
96 * @return null-terminated string of XalanDOMChar
97 */
98inline const XalanDOMChar*
100{
101 return theString.c_str();
102}
103
104
105
106/**
107 * Get the underlying representation of the target CharVectorType as a
108 * null-terminated string
109 *
110 * @param theString target string
111 * @return null-terminated string of chars
112 */
113inline const char*
115{
116 if (theString.empty() == true)
117 {
118 return 0;
119 }
120 else
121 {
122 const char* const ptr = &theString[0];
123
124 assert(ptr[theString.size() - 1] == '\0');
125
126 return ptr;
127 }
128}
129
130
131
132/**
133 * Get the underlying representation of the wide string as a
134 * UNICODE null-terminated string. This is here simply for
135 * consistency in the code. On certain platforms, compiler-
136 * generated wide strings will not contain Unicode code
137 * points. Another macro converts those into XalanDOMStrings,
138 * which are then transcoded. In these cases, the previous
139 * defined c_sstr() function gets called.
140 *
141 * On platforms where the compiler does generate Unicode wide
142 * strings, this function will be called instead.
143 *
144 * @deprecated This function is deprecated.
145 *
146 * @param theString target string
147 * @return null-terminated string of XalanDOMChar
148 */
149inline const XalanDOMChar*
151{
152 return theString;
153}
154
155
156
157/**
158 * Get the underlying representation of the target XalanDOMString as an array of
159 * XalanDOMChar, not guaranteed to be null-terminated.
160 *
161 * @deprecated This function is deprecated.
162 *
163 * @param theString target string
164 * @return array of XalanDOMChar
165 */
166inline const XalanDOMChar*
168{
169 return theString.c_str();
170}
171
172
173
174/**
175 * Get the underlying representation of a XalanDOMChar.
176 *
177 * @deprecated This function is deprecated.
178 *
179 * @param theString target string
180 * @return array of XalanDOMChar
181 */
182inline const XalanDOMChar*
184{
185 return theString;
186}
187
188
189
190/**
191 * Get the underlying representation of the target CharVectorType as a
192 * pointer to an array of characters
193 *
194 * @deprecated This function is deprecated.
195 *
196 * @param theString target string
197 * @return the pointer
198 */
199inline const char*
201{
202 return theString.empty() == true ? 0 : &theString[0];
203}
204
205
206
207/**
208 * Reserve some space in the string for more efficient
209 * concatenation...
210 *
211 * @deprecated This function is deprecated.
212 *
213 * @param theString target string
214 * @param theCount The amount of space to reserve
215 */
216inline void
223
224
225
226/**
227 * Get the length of a XalanDOMString
228 *
229 * @deprecated This function is deprecated.
230 *
231 * @param theString target string
232 * @return the length of the target string
233 */
234inline XalanDOMString::size_type
236{
237 return theString.length();
238}
239
240
241
242/**
243 * Get the length of a null-terminated string of
244 * XalanDOMChar characters
245 *
246 * @param theString target string
247 * @return the length of the target string
248 */
249inline XalanDOMString::size_type
251{
252 assert(theString != 0);
253
255
256 while(*theBufferPointer != 0)
257 {
259 }
260
262}
263
264
265
266/**
267 * Get the length of a null-terminated string.
268 *
269 * @param theString target string
270 * @return the length of the target string
271 */
272inline XalanDOMString::size_type
273length(const char* theString)
274{
275 assert(theString != 0);
276
277 return XalanDOMString::length(theString);
278}
279
280
281
282/**
283 * Determines if the target string contains any elements
284 *
285 * @deprecated This function is deprecated.
286 *
287 * @param str target string
288 * @return true if the target string has a non-zero length
289 */
290inline bool
292{
293 return str.empty();
294}
295
296
297
298/**
299 * Simulates the java String method indexOf().
300 *
301 * @param theString string to search
302 * @param theChar character searched for
303 * @return the index of theChar in theString,
304 * or length(theString) if the character is not
305 * found.
306 */
307inline XalanDOMString::size_type
309 const XalanDOMChar* theString,
311{
312 assert(theString != 0);
313
315
316 while(*thePointer != theChar && *thePointer != 0)
317 {
318 ++thePointer;
319 }
320
322}
323
324
325
326/**
327 * Simulates the java String method indexOf().
328 *
329 * @param theString string to search
330 * @param theStringLength the length of theString
331 * @param theChar character searched for
332 * @return the index of theChar in theString,
333 * or length(theString) if the character is not
334 * found.
335 */
336inline XalanDOMString::size_type
354
355
356
357/**
358 * Simulates the java String method indexOf().
359 *
360 * @param theString string to search
361 * @param theChar character searched for
362 * @return the index of theChar in theString,
363 * or length(theString) if the character is not
364 * found.
365 */
366inline XalanDOMString::size_type
370{
371 return theString.length() == 0 ? 0 : indexOf(theString.c_str(), theChar);
372}
373
374
375
376/**
377 * Simulates the java String method indexOf().
378 *
379 * @param theString string to search
380 * @param theStringLength length of the string to search
381 * @param theSubstring substring searched for
382 * @param theSubstringLength length of the substring searched for
383 * @return the index of theSubstring in theString,
384 * or length(theString) if the string is not
385 * found.
386 */
387XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(XalanDOMString::size_type)
388indexOf(
393
394
395
396/**
397 * Simulates the java String method indexOf().
398 *
399 * @param theString string to search
400 * @param theSubstring substring searched for
401 * @return the index of theSubstring in theString,
402 * or length(theString) if the string is not
403 * found.
404 */
414
415
416
417/**
418 * Simulates the java String method indexOf().
419 *
420 * @param theString string to search
421 * @param theSubstring substring searched for
422 * @return the index of theSubstring in theString,
423 * or length(theString) if the string is not
424 * found.
425 */
426XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(XalanDOMString::size_type)
427indexOf(
430
431
432
433/**
434 * Simulates the java String method lastIndexOf().
435 *
436 * @param theString string to search
437 * @param theChar character searched for
438 * @return the index of theChar in theString,
439 * or length(theString) if the character is not
440 * found.
441 */
442
444lastIndexOf(
447
448
449
450/**
451 * Simulates the java String method lastIndexOf().
452 *
453 * @param theString string to search
454 * @param theChar character searched for
455 * @return the index of theChar in theString,
456 * or length(theString) if the character is not
457 * found.
458 */
460lastIndexOf(
463{
464 return lastIndexOf(theString.c_str(), theChar);
465}
466
467
468
469/**
470 * Simulates the java String method startsWith().
471 *
472 * @param theString target string to search
473 * @param theStringLength the length of theString
474 * @param theSubstring substring searched for
475 * @param theSubstringLength the length of theSubstring
476 * @return true if the target string begins with the substring
477 */
479startsWith(
484
485
486
487/**
488 * Simulates the java String method startsWith().
489 *
490 * @param theDOMString target string to search
491 * @param theSubstring substring searched for
492 * @return true if the target string begins with the substring
493 */
494inline bool
503
504
505
506/**
507 * Simulates the java String method startsWith().
508 *
509 * @param theDOMString target string to search
510 * @param theSubstring substring searched for
511 * @return true if the target string begins with the substring
512 */
513inline bool
515 const XalanDOMChar* theString,
517{
518 assert(theString != 0);
519
520 return startsWith(
521 theString,
523 theSubstring.c_str(),
524 theSubstring.length());
525}
526
527
528
529/**
530 * Simulates the java String method startsWith().
531 *
532 * @param theDOMString target string to search
533 * @param theSubstring substring searched for
534 * @return true if the target string begins with the substring
535 */
536inline bool
540{
541 assert(theSubstring != 0);
542
543 return startsWith(
544 theString.c_str(),
545 theString.length(),
548}
549
550
551
552/**
553 * Simulates the java String method startsWith().
554 *
555 * @param theDOMString target string to search
556 * @param theSubstring substring searched for
557 * @param theSubstringLength the length of theSubstring
558 * @return true if the target string begins with the substring
559 */
560inline bool
574
575
576
577/**
578 * Simulates the java String method startsWith().
579 *
580 * @param theDOMString target string to search
581 * @param theSubstring substring searched for
582 * @return true if the target string begins with the substring
583 */
584inline bool
588{
589 return startsWith(
590 theString.c_str(),
591 theString.length(),
592 theSubstring.c_str(),
593 theSubstring.length());
594}
595
596
597
598/**
599 * Simulates the java String method endsWith().
600 *
601 * @param theString target string to search
602 * @param theSubstring substring searched for
603 * @return true if the target string ends with the substring
604 */
606endsWith(
611
612
613
614/**
615 * Simulates the java String method endsWith().
616 *
617 * @param theString target string to search
618 * @param theSubstring substring searched for
619 * @return true if the target string ends with the substring
620 */
621inline bool
622endsWith(
625{
626 assert(theString != 0 && theSubstring != 0);
627
628 return endsWith(
629 theString,
633}
634
635
636
637/**
638 * Simulates the java String method endsWith().
639 *
640 * @param theString target string to search
641 * @param theSubstring substring searched for
642 * @return true if the target string ends with the substring
643 */
644inline bool
648{
649 return endsWith(
650 theString.c_str(),
651 theString.length(),
652 theSubstring.c_str(),
653 theSubstring.length());
654}
655
656
657
658/**
659 * Converts a pointer into a XalanDOMString
660 *
661 * @param theValue pointer to be converted
662 * @param theResult the string to append with the result
663 * @return a reference to the passed string result.
664 */
666PointerToDOMString(
667 const void* theValue,
669
670
671
673{
674public:
675
677
678
679 static void
681
682 static void
684
685 static void
687 double theValue,
689 MemberFunctionPtr function);
690
691 static void
695 MemberFunctionPtr function);
696
697 static void
701 MemberFunctionPtr function);
702};
703
704
705
706/**
707 * Converts a double value into a XalanDOMString
708 *
709 * @param theValue number to be converted
710 * @param theResult the string to append with the result
711 * @return a reference to the passed string result.
712 */
714NumberToDOMString(
715 double theValue,
717
718
719
720/**
721 * Converts an 64-bit unsigned int value into a XalanDOMString
722 *
723 * @param theValue number to be converted
724 * @param theResult the string to append with the result
725 * @return a reference to the passed string result.
726 */
728NumberToDOMString(
731
732
733
734/**
735 * Converts an 64-bit signed int value into a XalanDOMString
736 *
737 * @param theValue number to be converted
738 * @param theResult the string to append with the result
739 * @return a reference to the passed string result.
740 */
742NumberToDOMString(
745
746
747
748/**
749 * Converts a 32-bit unsigned int value into a XalanDOMString
750 *
751 * @param theValue number to be converted
752 * @param theResult the string to append with the result
753 * @return a reference to the passed string result.
754 */
756NumberToDOMString(
759{
760 return NumberToDOMString(
761 static_cast<XMLUInt64>(theValue),
762 theResult);
763}
764
765
766
767/**
768 * Converts a 32-bit int value into a XalanDOMString
769 *
770 * @param theValue number to be converted
771 * @param theResult the string to append with the result
772 * @return a reference to the passed string result.
773 */
774inline XalanDOMString&
778{
779 return NumberToDOMString(
780 static_cast<XMLInt64>(theValue),
781 theResult);
782}
783
784
785
786/**
787 * Converts a 16-bit unsigned int value into a XalanDOMString
788 *
789 * @param theValue number to be converted
790 * @param theResult the string to append with the result
791 * @return a reference to the passed string result.
792 */
793inline XalanDOMString&
802
803
804
805/**
806 * Converts a 16-bit int value into a XalanDOMString
807 *
808 * @param theValue number to be converted
809 * @param theResult the string to append with the result
810 * @return a reference to the passed string result.
811 */
812inline XalanDOMString&
816{
817 return NumberToDOMString(
818 static_cast<XMLInt64>(theValue),
819 theResult);
820}
821
822
823
824/**
825 * Converts an 64-bit unsigned int value into a XalanDOMString
826 *
827 * @param theValue number to be converted
828 * @param theResult the string to append with the result
829 * @return a reference to the passed string result.
830 */
832NumberToHexDOMString(
835
836
837
838/**
839 * Converts an 64-bit signed int value into a XalanDOMString
840 *
841 * @param theValue number to be converted
842 * @param theResult the string to append with the result
843 * @return a reference to the passed string result.
844 */
846NumberToHexDOMString(
849
850
851
852/**
853 * Converts a 32-bit unsigned int value into a XalanDOMString
854 *
855 * @param theValue number to be converted
856 * @param theResult the string to append with the result
857 * @return a reference to the passed string result.
858 */
860NumberToHexDOMString(
863{
865 static_cast<XMLUInt64>(theValue),
866 theResult);
867}
868
869
870
871/**
872 * Converts a 32-bit signed int value into a XalanDOMString
873 *
874 * @param theValue number to be converted
875 * @param theResult the string to append with the result
876 * @return a reference to the passed string result.
877 */
878inline XalanDOMString&
887
888
889
890/**
891 * Converts a 16-bit unsigned int value into a XalanDOMString
892 *
893 * @param theValue number to be converted
894 * @param theResult the string to append with the result
895 * @return a reference to the passed string result.
896 */
897inline XalanDOMString&
906
907
908
909/**
910 * Converts a 16-bit signed int value into a XalanDOMString
911 *
912 * @param theValue number to be converted
913 * @param theResult the string to append with the result
914 * @return a reference to the passed string result.
915 */
916inline XalanDOMString&
925
926
927
928/**
929 * Converts a wide string into an integer value
930 *
931 * @param theString target string
932 * @return integer value of target string
933 */
935WideStringToInt(const XalanDOMChar* theString);
936
937
938
939/**
940 * Converts a wide string into a long value
941 *
942 * @param theString target string
943 * @return long value of target string
944 */
946WideStringToLong(const XalanDOMChar* theString);
947
948
949
950/**
951 * Converts a wide string into an unsigned long value
952 *
953 * @param theString target string
954 * @return unsigned long value of target string
955 */
957WideStringToUnsignedLong(const XalanDOMChar* theString);
958
959
960
961/**
962 * Converts a wide string into a double value
963 *
964 * @param theString target string
965 * @param theMemoryManager The MemoryManager instance to use.
966 * @return double value of target string
967 */
969WideStringToDouble(
971 MemoryManager& theMemoryManager);
972
973
974
975/**
976 * Converts a XalanDOMString into an integer value
977 *
978 * @param theString target string
979 * @return integer value of target string
980 */
981inline int
983{
984 return WideStringToInt(theString.c_str());
985}
986
987
988
989/**
990 * Converts a XalanDOMString into a long value
991 *
992 * @param theString target string
993 * @return long value of target string
994 */
995inline long
1000
1001
1002
1003/**
1004 * Converts a XalanDOMString into a long value
1005 *
1006 * @param theString target string
1007 * @return unsigned long value of target string
1008 */
1009inline unsigned long
1014
1015
1016
1017/**
1018 * Converts a XalanDOMString into a double value
1019 *
1020 * @param theString target string
1021 * @param theMemoryManager The MemoryManager instance to use.
1022 * @return double value of target string
1023 */
1024inline double
1027 MemoryManager& theMemoryManager)
1028{
1029 return WideStringToDouble(
1030 theString.c_str(),
1032}
1033
1034
1035
1036/**
1037 * Outputs the target string to the specified stream
1038 *
1039 * @param theStream output stream
1040 * @param theString target string
1041 * @see operator<<
1042 */
1044OutputString(
1047
1048
1049
1050/**
1051 * Outputs the target string to the specified stream
1052 *
1053 * @param theStream output stream
1054 * @param theString target string
1055 * @see operator<<
1056 */
1058OutputString(
1059 std::ostream& theStream,
1061
1062
1063
1064/**
1065 * Outputs the target string to the specified stream
1066 *
1067 * @param theStream output stream
1068 * @param theString target string
1069 * @see operator<<
1070 */
1072OutputString(
1075
1076
1077
1078/**
1079 * Outputs the target string to the specified stream
1080 *
1081 * @param theStream output stream
1082 * @param theString target string
1083 * @see operator<<
1084 */
1086OutputString(
1087 std::ostream& theStream,
1089 MemoryManager& theMemoryManager);
1090
1091
1092
1093/**
1094 * Outputs the target string to the specified stream
1095 *
1096 * @param theStream output stream
1097 * @param theString target string
1098 * @see operator<<
1099 */
1100inline void
1101OutputString(
1104{
1105 if (theString.empty() == false)
1106 {
1108 theStream,
1109 theString.c_str());
1110 }
1111}
1112
1113
1114
1115/**
1116 * Outputs the target string to the specified stream
1117 *
1118 * @param theStream output stream
1119 * @param theString target string
1120 * @param theMemoryManager The MemoryManager instance to use.
1121 * @see operator<<
1122 */
1123inline void
1125 std::ostream& theStream,
1127 MemoryManager& theMemoryManager)
1128{
1130 theStream,
1131 theString.c_str(),
1133}
1134
1135
1136
1137/**
1138 * Outputs the string to the specified stream
1139 *
1140 * @param theStream output stream
1141 * @param theString the string to output
1142 * @see OutputString
1143 */
1148{
1150 theStream,
1151 theString);
1152
1153 return theStream;
1154}
1155
1156
1157
1158/**
1159 * Outputs the string to the specified stream
1160 *
1161 * @param theStream output stream
1162 * @param theString the string to output
1163 * @see OutputString
1164 */
1165inline std::ostream&
1167 std::ostream& theStream,
1169{
1171 theStream,
1172 theString);
1173
1174 return theStream;
1175}
1176
1177
1178
1179/**
1180 * Outputs the target string to the specified stream
1181 *
1182 * @param theStream output stream
1183 * @param theString target string
1184 * @see OutputString
1185 */
1189 const XalanDOMChar* theString)
1190{
1192 theStream,
1193 theString);
1194
1195 return theStream;
1196}
1197
1198
1199
1200/**
1201 * Outputs the target string to the specified stream
1202 *
1203 * @param theStream output stream
1204 * @param theString target string
1205 * @see OutputString
1206 */
1207inline std::ostream&
1209 std::ostream& theStream,
1210 const XalanDOMChar* theString)
1211{
1213 theStream,
1214 theString,
1215 XalanMemMgrs::getDefault());
1216
1217 return theStream;
1218}
1219
1220
1221
1222/**
1223 * Outputs the target string to the specified stream
1224 *
1225 * @param theStream output stream
1226 * @param theString target string
1227 * @see OutputString
1228 */
1233{
1235 theString);
1236
1237 return theStream;
1238}
1239
1240
1241
1242/**
1243 * Outputs the target string to the specified stream
1244 *
1245 * @param theStream output stream
1246 * @param theString target string
1247 * @see OutputString
1248 */
1249inline std::ostream&
1251 std::ostream& theStream,
1253{
1255 theStream,
1256 theString,
1257 XalanMemMgrs::getDefault());
1258
1259 return theStream;
1260}
1261
1262
1263
1264/**
1265 * Outputs the target string to the specified stream
1266 *
1267 * @param theStream output stream
1268 * @param theString target string
1269 * @see OutputString
1270 */
1271inline std::ostream&
1273 std::ostream& theStream,
1275{
1277 theStream,
1278 theString,
1280
1281 return theStream;
1282}
1283
1284
1285
1286/**
1287 * Retrieves a character at a specified index in the target string
1288 *
1289 * @deprecated This function is deprecated.
1290 *
1291 * @param theString target string
1292 * @param theIndex index of character
1293 * @return character at specified index
1294 */
1295inline XalanDOMChar
1302
1303
1304
1305/**
1306 * Determines whether character represents white space
1307 *
1308 * @param theChar target character
1309 * @return true if character represents white space
1310 */
1311inline bool
1313{
1314 return XalanXMLChar::isWhitespace(theChar);
1315}
1316
1317
1318
1319/**
1320 * Determines whether character represents a digit
1321 *
1322 * @param theChar target character
1323 * @return true if character represents a digit
1324 */
1325inline bool
1327{
1328 return XalanXMLChar::isDigit(theChar);
1329}
1330
1331
1332
1333/**
1334 * Determines whether character represents a letter or digit
1335 *
1336 * @param theChar target character
1337 * @return true if character represents a letter or digit
1338 */
1339inline bool
1341{
1342 return XalanXMLChar::isDigit(theChar) ||
1343 XalanXMLChar::isLetter(theChar);
1344}
1345
1346
1347
1348
1349
1350
1351/**
1352 * Simulates the java String method substring(). Returns a new string that is
1353 * a substring of this string. The substring begins at the specified
1354 * theStartIndex and extends to the character at index theEndIndex - 1. Thus
1355 * the length of the substring is theEndIndex - theStartIndex.
1356 *
1357 * @param theString source string
1358 * @param theSubstring target string
1359 * @param theStartIndex starting index, inclusive
1360 * @param theEndIndex ending index, exclusive
1361 * @return A reference to theSubstring
1362 */
1364substring(
1369
1370
1371
1372/**
1373 * Simulates the java String method substring(). Returns a new string that is
1374 * a substring of this string. The substring begins at the specified
1375 * theStartIndex and extends to the character at index theEndIndex - 1. Thus
1376 * the length of the substring is theEndIndex - theStartIndex.
1377 *
1378 * @param theString source string
1379 * @param theSubstring target string
1380 * @param theStartIndex starting index, inclusive
1381 * @param theEndIndex ending index, exclusive
1382 */
1384substring(
1389
1390
1391
1392/**
1393 * Simulates the java String method substring(). Returns a new string that is
1394 * a substring of this string. The substring begins at the specified
1395 * theStartIndex and extends to the character at index theEndIndex - 1. Thus
1396 * the length of the substring is theEndIndex-theStartIndex.
1397 *
1398 * @param theString source string
1399 * @param theStartIndex starting index, inclusive
1400 * @param theEndIndex ending index, exclusive
1401 * @return string containing the specified range of characters from target
1402 */
1404substring(
1409
1410
1411
1412/**
1413 * Converts ASCII alphabetic characters from upper case to
1414 * lower case. This function works only with the Unicode
1415 * characters A-Z.
1416 *
1417 * @param theString target string
1418 * @return string containing lower case characters
1419 */
1422{
1423 if (theChar >= XalanUnicode::charLetter_A && theChar <= XalanUnicode::charLetter_Z)
1424 {
1425 return XalanDOMChar(theChar - (XalanUnicode::charLetter_A - XalanUnicode::charLetter_a));
1426 }
1427 else
1428 {
1429 return theChar;
1430 }
1431}
1432
1433
1434
1435/**
1436 * Converts ASCII alphabetic characters from lower case to
1437 * upper case. This function works only with the Unicode
1438 * characters a-z.
1439 *
1440 * @param theString target string
1441 * @return string containing upper case characters
1442 */
1443inline XalanDOMChar
1445{
1446 if (theChar >= XalanUnicode::charLetter_a && theChar <= XalanUnicode::charLetter_z)
1447 {
1448 return XalanDOMChar(theChar + (XalanUnicode::charLetter_A - XalanUnicode::charLetter_a));
1449 }
1450 else
1451 {
1452 return theChar;
1453 }
1454}
1455
1456
1457
1458/**
1459 * Flips the case to of the supplied character. This function works only with
1460 * the Unicode characters A-Z and a-z.
1461 *
1462 * @param theString target string
1463 * @return string containing lower case characters
1464 */
1465inline XalanDOMChar
1467{
1468 if (theChar >= XalanUnicode::charLetter_A && theChar <= XalanUnicode::charLetter_Z)
1469 {
1470 return XalanDOMChar(theChar - (XalanUnicode::charLetter_A - XalanUnicode::charLetter_a));
1471 }
1472 else if (theChar >= XalanUnicode::charLetter_a && theChar <= XalanUnicode::charLetter_z)
1473 {
1474 return XalanDOMChar(theChar + (XalanUnicode::charLetter_A - XalanUnicode::charLetter_a));
1475 }
1476 else
1477 {
1478 return theChar;
1479 }
1480}
1481
1482
1483
1484/**
1485 * Converts ASCII alphabetic characters from upper case to
1486 * lower case. This function works only with the characters
1487 * a-z and A-Z.
1488 *
1489 * @param theString The source string
1490 * @param theResult The target string
1491 * @return A reference to theResult
1492 */
1494toLowerCaseASCII(
1497
1498
1499
1500/**
1501 * Converts ASCII alphabetic characters from upper case to
1502 * lower case. This function works only with the characters
1503 * a-z and A-Z.
1504 *
1505 * @param theString The source string
1506 * @param theResult The target string
1507 * @return A reference to theResult
1508 */
1510toLowerCaseASCII(
1513
1514
1515
1516/**
1517 * Converts ASCII alphabetic characters from upper case to
1518 * lower case. This function works only with the characters
1519 * a-z and A-Z.
1520 *
1521 * @param theString The string to convert
1522 * @return A reference to theString
1523 */
1525toLowerCaseASCII(XalanDOMString& theString);
1526
1527
1528
1529/**
1530 * Converts ASCII alphabetic characters from lower case to
1531 * upper case. This function works only with the characters
1532 * a-z and A-Z.
1533 *
1534 * @param theString The source string
1535 * @param theResult The target string
1536 * @return A reference to theResult
1537 */
1539toUpperCaseASCII(
1542
1543
1544
1545/**
1546 * Converts ASCII alphabetic characters from lower case to
1547 * upper case. This function works only with the characters
1548 * a-z and A-Z.
1549 *
1550 * @param theString The source string
1551 * @param theResult The target string
1552 * @return A reference to theResult
1553 */
1555toUpperCaseASCII(
1558
1559
1560
1561/**
1562 * Converts ASCII alphabetic characters from lower case to
1563 * upper case. This function works only with the characters
1564 * a-z and A-Z.
1565 *
1566 * @param theString The string to convert
1567 * @return A reference to theString
1568 */
1570toUpperCaseASCII(XalanDOMString& theString);
1571
1572
1573
1574/**
1575 * Compare the contents of two strings.
1576 *
1577 * THIS FUNCTION DOES NOT COMPARE STRINGS LIKE strcmp() OR ANY
1578 * OTHER "COLLATION" ALGORITHM.
1579 *
1580 * @param theLHS first string to compare
1581 * @param theRHS second string to compare
1582 * @return Returns 0 for equal strings, less than 0 if theLHS is less
1583 * than theRHS, or greater than 0 if theRHS is greater than theLHS.
1584 * @see operator<()
1585 */
1587compare(
1590
1591
1592
1593/**
1594 * Compare the contents of two character arrays.
1595 *
1596 * THIS FUNCTION DOES NOT COMPARE STRINGS LIKE strcmp() OR ANY
1597 * OTHER "COLLATION" ALGORITHM.
1598 *
1599 * @param theLHS first array to compare
1600 * @param theLHSLength the length of the first array
1601 * @param theRHS second array to compare
1602 * @param theRHSLength the length of the second array
1603 * @return Returns 0 for equal arrays, less than 0 if theLHS is less
1604 * than theRHS, or greater than 0 if theRHS is greater than theLHS.
1605 */
1607compare(
1612
1613
1614
1615/**
1616 * Compare the contents of two null-terminated strings.
1617 *
1618 * THIS FUNCTION DOES NOT COMPARE STRINGS LIKE strcmp() OR ANY
1619 * OTHER "COLLATION" ALGORITHM.
1620 *
1621 * @param theLHS first string to compare
1622 * @param theRHS second string to compare
1623 * @return Returns 0 for equal strings, less than 0 if theLHS is less
1624 * than theRHS, or greater than 0 if theRHS is greater than theLHS.
1625 */
1626inline int
1627compare(
1630{
1632}
1633
1634
1635
1636/**
1637 * Compare the contents of two strings.
1638 *
1639 * THIS FUNCTION DOES NOT COMPARE STRINGS LIKE strcmp() OR ANY
1640 * OTHER "COLLATION" ALGORITHM.
1641 *
1642 * @param theLHS first string to compare
1643 * @param theRHS second string to compare
1644 * @return Returns 0 for equal strings, less than 0 if theLHS is less
1645 * than theRHS, or greater than 0 if theRHS is greater than theLHS.
1646 * @see operator<()
1647 * @see collationCompare()
1648 */
1649inline int
1651 const XalanDOMString& theLHS,
1652 const XalanDOMString& theRHS)
1653{
1654 return compare(
1655 theLHS.c_str(),
1656 theLHS.length(),
1657 theRHS.c_str(),
1658 theRHS.length());
1659}
1660
1661
1662
1663/**
1664 * Compare the contents of two strings.
1665 *
1666 * THIS FUNCTION DOES NOT COMPARE STRINGS LIKE strcmp() OR ANY
1667 * OTHER "COLLATION" ALGORITHM.
1668 *
1669 * @param theLHS first string to compare
1670 * @param theRHS second string to compare
1671 * @return Returns 0 for equal strings, less than 0 if theLHS is less
1672 * than theRHS, or greater than 0 if theRHS is greater than theLHS.
1673 */
1674inline int
1676 const XalanDOMChar* theLHS,
1677 const XalanDOMString& theRHS)
1678{
1679 return compare(
1680 theLHS,
1681 length(theLHS),
1682 theRHS.c_str(),
1683 theRHS.length());
1684}
1685
1686
1687
1688/**
1689 * Compare the contents of two strings.
1690 *
1691 * THIS FUNCTION DOES NOT COMPARE STRINGS LIKE strcmp() OR ANY
1692 * OTHER "COLLATION" ALGORITHM.
1693 *
1694 * @param theLHS first string to compare
1695 * @param theRHS second string to compare
1696 * @return Returns 0 for equal strings, less than 0 if theLHS is less
1697 * than theRHS, or greater than 0 if theRHS is greater than theLHS.
1698 */
1699inline int
1701 const XalanDOMString& theLHS,
1702 const XalanDOMChar* theRHS)
1703{
1704 return compare(
1705 theLHS.c_str(),
1706 theLHS.length(),
1707 theRHS,
1708 length(theRHS));
1709}
1710
1711
1712
1713/**
1714 * Compare the contents of two arrays in a case insensitive
1715 * manner. Only the characters a-z and A-Z are considered as
1716 * characters with "case".
1717 *
1718 * THIS FUNCTION DOES NOT COMPARE STRINGS LIKE strcmp() OR ANY
1719 * OTHER "COLLATION" ALGORITHM.
1720 *
1721 * @param theLHS first array to compare
1722 * @param theLHSLength the length of the first array
1723 * @param theRHS second array to compare
1724 * @param theRHSLength the length of the second array
1725 * @return Returns 0 for equal arrays, less than 0 if theLHS is less
1726 * than theRHS, or greater than 0 if theRHS is greater than theLHS.
1727 */
1729compareIgnoreCaseASCII(
1734
1735
1736
1737/**
1738 * Compare the contents of two strings, in a case insensitive
1739 * manner. Only the characters a-z and A-Z are considered as
1740 * characters with "case".
1741 *
1742 * THIS FUNCTION DOES NOT COMPARE STRINGS LIKE strcmp() OR ANY
1743 * OTHER "COLLATION" ALGORITHM.
1744 *
1745 * @param theLHS first string to compare
1746 * @param theRHS second string to compare
1747 * @return Returns 0 for equal strings, less than 0 if theLHS is less
1748 * than theRHS, or greater than 0 if theRHS is greater than theLHS.
1749 */
1750inline int
1751compareIgnoreCaseASCII(
1754{
1756}
1757
1758
1759
1760/**
1761 * Compare the contents of two strings, in a case insensitive
1762 * manner. Only the characters a-z and A-Z are considered as
1763 * characters with "case".
1764 *
1765 * THIS FUNCTION DOES NOT COMPARE STRINGS LIKE strcmp() OR ANY
1766 * OTHER "COLLATION" ALGORITHM.
1767 *
1768 * @param theLHS first string to compare
1769 * @param theRHS second string to compare
1770 * @return Returns 0 for equal strings, less than 0 if theLHS is less
1771 * than theRHS, or greater than 0 if theRHS is greater than theLHS.
1772 * @see operator<
1773 * @see collationCompare
1774 */
1775inline int
1777 const XalanDOMString& theLHS,
1778 const XalanDOMString& theRHS)
1779{
1781 theLHS.c_str(),
1782 theLHS.length(),
1783 theRHS.c_str(),
1784 theRHS.length());
1785}
1786
1787
1788
1789/**
1790 * Compare the contents of two strings, in a case insensitive
1791 * manner. Only the characters a-z and A-Z are considered as
1792 * characters with "case".
1793 *
1794 * THIS FUNCTION DOES NOT COMPARE STRINGS LIKE strcmp() OR ANY
1795 * OTHER "COLLATION" ALGORITHM.
1796 *
1797 * @param theLHS first string to compare
1798 * @param theRHS second string to compare
1799 * @return Returns 0 for equal strings, less than 0 if theLHS is less
1800 * than theRHS, or greater than 0 if theRHS is greater than theLHS.
1801 */
1802inline int
1804 const XalanDOMString& theLHS,
1805 const XalanDOMChar* theRHS)
1806{
1808 theLHS.c_str(),
1809 theLHS.length(),
1810 theRHS,
1811 length(theRHS));
1812}
1813
1814
1815
1816/**
1817 * Compare the contents of two strings, in a case insensitive
1818 * manner. Only the characters a-z and A-Z are considered for
1819 * the comparison.
1820 *
1821 * THIS FUNCTION DOES NOT COMPARE STRINGS LIKE strcmp() OR ANY
1822 * OTHER "COLLATION" ALGORITHM.
1823 *
1824 * @param theLHS first string to compare
1825 * @param theRHS second string to compare
1826 * @return Returns 0 for equal strings, less than 0 if theLHS is less
1827 * than theRHS, or greater than 0 if theRHS is greater than theLHS.
1828 */
1829inline int
1831 const XalanDOMChar* theLHS,
1832 const XalanDOMString& theRHS)
1833{
1835 theLHS,
1836 length(theLHS),
1837 theRHS.c_str(),
1838 theRHS.length());
1839}
1840
1841
1842
1843/**
1844 * Compare the contents of two character arrays.
1845 *
1846 * @param theLHS first array to compare
1847 * @param theLHSLength the length of the first array
1848 * @param theRHS second array to compare
1849 * @param theRHSLength the length of the second array
1850 * @return Returns 0 for equal arrays, less than 0 if theLHS is less
1851 * than theRHS, or greater than 0 if theRHS is greater than theLHS.
1852 */
1854collationCompare(
1859
1860
1861
1862/**
1863 * Compare the contents of two strings.
1864 *
1865 * @param theLHS first string to compare
1866 * @param theRHS second string to compare
1867 * @return Returns 0 for equal strings, less than 0 if theLHS is less
1868 * than theRHS, or greater than 0 if theRHS is greater than theLHS.
1869 * @see operator<()
1870 * @see compare()
1871 */
1873collationCompare(
1876
1877
1878
1879/**
1880 * Compare the contents of two strings.
1881 *
1882 * @param theLHS first string to compare
1883 * @param theRHS second string to compare
1884 * @return Returns 0 for equal strings, less than 0 if theLHS is less
1885 * than theRHS, or greater than 0 if theRHS is greater than theLHS.
1886 * @see operator<()
1887 * @see compare()
1888 */
1889inline int
1890collationCompare(
1893{
1894 return collationCompare(theLHS.c_str(), theRHS.c_str());
1895}
1896
1897
1898
1899/**
1900 * Compare the contents of two strings.
1901 *
1902 * @param theLHS first string to compare
1903 * @param theRHS second string to compare
1904 * @return Returns 0 for equal strings, less than 0 if theLHS is less
1905 * than theRHS, or greater than 0 if theRHS is greater than theLHS.
1906 */
1907inline int
1909 const XalanDOMChar* theLHS,
1910 const XalanDOMString& theRHS)
1911{
1912 return collationCompare(theLHS, theRHS.c_str());
1913}
1914
1915
1916
1917/**
1918 * Compare the contents of two strings.
1919 *
1920 * @param theLHS first string to compare
1921 * @param theRHS second string to compare
1922 * @return Returns 0 for equal strings, less than 0 if theLHS is less
1923 * than theRHS, or greater than 0 if theRHS is greater than theLHS.
1924 */
1925inline int
1927 const XalanDOMString& theLHS,
1928 const XalanDOMChar* theRHS)
1929{
1930 return collationCompare(
1931 theLHS.c_str(),
1932 theLHS.length(),
1933 theRHS,
1934 length(theRHS));
1935}
1936
1937
1938
1939/**
1940 * Compare the contents of two arrays for equality
1941 *
1942 * @param theLHS first array to compare
1943 * @param theRHS second array to compare
1944 * @param theLength the length of the arrays
1945 * @return true if the contents of both arrays are identical
1946 */
1948equals(
1952
1953
1954
1955/**
1956 * Compare the contents of two arrays for equality
1957 *
1958 * @param theLHS first array to compare
1959 * @param theLHSLength the length of the theLHS
1960 * @param theRHS second array to compare
1961 * @param theRHSLength the length of the theRHS
1962 * @return true if the contents of both arrays are identical
1963 */
1964inline bool
1973
1974
1975
1976/**
1977 * Compare the contents of two strings for equality
1978 *
1979 * @param theLHS first string to compare
1980 * @param theRHS second string to compare
1981 * @return true if the contents of both strings are identical
1982 */
1983inline bool
1992
1993
1994
1995/**
1996 * Compare the contents of two strings for equality
1997 *
1998 * @param theLHS first string to compare
1999 * @param theRHS second string to compare
2000 * @return true if the contents of both strings are identical
2001 */
2002inline bool
2004 const XalanDOMString& theLHS,
2005 const XalanDOMString& theRHS)
2006{
2007 return theLHS == theRHS;
2008}
2009
2010
2011
2012/**
2013 * Compare the contents of two strings for equality
2014 *
2015 * @param theLHS first string to compare
2016 * @param theRHS second string to compare
2017 * @return true if the contents of both strings are identical
2018 */
2019inline bool
2021 const XalanDOMChar* theLHS,
2022 const XalanDOMString& theRHS)
2023{
2024 assert(theLHS != 0);
2025
2026 // Swap them...
2027 return theRHS == theLHS;
2028}
2029
2030
2031
2032/**
2033 * Compare the contents of two strings for equality
2034 *
2035 * @param theLHS first string to compare
2036 * @param theRHS second string to compare
2037 * @return true if the contents of both strings are identical
2038 */
2039inline bool
2041 const XalanDOMChar* theRHS)
2042{
2043 return equals(theRHS, theLHS);
2044}
2045
2046
2047
2048/**
2049 * Compare the contents of two strings for equality
2050 *
2051 * @param theLHS first string to compare
2052 * @param theRHS second string to compare
2053 * @param theRHSLength the length of the theRHS
2054 * @return true if the contents of both strings are identical
2055 */
2056inline bool
2058 const XalanDOMString& theLHS,
2059 const XalanDOMChar* theRHS,
2061{
2062 return theRHSLength != theLHS.length() ? false : equals(theLHS.c_str(), theRHSLength, theRHS, theRHSLength);
2063}
2064
2065
2066
2067
2068/**
2069 * Compare the contents of two arrays for equality, without regard for case.
2070 * Only the characters a-z and A-Z are considered characters with "case".
2071 *
2072 * @param theLHS first string to compare
2073 * @param theRHS second string to compare
2074 * @return true if the case-insensitive contents of both strings are identical
2075 */
2077equalsIgnoreCaseASCII(
2081
2082
2083
2084/**
2085 * Compare the contents of two strings for equality, without regard for case.
2086 * Only the characters a-z and A-Z are considered characters with "case".
2087 *
2088 * @param theLHS first string to compare
2089 * @param theLHSLength the length of the theLHS
2090 * @param theRHS second string to compare
2091 * @param theRHSLength the length of the theRHS
2092 * @return true if both strings are identical
2093 */
2094inline bool
2104
2105
2106
2107/**
2108 * Compare the contents of two strings for equality, without regard for case.
2109 * Only the characters a-z and A-Z are considered characters with "case".
2110 *
2111 * @param theLHS first string to compare
2112 * @param theRHS second string to compare
2113 * @return true if both strings are identical
2114 */
2115inline bool
2125
2126
2127
2128/**
2129 * Compare the contents of two strings for equality, without regard for case
2130 * Only the characters A-Z and a-z are considered.
2131 *
2132 * @param theLHS first string to compare
2133 * @param theRHS second string to compare
2134 * @return true if the case-insensitive contents of both strings are identical
2135 */
2136inline bool
2138 const XalanDOMString& theLHS,
2139 const XalanDOMString& theRHS)
2140{
2142
2143 return theLength != theRHS.length() ? false :
2145 theLHS.c_str(),
2146 theRHS.c_str(),
2147 theLength);
2148}
2149
2150
2151
2152/**
2153 * Compare the contents of two strings for equality, without regard for case.
2154 * Only the characters a-z and A-Z are considered characters with "case".
2155 *
2156 * @param theLHS first string to compare
2157 * @param theRHS second string to compare
2158 * @return true if the case-insensitive contents of both strings are identical
2159 */
2160inline bool
2162 const XalanDOMChar* theLHS,
2163 const XalanDOMString& theRHS)
2164{
2166
2167 return theRHSLength != length(theLHS) ? false :
2169 theLHS,
2170 theRHS.c_str(),
2171 theRHSLength);
2172}
2173
2174
2175
2176/**
2177 * Compare the contents of two strings for equality, without regard for case.
2178 * Only the characters A-Z and a-z are considered.
2179 *
2180 * @param theLHS first string to compare
2181 * @param theRHS second string to compare
2182 * @return true if the case-insensitive contents of both strings are identical
2183 */
2184inline bool
2191
2192
2193
2194/**
2195 * Implements operator< for CharVectorType.
2196 *
2197 * @param theLHS first string to compare
2198 * @param theRHS second string to compare
2199 * @return Returns true if theLHS is lexically
2200 * less than theRHS
2201 * @see compare
2202 */
2203inline bool
2204operator<(
2205 const CharVectorType& theLHS,
2206 const CharVectorType& theRHS)
2207{
2208 return compare(theLHS, theRHS) < 0 ? true : false;
2209}
2210
2211
2212
2213/**
2214 * Implements operator< for DOMStrings.
2215 *
2216 * @param theLHS first string to compare
2217 * @param theRHS second string to compare
2218 * @return Returns true if theLHS is lexically
2219 * less than theRHS
2220 * @see compare
2221 */
2222inline bool
2223operator<(
2224 const XalanDOMString& theLHS,
2225 const XalanDOMString& theRHS)
2226{
2227 return compare(theLHS, theRHS) < 0 ? true : false;
2228}
2229
2230
2231
2232/**
2233 * Assign one string to another
2234 *
2235 * @deprecated This function is deprecated.
2236 *
2237 * @param theString target string
2238 * @param theStringToAppend string to assign
2239 * @param theStringToAppendLength length of the string (XalanDOMString::npos implies the string is null-terminated)
2240 * @return a reference to the target string
2241 */
2242inline XalanDOMString&
2246{
2248
2249 return theString;
2250}
2251
2252
2253
2254/**
2255 * Assign one string to another
2256 *
2257 * @deprecated This function is deprecated.
2258 *
2259 * @param theString target string
2260 * @param theStringToAppend string to assign
2261 * @param theStringToAppendLength length of the string (XalanDOMString::npos implies the string is null-terminated)
2262 * @return a reference to the target string
2263 */
2264inline XalanDOMString&
2269{
2270 if (theStringToAssignLength == XalanDOMString::npos)
2271 {
2273 }
2274 else
2275 {
2277 }
2278
2279 return theString;
2280}
2281
2282
2283
2284/**
2285 * Concatenate two strings
2286 *
2287 * @deprecated This function is deprecated.
2288 *
2289 * @param theString target string
2290 * @param theStringToAppend string to add to target
2291 * @return a reference to the target string
2292 */
2293inline XalanDOMString&
2297{
2299
2300 return theString;
2301}
2302
2303
2304
2305/**
2306 * Concatenate two strings
2307 *
2308 * @deprecated This function is deprecated.
2309 *
2310 * @param theString target string
2311 * @param theStringToAppend string to add to target
2312 * @param theStringToAppendLength length of the string (XalanDOMString::npos implies the string is null-terminated)
2313 * @return a reference to the target string
2314 */
2315inline XalanDOMString&
2320{
2322
2323 if (theStringToAppendLength == XalanDOMString::npos)
2324 {
2326 }
2327 else
2328 {
2330 }
2331
2332 return theString;
2333}
2334
2335
2336
2337/**
2338 * Concatenate two strings
2339 *
2340 * @deprecated This function is deprecated.
2341 *
2342 * @param theString target string
2343 * @param theStringToAppend string to add to target
2344 * @param theStringToAppendLength length of the string (XalanDOMString::npos implies the string is null-terminated)
2345 * @return string with contents of 'theStringToAppend' added to target string
2346 */
2347inline XalanDOMString&
2361
2362
2363
2364/**
2365 * Concatenate a string and a character
2366 *
2367 * @deprecated This function is deprecated.
2368 *
2369 * @param theString target string
2370 * @param theCharToAppend the character to add to the target
2371 * @return string with the character appended
2372 */
2373inline XalanDOMString&
2377{
2378 theString.append(1, theCharToAppend);
2379
2380 return theString;
2381}
2382
2383
2384
2385/**
2386 * Concatenate a string and a character
2387 *
2388 * @deprecated This function is deprecated.
2389 *
2390 * @param theString target string
2391 * @param theCharToAppend the character to add to the target
2392 * @return string with the character appended
2393 */
2394inline XalanDOMString&
2397 char theCharToAppend)
2398{
2399 // We have to transcode before appending...
2400 char theTempBuffer[] = { theCharToAppend, '\0' };
2401
2403}
2404
2405
2406
2407/**
2408 * Insert a string into another string.
2409 *
2410 * @deprecated This function is deprecated.
2411 *
2412 * @param theString target string
2413 * @param thePosition The position in the target string to insert
2414 * @param theStringToInsert The string to insert
2415 * @return A reference to the target string
2416 */
2417inline XalanDOMString&
2427
2428
2429
2430/**
2431 * Insert a string into another string.
2432 *
2433 * @deprecated This function is deprecated.
2434 *
2435 * @param theString target string
2436 * @param thePosition The position in the target string to insert
2437 * @param theStringToInsert The string to insert
2438 * @return A reference to the target string
2439 */
2440inline XalanDOMString&
2450
2451
2452
2453/**
2454 * Remove leading and trailing whitespace.
2455 *
2456 * @param theString The string to trim.
2457 * @param theResult The result string.
2458 * @return A reference to theResult.
2459 */
2461trim(
2464
2465
2466
2467/**
2468 * Remove all elements from target string
2469 *
2470 * @deprecated This function is deprecated.
2471 *
2472 * @param theString target string
2473 */
2474inline void
2476{
2477 theString.clear();
2478}
2479
2480
2481
2482/**
2483 * Remove all elements from target string
2484 *
2485 * @deprecated This function is deprecated.
2486 *
2487 * @param theString target string
2488 */
2489inline void
2491{
2492 theString.erase();
2493}
2494
2495
2496
2497/**
2498 * Remove all elements from target string
2499 * and frees all allocated memory.
2500 *
2501 * @param theString target string
2502 */
2503inline void
2508
2509
2510
2512CopyWideStringToVector(
2515
2516
2517
2519CopyStringToVector(
2520 const char* theString,
2522
2523
2524
2525/**
2526 * Utility function to make a null-terminated vector of XMLChs, from a
2527 * null-terminated array of chars, via transcoding, if requested.
2528 *
2529 * @param data array to be converted
2530 * @param whether or not to transcode
2531 * @return null-terminated vector of XalanDOMChar
2532 */
2534MakeXalanDOMCharVector(
2535 const char* data,
2537 bool fTranscode = true);
2538
2539
2540
2541/**
2542 * Utility function to make a null-terminated vector of XMLChs, from a
2543 * null-terminated array of XalanDOMChar.
2544 *
2545 * @param data array to be converted
2546 * @return null-terminated vector of XalanDOMChar
2547 */
2549MakeXalanDOMCharVector(const XalanDOMChar* data,
2551
2552
2553
2554/**
2555 * Utility function to make a null-terminated vector of XMLChs, from a
2556 * XalanDOMString
2557 *
2558 * @param data XalanDOMString to be converted
2559 * @return null-terminated vector of XalanDOMChar
2560 */
2562MakeXalanDOMCharVector(const XalanDOMString& data,
2564{
2565 return MakeXalanDOMCharVector(data.c_str(),result);
2566}
2567
2568
2569
2571{
2572 const XalanDOMChar*
2574 {
2575 return theString.c_str();
2576 }
2577};
2578
2579
2580
2581/**
2582 * Less than functor for DOMStrings which ignores case for the characters a-z and A-Z
2583 *
2584 * @param theLHS first string to compare
2585 * @param theRHS second string to compare
2586 * @return true if the theLHS is less than theRHS, without respect to case.
2587 */
2589{
2590 bool
2592 const XalanDOMString& theRHS) const
2593 {
2594 return compareIgnoreCaseASCII(theLHS, theRHS) < 0 ? true : false;
2595 }
2596};
2597
2598
2599
2600/**
2601 * Less than or equal functor for DOMStrings
2602 *
2603 * @param theLHS first string to compare
2604 * @param theRHS second string to compare
2605 * @return true if the theLHS is less than or equal to theRHS
2606 */
2608{
2609 bool
2611 const XalanDOMString& theRHS) const
2612 {
2613 return compare(theLHS, theRHS) <= 0 ? true : false;
2614 }
2615};
2616
2617
2618
2619/**
2620 * Greater than functor for DOMStrings
2621 *
2622 * @param theLHS first string to compare
2623 * @param theRHS second string to compare
2624 * @return true if the theLHS is greater than theRHS
2625 */
2627{
2628 bool
2630 const XalanDOMString& theRHS) const
2631 {
2632 return compare(theLHS, theRHS) > 0 ? true : false;
2633 }
2634};
2635
2636
2637
2638/**
2639 * Greater than or equal functor for DOMStrings
2640 *
2641 * @param theLHS first string to compare
2642 * @param theRHS second string to compare
2643 * @return true if the theLHS is greater than or equal to theRHS
2644 */
2646{
2647 bool
2649 const XalanDOMString& theRHS) const
2650 {
2651 return compare(theLHS, theRHS) >= 0 ? true : false;
2652 }
2653};
2654
2655
2656
2657/**
2658 * This functor is designed to compare 0-terminated wide strings in a case-insensitive
2659 * manner. It substitutes for the default less<type*> so that the contents of wide strings
2660 * can be compared, rather than just the pointers.
2661 */
2663{
2664 /**
2665 * Compare the values of two objects.
2666 *
2667 *
2668 * @param theLHS first object to compare
2669 * @param theRHS second object to compare
2670 * @return true if objects are the same
2671 */
2672 bool
2674 const XalanDOMChar* theLHS,
2675 const XalanDOMChar* theRHS) const
2676 {
2677 return compareIgnoreCaseASCII(theLHS, theRHS) < 0 ? true : false;
2678 }
2679};
2680
2681
2682
2683/**
2684 * Determines if the string contains only whitespace
2685 *
2686 * @param theString target string
2687 * @return true if string contains only whitespace
2688 */
2690isXMLWhitespace(const XalanDOMString& string);
2691
2692
2693
2694/**
2695 * Determines if a range in an array contains only whitespace
2696 *
2697 * @param ch target array
2698 * @param start starting index to examine
2699 * @param length number of characters to examine
2700 * @return true if specified range contains only whitespace
2701 */
2703isXMLWhitespace(
2706 XalanDOMString::size_type length);
2707
2708
2709
2710/**
2711 * Determines if a null-terminated string contains only whitespace
2712 *
2713 * @param theString target string
2714 * @return true if the string contains only whitespace
2715 */
2716inline bool
2718{
2719 assert(theString != 0);
2720
2722}
2723
2724
2725
2726}
2727
2728
2729
2730#endif // DOMSTRINGHELPER_HEADER_GUARD_1357924680
std::ostream & operator<<(std::ostream &target, const StrX &toDump)
#define XALAN_PLATFORMSUPPORT_EXPORT
#define XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(T)
#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)
static void terminate()
A SAX-based formatter interface for the XSL processor.
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.
size_t size_type
Definition XalanMap.hpp:46
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.
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.