LibreOffice: rtl/ustring.hxx Source File

LibreOffice LibreOffice 5.1 SDK C/C++ API Reference

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List
- File Members

ustring.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20 #ifndef INCLUDED_RTL_USTRING_HXX
21 #define INCLUDED_RTL_USTRING_HXX
22
23 #include <sal/config.h>
24
25 #include <cassert>
26 #include <cstddef>
27 #include <new>
28 #include <ostream>
29 #include <string.h>
30
31 #include <rtl/ustring.h>
32 #include <rtl/string.hxx>
33 #include <rtl/stringutils.hxx>
34 #include <rtl/textenc.h>
35 #include <sal/log.hxx>
36
37 #ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
38 #include <config_global.h>
39 #include <rtl/stringconcat.hxx>
40 #endif
41
42 // The unittest uses slightly different code to help check that the proper
43 // calls are made. The class is put into a different namespace to make
44 // sure the compiler generates a different (if generating also non-inline)
45 // copy of the function and does not merge them together. The class
46 // is "brought" into the proper rtl namespace by a typedef below.
47 #ifdef RTL_STRING_UNITTEST
48 #define rtl rtlunittest
49 #endif
50
51 namespace rtl
52 {
53
54 #ifdef RTL_STRING_UNITTEST
55 #undef rtl
56 #endif
57
58 #if defined LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
59
69 struct SAL_WARN_UNUSED OUStringLiteral
70 {
71 template< int N >
72 explicit SAL_CONSTEXPR OUStringLiteral( const char (&str)[ N ] ) : size( N - 1 ), data( str )
73 { /* only C++14 constexpr: assert( strlen( str ) == N - 1 ); */ }
74 int size;
75 const char* data;
76 };
77
79 #endif
80
81 /* ======================================================================= */
82
106 class SAL_WARN_UNUSED SAL_DLLPUBLIC_RTTI OUString
107 {
108 public:
110 rtl_uString * pData;
112
116 OUString()
117 {
118 pData = NULL;
119 rtl_uString_new( &pData );
120 }
121
127 OUString( const OUString & str )
128 {
129 pData = str.pData;
130 rtl_uString_acquire( pData );
131 }
132
138 OUString( rtl_uString * str )
139 {
140 pData = str;
141 rtl_uString_acquire( pData );
142 }
143
152 inline OUString( rtl_uString * str, __sal_NoAcquire )
153 { pData = str; }
154
160 explicit OUString( sal_Unicode value )
161 : pData (NULL)
162 {
163 rtl_uString_newFromStr_WithLength( &pData, &value, 1 );
164 }
165
166 #if defined LIBO_INTERNAL_ONLY && !defined RTL_STRING_UNITTEST_CONCAT
167 // Catch inadvertent conversions to the above ctor (but still allow
169 // construction from char literals):
170 OUString(int) = delete;
171 explicit OUString(char c):
172 OUString(sal_Unicode(static_cast<unsigned char>(c)))
173 {}
175 #endif
176
182 OUString( const sal_Unicode * value )
183 {
184 pData = NULL;
185 rtl_uString_newFromStr( &pData, value );
186 }
187
196 OUString( const sal_Unicode * value, sal_Int32 length )
197 {
198 pData = NULL;
199 rtl_uString_newFromStr_WithLength( &pData, value, length );
200 }
201
217 template< typename T >
218 OUString( T& literal, typename libreoffice_internal::ConstCharArrayDetector< T, libreoffice_internal::Dummy >::Type = libreoffice_internal::Dummy() )
219 {
220 assert(
221 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
222 pData = NULL;
223 if (libreoffice_internal::ConstCharArrayDetector<T>::length == 0) {
224 rtl_uString_new(&pData);
225 } else {
226 rtl_uString_newFromLiteral(
227 &pData,
228 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
229 literal),
230 libreoffice_internal::ConstCharArrayDetector<T>::length, 0);
231 }
232 #ifdef RTL_STRING_UNITTEST
233 rtl_string_unittest_const_literal = true;
234 #endif
235 }
236
237 #ifdef RTL_STRING_UNITTEST
238
242 template< typename T >
243 OUString( T&, typename libreoffice_internal::ExceptConstCharArrayDetector< T >::Type = libreoffice_internal::Dummy() )
244 {
245 pData = NULL;
246 rtl_uString_newFromLiteral( &pData, "!!br0ken!!", 10, 0 ); // set to garbage
247 rtl_string_unittest_invalid_conversion = true;
248 }
253 template< typename T >
254 OUString( const T&, typename libreoffice_internal::ExceptCharArrayDetector< T >::Type = libreoffice_internal::Dummy() )
255 {
256 pData = NULL;
257 rtl_uString_newFromLiteral( &pData, "!!br0ken!!", 10, 0 ); // set to garbage
258 rtl_string_unittest_invalid_conversion = true;
259 }
260 #endif
261
262 #ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
263
279 OUString(OUStringLiteral literal): pData(NULL) {
280 rtl_uString_newFromLiteral(&pData, literal.data, literal.size, 0);
281 }
283 #endif
284
299 OUString( const sal_Char * value, sal_Int32 length,
300 rtl_TextEncoding encoding,
301 sal_uInt32 convertFlags = OSTRING_TO_OUSTRING_CVTFLAGS )
302 {
303 pData = NULL;
304 rtl_string2UString( &pData, value, length, encoding, convertFlags );
305 if (pData == NULL) {
306 throw std::bad_alloc();
307 }
308 }
309
326 inline explicit OUString(
327 sal_uInt32 const * codePoints, sal_Int32 codePointCount):
328 pData(NULL)
329 {
330 rtl_uString_newFromCodePoints(&pData, codePoints, codePointCount);
331 if (pData == NULL) {
332 throw std::bad_alloc();
333 }
334 }
335
336 #ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
337
341 template< typename T1, typename T2 >
342 OUString( const OUStringConcat< T1, T2 >& c )
343 {
344 const sal_Int32 l = c.length();
345 pData = rtl_uString_alloc( l );
346 if (l != 0)
347 {
348 sal_Unicode* end = c.addData( pData->buffer );
349 pData->length = l;
350 *end = '\0';
351 // TODO realloc in case pData->length is noticeably smaller than l?
352 }
353 }
354 #endif
355
359 ~OUString()
360 {
361 rtl_uString_release( pData );
362 }
363
375 static inline OUString const & unacquired( rtl_uString * const * ppHandle )
376 { return * reinterpret_cast< OUString const * >( ppHandle ); }
377
383 OUString & operator=( const OUString & str )
384 {
385 rtl_uString_assign( &pData, str.pData );
386 return *this;
387 }
388
401 template< typename T >
402 typename libreoffice_internal::ConstCharArrayDetector< T, OUString& >::Type operator=( T& literal )
403 {
404 assert(
405 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
406 if (libreoffice_internal::ConstCharArrayDetector<T>::length == 0) {
407 rtl_uString_new(&pData);
408 } else {
409 rtl_uString_newFromLiteral(
410 &pData,
411 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
412 literal),
413 libreoffice_internal::ConstCharArrayDetector<T>::length, 0);
414 }
415 return *this;
416 }
417
423 OUString & operator+=( const OUString & str )
424 #if defined LIBO_INTERNAL_ONLY && HAVE_CXX11_REF_QUALIFIER
425 &
426 #endif
427 {
428 rtl_uString_newConcat( &pData, pData, str.pData );
429 return *this;
430 }
431 #if defined LIBO_INTERNAL_ONLY && HAVE_CXX11_REF_QUALIFIER
432 void operator+=(OUString const &) && = delete;
433 #endif
434
441 template<typename T>
442 typename libreoffice_internal::ConstCharArrayDetector<T, OUString &>::Type
443 operator +=(T & literal)
444 #if defined LIBO_INTERNAL_ONLY && HAVE_CXX11_REF_QUALIFIER
445 &
446 #endif
447 {
448 assert(
449 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
450 rtl_uString_newConcatAsciiL(
451 &pData, pData,
452 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal),
453 libreoffice_internal::ConstCharArrayDetector<T>::length);
454 return *this;
455 }
456 #if defined LIBO_INTERNAL_ONLY && HAVE_CXX11_REF_QUALIFIER
457 template<typename T>
458 typename libreoffice_internal::ConstCharArrayDetector<T, OUString &>::Type
459 operator +=(T &) && = delete;
460 #endif
461
462 #ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
463
467 template< typename T1, typename T2 >
468 OUString& operator+=( const OUStringConcat< T1, T2 >& c )
469 #if HAVE_CXX11_REF_QUALIFIER
470 &
471 #endif
472 {
473 sal_Int32 l = c.length();
474 if( l == 0 )
475 return *this;
476 l += pData->length;
477 rtl_uString_ensureCapacity( &pData, l );
478 sal_Unicode* end = c.addData( pData->buffer + pData->length );
479 *end = '\0';
480 pData->length = l;
481 return *this;
482 }
483 #if HAVE_CXX11_REF_QUALIFIER
484 template<typename T1, typename T2> void operator +=(
485 OUStringConcat<T1, T2> const &) && = delete;
486 #endif
487 #endif
488
493 void clear()
494 {
495 rtl_uString_new( &pData );
496 }
497
506 sal_Int32 getLength() const { return pData->length; }
507
516 bool isEmpty() const
517 {
518 return pData->length == 0;
519 }
520
528 const sal_Unicode * getStr() const { return pData->buffer; }
529
539 sal_Unicode operator [](sal_Int32 index) const {
540 // silence spurious -Werror=strict-overflow warnings from GCC 4.8.2
541 assert(index >= 0 && static_cast<sal_uInt32>(index) < static_cast<sal_uInt32>(getLength()));
542 return getStr()[index];
543 }
544
557 sal_Int32 compareTo( const OUString & str ) const
558 {
559 return rtl_ustr_compare_WithLength( pData->buffer, pData->length,
560 str.pData->buffer, str.pData->length );
561 }
562
578 sal_Int32 compareTo( const OUString & str, sal_Int32 maxLength ) const
579 {
580 return rtl_ustr_shortenedCompare_WithLength( pData->buffer, pData->length,
581 str.pData->buffer, str.pData->length, maxLength );
582 }
583
596 sal_Int32 reverseCompareTo( const OUString & str ) const
597 {
598 return rtl_ustr_reverseCompare_WithLength( pData->buffer, pData->length,
599 str.pData->buffer, str.pData->length );
600 }
601
607 template< typename T >
608 typename libreoffice_internal::ConstCharArrayDetector< T, sal_Int32 >::Type reverseCompareTo( T& literal ) const
609 {
610 assert(
611 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
612 return rtl_ustr_asciil_reverseCompare_WithLength(
613 pData->buffer, pData->length,
614 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal),
615 libreoffice_internal::ConstCharArrayDetector<T>::length);
616 }
617
629 bool equals( const OUString & str ) const
630 {
631 if ( pData->length != str.pData->length )
632 return false;
633 if ( pData == str.pData )
634 return true;
635 return rtl_ustr_reverseCompare_WithLength( pData->buffer, pData->length,
636 str.pData->buffer, str.pData->length ) == 0;
637 }
638
653 bool equalsIgnoreAsciiCase( const OUString & str ) const
654 {
655 if ( pData->length != str.pData->length )
656 return false;
657 if ( pData == str.pData )
658 return true;
659 return rtl_ustr_compareIgnoreAsciiCase_WithLength( pData->buffer, pData->length,
660 str.pData->buffer, str.pData->length ) == 0;
661 }
662
678 sal_Int32 compareToIgnoreAsciiCase( const OUString & str ) const
679 {
680 return rtl_ustr_compareIgnoreAsciiCase_WithLength( pData->buffer, pData->length,
681 str.pData->buffer, str.pData->length );
682 }
683
684
690 template< typename T >
691 typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type equalsIgnoreAsciiCase( T& literal ) const
692 {
693 assert(
694 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
695 return
696 (pData->length
697 == libreoffice_internal::ConstCharArrayDetector<T>::length)
698 && (rtl_ustr_ascii_compareIgnoreAsciiCase_WithLength(
699 pData->buffer, pData->length,
700 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
701 literal))
702 == 0);
703 }
704
720 bool match( const OUString & str, sal_Int32 fromIndex = 0 ) const
721 {
722 return rtl_ustr_shortenedCompare_WithLength( pData->buffer+fromIndex, pData->length-fromIndex,
723 str.pData->buffer, str.pData->length, str.pData->length ) == 0;
724 }
725
731 template< typename T >
732 typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type match( T& literal, sal_Int32 fromIndex = 0 ) const
733 {
734 assert(
735 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
736 return
737 rtl_ustr_ascii_shortenedCompare_WithLength(
738 pData->buffer+fromIndex, pData->length-fromIndex,
739 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
740 literal),
741 libreoffice_internal::ConstCharArrayDetector<T>::length)
742 == 0;
743 }
744
763 bool matchIgnoreAsciiCase( const OUString & str, sal_Int32 fromIndex = 0 ) const
764 {
765 return rtl_ustr_shortenedCompareIgnoreAsciiCase_WithLength( pData->buffer+fromIndex, pData->length-fromIndex,
766 str.pData->buffer, str.pData->length,
767 str.pData->length ) == 0;
768 }
769
775 template< typename T >
776 typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type matchIgnoreAsciiCase( T& literal, sal_Int32 fromIndex = 0 ) const
777 {
778 assert(
779 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
780 return
781 rtl_ustr_ascii_shortenedCompareIgnoreAsciiCase_WithLength(
782 pData->buffer+fromIndex, pData->length-fromIndex,
783 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
784 literal),
785 libreoffice_internal::ConstCharArrayDetector<T>::length)
786 == 0;
787 }
788
805 sal_Int32 compareToAscii( const sal_Char* asciiStr ) const
806 {
807 return rtl_ustr_ascii_compare_WithLength( pData->buffer, pData->length, asciiStr );
808 }
809
832 SAL_DEPRECATED(
833 "replace s1.compareToAscii(s2, strlen(s2)) == 0 with s1.startsWith(s2)")
834 sal_Int32 compareToAscii( const sal_Char * asciiStr, sal_Int32 maxLength ) const
835 {
836 return rtl_ustr_ascii_shortenedCompare_WithLength( pData->buffer, pData->length,
837 asciiStr, maxLength );
838 }
839
859 sal_Int32 reverseCompareToAsciiL( const sal_Char * asciiStr, sal_Int32 asciiStrLength ) const
860 {
861 return rtl_ustr_asciil_reverseCompare_WithLength( pData->buffer, pData->length,
862 asciiStr, asciiStrLength );
863 }
864
880 bool equalsAscii( const sal_Char* asciiStr ) const
881 {
882 return rtl_ustr_ascii_compare_WithLength( pData->buffer, pData->length,
883 asciiStr ) == 0;
884 }
885
903 bool equalsAsciiL( const sal_Char* asciiStr, sal_Int32 asciiStrLength ) const
904 {
905 if ( pData->length != asciiStrLength )
906 return false;
907
908 return rtl_ustr_asciil_reverseEquals_WithLength(
909 pData->buffer, asciiStr, asciiStrLength );
910 }
911
930 bool equalsIgnoreAsciiCaseAscii( const sal_Char * asciiStr ) const
931 {
932 return rtl_ustr_ascii_compareIgnoreAsciiCase_WithLength( pData->buffer, pData->length, asciiStr ) == 0;
933 }
934
953 sal_Int32 compareToIgnoreAsciiCaseAscii( const sal_Char * asciiStr ) const
954 {
955 return rtl_ustr_ascii_compareIgnoreAsciiCase_WithLength( pData->buffer, pData->length, asciiStr );
956 }
957
978 bool equalsIgnoreAsciiCaseAsciiL( const sal_Char * asciiStr, sal_Int32 asciiStrLength ) const
979 {
980 if ( pData->length != asciiStrLength )
981 return false;
982
983 return rtl_ustr_ascii_compareIgnoreAsciiCase_WithLength( pData->buffer, pData->length, asciiStr ) == 0;
984 }
985
1007 bool matchAsciiL( const sal_Char* asciiStr, sal_Int32 asciiStrLength, sal_Int32 fromIndex = 0 ) const
1008 {
1009 return rtl_ustr_ascii_shortenedCompare_WithLength( pData->buffer+fromIndex, pData->length-fromIndex,
1010 asciiStr, asciiStrLength ) == 0;
1011 }
1012
1013 // This overload is left undefined, to detect calls of matchAsciiL that
1014 // erroneously use RTL_CONSTASCII_USTRINGPARAM instead of
1015 // RTL_CONSTASCII_STRINGPARAM (but would lead to ambiguities on 32 bit
1016 // platforms):
1017 #if SAL_TYPES_SIZEOFLONG == 8
1018 void matchAsciiL(char const *, sal_Int32, rtl_TextEncoding) const;
1019 #endif
1020
1045 bool matchIgnoreAsciiCaseAsciiL( const sal_Char* asciiStr, sal_Int32 asciiStrLength, sal_Int32 fromIndex = 0 ) const
1046 {
1047 return rtl_ustr_ascii_shortenedCompareIgnoreAsciiCase_WithLength( pData->buffer+fromIndex, pData->length-fromIndex,
1048 asciiStr, asciiStrLength ) == 0;
1049 }
1050
1051 // This overload is left undefined, to detect calls of
1052 // matchIgnoreAsciiCaseAsciiL that erroneously use
1053 // RTL_CONSTASCII_USTRINGPARAM instead of RTL_CONSTASCII_STRINGPARAM (but
1054 // would lead to ambiguities on 32 bit platforms):
1055 #if SAL_TYPES_SIZEOFLONG == 8
1056 void matchIgnoreAsciiCaseAsciiL(char const *, sal_Int32, rtl_TextEncoding)
1057 const;
1058 #endif
1059
1074 bool startsWith(OUString const & str, OUString * rest = NULL) const {
1075 bool b = match(str);
1076 if (b && rest != NULL) {
1077 *rest = copy(str.getLength());
1078 }
1079 return b;
1080 }
1081
1087 template< typename T >
1088 typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type startsWith(
1089 T & literal, OUString * rest = NULL) const
1090 {
1091 assert(
1092 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
1093 bool b
1094 = (libreoffice_internal::ConstCharArrayDetector<T>::length
1095 <= sal_uInt32(pData->length))
1096 && rtl_ustr_asciil_reverseEquals_WithLength(
1097 pData->buffer,
1098 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
1099 literal),
1100 libreoffice_internal::ConstCharArrayDetector<T>::length);
1101 if (b && rest != NULL) {
1102 *rest = copy(
1103 libreoffice_internal::ConstCharArrayDetector<T>::length);
1104 }
1105 return b;
1106 }
1107
1128 bool startsWithIgnoreAsciiCase(OUString const & str, OUString * rest = NULL)
1129 const
1130 {
1131 bool b = matchIgnoreAsciiCase(str);
1132 if (b && rest != NULL) {
1133 *rest = copy(str.getLength());
1134 }
1135 return b;
1136 }
1137
1143 template< typename T >
1144 typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type
1145 startsWithIgnoreAsciiCase(T & literal, OUString * rest = NULL) const
1146 {
1147 assert(
1148 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
1149 bool b
1150 = (rtl_ustr_ascii_compareIgnoreAsciiCase_WithLengths(
1151 pData->buffer,
1152 libreoffice_internal::ConstCharArrayDetector<T>::length,
1153 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
1154 literal),
1155 libreoffice_internal::ConstCharArrayDetector<T>::length)
1156 == 0);
1157 if (b && rest != NULL) {
1158 *rest = copy(
1159 libreoffice_internal::ConstCharArrayDetector<T>::length);
1160 }
1161 return b;
1162 }
1163
1178 bool endsWith(OUString const & str, OUString * rest = NULL) const {
1179 bool b = str.getLength() <= getLength()
1180 && match(str, getLength() - str.getLength());
1181 if (b && rest != NULL) {
1182 *rest = copy(0, getLength() - str.getLength());
1183 }
1184 return b;
1185 }
1186
1192 template< typename T >
1193 typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type
1194 endsWith(T & literal, OUString * rest = NULL) const
1195 {
1196 assert(
1197 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
1198 bool b
1199 = (libreoffice_internal::ConstCharArrayDetector<T>::length
1200 <= sal_uInt32(pData->length))
1201 && rtl_ustr_asciil_reverseEquals_WithLength(
1202 (pData->buffer + pData->length
1203 - libreoffice_internal::ConstCharArrayDetector<T>::length),
1204 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
1205 literal),
1206 libreoffice_internal::ConstCharArrayDetector<T>::length);
1207 if (b && rest != NULL) {
1208 *rest = copy(
1209 0,
1210 (getLength()
1211 - libreoffice_internal::ConstCharArrayDetector<T>::length));
1212 }
1213 return b;
1214 }
1215
1227 inline bool endsWithAsciiL(char const * asciiStr, sal_Int32 asciiStrLength)
1228 const
1229 {
1230 return asciiStrLength <= pData->length
1231 && rtl_ustr_asciil_reverseEquals_WithLength(
1232 pData->buffer + pData->length - asciiStrLength, asciiStr,
1233 asciiStrLength);
1234 }
1235
1256 bool endsWithIgnoreAsciiCase(OUString const & str, OUString * rest = NULL) const
1257 {
1258 bool b = str.getLength() <= getLength()
1259 && matchIgnoreAsciiCase(str, getLength() - str.getLength());
1260 if (b && rest != NULL) {
1261 *rest = copy(0, getLength() - str.getLength());
1262 }
1263 return b;
1264 }
1265
1271 template< typename T >
1272 typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type
1273 endsWithIgnoreAsciiCase(T & literal, OUString * rest = NULL) const
1274 {
1275 assert(
1276 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
1277 bool b
1278 = (libreoffice_internal::ConstCharArrayDetector<T>::length
1279 <= sal_uInt32(pData->length))
1280 && (rtl_ustr_ascii_compareIgnoreAsciiCase_WithLengths(
1281 (pData->buffer + pData->length
1282 - libreoffice_internal::ConstCharArrayDetector<T>::length),
1283 libreoffice_internal::ConstCharArrayDetector<T>::length,
1284 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
1285 literal),
1286 libreoffice_internal::ConstCharArrayDetector<T>::length)
1287 == 0);
1288 if (b && rest != NULL) {
1289 *rest = copy(
1290 0,
1291 (getLength()
1292 - libreoffice_internal::ConstCharArrayDetector<T>::length));
1293 }
1294 return b;
1295 }
1296
1307 inline bool endsWithIgnoreAsciiCaseAsciiL(
1308 char const * asciiStr, sal_Int32 asciiStrLength) const
1309 {
1310 return asciiStrLength <= pData->length
1311 && (rtl_ustr_ascii_compareIgnoreAsciiCase_WithLengths(
1312 pData->buffer + pData->length - asciiStrLength,
1313 asciiStrLength, asciiStr, asciiStrLength)
1314 == 0);
1315 }
1316
1317 friend bool operator == ( const OUString& rStr1, const OUString& rStr2 )
1318 { return rStr1.equals(rStr2); }
1319 friend bool operator == ( const OUString& rStr1, const sal_Unicode * pStr2 )
1320 { return rStr1.compareTo( pStr2 ) == 0; }
1321 friend bool operator == ( const sal_Unicode * pStr1, const OUString& rStr2 )
1322 { return OUString( pStr1 ).compareTo( rStr2 ) == 0; }
1323
1324 friend bool operator != ( const OUString& rStr1, const OUString& rStr2 )
1325 { return !(operator == ( rStr1, rStr2 )); }
1326 friend bool operator != ( const OUString& rStr1, const sal_Unicode * pStr2 )
1327 { return !(operator == ( rStr1, pStr2 )); }
1328 friend bool operator != ( const sal_Unicode * pStr1, const OUString& rStr2 )
1329 { return !(operator == ( pStr1, rStr2 )); }
1330
1331 friend bool operator < ( const OUString& rStr1, const OUString& rStr2 )
1332 { return rStr1.compareTo( rStr2 ) < 0; }
1333 friend bool operator > ( const OUString& rStr1, const OUString& rStr2 )
1334 { return rStr1.compareTo( rStr2 ) > 0; }
1335 friend bool operator <= ( const OUString& rStr1, const OUString& rStr2 )
1336 { return rStr1.compareTo( rStr2 ) <= 0; }
1337 friend bool operator >= ( const OUString& rStr1, const OUString& rStr2 )
1338 { return rStr1.compareTo( rStr2 ) >= 0; }
1339
1347 template< typename T >
1348 friend inline typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type operator==( const OUString& string, T& literal )
1349 {
1350 assert(
1351 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
1352 return string.equalsAsciiL(
1353 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal),
1354 libreoffice_internal::ConstCharArrayDetector<T>::length);
1355 }
1363 template< typename T >
1364 friend inline typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type operator==( T& literal, const OUString& string )
1365 {
1366 assert(
1367 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
1368 return string.equalsAsciiL(
1369 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal),
1370 libreoffice_internal::ConstCharArrayDetector<T>::length);
1371 }
1379 template< typename T >
1380 friend inline typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type operator!=( const OUString& string, T& literal )
1381 {
1382 assert(
1383 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
1384 return !string.equalsAsciiL(
1385 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal),
1386 libreoffice_internal::ConstCharArrayDetector<T>::length);
1387 }
1395 template< typename T >
1396 friend inline typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type operator!=( T& literal, const OUString& string )
1397 {
1398 assert(
1399 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
1400 return !string.equalsAsciiL(
1401 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal),
1402 libreoffice_internal::ConstCharArrayDetector<T>::length);
1403 }
1404
1405 #if defined LIBO_INTERNAL_ONLY
1406
1408 /* Comparison between OUString and OUStringLiteral.
1409
1410 @since LibreOffice 5.0
1411 */
1412
1413 friend bool operator ==(OUString const & lhs, OUStringLiteral const & rhs) {
1414 return lhs.equalsAsciiL(rhs.data, rhs.size);
1415 }
1416
1417 friend bool operator !=(OUString const & lhs, OUStringLiteral const & rhs) {
1418 return !lhs.equalsAsciiL(rhs.data, rhs.size);
1419 }
1420
1421 friend bool operator <(OUString const & lhs, OUStringLiteral const & rhs) {
1422 return
1423 (rtl_ustr_ascii_compare_WithLength(
1424 lhs.pData->buffer, lhs.pData->length, rhs.data))
1425 < 0;
1426 }
1427
1428 friend bool operator <=(OUString const & lhs, OUStringLiteral const & rhs) {
1429 return
1430 (rtl_ustr_ascii_compare_WithLength(
1431 lhs.pData->buffer, lhs.pData->length, rhs.data))
1432 <= 0;
1433 }
1434
1435 friend bool operator >(OUString const & lhs, OUStringLiteral const & rhs) {
1436 return
1437 (rtl_ustr_ascii_compare_WithLength(
1438 lhs.pData->buffer, lhs.pData->length, rhs.data))
1439 > 0;
1440 }
1441
1442 friend bool operator >=(OUString const & lhs, OUStringLiteral const & rhs) {
1443 return
1444 (rtl_ustr_ascii_compare_WithLength(
1445 lhs.pData->buffer, lhs.pData->length, rhs.data))
1446 >= 0;
1447 }
1448
1449 friend bool operator ==(OUStringLiteral const & lhs, OUString const & rhs) {
1450 return rhs.equalsAsciiL(lhs.data, lhs.size);
1451 }
1452
1453 friend bool operator !=(OUStringLiteral const & lhs, OUString const & rhs) {
1454 return !rhs.equalsAsciiL(lhs.data, lhs.size);
1455 }
1456
1457 friend bool operator <(OUStringLiteral const & lhs, OUString const & rhs) {
1458 return
1459 (rtl_ustr_ascii_compare_WithLength(
1460 rhs.pData->buffer, rhs.pData->length, lhs.data))
1461 >= 0;
1462 }
1463
1464 friend bool operator <=(OUStringLiteral const & lhs, OUString const & rhs) {
1465 return
1466 (rtl_ustr_ascii_compare_WithLength(
1467 rhs.pData->buffer, rhs.pData->length, lhs.data))
1468 > 0;
1469 }
1470
1471 friend bool operator >(OUStringLiteral const & lhs, OUString const & rhs) {
1472 return
1473 (rtl_ustr_ascii_compare_WithLength(
1474 rhs.pData->buffer, rhs.pData->length, lhs.data))
1475 <= 0;
1476 }
1477
1478 friend bool operator >=(OUStringLiteral const & lhs, OUString const & rhs) {
1479 return
1480 (rtl_ustr_ascii_compare_WithLength(
1481 rhs.pData->buffer, rhs.pData->length, lhs.data))
1482 < 0;
1483 }
1484
1486 #endif
1487
1495 sal_Int32 hashCode() const
1496 {
1497 return rtl_ustr_hashCode_WithLength( pData->buffer, pData->length );
1498 }
1499
1513 sal_Int32 indexOf( sal_Unicode ch, sal_Int32 fromIndex = 0 ) const
1514 {
1515 sal_Int32 ret = rtl_ustr_indexOfChar_WithLength( pData->buffer+fromIndex, pData->length-fromIndex, ch );
1516 return (ret < 0 ? ret : ret+fromIndex);
1517 }
1518
1528 sal_Int32 lastIndexOf( sal_Unicode ch ) const
1529 {
1530 return rtl_ustr_lastIndexOfChar_WithLength( pData->buffer, pData->length, ch );
1531 }
1532
1545 sal_Int32 lastIndexOf( sal_Unicode ch, sal_Int32 fromIndex ) const
1546 {
1547 return rtl_ustr_lastIndexOfChar_WithLength( pData->buffer, fromIndex, ch );
1548 }
1549
1565 sal_Int32 indexOf( const OUString & str, sal_Int32 fromIndex = 0 ) const
1566 {
1567 sal_Int32 ret = rtl_ustr_indexOfStr_WithLength( pData->buffer+fromIndex, pData->length-fromIndex,
1568 str.pData->buffer, str.pData->length );
1569 return (ret < 0 ? ret : ret+fromIndex);
1570 }
1571
1577 template< typename T >
1578 typename libreoffice_internal::ConstCharArrayDetector< T, sal_Int32 >::Type indexOf( T& literal, sal_Int32 fromIndex = 0 ) const
1579 {
1580 assert(
1581 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
1582 sal_Int32 n = rtl_ustr_indexOfAscii_WithLength(
1583 pData->buffer + fromIndex, pData->length - fromIndex,
1584 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal),
1585 libreoffice_internal::ConstCharArrayDetector<T>::length);
1586 return n < 0 ? n : n + fromIndex;
1587 }
1588
1612 sal_Int32 indexOfAsciiL(
1613 char const * str, sal_Int32 len, sal_Int32 fromIndex = 0) const
1614 {
1615 sal_Int32 ret = rtl_ustr_indexOfAscii_WithLength(
1616 pData->buffer + fromIndex, pData->length - fromIndex, str, len);
1617 return ret < 0 ? ret : ret + fromIndex;
1618 }
1619
1620 // This overload is left undefined, to detect calls of indexOfAsciiL that
1621 // erroneously use RTL_CONSTASCII_USTRINGPARAM instead of
1622 // RTL_CONSTASCII_STRINGPARAM (but would lead to ambiguities on 32 bit
1623 // platforms):
1624 #if SAL_TYPES_SIZEOFLONG == 8
1625 void indexOfAsciiL(char const *, sal_Int32 len, rtl_TextEncoding) const;
1626 #endif
1627
1643 sal_Int32 lastIndexOf( const OUString & str ) const
1644 {
1645 return rtl_ustr_lastIndexOfStr_WithLength( pData->buffer, pData->length,
1646 str.pData->buffer, str.pData->length );
1647 }
1648
1666 sal_Int32 lastIndexOf( const OUString & str, sal_Int32 fromIndex ) const
1667 {
1668 return rtl_ustr_lastIndexOfStr_WithLength( pData->buffer, fromIndex,
1669 str.pData->buffer, str.pData->length );
1670 }
1671
1677 template< typename T >
1678 typename libreoffice_internal::ConstCharArrayDetector< T, sal_Int32 >::Type lastIndexOf( T& literal ) const
1679 {
1680 assert(
1681 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
1682 return rtl_ustr_lastIndexOfAscii_WithLength(
1683 pData->buffer, pData->length,
1684 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal),
1685 libreoffice_internal::ConstCharArrayDetector<T>::length);
1686 }
1687
1707 sal_Int32 lastIndexOfAsciiL(char const * str, sal_Int32 len) const
1708 {
1709 return rtl_ustr_lastIndexOfAscii_WithLength(
1710 pData->buffer, pData->length, str, len);
1711 }
1712
1723 SAL_WARN_UNUSED_RESULT OUString copy( sal_Int32 beginIndex ) const
1724 {
1725 rtl_uString *pNew = NULL;
1726 rtl_uString_newFromSubString( &pNew, pData, beginIndex, getLength() - beginIndex );
1727 return OUString( pNew, SAL_NO_ACQUIRE );
1728 }
1729
1742 SAL_WARN_UNUSED_RESULT OUString copy( sal_Int32 beginIndex, sal_Int32 count ) const
1743 {
1744 rtl_uString *pNew = NULL;
1745 rtl_uString_newFromSubString( &pNew, pData, beginIndex, count );
1746 return OUString( pNew, SAL_NO_ACQUIRE );
1747 }
1748
1757 SAL_WARN_UNUSED_RESULT OUString concat( const OUString & str ) const
1758 {
1759 rtl_uString* pNew = NULL;
1760 rtl_uString_newConcat( &pNew, pData, str.pData );
1761 return OUString( pNew, SAL_NO_ACQUIRE );
1762 }
1763
1764 #ifndef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
1765 friend OUString operator+( const OUString& rStr1, const OUString& rStr2 )
1766 {
1767 return rStr1.concat( rStr2 );
1768 }
1769 #endif
1770
1784 SAL_WARN_UNUSED_RESULT OUString replaceAt( sal_Int32 index, sal_Int32 count, const OUString& newStr ) const
1785 {
1786 rtl_uString* pNew = NULL;
1787 rtl_uString_newReplaceStrAt( &pNew, pData, index, count, newStr.pData );
1788 return OUString( pNew, SAL_NO_ACQUIRE );
1789 }
1790
1804 SAL_WARN_UNUSED_RESULT OUString replace( sal_Unicode oldChar, sal_Unicode newChar ) const
1805 {
1806 rtl_uString* pNew = NULL;
1807 rtl_uString_newReplace( &pNew, pData, oldChar, newChar );
1808 return OUString( pNew, SAL_NO_ACQUIRE );
1809 }
1810
1829 SAL_WARN_UNUSED_RESULT OUString replaceFirst(
1830 OUString const & from, OUString const & to, sal_Int32 * index = NULL) const
1831 {
1832 rtl_uString * s = NULL;
1833 sal_Int32 i = 0;
1834 rtl_uString_newReplaceFirst(
1835 &s, pData, from.pData, to.pData, index == NULL ? &i : index);
1836 return OUString(s, SAL_NO_ACQUIRE);
1837 }
1838
1857 template< typename T >
1858 SAL_WARN_UNUSED_RESULT typename libreoffice_internal::ConstCharArrayDetector< T, OUString >::Type replaceFirst( T& from, OUString const & to,
1859 sal_Int32 * index = NULL) const
1860 {
1861 assert(libreoffice_internal::ConstCharArrayDetector<T>::isValid(from));
1862 rtl_uString * s = NULL;
1863 sal_Int32 i = 0;
1864 rtl_uString_newReplaceFirstAsciiL(
1865 &s, pData,
1866 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(from),
1867 libreoffice_internal::ConstCharArrayDetector<T>::length, to.pData,
1868 index == NULL ? &i : index);
1869 return OUString(s, SAL_NO_ACQUIRE);
1870 }
1871
1890 template< typename T >
1891 SAL_WARN_UNUSED_RESULT typename libreoffice_internal::ConstCharArrayDetector< T, OUString >::Type replaceFirst( OUString const & from, T& to,
1892 sal_Int32 * index = NULL) const
1893 {
1894 assert(libreoffice_internal::ConstCharArrayDetector<T>::isValid(to));
1895 rtl_uString * s = NULL;
1896 sal_Int32 i = 0;
1897 rtl_uString_newReplaceFirstToAsciiL(
1898 &s, pData, from.pData,
1899 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(to),
1900 libreoffice_internal::ConstCharArrayDetector<T>::length,
1901 index == NULL ? &i : index);
1902 return OUString(s, SAL_NO_ACQUIRE);
1903 }
1904
1923 template< typename T1, typename T2 >
1924 SAL_WARN_UNUSED_RESULT typename libreoffice_internal::ConstCharArrayDetector< T1, typename libreoffice_internal::ConstCharArrayDetector< T2, OUString >::Type >::Type
1925 replaceFirst( T1& from, T2& to, sal_Int32 * index = NULL) const
1926 {
1927 assert(libreoffice_internal::ConstCharArrayDetector<T1>::isValid(from));
1928 assert(libreoffice_internal::ConstCharArrayDetector<T2>::isValid(to));
1929 rtl_uString * s = NULL;
1930 sal_Int32 i = 0;
1931 rtl_uString_newReplaceFirstAsciiLAsciiL(
1932 &s, pData,
1933 libreoffice_internal::ConstCharArrayDetector<T1>::toPointer(from),
1934 libreoffice_internal::ConstCharArrayDetector<T1>::length,
1935 libreoffice_internal::ConstCharArrayDetector<T2>::toPointer(to),
1936 libreoffice_internal::ConstCharArrayDetector<T2>::length,
1937 index == NULL ? &i : index);
1938 return OUString(s, SAL_NO_ACQUIRE);
1939 }
1940
1956 SAL_WARN_UNUSED_RESULT OUString replaceAll(
1957 OUString const & from, OUString const & to, sal_Int32 fromIndex = 0) const
1958 {
1959 rtl_uString * s = NULL;
1960 rtl_uString_newReplaceAllFromIndex(&s, pData, from.pData, to.pData, fromIndex);
1961 return OUString(s, SAL_NO_ACQUIRE);
1962 }
1963
1977 template< typename T >
1978 SAL_WARN_UNUSED_RESULT typename libreoffice_internal::ConstCharArrayDetector< T, OUString >::Type replaceAll( T& from, OUString const & to) const
1979 {
1980 assert(libreoffice_internal::ConstCharArrayDetector<T>::isValid(from));
1981 rtl_uString * s = NULL;
1982 rtl_uString_newReplaceAllAsciiL(
1983 &s, pData,
1984 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(from),
1985 libreoffice_internal::ConstCharArrayDetector<T>::length, to.pData);
1986 return OUString(s, SAL_NO_ACQUIRE);
1987 }
1988
2002 template< typename T >
2003 SAL_WARN_UNUSED_RESULT typename libreoffice_internal::ConstCharArrayDetector< T, OUString >::Type replaceAll( OUString const & from, T& to) const
2004 {
2005 assert(libreoffice_internal::ConstCharArrayDetector<T>::isValid(to));
2006 rtl_uString * s = NULL;
2007 rtl_uString_newReplaceAllToAsciiL(
2008 &s, pData, from.pData,
2009 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(to),
2010 libreoffice_internal::ConstCharArrayDetector<T>::length);
2011 return OUString(s, SAL_NO_ACQUIRE);
2012 }
2013
2027 template< typename T1, typename T2 >
2028 SAL_WARN_UNUSED_RESULT typename libreoffice_internal::ConstCharArrayDetector< T1, typename libreoffice_internal::ConstCharArrayDetector< T2, OUString >::Type >::Type
2029 replaceAll( T1& from, T2& to ) const
2030 {
2031 assert(libreoffice_internal::ConstCharArrayDetector<T1>::isValid(from));
2032 assert(libreoffice_internal::ConstCharArrayDetector<T2>::isValid(to));
2033 rtl_uString * s = NULL;
2034 rtl_uString_newReplaceAllAsciiLAsciiL(
2035 &s, pData,
2036 libreoffice_internal::ConstCharArrayDetector<T1>::toPointer(from),
2037 libreoffice_internal::ConstCharArrayDetector<T1>::length,
2038 libreoffice_internal::ConstCharArrayDetector<T2>::toPointer(to),
2039 libreoffice_internal::ConstCharArrayDetector<T2>::length);
2040 return OUString(s, SAL_NO_ACQUIRE);
2041 }
2042
2053 SAL_WARN_UNUSED_RESULT OUString toAsciiLowerCase() const
2054 {
2055 rtl_uString* pNew = NULL;
2056 rtl_uString_newToAsciiLowerCase( &pNew, pData );
2057 return OUString( pNew, SAL_NO_ACQUIRE );
2058 }
2059
2070 SAL_WARN_UNUSED_RESULT OUString toAsciiUpperCase() const
2071 {
2072 rtl_uString* pNew = NULL;
2073 rtl_uString_newToAsciiUpperCase( &pNew, pData );
2074 return OUString( pNew, SAL_NO_ACQUIRE );
2075 }
2076
2088 SAL_WARN_UNUSED_RESULT OUString trim() const
2089 {
2090 rtl_uString* pNew = NULL;
2091 rtl_uString_newTrim( &pNew, pData );
2092 return OUString( pNew, SAL_NO_ACQUIRE );
2093 }
2094
2119 OUString getToken( sal_Int32 token, sal_Unicode cTok, sal_Int32& index ) const
2120 {
2121 rtl_uString * pNew = NULL;
2122 index = rtl_uString_getToken( &pNew, pData, token, cTok, index );
2123 return OUString( pNew, SAL_NO_ACQUIRE );
2124 }
2125
2139 OUString getToken(sal_Int32 count, sal_Unicode separator) const {
2140 sal_Int32 n = 0;
2141 return getToken(count, separator, n);
2142 }
2143
2152 bool toBoolean() const
2153 {
2154 return rtl_ustr_toBoolean( pData->buffer );
2155 }
2156
2163 sal_Unicode toChar() const
2164 {
2165 return pData->buffer[0];
2166 }
2167
2178 sal_Int32 toInt32( sal_Int16 radix = 10 ) const
2179 {
2180 return rtl_ustr_toInt32( pData->buffer, radix );
2181 }
2182
2195 sal_uInt32 toUInt32( sal_Int16 radix = 10 ) const
2196 {
2197 return rtl_ustr_toUInt32( pData->buffer, radix );
2198 }
2199
2210 sal_Int64 toInt64( sal_Int16 radix = 10 ) const
2211 {
2212 return rtl_ustr_toInt64( pData->buffer, radix );
2213 }
2214
2227 sal_uInt64 toUInt64( sal_Int16 radix = 10 ) const
2228 {
2229 return rtl_ustr_toUInt64( pData->buffer, radix );
2230 }
2231
2240 float toFloat() const
2241 {
2242 return rtl_ustr_toFloat( pData->buffer );
2243 }
2244
2253 double toDouble() const
2254 {
2255 return rtl_ustr_toDouble( pData->buffer );
2256 }
2257
2258
2274 OUString intern() const
2275 {
2276 rtl_uString * pNew = NULL;
2277 rtl_uString_intern( &pNew, pData );
2278 if (pNew == NULL) {
2279 throw std::bad_alloc();
2280 }
2281 return OUString( pNew, SAL_NO_ACQUIRE );
2282 }
2283
2309 static OUString intern( const sal_Char * value, sal_Int32 length,
2310 rtl_TextEncoding encoding,
2311 sal_uInt32 convertFlags = OSTRING_TO_OUSTRING_CVTFLAGS,
2312 sal_uInt32 *pInfo = NULL )
2313 {
2314 rtl_uString * pNew = NULL;
2315 rtl_uString_internConvert( &pNew, value, length, encoding,
2316 convertFlags, pInfo );
2317 if (pNew == NULL) {
2318 throw std::bad_alloc();
2319 }
2320 return OUString( pNew, SAL_NO_ACQUIRE );
2321 }
2322
2347 inline bool convertToString(OString * pTarget, rtl_TextEncoding nEncoding,
2348 sal_uInt32 nFlags) const
2349 {
2350 return rtl_convertUStringToString(&pTarget->pData, pData->buffer,
2351 pData->length, nEncoding, nFlags);
2352 }
2353
2405 inline sal_uInt32 iterateCodePoints(
2406 sal_Int32 * indexUtf16, sal_Int32 incrementCodePoints = 1) const
2407 {
2408 return rtl_uString_iterateCodePoints(
2409 pData, indexUtf16, incrementCodePoints);
2410 }
2411
2421 static inline OUString fromUtf8(const OString& rSource)
2422 {
2423 OUString aTarget;
2424 bool bSuccess = rtl_convertStringToUString(&aTarget.pData,
2425 rSource.getStr(),
2426 rSource.getLength(),
2427 RTL_TEXTENCODING_UTF8,
2428 RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR|RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR|RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR);
2429 (void) bSuccess;
2430 assert(bSuccess);
2431 return aTarget;
2432 }
2433
2444 inline OString toUtf8() const
2445 {
2446 OString aTarget;
2447 bool bSuccess = rtl_convertUStringToString(&aTarget.pData,
2448 getStr(),
2449 getLength(),
2450 RTL_TEXTENCODING_UTF8,
2451 RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR|RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR);
2452 (void) bSuccess;
2453 assert(bSuccess);
2454 return aTarget;
2455 }
2456
2467 static OUString number( int i, sal_Int16 radix = 10 )
2468 {
2469 sal_Unicode aBuf[RTL_USTR_MAX_VALUEOFINT32];
2470 rtl_uString* pNewData = NULL;
2471 rtl_uString_newFromStr_WithLength( &pNewData, aBuf, rtl_ustr_valueOfInt32( aBuf, i, radix ) );
2472 return OUString( pNewData, SAL_NO_ACQUIRE );
2473 }
2476 static OUString number( unsigned int i, sal_Int16 radix = 10 )
2477 {
2478 return number( static_cast< unsigned long long >( i ), radix );
2479 }
2482 static OUString number( long i, sal_Int16 radix = 10)
2483 {
2484 return number( static_cast< long long >( i ), radix );
2485 }
2488 static OUString number( unsigned long i, sal_Int16 radix = 10 )
2489 {
2490 return number( static_cast< unsigned long long >( i ), radix );
2491 }
2494 static OUString number( long long ll, sal_Int16 radix = 10 )
2495 {
2496 sal_Unicode aBuf[RTL_STR_MAX_VALUEOFINT64];
2497 rtl_uString* pNewData = NULL;
2498 rtl_uString_newFromStr_WithLength( &pNewData, aBuf, rtl_ustr_valueOfInt64( aBuf, ll, radix ) );
2499 return OUString( pNewData, SAL_NO_ACQUIRE );
2500 }
2503 static OUString number( unsigned long long ll, sal_Int16 radix = 10 )
2504 {
2505 sal_Unicode aBuf[RTL_STR_MAX_VALUEOFUINT64];
2506 rtl_uString* pNewData = NULL;
2507 rtl_uString_newFromStr_WithLength( &pNewData, aBuf, rtl_ustr_valueOfUInt64( aBuf, ll, radix ) );
2508 return OUString( pNewData, SAL_NO_ACQUIRE );
2509 }
2510
2520 static OUString number( float f )
2521 {
2522 sal_Unicode aBuf[RTL_USTR_MAX_VALUEOFFLOAT];
2523 rtl_uString* pNewData = NULL;
2524 rtl_uString_newFromStr_WithLength( &pNewData, aBuf, rtl_ustr_valueOfFloat( aBuf, f ) );
2525 return OUString( pNewData, SAL_NO_ACQUIRE );
2526 }
2527
2537 static OUString number( double d )
2538 {
2539 sal_Unicode aBuf[RTL_USTR_MAX_VALUEOFDOUBLE];
2540 rtl_uString* pNewData = NULL;
2541 rtl_uString_newFromStr_WithLength( &pNewData, aBuf, rtl_ustr_valueOfDouble( aBuf, d ) );
2542 return OUString( pNewData, SAL_NO_ACQUIRE );
2543 }
2544
2556 SAL_DEPRECATED("use boolean()") static OUString valueOf( sal_Bool b )
2557 {
2558 return boolean(b);
2559 }
2560
2572 static OUString boolean( bool b )
2573 {
2574 sal_Unicode aBuf[RTL_USTR_MAX_VALUEOFBOOLEAN];
2575 rtl_uString* pNewData = NULL;
2576 rtl_uString_newFromStr_WithLength( &pNewData, aBuf, rtl_ustr_valueOfBoolean( aBuf, b ) );
2577 return OUString( pNewData, SAL_NO_ACQUIRE );
2578 }
2579
2587 SAL_DEPRECATED("convert to OUString or use directly") static OUString valueOf( sal_Unicode c )
2588 {
2589 return OUString( &c, 1 );
2590 }
2591
2602 SAL_DEPRECATED("use number()") static OUString valueOf( sal_Int32 i, sal_Int16 radix = 10 )
2603 {
2604 return number( i, radix );
2605 }
2606
2617 SAL_DEPRECATED("use number()") static OUString valueOf( sal_Int64 ll, sal_Int16 radix = 10 )
2618 {
2619 return number( ll, radix );
2620 }
2621
2631 SAL_DEPRECATED("use number()") static OUString valueOf( float f )
2632 {
2633 return number(f);
2634 }
2635
2645 SAL_DEPRECATED("use number()") static OUString valueOf( double d )
2646 {
2647 return number(d);
2648 }
2649
2665 static OUString createFromAscii( const sal_Char * value )
2666 {
2667 rtl_uString* pNew = NULL;
2668 rtl_uString_newFromAscii( &pNew, value );
2669 return OUString( pNew, SAL_NO_ACQUIRE );
2670 }
2671 };
2672
2673 #if defined LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
2674
2679 template<>
2680 struct ToStringHelper< OUString >
2681 {
2682 static int length( const OUString& s ) { return s.getLength(); }
2683 static sal_Unicode* addData( sal_Unicode* buffer, const OUString& s ) { return addDataHelper( buffer, s.getStr(), s.getLength()); }
2684 static const bool allowOStringConcat = false;
2685 static const bool allowOUStringConcat = true;
2686 };
2687
2691 template<>
2692 struct ToStringHelper< OUStringLiteral >
2693 {
2694 static int length( const OUStringLiteral& str ) { return str.size; }
2695 static sal_Unicode* addData( sal_Unicode* buffer, const OUStringLiteral& str ) { return addDataLiteral( buffer, str.data, str.size ); }
2696 static const bool allowOStringConcat = false;
2697 static const bool allowOUStringConcat = true;
2698 };
2699
2703 template< typename charT, typename traits, typename T1, typename T2 >
2704 inline std::basic_ostream<charT, traits> & operator <<(
2705 std::basic_ostream<charT, traits> & stream, const OUStringConcat< T1, T2 >& concat)
2706 {
2707 return stream << OUString( concat );
2708 }
2709
2711 #endif
2712
2718 struct OUStringHash
2719 {
2729 size_t operator()(const OUString& rString) const
2730 { return (size_t)rString.hashCode(); }
2731 };
2732
2733 /* ======================================================================= */
2734
2752 inline OUString OStringToOUString( const OString & rStr,
2753 rtl_TextEncoding encoding,
2754 sal_uInt32 convertFlags = OSTRING_TO_OUSTRING_CVTFLAGS )
2755 {
2756 return OUString( rStr.getStr(), rStr.getLength(), encoding, convertFlags );
2757 }
2758
2776 inline OString OUStringToOString( const OUString & rUnicode,
2777 rtl_TextEncoding encoding,
2778 sal_uInt32 convertFlags = OUSTRING_TO_OSTRING_CVTFLAGS )
2779 {
2780 return OString( rUnicode.getStr(), rUnicode.getLength(), encoding, convertFlags );
2781 }
2782
2783 /* ======================================================================= */
2784
2793 template< typename charT, typename traits >
2794 inline std::basic_ostream<charT, traits> & operator <<(
2795 std::basic_ostream<charT, traits> & stream, OUString const & string)
2796 {
2797 return stream <<
2798 OUStringToOString(string, RTL_TEXTENCODING_UTF8).getStr();
2799 // best effort; potentially loses data due to conversion failures
2800 // (stray surrogate halves) and embedded null characters
2801 }
2802
2803 } // namespace
2804
2805 #ifdef RTL_STRING_UNITTEST
2806 namespace rtl
2807 {
2808 typedef rtlunittest::OUString OUString;
2809 }
2810 #endif
2811
2812 // In internal code, allow to use classes like OUString without having to
2813 // explicitly refer to the rtl namespace, which is kind of superfluous given
2814 // that OUString itself is namespaced by its OU prefix:
2815 #if defined LIBO_INTERNAL_ONLY && !defined RTL_STRING_UNITTEST
2816 using ::rtl::OUString;
2817 using ::rtl::OUStringHash;
2818 using ::rtl::OStringToOUString;
2819 using ::rtl::OUStringToOString;
2820 using ::rtl::OUStringLiteral;
2821 using ::rtl::OUStringLiteral1;
2822 #endif
2823
2824 #endif /* _RTL_USTRING_HXX */
2825
2826 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
rtl_uString_newToAsciiUpperCase
SAL_DLLPUBLIC void rtl_uString_newToAsciiUpperCase(rtl_uString **newStr, rtl_uString *str) SAL_THROW_EXTERN_C()
Create a new string by converting all ASCII lowercase letters to uppercase within another string...
rtl::OUString::boolean
static OUString boolean(bool b)
Returns the string representation of the boolean argument.
Definition: ustring.hxx:2572
rtl::OUString::indexOfAsciiL
sal_Int32 indexOfAsciiL(char const *str, sal_Int32 len, sal_Int32 fromIndex=0) const
Returns the index within this string of the first occurrence of the specified ASCII substring...
Definition: ustring.hxx:1612
rtl::OUString::intern
static OUString intern(const sal_Char *value, sal_Int32 length, rtl_TextEncoding encoding, sal_uInt32 convertFlags=OSTRING_TO_OUSTRING_CVTFLAGS, sal_uInt32 *pInfo=NULL)
Return a canonical representation for a converted string.
Definition: ustring.hxx:2309
rtl::OUString::OUString
OUString()
New string containing no characters.
Definition: ustring.hxx:116
rtl_ustr_hashCode_WithLength
SAL_DLLPUBLIC sal_Int32 rtl_ustr_hashCode_WithLength(const sal_Unicode *str, sal_Int32 len) SAL_THROW_EXTERN_C()
Return a hash code for a string.
rtl_ustr_ascii_compareIgnoreAsciiCase_WithLengths
SAL_DLLPUBLIC sal_Int32 rtl_ustr_ascii_compareIgnoreAsciiCase_WithLengths(sal_Unicode const *first, sal_Int32 firstLen, char const *second, sal_Int32 secondLen) SAL_THROW_EXTERN_C()
Compare two strings, ignoring the case of ASCII characters.
rtl::OUString::toDouble
double toDouble() const
Returns the double value from this string.
Definition: ustring.hxx:2253
OSTRING_TO_OUSTRING_CVTFLAGS
#define OSTRING_TO_OUSTRING_CVTFLAGS
Definition: ustring.h:1894
rtl::OUString::toInt32
sal_Int32 toInt32(sal_Int16 radix=10) const
Returns the int32 value from this string.
Definition: ustring.hxx:2178
rtl_uString_newConcatAsciiL
SAL_DLLPUBLIC void rtl_uString_newConcatAsciiL(rtl_uString **newString, rtl_uString *left, char const *right, sal_Int32 rightLength)
Create a new string that is the concatenation of two other strings.
rtl::OUString::reverseCompareTo
libreoffice_internal::ConstCharArrayDetector< T, sal_Int32 >::Type reverseCompareTo(T &literal) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: ustring.hxx:608
rtl::OUString::getStr
const sal_Unicode * getStr() const
Returns a pointer to the Unicode character buffer for this string.
Definition: ustring.hxx:528
rtl::OUString::clear
void clear()
Clears the string, i.e, makes a zero-character string.
Definition: ustring.hxx:493
rtl::OUString::equalsIgnoreAsciiCaseAscii
bool equalsIgnoreAsciiCaseAscii(const sal_Char *asciiStr) const
Perform a ASCII lowercase comparison of two strings.
Definition: ustring.hxx:930
rtl_uString_newReplaceFirst
SAL_DLLPUBLIC void rtl_uString_newReplaceFirst(rtl_uString **newStr, rtl_uString *str, rtl_uString const *from, rtl_uString const *to, sal_Int32 *index) SAL_THROW_EXTERN_C()
Create a new string by replacing the first occurrence of a given substring with another substring...
rtl::OUString::getLength
sal_Int32 getLength() const
Returns the length of this string.
Definition: ustring.hxx:506
rtl::OUString::matchIgnoreAsciiCaseAsciiL
bool matchIgnoreAsciiCaseAsciiL(const sal_Char *asciiStr, sal_Int32 asciiStrLength, sal_Int32 fromIndex=0) const
Match against a substring appearing in this string, ignoring the case of ASCII letters.
Definition: ustring.hxx:1045
rtl::OUString::operator=
OUString & operator=(const OUString &str)
Assign a new string.
Definition: ustring.hxx:383
rtl_uString_new
SAL_DLLPUBLIC void rtl_uString_new(rtl_uString **newStr) SAL_THROW_EXTERN_C()
Allocate a new string containing no characters.
rtl::OUString::endsWith
bool endsWith(OUString const &str, OUString *rest=NULL) const
Check whether this string ends with a given substring.
Definition: ustring.hxx:1178
textenc.h
rtl::OUString::intern
OUString intern() const
Return a canonical representation for a string.
Definition: ustring.hxx:2274
rtl::OUString::unacquired
static OUString const & unacquired(rtl_uString *const *ppHandle)
Provides an OUString const & passing a storage pointer of an rtl_uString * handle.
Definition: ustring.hxx:375
rtl_uString_ensureCapacity
SAL_DLLPUBLIC void rtl_uString_ensureCapacity(rtl_uString **str, sal_Int32 size) SAL_THROW_EXTERN_C()
Ensure a string has enough space for a given number of characters.
rtl::OUString::toUInt64
sal_uInt64 toUInt64(sal_Int16 radix=10) const
Returns the uint64 value from this string.
Definition: ustring.hxx:2227
rtl_ustr_shortenedCompare_WithLength
SAL_DLLPUBLIC sal_Int32 rtl_ustr_shortenedCompare_WithLength(const sal_Unicode *first, sal_Int32 firstLen, const sal_Unicode *second, sal_Int32 secondLen, sal_Int32 shortenedLen) SAL_THROW_EXTERN_C()
Compare two strings with a maximum count of characters.
sal_Char
char sal_Char
A legacy synonym for char.
Definition: types.h:130
rtl_ustr_toUInt32
SAL_DLLPUBLIC sal_uInt32 rtl_ustr_toUInt32(const sal_Unicode *str, sal_Int16 radix) SAL_THROW_EXTERN_C()
Interpret a string as an unsigned integer.
rtl::OUString::number
static OUString number(long long ll, sal_Int16 radix=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: ustring.hxx:2494
log.hxx
RTL_TEXTENCODING_UTF8
#define RTL_TEXTENCODING_UTF8
Definition: textenc.h:121
rtl_ustr_compare_WithLength
SAL_DLLPUBLIC sal_Int32 rtl_ustr_compare_WithLength(const sal_Unicode *first, sal_Int32 firstLen, const sal_Unicode *second, sal_Int32 secondLen) SAL_THROW_EXTERN_C()
Compare two strings.
rtl::OStringToOUString
OUString OStringToOUString(const OString &rStr, rtl_TextEncoding encoding, sal_uInt32 convertFlags=OSTRING_TO_OUSTRING_CVTFLAGS)
Convert an OString to an OUString, using a specific text encoding.
Definition: ustring.hxx:2752
rtl_ustr_ascii_compareIgnoreAsciiCase_WithLength
SAL_DLLPUBLIC sal_Int32 rtl_ustr_ascii_compareIgnoreAsciiCase_WithLength(const sal_Unicode *first, sal_Int32 firstLen, const sal_Char *second) SAL_THROW_EXTERN_C()
Compare two strings, ignoring the case of ASCII characters.
config.h
rtl::OUString::operator==
friend libreoffice_internal::ConstCharArrayDetector< T, bool >::Type operator==(const OUString &string, T &literal)
Compare string to an ASCII string literal.
Definition: ustring.hxx:1348
RTL_USTR_MAX_VALUEOFBOOLEAN
#define RTL_USTR_MAX_VALUEOFBOOLEAN
Definition: ustring.h:915
rtl::OUString::OUString
OUString(sal_Unicode value)
New string from a single Unicode character.
Definition: ustring.hxx:160
stringutils.hxx
rtl_uString_newReplaceFirstToAsciiL
SAL_DLLPUBLIC void rtl_uString_newReplaceFirstToAsciiL(rtl_uString **newStr, rtl_uString *str, rtl_uString const *from, char const *to, sal_Int32 toLength, sal_Int32 *index) SAL_THROW_EXTERN_C()
Create a new string by replacing the first occurrence of a given substring with another substring...
rtl_uString_newFromCodePoints
SAL_DLLPUBLIC void rtl_uString_newFromCodePoints(rtl_uString **newString, sal_uInt32 const *codePoints, sal_Int32 codePointCount) SAL_THROW_EXTERN_C()
Allocate a new string from an array of Unicode code points.
RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR
#define RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR
Definition: textcvt.h:71
RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR
#define RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR
Definition: textcvt.h:64
rtl::OUString::number
static OUString number(unsigned int i, sal_Int16 radix=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: ustring.hxx:2476
SAL_WARN_UNUSED
#define SAL_WARN_UNUSED
Annotate classes where a compiler should warn if an instance is unused.
Definition: types.h:612
rtl::OUString::OUString
OUString(sal_uInt32 const *codePoints, sal_Int32 codePointCount)
Create a new string from an array of Unicode code points.
Definition: ustring.hxx:326
rtl::OUStringToOString
OString OUStringToOString(const OUString &rUnicode, rtl_TextEncoding encoding, sal_uInt32 convertFlags=OUSTRING_TO_OSTRING_CVTFLAGS)
Convert an OUString to an OString, using a specific text encoding.
Definition: ustring.hxx:2776
rtl::OUString::number
static OUString number(long i, sal_Int16 radix=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: ustring.hxx:2482
rtl_convertUStringToString
SAL_DLLPUBLIC sal_Bool rtl_convertUStringToString(rtl_String **pTarget, sal_Unicode const *pSource, sal_Int32 nLength, rtl_TextEncoding nEncoding, sal_uInt32 nFlags) SAL_THROW_EXTERN_C()
Converts a Unicode string to a byte string, signalling failure.
rtl_uString_getToken
SAL_DLLPUBLIC sal_Int32 rtl_uString_getToken(rtl_uString **newStr, rtl_uString *str, sal_Int32 token, sal_Unicode cTok, sal_Int32 idx) SAL_THROW_EXTERN_C()
Create a new string by extracting a single token from another string.
rtl_ustr_toDouble
SAL_DLLPUBLIC double rtl_ustr_toDouble(const sal_Unicode *str) SAL_THROW_EXTERN_C()
Interpret a string as a double.
rtl_ustr_indexOfAscii_WithLength
SAL_DLLPUBLIC sal_Int32 rtl_ustr_indexOfAscii_WithLength(sal_Unicode const *str, sal_Int32 len, char const *subStr, sal_Int32 subLen) SAL_THROW_EXTERN_C()
Search for the first occurrence of an ASCII substring within a string.
rtl_ustr_asciil_reverseEquals_WithLength
SAL_DLLPUBLIC sal_Bool rtl_ustr_asciil_reverseEquals_WithLength(const sal_Unicode *first, const sal_Char *second, sal_Int32 len) SAL_THROW_EXTERN_C()
Compare two strings from back to front for equality.
rtl::OUStringHash::operator()
size_t operator()(const OUString &rString) const
Compute a hash code for a string.
Definition: ustring.hxx:2729
rtl_ustr_toInt64
SAL_DLLPUBLIC sal_Int64 rtl_ustr_toInt64(const sal_Unicode *str, sal_Int16 radix) SAL_THROW_EXTERN_C()
Interpret a string as a long integer.
rtl::OUString::toBoolean
bool toBoolean() const
Returns the Boolean value from this string.
Definition: ustring.hxx:2152
rtl_uString_newFromStr_WithLength
SAL_DLLPUBLIC void rtl_uString_newFromStr_WithLength(rtl_uString **newStr, const sal_Unicode *value, sal_Int32 len) SAL_THROW_EXTERN_C()
Allocate a new string that contains a copy of a character array.
rtl_uString_newReplace
SAL_DLLPUBLIC void rtl_uString_newReplace(rtl_uString **newStr, rtl_uString *str, sal_Unicode oldChar, sal_Unicode newChar) SAL_THROW_EXTERN_C()
Create a new string by replacing all occurrences of a single character within another string...
rtl_ustr_valueOfInt64
SAL_DLLPUBLIC sal_Int32 rtl_ustr_valueOfInt64(sal_Unicode *str, sal_Int64 l, sal_Int16 radix) SAL_THROW_EXTERN_C()
Create the string representation of a long integer.
rtl::OUString::getToken
OUString getToken(sal_Int32 count, sal_Unicode separator) const
Returns a token from the string.
Definition: ustring.hxx:2139
rtl::OUString::concat
SAL_WARN_UNUSED_RESULT OUString concat(const OUString &str) const
Concatenates the specified string to the end of this string.
Definition: ustring.hxx:1757
rtl::OUString::equals
bool equals(const OUString &str) const
Perform a comparison of two strings.
Definition: ustring.hxx:629
rtl_ustr_asciil_reverseCompare_WithLength
SAL_DLLPUBLIC sal_Int32 rtl_ustr_asciil_reverseCompare_WithLength(const sal_Unicode *first, sal_Int32 firstLen, const sal_Char *second, sal_Int32 secondLen) SAL_THROW_EXTERN_C()
Compare two strings from back to front.
rtl::OUString::matchAsciiL
bool matchAsciiL(const sal_Char *asciiStr, sal_Int32 asciiStrLength, sal_Int32 fromIndex=0) const
Match against a substring appearing in this string.
Definition: ustring.hxx:1007
rtl::OUString::lastIndexOfAsciiL
sal_Int32 lastIndexOfAsciiL(char const *str, sal_Int32 len) const
Returns the index within this string of the last occurrence of the specified ASCII substring...
Definition: ustring.hxx:1707
rtl::libreoffice_internal::ConstCharArrayDetector
Definition: stringutils.hxx:160
rtl::OUString::convertToString
bool convertToString(OString *pTarget, rtl_TextEncoding nEncoding, sal_uInt32 nFlags) const
Converts to an OString, signalling failure.
Definition: ustring.hxx:2347
rtl::operator<<
std::basic_ostream< charT, traits > & operator<<(std::basic_ostream< charT, traits > &stream, OString const &string)
Support for rtl::OString in std::ostream (and thus in CPPUNIT_ASSERT or SAL_INFO macros, for example).
Definition: string.hxx:1858
rtl_uString_intern
SAL_DLLPUBLIC void rtl_uString_intern(rtl_uString **newStr, rtl_uString *str) SAL_THROW_EXTERN_C()
Return a canonical representation for a string.
rtl_uString_newReplaceAllToAsciiL
SAL_DLLPUBLIC void rtl_uString_newReplaceAllToAsciiL(rtl_uString **newStr, rtl_uString *str, rtl_uString const *from, char const *to, sal_Int32 toLength) SAL_THROW_EXTERN_C()
Create a new string by replacing all occurrences of a given substring with another substring...
rtl_uString_newFromAscii
SAL_DLLPUBLIC void rtl_uString_newFromAscii(rtl_uString **newStr, const sal_Char *value) SAL_THROW_EXTERN_C()
Allocate a new string that contains a copy of a character array.
RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR
#define RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR
Definition: textcvt.h:68
RTL_STR_MAX_VALUEOFUINT64
#define RTL_STR_MAX_VALUEOFUINT64
Definition: string.h:673
rtl::OUString::operator+
friend OUString operator+(const OUString &rStr1, const OUString &rStr2)
Definition: ustring.hxx:1765
rtl::OUString::compareTo
sal_Int32 compareTo(const OUString &str, sal_Int32 maxLength) const
Compares two strings with a maximum count of characters.
Definition: ustring.hxx:578
rtl_ustr_toInt32
SAL_DLLPUBLIC sal_Int32 rtl_ustr_toInt32(const sal_Unicode *str, sal_Int16 radix) SAL_THROW_EXTERN_C()
Interpret a string as an integer.
rtl_ustr_valueOfInt32
SAL_DLLPUBLIC sal_Int32 rtl_ustr_valueOfInt32(sal_Unicode *str, sal_Int32 i, sal_Int16 radix) SAL_THROW_EXTERN_C()
Create the string representation of an integer.
RTL_USTR_MAX_VALUEOFINT32
#define RTL_USTR_MAX_VALUEOFINT32
Definition: ustring.h:957
rtl::OUString::lastIndexOf
sal_Int32 lastIndexOf(const OUString &str) const
Returns the index within this string of the last occurrence of the specified substring, searching backward starting at the end.
Definition: ustring.hxx:1643
rtl_string2UString
SAL_DLLPUBLIC void rtl_string2UString(rtl_uString **newStr, const sal_Char *str, sal_Int32 len, rtl_TextEncoding encoding, sal_uInt32 convertFlags) SAL_THROW_EXTERN_C()
Create a new Unicode string by converting a byte string, using a specific text encoding.
rtl_uString_newReplaceAllAsciiLAsciiL
SAL_DLLPUBLIC void rtl_uString_newReplaceAllAsciiLAsciiL(rtl_uString **newStr, rtl_uString *str, char const *from, sal_Int32 fromLength, char const *to, sal_Int32 toLength) SAL_THROW_EXTERN_C()
Create a new string by replacing all occurrences of a given substring with another substring...
rtl::OUString::number
static OUString number(unsigned long long ll, sal_Int16 radix=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: ustring.hxx:2503
sal_Bool
unsigned char sal_Bool
Definition: types.h:48
rtl_ustr_valueOfFloat
SAL_DLLPUBLIC sal_Int32 rtl_ustr_valueOfFloat(sal_Unicode *str, float f) SAL_THROW_EXTERN_C()
Create the string representation of a float.
salhelper::operator<
bool operator<(const TTimeValue &rTimeA, const TTimeValue &rTimeB)
Definition: timer.hxx:96
rtl::OString::getStr
const sal_Char * getStr() const
Returns a pointer to the characters of this string.
Definition: string.hxx:394
stringconcat.hxx
rtl_ustr_lastIndexOfAscii_WithLength
SAL_DLLPUBLIC sal_Int32 rtl_ustr_lastIndexOfAscii_WithLength(sal_Unicode const *str, sal_Int32 len, char const *subStr, sal_Int32 subLen) SAL_THROW_EXTERN_C()
Search for the last occurrence of an ASCII substring within a string.
RTL_USTR_MAX_VALUEOFFLOAT
#define RTL_USTR_MAX_VALUEOFFLOAT
Definition: ustring.h:1022
rtl::OUString::lastIndexOf
sal_Int32 lastIndexOf(sal_Unicode ch, sal_Int32 fromIndex) const
Returns the index within this string of the last occurrence of the specified character, searching backward starting before the specified index.
Definition: ustring.hxx:1545
rtl_ustr_valueOfUInt64
SAL_DLLPUBLIC sal_Int32 rtl_ustr_valueOfUInt64(sal_Unicode *str, sal_uInt64 l, sal_Int16 radix) SAL_THROW_EXTERN_C()
Create the string representation of an unsigned long integer.
rtl::OUString::equalsIgnoreAsciiCase
libreoffice_internal::ConstCharArrayDetector< T, bool >::Type equalsIgnoreAsciiCase(T &literal) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: ustring.hxx:691
rtl::OUString::indexOf
libreoffice_internal::ConstCharArrayDetector< T, sal_Int32 >::Type indexOf(T &literal, sal_Int32 fromIndex=0) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: ustring.hxx:1578
rtl_uString_acquire
SAL_DLLPUBLIC void rtl_uString_acquire(rtl_uString *str) SAL_THROW_EXTERN_C()
Increment the reference count of a string.
rtl::OUString::endsWithIgnoreAsciiCase
bool endsWithIgnoreAsciiCase(OUString const &str, OUString *rest=NULL) const
Check whether this string ends with a given string, ignoring the case of ASCII letters.
Definition: ustring.hxx:1256
rtl::OUString::endsWithIgnoreAsciiCase
libreoffice_internal::ConstCharArrayDetector< T, bool >::Type endsWithIgnoreAsciiCase(T &literal, OUString *rest=NULL) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: ustring.hxx:1273
rtl::OUString::fromUtf8
static OUString fromUtf8(const OString &rSource)
Convert an OString to an OUString, assuming that the OString is UTF-8-encoded.
Definition: ustring.hxx:2421
rtl_ustr_toBoolean
SAL_DLLPUBLIC sal_Bool rtl_ustr_toBoolean(const sal_Unicode *str) SAL_THROW_EXTERN_C()
Interpret a string as a boolean.
rtl::OUString::iterateCodePoints
sal_uInt32 iterateCodePoints(sal_Int32 *indexUtf16, sal_Int32 incrementCodePoints=1) const
Iterate through this string based on code points instead of UTF-16 code units.
Definition: ustring.hxx:2405
salhelper::operator>
bool operator>(const TTimeValue &rTimeA, const TTimeValue &rTimeB)
Definition: timer.hxx:106
rtl::OUString::copy
SAL_WARN_UNUSED_RESULT OUString copy(sal_Int32 beginIndex, sal_Int32 count) const
Returns a new string that is a substring of this string.
Definition: ustring.hxx:1742
rtl::OUString::equalsAsciiL
bool equalsAsciiL(const sal_Char *asciiStr, sal_Int32 asciiStrLength) const
Perform a comparison of two strings.
Definition: ustring.hxx:903
rtl::OUString::operator!=
friend libreoffice_internal::ConstCharArrayDetector< T, bool >::Type operator!=(T &literal, const OUString &string)
Compare string to an ASCII string literal.
Definition: ustring.hxx:1396
com::sun::star::uno::operator!=
bool operator!=(const Any &rAny, const C &value)
Template unequality operator: compares set value of left side any to right side value.
Definition: Any.hxx:584
rtl::OUString::reverseCompareTo
sal_Int32 reverseCompareTo(const OUString &str) const
Compares two strings in reverse order.
Definition: ustring.hxx:596
rtl_uString_newFromSubString
SAL_DLLPUBLIC void rtl_uString_newFromSubString(rtl_uString **newStr, const rtl_uString *from, sal_Int32 beginIndex, sal_Int32 count) SAL_THROW_EXTERN_C()
Allocate a new string that is a substring of this string.
__sal_NoAcquire
__sal_NoAcquire
Definition: types.h:382
rtl_ustr_ascii_shortenedCompareIgnoreAsciiCase_WithLength
SAL_DLLPUBLIC sal_Int32 rtl_ustr_ascii_shortenedCompareIgnoreAsciiCase_WithLength(const sal_Unicode *first, sal_Int32 firstLen, const sal_Char *second, sal_Int32 shortenedLen) SAL_THROW_EXTERN_C()
Compare two strings with a maximum count of characters, ignoring the case of ASCII characters...
rtl::OUString::replaceAt
SAL_WARN_UNUSED_RESULT OUString replaceAt(sal_Int32 index, sal_Int32 count, const OUString &newStr) const
Returns a new string resulting from replacing n = count characters from position index in this string...
Definition: ustring.hxx:1784
SAL_WARN_UNUSED_RESULT
#define SAL_WARN_UNUSED_RESULT
Use this as markup for functions and methods whose return value must be checked.
Definition: types.h:323
rtl::OUString::replaceFirst
SAL_WARN_UNUSED_RESULT OUString replaceFirst(OUString const &from, OUString const &to, sal_Int32 *index=NULL) const
Returns a new string resulting from replacing the first occurrence of a given substring with another ...
Definition: ustring.hxx:1829
rtl::OUString::match
bool match(const OUString &str, sal_Int32 fromIndex=0) const
Match against a substring appearing in this string.
Definition: ustring.hxx:720
rtl::OUString::toUInt32
sal_uInt32 toUInt32(sal_Int16 radix=10) const
Returns the uint32 value from this string.
Definition: ustring.hxx:2195
rtl::OUString::replaceAll
SAL_WARN_UNUSED_RESULT libreoffice_internal::ConstCharArrayDetector< T, OUString >::Type replaceAll(T &from, OUString const &to) const
Returns a new string resulting from replacing all occurrences of a given substring with another subst...
Definition: ustring.hxx:1978
rtl::OUString::isEmpty
bool isEmpty() const
Checks if a string is empty.
Definition: ustring.hxx:516
rtl::OUString::toUtf8
OString toUtf8() const
Convert this string to an OString, assuming that the string can be UTF-8-encoded successfully.
Definition: ustring.hxx:2444
rtl::OUString::OUString
OUString(rtl_uString *str)
New string from OUString data.
Definition: ustring.hxx:138
rtl_uString_newReplaceAllFromIndex
SAL_DLLPUBLIC void rtl_uString_newReplaceAllFromIndex(rtl_uString **newStr, rtl_uString *str, rtl_uString const *from, rtl_uString const *to, sal_Int32 fromIndex) SAL_THROW_EXTERN_C()
Create a new string by replacing all occurrences of a given substring with another substring...
rtl::OUString::copy
SAL_WARN_UNUSED_RESULT OUString copy(sal_Int32 beginIndex) const
Returns a new string that is a substring of this string.
Definition: ustring.hxx:1723
RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR
#define RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR
Definition: textcvt.h:134
rtl::OUString::startsWith
libreoffice_internal::ConstCharArrayDetector< T, bool >::Type startsWith(T &literal, OUString *rest=NULL) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: ustring.hxx:1088
rtl::OUString::matchIgnoreAsciiCase
bool matchIgnoreAsciiCase(const OUString &str, sal_Int32 fromIndex=0) const
Match against a substring appearing in this string, ignoring the case of ASCII letters.
Definition: ustring.hxx:763
rtl_ustr_ascii_compare_WithLength
SAL_DLLPUBLIC sal_Int32 rtl_ustr_ascii_compare_WithLength(const sal_Unicode *first, sal_Int32 firstLen, const sal_Char *second) SAL_THROW_EXTERN_C()
Compare two strings.
rtl_convertStringToUString
SAL_DLLPUBLIC sal_Bool rtl_convertStringToUString(rtl_uString **target, char const *source, sal_Int32 length, rtl_TextEncoding encoding, sal_uInt32 flags) SAL_THROW_EXTERN_C()
Converts a byte string to a Unicode string, signalling failure.
sal_Unicode
sal_uInt16 sal_Unicode
Definition: types.h:155
rtl::OUString::operator!=
friend libreoffice_internal::ConstCharArrayDetector< T, bool >::Type operator!=(const OUString &string, T &literal)
Compare string to an ASCII string literal.
Definition: ustring.hxx:1380
rtl_uString_newFromStr
SAL_DLLPUBLIC void rtl_uString_newFromStr(rtl_uString **newStr, const sal_Unicode *value) SAL_THROW_EXTERN_C()
Allocate a new string that contains a copy of a character array.
rtl::OUString::getToken
OUString getToken(sal_Int32 token, sal_Unicode cTok, sal_Int32 &index) const
Returns a token in the string.
Definition: ustring.hxx:2119
rtl::OUString::toAsciiLowerCase
SAL_WARN_UNUSED_RESULT OUString toAsciiLowerCase() const
Converts from this string all ASCII uppercase characters (65-90) to ASCII lowercase characters (97-12...
Definition: ustring.hxx:2053
rtl_uString_newToAsciiLowerCase
SAL_DLLPUBLIC void rtl_uString_newToAsciiLowerCase(rtl_uString **newStr, rtl_uString *str) SAL_THROW_EXTERN_C()
Create a new string by converting all ASCII uppercase letters to lowercase within another string...
rtl_TextEncoding
sal_uInt16 rtl_TextEncoding
The various supported text encodings.
Definition: textenc.h:39
rtl::OUString::compareToAscii
sal_Int32 compareToAscii(const sal_Char *asciiStr) const
Compares two strings.
Definition: ustring.hxx:805
rtl_ustr_compareIgnoreAsciiCase_WithLength
SAL_DLLPUBLIC sal_Int32 rtl_ustr_compareIgnoreAsciiCase_WithLength(const sal_Unicode *first, sal_Int32 firstLen, const sal_Unicode *second, sal_Int32 secondLen) SAL_THROW_EXTERN_C()
Compare two strings, ignoring the case of ASCII characters.
rtl::OUString::startsWithIgnoreAsciiCase
bool startsWithIgnoreAsciiCase(OUString const &str, OUString *rest=NULL) const
Check whether this string starts with a given string, ignoring the case of ASCII letters.
Definition: ustring.hxx:1128
rtl::OUString::toChar
sal_Unicode toChar() const
Returns the first character from this string.
Definition: ustring.hxx:2163
rtl::OUString::equalsIgnoreAsciiCaseAsciiL
bool equalsIgnoreAsciiCaseAsciiL(const sal_Char *asciiStr, sal_Int32 asciiStrLength) const
Perform an ASCII lowercase comparison of two strings.
Definition: ustring.hxx:978
rtl::OUString::number
static OUString number(float f)
Returns the string representation of the float argument.
Definition: ustring.hxx:2520
rtl_ustr_ascii_shortenedCompare_WithLength
SAL_DLLPUBLIC sal_Int32 rtl_ustr_ascii_shortenedCompare_WithLength(const sal_Unicode *first, sal_Int32 firstLen, const sal_Char *second, sal_Int32 shortenedLen) SAL_THROW_EXTERN_C()
Compare two strings with a maximum count of characters.
rtl::OUString::lastIndexOf
sal_Int32 lastIndexOf(const OUString &str, sal_Int32 fromIndex) const
Returns the index within this string of the last occurrence of the specified substring, searching backward starting before the specified index.
Definition: ustring.hxx:1666
rtl::OUString::indexOf
sal_Int32 indexOf(sal_Unicode ch, sal_Int32 fromIndex=0) const
Returns the index within this string of the first occurrence of the specified character, starting the search at the specified index.
Definition: ustring.hxx:1513
rtl::OUString::replaceFirst
SAL_WARN_UNUSED_RESULT libreoffice_internal::ConstCharArrayDetector< T, OUString >::Type replaceFirst(OUString const &from, T &to, sal_Int32 *index=NULL) const
Returns a new string resulting from replacing the first occurrence of a given substring with another ...
Definition: ustring.hxx:1891
rtl::OUString::toFloat
float toFloat() const
Returns the float value from this string.
Definition: ustring.hxx:2240
rtl::OUString::lastIndexOf
sal_Int32 lastIndexOf(sal_Unicode ch) const
Returns the index within this string of the last occurrence of the specified character, searching backward starting at the end.
Definition: ustring.hxx:1528
rtl::OUString::toInt64
sal_Int64 toInt64(sal_Int16 radix=10) const
Returns the int64 value from this string.
Definition: ustring.hxx:2210
rtl::OUString::compareToIgnoreAsciiCaseAscii
sal_Int32 compareToIgnoreAsciiCaseAscii(const sal_Char *asciiStr) const
Compares two ASCII strings ignoring case.
Definition: ustring.hxx:953
rtl::OUString::replaceAll
SAL_WARN_UNUSED_RESULT libreoffice_internal::ConstCharArrayDetector< T1, typename libreoffice_internal::ConstCharArrayDetector< T2, OUString >::Type >::Type replaceAll(T1 &from, T2 &to) const
Returns a new string resulting from replacing all occurrences of a given substring with another subst...
Definition: ustring.hxx:2029
rtl::OUStringHash
A helper to use OUStrings with hash maps.
Definition: ustring.hxx:2718
rtl
Definition: bootstrap.hxx:29
rtl::OUString
This String class provides base functionality for C++ like Unicode character array handling...
Definition: ustring.hxx:106
SAL_NO_ACQUIRE
definition of a no acquire enum for ctors
Definition: types.h:386
SAL_CONSTEXPR
#define SAL_CONSTEXPR
C++11 "constexpr" feature.
Definition: types.h:443
rtl::OUString::matchIgnoreAsciiCase
libreoffice_internal::ConstCharArrayDetector< T, bool >::Type matchIgnoreAsciiCase(T &literal, sal_Int32 fromIndex=0) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: ustring.hxx:776
RTL_USTR_MAX_VALUEOFDOUBLE
#define RTL_USTR_MAX_VALUEOFDOUBLE
Definition: ustring.h:1041
SAL_DEPRECATED
#define SAL_DEPRECATED(message)
Use as follows: SAL_DEPRECATED("Dont use, its evil.") void doit(int nPara);.
Definition: types.h:499
rtl_ustr_reverseCompare_WithLength
SAL_DLLPUBLIC sal_Int32 rtl_ustr_reverseCompare_WithLength(const sal_Unicode *first, sal_Int32 firstLen, const sal_Unicode *second, sal_Int32 secondLen) SAL_THROW_EXTERN_C()
Compare two strings from back to front.
rtl::OUString::compareTo
sal_Int32 compareTo(const OUString &str) const
Compares two strings.
Definition: ustring.hxx:557
rtl::OUString::OUString
OUString(T &literal, typename libreoffice_internal::ConstCharArrayDetector< T, libreoffice_internal::Dummy >::Type=libreoffice_internal::Dummy())
New string from an 8-Bit string literal that is expected to contain only characters in the ASCII set ...
Definition: ustring.hxx:218
rtl::OString::getLength
sal_Int32 getLength() const
Returns the length of this string.
Definition: string.hxx:368
string.hxx
rtl::OUString::endsWithAsciiL
bool endsWithAsciiL(char const *asciiStr, sal_Int32 asciiStrLength) const
Check whether this string ends with a given ASCII string.
Definition: ustring.hxx:1227
rtl_uString_newReplaceFirstAsciiL
SAL_DLLPUBLIC void rtl_uString_newReplaceFirstAsciiL(rtl_uString **newStr, rtl_uString *str, char const *from, sal_Int32 fromLength, rtl_uString const *to, sal_Int32 *index) SAL_THROW_EXTERN_C()
Create a new string by replacing the first occurrence of a given substring with another substring...
rtl::OUString::OUString
OUString(const sal_Char *value, sal_Int32 length, rtl_TextEncoding encoding, sal_uInt32 convertFlags=OSTRING_TO_OUSTRING_CVTFLAGS)
New string from an 8-Bit character buffer array.
Definition: ustring.hxx:299
rtl::OUString::match
libreoffice_internal::ConstCharArrayDetector< T, bool >::Type match(T &literal, sal_Int32 fromIndex=0) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: ustring.hxx:732
rtl_ustr_valueOfBoolean
SAL_DLLPUBLIC sal_Int32 rtl_ustr_valueOfBoolean(sal_Unicode *str, sal_Bool b) SAL_THROW_EXTERN_C()
Create the string representation of a boolean.
rtl::OUString::toAsciiUpperCase
SAL_WARN_UNUSED_RESULT OUString toAsciiUpperCase() const
Converts from this string all ASCII lowercase characters (97-122) to ASCII uppercase characters (65-9...
Definition: ustring.hxx:2070
rtl::OUString::hashCode
sal_Int32 hashCode() const
Returns a hashcode for this string.
Definition: ustring.hxx:1495
rtl_uString_newFromLiteral
SAL_DLLPUBLIC void rtl_uString_newFromLiteral(rtl_uString **newStr, const sal_Char *value, sal_Int32 len, sal_Int32 allocExtra) SAL_THROW_EXTERN_C()
rtl_uString_newTrim
SAL_DLLPUBLIC void rtl_uString_newTrim(rtl_uString **newStr, rtl_uString *str) SAL_THROW_EXTERN_C()
Create a new string by removing white space from both ends of another string.
rtl::OUString::replaceAll
SAL_WARN_UNUSED_RESULT OUString replaceAll(OUString const &from, OUString const &to, sal_Int32 fromIndex=0) const
Returns a new string resulting from replacing all occurrences of a given substring with another subst...
Definition: ustring.hxx:1956
salhelper::operator==
bool operator==(const TTimeValue &rTimeA, const TTimeValue &rTimeB)
Definition: timer.hxx:116
rtl::OUString::trim
SAL_WARN_UNUSED_RESULT OUString trim() const
Returns a new string resulting from removing white space from both ends of the string.
Definition: ustring.hxx:2088
rtl::OUString::OUString
OUString(const sal_Unicode *value)
New string from a Unicode character buffer array.
Definition: ustring.hxx:182
rtl::OUString::compareToIgnoreAsciiCase
sal_Int32 compareToIgnoreAsciiCase(const OUString &str) const
Perform a ASCII lowercase comparison of two strings.
Definition: ustring.hxx:678
rtl::OUString::replaceFirst
SAL_WARN_UNUSED_RESULT libreoffice_internal::ConstCharArrayDetector< T, OUString >::Type replaceFirst(T &from, OUString const &to, sal_Int32 *index=NULL) const
Returns a new string resulting from replacing the first occurrence of a given substring with another ...
Definition: ustring.hxx:1858
rtl::OUString::createFromAscii
static OUString createFromAscii(const sal_Char *value)
Returns a OUString copied without conversion from an ASCII character string.
Definition: ustring.hxx:2665
rtl_ustr_toUInt64
SAL_DLLPUBLIC sal_uInt64 rtl_ustr_toUInt64(const sal_Unicode *str, sal_Int16 radix) SAL_THROW_EXTERN_C()
Interpret a string as an unsigned long integer.
rtl::OUString::OUString
OUString(const OUString &str)
New string from OUString.
Definition: ustring.hxx:127
rtl::OUString::replace
SAL_WARN_UNUSED_RESULT OUString replace(sal_Unicode oldChar, sal_Unicode newChar) const
Returns a new string resulting from replacing all occurrences of oldChar in this string with newChar...
Definition: ustring.hxx:1804
rtl::libreoffice_internal::Dummy
Definition: stringutils.hxx:117
rtl_uString_assign
SAL_DLLPUBLIC void rtl_uString_assign(rtl_uString **str, rtl_uString *rightValue) SAL_THROW_EXTERN_C()
Assign a new value to a string.
rtl_uString_newConcat
SAL_DLLPUBLIC void rtl_uString_newConcat(rtl_uString **newStr, rtl_uString *left, rtl_uString *right) SAL_THROW_EXTERN_C()
Create a new string that is the concatenation of two other strings.
rtl_ustr_indexOfStr_WithLength
SAL_DLLPUBLIC sal_Int32 rtl_ustr_indexOfStr_WithLength(const sal_Unicode *str, sal_Int32 len, const sal_Unicode *subStr, sal_Int32 subLen) SAL_THROW_EXTERN_C()
Search for the first occurrence of a substring within a string.
rtl::OUString::endsWith
libreoffice_internal::ConstCharArrayDetector< T, bool >::Type endsWith(T &literal, OUString *rest=NULL) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: ustring.hxx:1194
rtl::OUString::operator+=
OUString & operator+=(const OUString &str)
Append a string to this string.
Definition: ustring.hxx:423
rtl::OUString::number
static OUString number(unsigned long i, sal_Int16 radix=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: ustring.hxx:2488
rtl_uString_release
SAL_DLLPUBLIC void rtl_uString_release(rtl_uString *str) SAL_THROW_EXTERN_C()
Decrement the reference count of a string.
RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR
#define RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR
Definition: textcvt.h:128
rtl::OUString::indexOf
sal_Int32 indexOf(const OUString &str, sal_Int32 fromIndex=0) const
Returns the index within this string of the first occurrence of the specified substring, starting at the specified index.
Definition: ustring.hxx:1565
rtl_uString_newReplaceAllAsciiL
SAL_DLLPUBLIC void rtl_uString_newReplaceAllAsciiL(rtl_uString **newStr, rtl_uString *str, char const *from, sal_Int32 fromLength, rtl_uString const *to) SAL_THROW_EXTERN_C()
Create a new string by replacing all occurrences of a given substring with another substring...
RTL_STR_MAX_VALUEOFINT64
#define RTL_STR_MAX_VALUEOFINT64
Definition: string.h:650
rtl::OUString::equalsAscii
bool equalsAscii(const sal_Char *asciiStr) const
Perform a comparison of two strings.
Definition: ustring.hxx:880
rtl::OUString::~OUString
~OUString()
Release the string data.
Definition: ustring.hxx:359
rtl::OUString::number
static OUString number(double d)
Returns the string representation of the double argument.
Definition: ustring.hxx:2537
rtl_ustr_lastIndexOfStr_WithLength
SAL_DLLPUBLIC sal_Int32 rtl_ustr_lastIndexOfStr_WithLength(const sal_Unicode *str, sal_Int32 len, const sal_Unicode *subStr, sal_Int32 subLen) SAL_THROW_EXTERN_C()
Search for the last occurrence of a substring within a string.
rtl_uString_newReplaceStrAt
SAL_DLLPUBLIC void rtl_uString_newReplaceStrAt(rtl_uString **newStr, rtl_uString *str, sal_Int32 idx, sal_Int32 count, rtl_uString *subStr) SAL_THROW_EXTERN_C()
Create a new string by replacing a substring of another string.
rtl_ustr_indexOfChar_WithLength
SAL_DLLPUBLIC sal_Int32 rtl_ustr_indexOfChar_WithLength(const sal_Unicode *str, sal_Int32 len, sal_Unicode ch) SAL_THROW_EXTERN_C()
Search for the first occurrence of a character within a string.
rtl_ustr_lastIndexOfChar_WithLength
SAL_DLLPUBLIC sal_Int32 rtl_ustr_lastIndexOfChar_WithLength(const sal_Unicode *str, sal_Int32 len, sal_Unicode ch) SAL_THROW_EXTERN_C()
Search for the last occurrence of a character within a string.
rtl_uString_newReplaceFirstAsciiLAsciiL
SAL_DLLPUBLIC void rtl_uString_newReplaceFirstAsciiLAsciiL(rtl_uString **newStr, rtl_uString *str, char const *from, sal_Int32 fromLength, char const *to, sal_Int32 toLength, sal_Int32 *index) SAL_THROW_EXTERN_C()
Create a new string by replacing the first occurrence of a given substring with another substring...
rtl::OUString::reverseCompareToAsciiL
sal_Int32 reverseCompareToAsciiL(const sal_Char *asciiStr, sal_Int32 asciiStrLength) const
Compares two strings in reverse order.
Definition: ustring.hxx:859
rtl_ustr_valueOfDouble
SAL_DLLPUBLIC sal_Int32 rtl_ustr_valueOfDouble(sal_Unicode *str, double d) SAL_THROW_EXTERN_C()
Create the string representation of a double.
rtl::OUString::lastIndexOf
libreoffice_internal::ConstCharArrayDetector< T, sal_Int32 >::Type lastIndexOf(T &literal) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: ustring.hxx:1678
rtl::OUString::startsWithIgnoreAsciiCase
libreoffice_internal::ConstCharArrayDetector< T, bool >::Type startsWithIgnoreAsciiCase(T &literal, OUString *rest=NULL) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: ustring.hxx:1145
rtl::OUString::equalsIgnoreAsciiCase
bool equalsIgnoreAsciiCase(const OUString &str) const
Perform a ASCII lowercase comparison of two strings.
Definition: ustring.hxx:653
rtl::OUString::OUString
OUString(rtl_uString *str, __sal_NoAcquire)
New OUString from OUString data without acquiring it.
Definition: ustring.hxx:152
rtl::OUString::operator==
friend libreoffice_internal::ConstCharArrayDetector< T, bool >::Type operator==(T &literal, const OUString &string)
Compare string to an ASCII string literal.
Definition: ustring.hxx:1364
rtl::OUString::startsWith
bool startsWith(OUString const &str, OUString *rest=NULL) const
Check whether this string starts with a given substring.
Definition: ustring.hxx:1074
rtl::OUString::endsWithIgnoreAsciiCaseAsciiL
bool endsWithIgnoreAsciiCaseAsciiL(char const *asciiStr, sal_Int32 asciiStrLength) const
Check whether this string ends with a given ASCII string, ignoring the case of ASCII letters...
Definition: ustring.hxx:1307
rtl::OUString::replaceFirst
SAL_WARN_UNUSED_RESULT libreoffice_internal::ConstCharArrayDetector< T1, typename libreoffice_internal::ConstCharArrayDetector< T2, OUString >::Type >::Type replaceFirst(T1 &from, T2 &to, sal_Int32 *index=NULL) const
Returns a new string resulting from replacing the first occurrence of a given substring with another ...
Definition: ustring.hxx:1925
ustring.h
rtl::OUString::OUString
OUString(const sal_Unicode *value, sal_Int32 length)
New string from a Unicode character buffer array.
Definition: ustring.hxx:196
rtl_uString_internConvert
SAL_DLLPUBLIC void rtl_uString_internConvert(rtl_uString **newStr, const sal_Char *str, sal_Int32 len, rtl_TextEncoding encoding, sal_uInt32 convertFlags, sal_uInt32 *pInfo) SAL_THROW_EXTERN_C()
Return a canonical representation for a string.
rtl::OUString::number
static OUString number(int i, sal_Int16 radix=10)
Returns the string representation of the integer argument.
Definition: ustring.hxx:2467
string.h
rtl_uString_alloc
SAL_DLLPUBLIC rtl_uString * rtl_uString_alloc(sal_Int32 nLen) SAL_THROW_EXTERN_C()
Allocate a new string containing space for a given number of characters.
rtl::OUString::replaceAll
SAL_WARN_UNUSED_RESULT libreoffice_internal::ConstCharArrayDetector< T, OUString >::Type replaceAll(OUString const &from, T &to) const
Returns a new string resulting from replacing all occurrences of a given substring with another subst...
Definition: ustring.hxx:2003
rtl::OUString::operator=
libreoffice_internal::ConstCharArrayDetector< T, OUString & >::Type operator=(T &literal)
Assign a new string from an 8-Bit string literal that is expected to contain only characters in the A...
Definition: ustring.hxx:402
rtl_uString_iterateCodePoints
SAL_DLLPUBLIC sal_uInt32 rtl_uString_iterateCodePoints(rtl_uString const *string, sal_Int32 *indexUtf16, sal_Int32 incrementCodePoints)
Iterate through a string based on code points instead of UTF-16 code units.
rtl_ustr_shortenedCompareIgnoreAsciiCase_WithLength
SAL_DLLPUBLIC sal_Int32 rtl_ustr_shortenedCompareIgnoreAsciiCase_WithLength(const sal_Unicode *first, sal_Int32 firstLen, const sal_Unicode *second, sal_Int32 secondLen, sal_Int32 shortenedLen) SAL_THROW_EXTERN_C()
Compare two strings with a maximum count of characters, ignoring the case of ASCII characters...
rtl::OString
This String class provide base functionality for C++ like 8-Bit character array handling.
Definition: string.hxx:90
rtl_ustr_toFloat
SAL_DLLPUBLIC float rtl_ustr_toFloat(const sal_Unicode *str) SAL_THROW_EXTERN_C()
Interpret a string as a float.
OUSTRING_TO_OSTRING_CVTFLAGS
#define OUSTRING_TO_OSTRING_CVTFLAGS
Definition: string.h:1324