LibreOffice: rtl/ustring.hxx Source File

LibreOffice LibreOffice 5.2 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
133 #ifndef _MSC_VER // TODO?
134 #if defined LIBO_INTERNAL_ONLY
135
141 OUString( OUString && str )
142 {
143 pData = str.pData;
144 str.pData = nullptr;
145 rtl_uString_new( &str.pData );
146 }
147 #endif
148 #endif
149
155 OUString( rtl_uString * str )
156 {
157 pData = str;
158 rtl_uString_acquire( pData );
159 }
160
169 inline OUString( rtl_uString * str, __sal_NoAcquire )
170 { pData = str; }
171
177 explicit OUString( sal_Unicode value )
178 : pData (NULL)
179 {
180 rtl_uString_newFromStr_WithLength( &pData, &value, 1 );
181 }
182
183 #if defined LIBO_INTERNAL_ONLY && !defined RTL_STRING_UNITTEST_CONCAT
184 // Catch inadvertent conversions to the above ctor (but still allow
186 // construction from char literals):
187 OUString(int) = delete;
188 explicit OUString(char c):
189 OUString(sal_Unicode(static_cast<unsigned char>(c)))
190 {}
192 #endif
193
199 OUString( const sal_Unicode * value )
200 {
201 pData = NULL;
202 rtl_uString_newFromStr( &pData, value );
203 }
204
213 OUString( const sal_Unicode * value, sal_Int32 length )
214 {
215 pData = NULL;
216 rtl_uString_newFromStr_WithLength( &pData, value, length );
217 }
218
234 template< typename T >
235 OUString( T& literal, typename libreoffice_internal::ConstCharArrayDetector< T, libreoffice_internal::Dummy >::Type = libreoffice_internal::Dummy() )
236 {
237 assert(
238 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
239 pData = NULL;
240 if (libreoffice_internal::ConstCharArrayDetector<T>::length == 0) {
241 rtl_uString_new(&pData);
242 } else {
243 rtl_uString_newFromLiteral(
244 &pData,
245 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
246 literal),
247 libreoffice_internal::ConstCharArrayDetector<T>::length, 0);
248 }
249 #ifdef RTL_STRING_UNITTEST
250 rtl_string_unittest_const_literal = true;
251 #endif
252 }
253
254 #ifdef RTL_STRING_UNITTEST
255
259 template< typename T >
260 OUString( T&, typename libreoffice_internal::ExceptConstCharArrayDetector< T >::Type = libreoffice_internal::Dummy() )
261 {
262 pData = NULL;
263 rtl_uString_newFromLiteral( &pData, "!!br0ken!!", 10, 0 ); // set to garbage
264 rtl_string_unittest_invalid_conversion = true;
265 }
270 template< typename T >
271 OUString( const T&, typename libreoffice_internal::ExceptCharArrayDetector< T >::Type = libreoffice_internal::Dummy() )
272 {
273 pData = NULL;
274 rtl_uString_newFromLiteral( &pData, "!!br0ken!!", 10, 0 ); // set to garbage
275 rtl_string_unittest_invalid_conversion = true;
276 }
277 #endif
278
279 #ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
280
296 OUString(OUStringLiteral literal): pData(NULL) {
297 rtl_uString_newFromLiteral(&pData, literal.data, literal.size, 0);
298 }
300 #endif
301
316 OUString( const sal_Char * value, sal_Int32 length,
317 rtl_TextEncoding encoding,
318 sal_uInt32 convertFlags = OSTRING_TO_OUSTRING_CVTFLAGS )
319 {
320 pData = NULL;
321 rtl_string2UString( &pData, value, length, encoding, convertFlags );
322 if (pData == NULL) {
323 throw std::bad_alloc();
324 }
325 }
326
343 inline explicit OUString(
344 sal_uInt32 const * codePoints, sal_Int32 codePointCount):
345 pData(NULL)
346 {
347 rtl_uString_newFromCodePoints(&pData, codePoints, codePointCount);
348 if (pData == NULL) {
349 throw std::bad_alloc();
350 }
351 }
352
353 #ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
354
358 template< typename T1, typename T2 >
359 OUString( const OUStringConcat< T1, T2 >& c )
360 {
361 const sal_Int32 l = c.length();
362 pData = rtl_uString_alloc( l );
363 if (l != 0)
364 {
365 sal_Unicode* end = c.addData( pData->buffer );
366 pData->length = l;
367 *end = '\0';
368 // TODO realloc in case pData->length is noticeably smaller than l?
369 }
370 }
371 #endif
372
376 ~OUString()
377 {
378 rtl_uString_release( pData );
379 }
380
392 static inline OUString const & unacquired( rtl_uString * const * ppHandle )
393 { return * reinterpret_cast< OUString const * >( ppHandle ); }
394
400 OUString & operator=( const OUString & str )
401 {
402 rtl_uString_assign( &pData, str.pData );
403 return *this;
404 }
405
406 #ifndef _MSC_VER // TODO?
407 #if defined LIBO_INTERNAL_ONLY
408
414 OUString & operator=( OUString && str )
415 {
416 rtl_uString_release( pData );
417 pData = str.pData;
418 str.pData = nullptr;
419 rtl_uString_new( &str.pData );
420 return *this;
421 }
422 #endif
423 #endif
424
437 template< typename T >
438 typename libreoffice_internal::ConstCharArrayDetector< T, OUString& >::Type operator=( T& literal )
439 {
440 assert(
441 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
442 if (libreoffice_internal::ConstCharArrayDetector<T>::length == 0) {
443 rtl_uString_new(&pData);
444 } else {
445 rtl_uString_newFromLiteral(
446 &pData,
447 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
448 literal),
449 libreoffice_internal::ConstCharArrayDetector<T>::length, 0);
450 }
451 return *this;
452 }
453
459 OUString & operator+=( const OUString & str )
460 #if defined LIBO_INTERNAL_ONLY && HAVE_CXX11_REF_QUALIFIER
461 &
462 #endif
463 {
464 rtl_uString_newConcat( &pData, pData, str.pData );
465 return *this;
466 }
467 #if defined LIBO_INTERNAL_ONLY && HAVE_CXX11_REF_QUALIFIER
468 void operator+=(OUString const &) && = delete;
469 #endif
470
477 template<typename T>
478 typename libreoffice_internal::ConstCharArrayDetector<T, OUString &>::Type
479 operator +=(T & literal)
480 #if defined LIBO_INTERNAL_ONLY && HAVE_CXX11_REF_QUALIFIER
481 &
482 #endif
483 {
484 assert(
485 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
486 rtl_uString_newConcatAsciiL(
487 &pData, pData,
488 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal),
489 libreoffice_internal::ConstCharArrayDetector<T>::length);
490 return *this;
491 }
492 #if defined LIBO_INTERNAL_ONLY && HAVE_CXX11_REF_QUALIFIER
493 template<typename T>
494 typename libreoffice_internal::ConstCharArrayDetector<T, OUString &>::Type
495 operator +=(T &) && = delete;
496 #endif
497
498 #ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
499
503 template< typename T1, typename T2 >
504 OUString& operator+=( const OUStringConcat< T1, T2 >& c )
505 #if HAVE_CXX11_REF_QUALIFIER
506 &
507 #endif
508 {
509 sal_Int32 l = c.length();
510 if( l == 0 )
511 return *this;
512 l += pData->length;
513 rtl_uString_ensureCapacity( &pData, l );
514 sal_Unicode* end = c.addData( pData->buffer + pData->length );
515 *end = '\0';
516 pData->length = l;
517 return *this;
518 }
519 #if HAVE_CXX11_REF_QUALIFIER
520 template<typename T1, typename T2> void operator +=(
521 OUStringConcat<T1, T2> const &) && = delete;
522 #endif
523 #endif
524
529 void clear()
530 {
531 rtl_uString_new( &pData );
532 }
533
542 sal_Int32 getLength() const { return pData->length; }
543
552 bool isEmpty() const
553 {
554 return pData->length == 0;
555 }
556
564 const sal_Unicode * getStr() const { return pData->buffer; }
565
575 sal_Unicode operator [](sal_Int32 index) const {
576 // silence spurious -Werror=strict-overflow warnings from GCC 4.8.2
577 assert(index >= 0 && static_cast<sal_uInt32>(index) < static_cast<sal_uInt32>(getLength()));
578 return getStr()[index];
579 }
580
593 sal_Int32 compareTo( const OUString & str ) const
594 {
595 return rtl_ustr_compare_WithLength( pData->buffer, pData->length,
596 str.pData->buffer, str.pData->length );
597 }
598
614 sal_Int32 compareTo( const OUString & str, sal_Int32 maxLength ) const
615 {
616 return rtl_ustr_shortenedCompare_WithLength( pData->buffer, pData->length,
617 str.pData->buffer, str.pData->length, maxLength );
618 }
619
632 sal_Int32 reverseCompareTo( const OUString & str ) const
633 {
634 return rtl_ustr_reverseCompare_WithLength( pData->buffer, pData->length,
635 str.pData->buffer, str.pData->length );
636 }
637
643 template< typename T >
644 typename libreoffice_internal::ConstCharArrayDetector< T, sal_Int32 >::Type reverseCompareTo( T& literal ) const
645 {
646 assert(
647 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
648 return rtl_ustr_asciil_reverseCompare_WithLength(
649 pData->buffer, pData->length,
650 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal),
651 libreoffice_internal::ConstCharArrayDetector<T>::length);
652 }
653
665 bool equals( const OUString & str ) const
666 {
667 if ( pData->length != str.pData->length )
668 return false;
669 if ( pData == str.pData )
670 return true;
671 return rtl_ustr_reverseCompare_WithLength( pData->buffer, pData->length,
672 str.pData->buffer, str.pData->length ) == 0;
673 }
674
689 bool equalsIgnoreAsciiCase( const OUString & str ) const
690 {
691 if ( pData->length != str.pData->length )
692 return false;
693 if ( pData == str.pData )
694 return true;
695 return rtl_ustr_compareIgnoreAsciiCase_WithLength( pData->buffer, pData->length,
696 str.pData->buffer, str.pData->length ) == 0;
697 }
698
714 sal_Int32 compareToIgnoreAsciiCase( const OUString & str ) const
715 {
716 return rtl_ustr_compareIgnoreAsciiCase_WithLength( pData->buffer, pData->length,
717 str.pData->buffer, str.pData->length );
718 }
719
720
726 template< typename T >
727 typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type equalsIgnoreAsciiCase( T& literal ) const
728 {
729 assert(
730 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
731 return
732 (pData->length
733 == libreoffice_internal::ConstCharArrayDetector<T>::length)
734 && (rtl_ustr_ascii_compareIgnoreAsciiCase_WithLength(
735 pData->buffer, pData->length,
736 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
737 literal))
738 == 0);
739 }
740
756 bool match( const OUString & str, sal_Int32 fromIndex = 0 ) const
757 {
758 return rtl_ustr_shortenedCompare_WithLength( pData->buffer+fromIndex, pData->length-fromIndex,
759 str.pData->buffer, str.pData->length, str.pData->length ) == 0;
760 }
761
767 template< typename T >
768 typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type match( T& literal, sal_Int32 fromIndex = 0 ) const
769 {
770 assert(
771 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
772 return
773 rtl_ustr_ascii_shortenedCompare_WithLength(
774 pData->buffer+fromIndex, pData->length-fromIndex,
775 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
776 literal),
777 libreoffice_internal::ConstCharArrayDetector<T>::length)
778 == 0;
779 }
780
799 bool matchIgnoreAsciiCase( const OUString & str, sal_Int32 fromIndex = 0 ) const
800 {
801 return rtl_ustr_shortenedCompareIgnoreAsciiCase_WithLength( pData->buffer+fromIndex, pData->length-fromIndex,
802 str.pData->buffer, str.pData->length,
803 str.pData->length ) == 0;
804 }
805
811 template< typename T >
812 typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type matchIgnoreAsciiCase( T& literal, sal_Int32 fromIndex = 0 ) const
813 {
814 assert(
815 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
816 return
817 rtl_ustr_ascii_shortenedCompareIgnoreAsciiCase_WithLength(
818 pData->buffer+fromIndex, pData->length-fromIndex,
819 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
820 literal),
821 libreoffice_internal::ConstCharArrayDetector<T>::length)
822 == 0;
823 }
824
841 sal_Int32 compareToAscii( const sal_Char* asciiStr ) const
842 {
843 return rtl_ustr_ascii_compare_WithLength( pData->buffer, pData->length, asciiStr );
844 }
845
868 SAL_DEPRECATED(
869 "replace s1.compareToAscii(s2, strlen(s2)) == 0 with s1.startsWith(s2)")
870 sal_Int32 compareToAscii( const sal_Char * asciiStr, sal_Int32 maxLength ) const
871 {
872 return rtl_ustr_ascii_shortenedCompare_WithLength( pData->buffer, pData->length,
873 asciiStr, maxLength );
874 }
875
895 sal_Int32 reverseCompareToAsciiL( const sal_Char * asciiStr, sal_Int32 asciiStrLength ) const
896 {
897 return rtl_ustr_asciil_reverseCompare_WithLength( pData->buffer, pData->length,
898 asciiStr, asciiStrLength );
899 }
900
916 bool equalsAscii( const sal_Char* asciiStr ) const
917 {
918 return rtl_ustr_ascii_compare_WithLength( pData->buffer, pData->length,
919 asciiStr ) == 0;
920 }
921
939 bool equalsAsciiL( const sal_Char* asciiStr, sal_Int32 asciiStrLength ) const
940 {
941 if ( pData->length != asciiStrLength )
942 return false;
943
944 return rtl_ustr_asciil_reverseEquals_WithLength(
945 pData->buffer, asciiStr, asciiStrLength );
946 }
947
966 bool equalsIgnoreAsciiCaseAscii( const sal_Char * asciiStr ) const
967 {
968 return rtl_ustr_ascii_compareIgnoreAsciiCase_WithLength( pData->buffer, pData->length, asciiStr ) == 0;
969 }
970
989 sal_Int32 compareToIgnoreAsciiCaseAscii( const sal_Char * asciiStr ) const
990 {
991 return rtl_ustr_ascii_compareIgnoreAsciiCase_WithLength( pData->buffer, pData->length, asciiStr );
992 }
993
1014 bool equalsIgnoreAsciiCaseAsciiL( const sal_Char * asciiStr, sal_Int32 asciiStrLength ) const
1015 {
1016 if ( pData->length != asciiStrLength )
1017 return false;
1018
1019 return rtl_ustr_ascii_compareIgnoreAsciiCase_WithLength( pData->buffer, pData->length, asciiStr ) == 0;
1020 }
1021
1043 bool matchAsciiL( const sal_Char* asciiStr, sal_Int32 asciiStrLength, sal_Int32 fromIndex = 0 ) const
1044 {
1045 return rtl_ustr_ascii_shortenedCompare_WithLength( pData->buffer+fromIndex, pData->length-fromIndex,
1046 asciiStr, asciiStrLength ) == 0;
1047 }
1048
1049 // This overload is left undefined, to detect calls of matchAsciiL that
1050 // erroneously use RTL_CONSTASCII_USTRINGPARAM instead of
1051 // RTL_CONSTASCII_STRINGPARAM (but would lead to ambiguities on 32 bit
1052 // platforms):
1053 #if SAL_TYPES_SIZEOFLONG == 8
1054 void matchAsciiL(char const *, sal_Int32, rtl_TextEncoding) const;
1055 #endif
1056
1081 bool matchIgnoreAsciiCaseAsciiL( const sal_Char* asciiStr, sal_Int32 asciiStrLength, sal_Int32 fromIndex = 0 ) const
1082 {
1083 return rtl_ustr_ascii_shortenedCompareIgnoreAsciiCase_WithLength( pData->buffer+fromIndex, pData->length-fromIndex,
1084 asciiStr, asciiStrLength ) == 0;
1085 }
1086
1087 // This overload is left undefined, to detect calls of
1088 // matchIgnoreAsciiCaseAsciiL that erroneously use
1089 // RTL_CONSTASCII_USTRINGPARAM instead of RTL_CONSTASCII_STRINGPARAM (but
1090 // would lead to ambiguities on 32 bit platforms):
1091 #if SAL_TYPES_SIZEOFLONG == 8
1092 void matchIgnoreAsciiCaseAsciiL(char const *, sal_Int32, rtl_TextEncoding)
1093 const;
1094 #endif
1095
1110 bool startsWith(OUString const & str, OUString * rest = NULL) const {
1111 bool b = match(str);
1112 if (b && rest != NULL) {
1113 *rest = copy(str.getLength());
1114 }
1115 return b;
1116 }
1117
1123 template< typename T >
1124 typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type startsWith(
1125 T & literal, OUString * rest = NULL) const
1126 {
1127 assert(
1128 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
1129 bool b
1130 = (libreoffice_internal::ConstCharArrayDetector<T>::length
1131 <= sal_uInt32(pData->length))
1132 && rtl_ustr_asciil_reverseEquals_WithLength(
1133 pData->buffer,
1134 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
1135 literal),
1136 libreoffice_internal::ConstCharArrayDetector<T>::length);
1137 if (b && rest != NULL) {
1138 *rest = copy(
1139 libreoffice_internal::ConstCharArrayDetector<T>::length);
1140 }
1141 return b;
1142 }
1143
1164 bool startsWithIgnoreAsciiCase(OUString const & str, OUString * rest = NULL)
1165 const
1166 {
1167 bool b = matchIgnoreAsciiCase(str);
1168 if (b && rest != NULL) {
1169 *rest = copy(str.getLength());
1170 }
1171 return b;
1172 }
1173
1179 template< typename T >
1180 typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type
1181 startsWithIgnoreAsciiCase(T & literal, OUString * rest = NULL) const
1182 {
1183 assert(
1184 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
1185 bool b
1186 = (rtl_ustr_ascii_compareIgnoreAsciiCase_WithLengths(
1187 pData->buffer,
1188 libreoffice_internal::ConstCharArrayDetector<T>::length,
1189 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
1190 literal),
1191 libreoffice_internal::ConstCharArrayDetector<T>::length)
1192 == 0);
1193 if (b && rest != NULL) {
1194 *rest = copy(
1195 libreoffice_internal::ConstCharArrayDetector<T>::length);
1196 }
1197 return b;
1198 }
1199
1214 bool endsWith(OUString const & str, OUString * rest = NULL) const {
1215 bool b = str.getLength() <= getLength()
1216 && match(str, getLength() - str.getLength());
1217 if (b && rest != NULL) {
1218 *rest = copy(0, getLength() - str.getLength());
1219 }
1220 return b;
1221 }
1222
1228 template< typename T >
1229 typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type
1230 endsWith(T & literal, OUString * rest = NULL) const
1231 {
1232 assert(
1233 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
1234 bool b
1235 = (libreoffice_internal::ConstCharArrayDetector<T>::length
1236 <= sal_uInt32(pData->length))
1237 && rtl_ustr_asciil_reverseEquals_WithLength(
1238 (pData->buffer + pData->length
1239 - libreoffice_internal::ConstCharArrayDetector<T>::length),
1240 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
1241 literal),
1242 libreoffice_internal::ConstCharArrayDetector<T>::length);
1243 if (b && rest != NULL) {
1244 *rest = copy(
1245 0,
1246 (getLength()
1247 - libreoffice_internal::ConstCharArrayDetector<T>::length));
1248 }
1249 return b;
1250 }
1251
1263 inline bool endsWithAsciiL(char const * asciiStr, sal_Int32 asciiStrLength)
1264 const
1265 {
1266 return asciiStrLength <= pData->length
1267 && rtl_ustr_asciil_reverseEquals_WithLength(
1268 pData->buffer + pData->length - asciiStrLength, asciiStr,
1269 asciiStrLength);
1270 }
1271
1292 bool endsWithIgnoreAsciiCase(OUString const & str, OUString * rest = NULL) const
1293 {
1294 bool b = str.getLength() <= getLength()
1295 && matchIgnoreAsciiCase(str, getLength() - str.getLength());
1296 if (b && rest != NULL) {
1297 *rest = copy(0, getLength() - str.getLength());
1298 }
1299 return b;
1300 }
1301
1307 template< typename T >
1308 typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type
1309 endsWithIgnoreAsciiCase(T & literal, OUString * rest = NULL) const
1310 {
1311 assert(
1312 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
1313 bool b
1314 = (libreoffice_internal::ConstCharArrayDetector<T>::length
1315 <= sal_uInt32(pData->length))
1316 && (rtl_ustr_ascii_compareIgnoreAsciiCase_WithLengths(
1317 (pData->buffer + pData->length
1318 - libreoffice_internal::ConstCharArrayDetector<T>::length),
1319 libreoffice_internal::ConstCharArrayDetector<T>::length,
1320 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
1321 literal),
1322 libreoffice_internal::ConstCharArrayDetector<T>::length)
1323 == 0);
1324 if (b && rest != NULL) {
1325 *rest = copy(
1326 0,
1327 (getLength()
1328 - libreoffice_internal::ConstCharArrayDetector<T>::length));
1329 }
1330 return b;
1331 }
1332
1343 inline bool endsWithIgnoreAsciiCaseAsciiL(
1344 char const * asciiStr, sal_Int32 asciiStrLength) const
1345 {
1346 return asciiStrLength <= pData->length
1347 && (rtl_ustr_ascii_compareIgnoreAsciiCase_WithLengths(
1348 pData->buffer + pData->length - asciiStrLength,
1349 asciiStrLength, asciiStr, asciiStrLength)
1350 == 0);
1351 }
1352
1353 friend bool operator == ( const OUString& rStr1, const OUString& rStr2 )
1354 { return rStr1.equals(rStr2); }
1355 friend bool operator == ( const OUString& rStr1, const sal_Unicode * pStr2 )
1356 { return rStr1.compareTo( pStr2 ) == 0; }
1357 friend bool operator == ( const sal_Unicode * pStr1, const OUString& rStr2 )
1358 { return OUString( pStr1 ).compareTo( rStr2 ) == 0; }
1359
1360 friend bool operator != ( const OUString& rStr1, const OUString& rStr2 )
1361 { return !(operator == ( rStr1, rStr2 )); }
1362 friend bool operator != ( const OUString& rStr1, const sal_Unicode * pStr2 )
1363 { return !(operator == ( rStr1, pStr2 )); }
1364 friend bool operator != ( const sal_Unicode * pStr1, const OUString& rStr2 )
1365 { return !(operator == ( pStr1, rStr2 )); }
1366
1367 friend bool operator < ( const OUString& rStr1, const OUString& rStr2 )
1368 { return rStr1.compareTo( rStr2 ) < 0; }
1369 friend bool operator > ( const OUString& rStr1, const OUString& rStr2 )
1370 { return rStr1.compareTo( rStr2 ) > 0; }
1371 friend bool operator <= ( const OUString& rStr1, const OUString& rStr2 )
1372 { return rStr1.compareTo( rStr2 ) <= 0; }
1373 friend bool operator >= ( const OUString& rStr1, const OUString& rStr2 )
1374 { return rStr1.compareTo( rStr2 ) >= 0; }
1375
1383 template< typename T >
1384 friend inline typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type operator==( const OUString& string, T& literal )
1385 {
1386 assert(
1387 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
1388 return string.equalsAsciiL(
1389 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal),
1390 libreoffice_internal::ConstCharArrayDetector<T>::length);
1391 }
1399 template< typename T >
1400 friend inline typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type operator==( T& literal, const OUString& string )
1401 {
1402 assert(
1403 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
1404 return string.equalsAsciiL(
1405 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal),
1406 libreoffice_internal::ConstCharArrayDetector<T>::length);
1407 }
1415 template< typename T >
1416 friend inline typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type operator!=( const OUString& string, T& literal )
1417 {
1418 assert(
1419 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
1420 return !string.equalsAsciiL(
1421 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal),
1422 libreoffice_internal::ConstCharArrayDetector<T>::length);
1423 }
1431 template< typename T >
1432 friend inline typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type operator!=( T& literal, const OUString& string )
1433 {
1434 assert(
1435 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
1436 return !string.equalsAsciiL(
1437 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal),
1438 libreoffice_internal::ConstCharArrayDetector<T>::length);
1439 }
1440
1441 #if defined LIBO_INTERNAL_ONLY
1442
1444 /* Comparison between OUString and OUStringLiteral.
1445
1446 @since LibreOffice 5.0
1447 */
1448
1449 friend bool operator ==(OUString const & lhs, OUStringLiteral const & rhs) {
1450 return lhs.equalsAsciiL(rhs.data, rhs.size);
1451 }
1452
1453 friend bool operator !=(OUString const & lhs, OUStringLiteral const & rhs) {
1454 return !lhs.equalsAsciiL(rhs.data, rhs.size);
1455 }
1456
1457 friend bool operator <(OUString const & lhs, OUStringLiteral const & rhs) {
1458 return
1459 (rtl_ustr_ascii_compare_WithLength(
1460 lhs.pData->buffer, lhs.pData->length, rhs.data))
1461 < 0;
1462 }
1463
1464 friend bool operator <=(OUString const & lhs, OUStringLiteral const & rhs) {
1465 return
1466 (rtl_ustr_ascii_compare_WithLength(
1467 lhs.pData->buffer, lhs.pData->length, rhs.data))
1468 <= 0;
1469 }
1470
1471 friend bool operator >(OUString const & lhs, OUStringLiteral const & rhs) {
1472 return
1473 (rtl_ustr_ascii_compare_WithLength(
1474 lhs.pData->buffer, lhs.pData->length, rhs.data))
1475 > 0;
1476 }
1477
1478 friend bool operator >=(OUString const & lhs, OUStringLiteral const & rhs) {
1479 return
1480 (rtl_ustr_ascii_compare_WithLength(
1481 lhs.pData->buffer, lhs.pData->length, rhs.data))
1482 >= 0;
1483 }
1484
1485 friend bool operator ==(OUStringLiteral const & lhs, OUString const & rhs) {
1486 return rhs.equalsAsciiL(lhs.data, lhs.size);
1487 }
1488
1489 friend bool operator !=(OUStringLiteral const & lhs, OUString const & rhs) {
1490 return !rhs.equalsAsciiL(lhs.data, lhs.size);
1491 }
1492
1493 friend bool operator <(OUStringLiteral const & lhs, OUString const & rhs) {
1494 return
1495 (rtl_ustr_ascii_compare_WithLength(
1496 rhs.pData->buffer, rhs.pData->length, lhs.data))
1497 >= 0;
1498 }
1499
1500 friend bool operator <=(OUStringLiteral const & lhs, OUString const & rhs) {
1501 return
1502 (rtl_ustr_ascii_compare_WithLength(
1503 rhs.pData->buffer, rhs.pData->length, lhs.data))
1504 > 0;
1505 }
1506
1507 friend bool operator >(OUStringLiteral const & lhs, OUString const & rhs) {
1508 return
1509 (rtl_ustr_ascii_compare_WithLength(
1510 rhs.pData->buffer, rhs.pData->length, lhs.data))
1511 <= 0;
1512 }
1513
1514 friend bool operator >=(OUStringLiteral const & lhs, OUString const & rhs) {
1515 return
1516 (rtl_ustr_ascii_compare_WithLength(
1517 rhs.pData->buffer, rhs.pData->length, lhs.data))
1518 < 0;
1519 }
1520
1522 #endif
1523
1531 sal_Int32 hashCode() const
1532 {
1533 return rtl_ustr_hashCode_WithLength( pData->buffer, pData->length );
1534 }
1535
1549 sal_Int32 indexOf( sal_Unicode ch, sal_Int32 fromIndex = 0 ) const
1550 {
1551 sal_Int32 ret = rtl_ustr_indexOfChar_WithLength( pData->buffer+fromIndex, pData->length-fromIndex, ch );
1552 return (ret < 0 ? ret : ret+fromIndex);
1553 }
1554
1564 sal_Int32 lastIndexOf( sal_Unicode ch ) const
1565 {
1566 return rtl_ustr_lastIndexOfChar_WithLength( pData->buffer, pData->length, ch );
1567 }
1568
1581 sal_Int32 lastIndexOf( sal_Unicode ch, sal_Int32 fromIndex ) const
1582 {
1583 return rtl_ustr_lastIndexOfChar_WithLength( pData->buffer, fromIndex, ch );
1584 }
1585
1601 sal_Int32 indexOf( const OUString & str, sal_Int32 fromIndex = 0 ) const
1602 {
1603 sal_Int32 ret = rtl_ustr_indexOfStr_WithLength( pData->buffer+fromIndex, pData->length-fromIndex,
1604 str.pData->buffer, str.pData->length );
1605 return (ret < 0 ? ret : ret+fromIndex);
1606 }
1607
1613 template< typename T >
1614 typename libreoffice_internal::ConstCharArrayDetector< T, sal_Int32 >::Type indexOf( T& literal, sal_Int32 fromIndex = 0 ) const
1615 {
1616 assert(
1617 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
1618 sal_Int32 n = rtl_ustr_indexOfAscii_WithLength(
1619 pData->buffer + fromIndex, pData->length - fromIndex,
1620 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal),
1621 libreoffice_internal::ConstCharArrayDetector<T>::length);
1622 return n < 0 ? n : n + fromIndex;
1623 }
1624
1648 sal_Int32 indexOfAsciiL(
1649 char const * str, sal_Int32 len, sal_Int32 fromIndex = 0) const
1650 {
1651 sal_Int32 ret = rtl_ustr_indexOfAscii_WithLength(
1652 pData->buffer + fromIndex, pData->length - fromIndex, str, len);
1653 return ret < 0 ? ret : ret + fromIndex;
1654 }
1655
1656 // This overload is left undefined, to detect calls of indexOfAsciiL that
1657 // erroneously use RTL_CONSTASCII_USTRINGPARAM instead of
1658 // RTL_CONSTASCII_STRINGPARAM (but would lead to ambiguities on 32 bit
1659 // platforms):
1660 #if SAL_TYPES_SIZEOFLONG == 8
1661 void indexOfAsciiL(char const *, sal_Int32 len, rtl_TextEncoding) const;
1662 #endif
1663
1679 sal_Int32 lastIndexOf( const OUString & str ) const
1680 {
1681 return rtl_ustr_lastIndexOfStr_WithLength( pData->buffer, pData->length,
1682 str.pData->buffer, str.pData->length );
1683 }
1684
1702 sal_Int32 lastIndexOf( const OUString & str, sal_Int32 fromIndex ) const
1703 {
1704 return rtl_ustr_lastIndexOfStr_WithLength( pData->buffer, fromIndex,
1705 str.pData->buffer, str.pData->length );
1706 }
1707
1713 template< typename T >
1714 typename libreoffice_internal::ConstCharArrayDetector< T, sal_Int32 >::Type lastIndexOf( T& literal ) const
1715 {
1716 assert(
1717 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
1718 return rtl_ustr_lastIndexOfAscii_WithLength(
1719 pData->buffer, pData->length,
1720 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal),
1721 libreoffice_internal::ConstCharArrayDetector<T>::length);
1722 }
1723
1743 sal_Int32 lastIndexOfAsciiL(char const * str, sal_Int32 len) const
1744 {
1745 return rtl_ustr_lastIndexOfAscii_WithLength(
1746 pData->buffer, pData->length, str, len);
1747 }
1748
1759 SAL_WARN_UNUSED_RESULT OUString copy( sal_Int32 beginIndex ) const
1760 {
1761 rtl_uString *pNew = NULL;
1762 rtl_uString_newFromSubString( &pNew, pData, beginIndex, getLength() - beginIndex );
1763 return OUString( pNew, SAL_NO_ACQUIRE );
1764 }
1765
1778 SAL_WARN_UNUSED_RESULT OUString copy( sal_Int32 beginIndex, sal_Int32 count ) const
1779 {
1780 rtl_uString *pNew = NULL;
1781 rtl_uString_newFromSubString( &pNew, pData, beginIndex, count );
1782 return OUString( pNew, SAL_NO_ACQUIRE );
1783 }
1784
1793 SAL_WARN_UNUSED_RESULT OUString concat( const OUString & str ) const
1794 {
1795 rtl_uString* pNew = NULL;
1796 rtl_uString_newConcat( &pNew, pData, str.pData );
1797 return OUString( pNew, SAL_NO_ACQUIRE );
1798 }
1799
1800 #ifndef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
1801 friend OUString operator+( const OUString& rStr1, const OUString& rStr2 )
1802 {
1803 return rStr1.concat( rStr2 );
1804 }
1805 #endif
1806
1820 SAL_WARN_UNUSED_RESULT OUString replaceAt( sal_Int32 index, sal_Int32 count, const OUString& newStr ) const
1821 {
1822 rtl_uString* pNew = NULL;
1823 rtl_uString_newReplaceStrAt( &pNew, pData, index, count, newStr.pData );
1824 return OUString( pNew, SAL_NO_ACQUIRE );
1825 }
1826
1840 SAL_WARN_UNUSED_RESULT OUString replace( sal_Unicode oldChar, sal_Unicode newChar ) const
1841 {
1842 rtl_uString* pNew = NULL;
1843 rtl_uString_newReplace( &pNew, pData, oldChar, newChar );
1844 return OUString( pNew, SAL_NO_ACQUIRE );
1845 }
1846
1865 SAL_WARN_UNUSED_RESULT OUString replaceFirst(
1866 OUString const & from, OUString const & to, sal_Int32 * index = NULL) const
1867 {
1868 rtl_uString * s = NULL;
1869 sal_Int32 i = 0;
1870 rtl_uString_newReplaceFirst(
1871 &s, pData, from.pData, to.pData, index == NULL ? &i : index);
1872 return OUString(s, SAL_NO_ACQUIRE);
1873 }
1874
1893 template< typename T >
1894 SAL_WARN_UNUSED_RESULT typename libreoffice_internal::ConstCharArrayDetector< T, OUString >::Type replaceFirst( T& from, OUString const & to,
1895 sal_Int32 * index = NULL) const
1896 {
1897 assert(libreoffice_internal::ConstCharArrayDetector<T>::isValid(from));
1898 rtl_uString * s = NULL;
1899 sal_Int32 i = 0;
1900 rtl_uString_newReplaceFirstAsciiL(
1901 &s, pData,
1902 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(from),
1903 libreoffice_internal::ConstCharArrayDetector<T>::length, to.pData,
1904 index == NULL ? &i : index);
1905 return OUString(s, SAL_NO_ACQUIRE);
1906 }
1907
1926 template< typename T >
1927 SAL_WARN_UNUSED_RESULT typename libreoffice_internal::ConstCharArrayDetector< T, OUString >::Type replaceFirst( OUString const & from, T& to,
1928 sal_Int32 * index = NULL) const
1929 {
1930 assert(libreoffice_internal::ConstCharArrayDetector<T>::isValid(to));
1931 rtl_uString * s = NULL;
1932 sal_Int32 i = 0;
1933 rtl_uString_newReplaceFirstToAsciiL(
1934 &s, pData, from.pData,
1935 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(to),
1936 libreoffice_internal::ConstCharArrayDetector<T>::length,
1937 index == NULL ? &i : index);
1938 return OUString(s, SAL_NO_ACQUIRE);
1939 }
1940
1959 template< typename T1, typename T2 >
1960 SAL_WARN_UNUSED_RESULT typename libreoffice_internal::ConstCharArrayDetector< T1, typename libreoffice_internal::ConstCharArrayDetector< T2, OUString >::Type >::Type
1961 replaceFirst( T1& from, T2& to, sal_Int32 * index = NULL) const
1962 {
1963 assert(libreoffice_internal::ConstCharArrayDetector<T1>::isValid(from));
1964 assert(libreoffice_internal::ConstCharArrayDetector<T2>::isValid(to));
1965 rtl_uString * s = NULL;
1966 sal_Int32 i = 0;
1967 rtl_uString_newReplaceFirstAsciiLAsciiL(
1968 &s, pData,
1969 libreoffice_internal::ConstCharArrayDetector<T1>::toPointer(from),
1970 libreoffice_internal::ConstCharArrayDetector<T1>::length,
1971 libreoffice_internal::ConstCharArrayDetector<T2>::toPointer(to),
1972 libreoffice_internal::ConstCharArrayDetector<T2>::length,
1973 index == NULL ? &i : index);
1974 return OUString(s, SAL_NO_ACQUIRE);
1975 }
1976
1992 SAL_WARN_UNUSED_RESULT OUString replaceAll(
1993 OUString const & from, OUString const & to, sal_Int32 fromIndex = 0) const
1994 {
1995 rtl_uString * s = NULL;
1996 rtl_uString_newReplaceAllFromIndex(&s, pData, from.pData, to.pData, fromIndex);
1997 return OUString(s, SAL_NO_ACQUIRE);
1998 }
1999
2013 template< typename T >
2014 SAL_WARN_UNUSED_RESULT typename libreoffice_internal::ConstCharArrayDetector< T, OUString >::Type replaceAll( T& from, OUString const & to) const
2015 {
2016 assert(libreoffice_internal::ConstCharArrayDetector<T>::isValid(from));
2017 rtl_uString * s = NULL;
2018 rtl_uString_newReplaceAllAsciiL(
2019 &s, pData,
2020 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(from),
2021 libreoffice_internal::ConstCharArrayDetector<T>::length, to.pData);
2022 return OUString(s, SAL_NO_ACQUIRE);
2023 }
2024
2038 template< typename T >
2039 SAL_WARN_UNUSED_RESULT typename libreoffice_internal::ConstCharArrayDetector< T, OUString >::Type replaceAll( OUString const & from, T& to) const
2040 {
2041 assert(libreoffice_internal::ConstCharArrayDetector<T>::isValid(to));
2042 rtl_uString * s = NULL;
2043 rtl_uString_newReplaceAllToAsciiL(
2044 &s, pData, from.pData,
2045 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(to),
2046 libreoffice_internal::ConstCharArrayDetector<T>::length);
2047 return OUString(s, SAL_NO_ACQUIRE);
2048 }
2049
2063 template< typename T1, typename T2 >
2064 SAL_WARN_UNUSED_RESULT typename libreoffice_internal::ConstCharArrayDetector< T1, typename libreoffice_internal::ConstCharArrayDetector< T2, OUString >::Type >::Type
2065 replaceAll( T1& from, T2& to ) const
2066 {
2067 assert(libreoffice_internal::ConstCharArrayDetector<T1>::isValid(from));
2068 assert(libreoffice_internal::ConstCharArrayDetector<T2>::isValid(to));
2069 rtl_uString * s = NULL;
2070 rtl_uString_newReplaceAllAsciiLAsciiL(
2071 &s, pData,
2072 libreoffice_internal::ConstCharArrayDetector<T1>::toPointer(from),
2073 libreoffice_internal::ConstCharArrayDetector<T1>::length,
2074 libreoffice_internal::ConstCharArrayDetector<T2>::toPointer(to),
2075 libreoffice_internal::ConstCharArrayDetector<T2>::length);
2076 return OUString(s, SAL_NO_ACQUIRE);
2077 }
2078
2089 SAL_WARN_UNUSED_RESULT OUString toAsciiLowerCase() const
2090 {
2091 rtl_uString* pNew = NULL;
2092 rtl_uString_newToAsciiLowerCase( &pNew, pData );
2093 return OUString( pNew, SAL_NO_ACQUIRE );
2094 }
2095
2106 SAL_WARN_UNUSED_RESULT OUString toAsciiUpperCase() const
2107 {
2108 rtl_uString* pNew = NULL;
2109 rtl_uString_newToAsciiUpperCase( &pNew, pData );
2110 return OUString( pNew, SAL_NO_ACQUIRE );
2111 }
2112
2124 SAL_WARN_UNUSED_RESULT OUString trim() const
2125 {
2126 rtl_uString* pNew = NULL;
2127 rtl_uString_newTrim( &pNew, pData );
2128 return OUString( pNew, SAL_NO_ACQUIRE );
2129 }
2130
2155 OUString getToken( sal_Int32 token, sal_Unicode cTok, sal_Int32& index ) const
2156 {
2157 rtl_uString * pNew = NULL;
2158 index = rtl_uString_getToken( &pNew, pData, token, cTok, index );
2159 return OUString( pNew, SAL_NO_ACQUIRE );
2160 }
2161
2175 OUString getToken(sal_Int32 count, sal_Unicode separator) const {
2176 sal_Int32 n = 0;
2177 return getToken(count, separator, n);
2178 }
2179
2188 bool toBoolean() const
2189 {
2190 return rtl_ustr_toBoolean( pData->buffer );
2191 }
2192
2199 sal_Unicode toChar() const
2200 {
2201 return pData->buffer[0];
2202 }
2203
2214 sal_Int32 toInt32( sal_Int16 radix = 10 ) const
2215 {
2216 return rtl_ustr_toInt32( pData->buffer, radix );
2217 }
2218
2231 sal_uInt32 toUInt32( sal_Int16 radix = 10 ) const
2232 {
2233 return rtl_ustr_toUInt32( pData->buffer, radix );
2234 }
2235
2246 sal_Int64 toInt64( sal_Int16 radix = 10 ) const
2247 {
2248 return rtl_ustr_toInt64( pData->buffer, radix );
2249 }
2250
2263 sal_uInt64 toUInt64( sal_Int16 radix = 10 ) const
2264 {
2265 return rtl_ustr_toUInt64( pData->buffer, radix );
2266 }
2267
2276 float toFloat() const
2277 {
2278 return rtl_ustr_toFloat( pData->buffer );
2279 }
2280
2289 double toDouble() const
2290 {
2291 return rtl_ustr_toDouble( pData->buffer );
2292 }
2293
2294
2310 OUString intern() const
2311 {
2312 rtl_uString * pNew = NULL;
2313 rtl_uString_intern( &pNew, pData );
2314 if (pNew == NULL) {
2315 throw std::bad_alloc();
2316 }
2317 return OUString( pNew, SAL_NO_ACQUIRE );
2318 }
2319
2345 static OUString intern( const sal_Char * value, sal_Int32 length,
2346 rtl_TextEncoding encoding,
2347 sal_uInt32 convertFlags = OSTRING_TO_OUSTRING_CVTFLAGS,
2348 sal_uInt32 *pInfo = NULL )
2349 {
2350 rtl_uString * pNew = NULL;
2351 rtl_uString_internConvert( &pNew, value, length, encoding,
2352 convertFlags, pInfo );
2353 if (pNew == NULL) {
2354 throw std::bad_alloc();
2355 }
2356 return OUString( pNew, SAL_NO_ACQUIRE );
2357 }
2358
2383 inline bool convertToString(OString * pTarget, rtl_TextEncoding nEncoding,
2384 sal_uInt32 nFlags) const
2385 {
2386 return rtl_convertUStringToString(&pTarget->pData, pData->buffer,
2387 pData->length, nEncoding, nFlags);
2388 }
2389
2441 inline sal_uInt32 iterateCodePoints(
2442 sal_Int32 * indexUtf16, sal_Int32 incrementCodePoints = 1) const
2443 {
2444 return rtl_uString_iterateCodePoints(
2445 pData, indexUtf16, incrementCodePoints);
2446 }
2447
2457 static inline OUString fromUtf8(const OString& rSource)
2458 {
2459 OUString aTarget;
2460 bool bSuccess = rtl_convertStringToUString(&aTarget.pData,
2461 rSource.getStr(),
2462 rSource.getLength(),
2463 RTL_TEXTENCODING_UTF8,
2464 RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR|RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR|RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR);
2465 (void) bSuccess;
2466 assert(bSuccess);
2467 return aTarget;
2468 }
2469
2480 inline OString toUtf8() const
2481 {
2482 OString aTarget;
2483 bool bSuccess = rtl_convertUStringToString(&aTarget.pData,
2484 getStr(),
2485 getLength(),
2486 RTL_TEXTENCODING_UTF8,
2487 RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR|RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR);
2488 (void) bSuccess;
2489 assert(bSuccess);
2490 return aTarget;
2491 }
2492
2503 static OUString number( int i, sal_Int16 radix = 10 )
2504 {
2505 sal_Unicode aBuf[RTL_USTR_MAX_VALUEOFINT32];
2506 rtl_uString* pNewData = NULL;
2507 rtl_uString_newFromStr_WithLength( &pNewData, aBuf, rtl_ustr_valueOfInt32( aBuf, i, radix ) );
2508 return OUString( pNewData, SAL_NO_ACQUIRE );
2509 }
2512 static OUString number( unsigned int i, sal_Int16 radix = 10 )
2513 {
2514 return number( static_cast< unsigned long long >( i ), radix );
2515 }
2518 static OUString number( long i, sal_Int16 radix = 10)
2519 {
2520 return number( static_cast< long long >( i ), radix );
2521 }
2524 static OUString number( unsigned long i, sal_Int16 radix = 10 )
2525 {
2526 return number( static_cast< unsigned long long >( i ), radix );
2527 }
2530 static OUString number( long long ll, sal_Int16 radix = 10 )
2531 {
2532 sal_Unicode aBuf[RTL_STR_MAX_VALUEOFINT64];
2533 rtl_uString* pNewData = NULL;
2534 rtl_uString_newFromStr_WithLength( &pNewData, aBuf, rtl_ustr_valueOfInt64( aBuf, ll, radix ) );
2535 return OUString( pNewData, SAL_NO_ACQUIRE );
2536 }
2539 static OUString number( unsigned long long ll, sal_Int16 radix = 10 )
2540 {
2541 sal_Unicode aBuf[RTL_STR_MAX_VALUEOFUINT64];
2542 rtl_uString* pNewData = NULL;
2543 rtl_uString_newFromStr_WithLength( &pNewData, aBuf, rtl_ustr_valueOfUInt64( aBuf, ll, radix ) );
2544 return OUString( pNewData, SAL_NO_ACQUIRE );
2545 }
2546
2556 static OUString number( float f )
2557 {
2558 sal_Unicode aBuf[RTL_USTR_MAX_VALUEOFFLOAT];
2559 rtl_uString* pNewData = NULL;
2560 rtl_uString_newFromStr_WithLength( &pNewData, aBuf, rtl_ustr_valueOfFloat( aBuf, f ) );
2561 return OUString( pNewData, SAL_NO_ACQUIRE );
2562 }
2563
2573 static OUString number( double d )
2574 {
2575 sal_Unicode aBuf[RTL_USTR_MAX_VALUEOFDOUBLE];
2576 rtl_uString* pNewData = NULL;
2577 rtl_uString_newFromStr_WithLength( &pNewData, aBuf, rtl_ustr_valueOfDouble( aBuf, d ) );
2578 return OUString( pNewData, SAL_NO_ACQUIRE );
2579 }
2580
2592 SAL_DEPRECATED("use boolean()") static OUString valueOf( sal_Bool b )
2593 {
2594 return boolean(b);
2595 }
2596
2608 static OUString boolean( bool b )
2609 {
2610 sal_Unicode aBuf[RTL_USTR_MAX_VALUEOFBOOLEAN];
2611 rtl_uString* pNewData = NULL;
2612 rtl_uString_newFromStr_WithLength( &pNewData, aBuf, rtl_ustr_valueOfBoolean( aBuf, b ) );
2613 return OUString( pNewData, SAL_NO_ACQUIRE );
2614 }
2615
2623 SAL_DEPRECATED("convert to OUString or use directly") static OUString valueOf( sal_Unicode c )
2624 {
2625 return OUString( &c, 1 );
2626 }
2627
2638 SAL_DEPRECATED("use number()") static OUString valueOf( sal_Int32 i, sal_Int16 radix = 10 )
2639 {
2640 return number( i, radix );
2641 }
2642
2653 SAL_DEPRECATED("use number()") static OUString valueOf( sal_Int64 ll, sal_Int16 radix = 10 )
2654 {
2655 return number( ll, radix );
2656 }
2657
2667 SAL_DEPRECATED("use number()") static OUString valueOf( float f )
2668 {
2669 return number(f);
2670 }
2671
2681 SAL_DEPRECATED("use number()") static OUString valueOf( double d )
2682 {
2683 return number(d);
2684 }
2685
2701 static OUString createFromAscii( const sal_Char * value )
2702 {
2703 rtl_uString* pNew = NULL;
2704 rtl_uString_newFromAscii( &pNew, value );
2705 return OUString( pNew, SAL_NO_ACQUIRE );
2706 }
2707 };
2708
2709 #if defined LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
2710
2715 template<>
2716 struct ToStringHelper< OUString >
2717 {
2718 static int length( const OUString& s ) { return s.getLength(); }
2719 static sal_Unicode* addData( sal_Unicode* buffer, const OUString& s ) { return addDataHelper( buffer, s.getStr(), s.getLength()); }
2720 static const bool allowOStringConcat = false;
2721 static const bool allowOUStringConcat = true;
2722 };
2723
2727 template<>
2728 struct ToStringHelper< OUStringLiteral >
2729 {
2730 static int length( const OUStringLiteral& str ) { return str.size; }
2731 static sal_Unicode* addData( sal_Unicode* buffer, const OUStringLiteral& str ) { return addDataLiteral( buffer, str.data, str.size ); }
2732 static const bool allowOStringConcat = false;
2733 static const bool allowOUStringConcat = true;
2734 };
2735
2739 template< typename charT, typename traits, typename T1, typename T2 >
2740 inline std::basic_ostream<charT, traits> & operator <<(
2741 std::basic_ostream<charT, traits> & stream, const OUStringConcat< T1, T2 >& concat)
2742 {
2743 return stream << OUString( concat );
2744 }
2745
2747 #endif
2748
2754 struct OUStringHash
2755 {
2765 size_t operator()(const OUString& rString) const
2766 { return (size_t)rString.hashCode(); }
2767 };
2768
2769 /* ======================================================================= */
2770
2788 inline OUString OStringToOUString( const OString & rStr,
2789 rtl_TextEncoding encoding,
2790 sal_uInt32 convertFlags = OSTRING_TO_OUSTRING_CVTFLAGS )
2791 {
2792 return OUString( rStr.getStr(), rStr.getLength(), encoding, convertFlags );
2793 }
2794
2812 inline OString OUStringToOString( const OUString & rUnicode,
2813 rtl_TextEncoding encoding,
2814 sal_uInt32 convertFlags = OUSTRING_TO_OSTRING_CVTFLAGS )
2815 {
2816 return OString( rUnicode.getStr(), rUnicode.getLength(), encoding, convertFlags );
2817 }
2818
2819 /* ======================================================================= */
2820
2829 template< typename charT, typename traits >
2830 inline std::basic_ostream<charT, traits> & operator <<(
2831 std::basic_ostream<charT, traits> & stream, OUString const & string)
2832 {
2833 return stream <<
2834 OUStringToOString(string, RTL_TEXTENCODING_UTF8).getStr();
2835 // best effort; potentially loses data due to conversion failures
2836 // (stray surrogate halves) and embedded null characters
2837 }
2838
2839 } // namespace
2840
2841 #ifdef RTL_STRING_UNITTEST
2842 namespace rtl
2843 {
2844 typedef rtlunittest::OUString OUString;
2845 }
2846 #endif
2847
2848 // In internal code, allow to use classes like OUString without having to
2849 // explicitly refer to the rtl namespace, which is kind of superfluous given
2850 // that OUString itself is namespaced by its OU prefix:
2851 #if defined LIBO_INTERNAL_ONLY && !defined RTL_STRING_UNITTEST
2852 using ::rtl::OUString;
2853 using ::rtl::OUStringHash;
2854 using ::rtl::OStringToOUString;
2855 using ::rtl::OUStringToOString;
2856 using ::rtl::OUStringLiteral;
2857 using ::rtl::OUStringLiteral1;
2858 #endif
2859
2860 #endif /* _RTL_USTRING_HXX */
2861
2862 /* 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:2608
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:1648
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:2345
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:2289
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:2214
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:644
rtl::OUString::getStr
const sal_Unicode * getStr() const
Returns a pointer to the Unicode character buffer for this string.
Definition: ustring.hxx:564
rtl::OUString::clear
void clear()
Clears the string, i.e, makes a zero-character string.
Definition: ustring.hxx:529
rtl::OUString::equalsIgnoreAsciiCaseAscii
bool equalsIgnoreAsciiCaseAscii(const sal_Char *asciiStr) const
Perform a ASCII lowercase comparison of two strings.
Definition: ustring.hxx:966
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:542
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:1081
rtl::OUString::operator=
OUString & operator=(const OUString &str)
Assign a new string.
Definition: ustring.hxx:400
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:1214
textenc.h
rtl::OUString::intern
OUString intern() const
Return a canonical representation for a string.
Definition: ustring.hxx:2310
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:392
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:2263
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:2530
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:2788
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:1384
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:177
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:2512
SAL_WARN_UNUSED
#define SAL_WARN_UNUSED
Annotate classes where a compiler should warn if an instance is unused.
Definition: types.h:624
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:343
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:2812
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:2518
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_uString_acquire
SAL_DLLPUBLIC void rtl_uString_acquire(rtl_uString *str) SAL_THROW_EXTERN_C() SAL_HOT
Increment the reference count of a string.
rtl::OUStringHash::operator()
size_t operator()(const OUString &rString) const
Compute a hash code for a string.
Definition: ustring.hxx:2765
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:2188
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:2175
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:1793
rtl::OUString::equals
bool equals(const OUString &str) const
Perform a comparison of two strings.
Definition: ustring.hxx:665
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:1043
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:1743
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:2383
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:1894
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:1801
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:614
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:1679
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:2539
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:430
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:1581
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:727
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:1614
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:1292
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:1309
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:2457
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_uString_release
SAL_DLLPUBLIC void rtl_uString_release(rtl_uString *str) SAL_THROW_EXTERN_C() SAL_HOT
Decrement the reference count of a string.
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:2441
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:1778
rtl::OUString::equalsAsciiL
bool equalsAsciiL(const sal_Char *asciiStr, sal_Int32 asciiStrLength) const
Perform a comparison of two strings.
Definition: ustring.hxx:939
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:1432
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:573
rtl::OUString::reverseCompareTo
sal_Int32 reverseCompareTo(const OUString &str) const
Compares two strings in reverse order.
Definition: ustring.hxx:632
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:384
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:1820
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:325
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:1865
rtl::OUString::match
bool match(const OUString &str, sal_Int32 fromIndex=0) const
Match against a substring appearing in this string.
Definition: ustring.hxx:756
rtl::OUString::toUInt32
sal_uInt32 toUInt32(sal_Int16 radix=10) const
Returns the uint32 value from this string.
Definition: ustring.hxx:2231
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:2014
rtl::OUString::isEmpty
bool isEmpty() const
Checks if a string is empty.
Definition: ustring.hxx:552
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:2480
rtl::OUString::OUString
OUString(rtl_uString *str)
New string from OUString data.
Definition: ustring.hxx:155
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:1759
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:1124
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:799
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:1416
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:2155
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:2089
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:841
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:1164
rtl::OUString::toChar
sal_Unicode toChar() const
Returns the first character from this string.
Definition: ustring.hxx:2199
rtl::OUString::equalsIgnoreAsciiCaseAsciiL
bool equalsIgnoreAsciiCaseAsciiL(const sal_Char *asciiStr, sal_Int32 asciiStrLength) const
Perform an ASCII lowercase comparison of two strings.
Definition: ustring.hxx:1014
rtl::OUString::number
static OUString number(float f)
Returns the string representation of the float argument.
Definition: ustring.hxx:2556
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:1702
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:1549
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:1927
rtl::OUString::toFloat
float toFloat() const
Returns the float value from this string.
Definition: ustring.hxx:2276
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:1564
rtl::OUString::toInt64
sal_Int64 toInt64(sal_Int16 radix=10) const
Returns the int64 value from this string.
Definition: ustring.hxx:2246
rtl::OUString::compareToIgnoreAsciiCaseAscii
sal_Int32 compareToIgnoreAsciiCaseAscii(const sal_Char *asciiStr) const
Compares two ASCII strings ignoring case.
Definition: ustring.hxx:989
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:2065
rtl::OUStringHash
A helper to use OUStrings with hash maps.
Definition: ustring.hxx:2754
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:388
SAL_CONSTEXPR
#define SAL_CONSTEXPR
C++11 "constexpr" feature.
Definition: types.h:445
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:812
RTL_USTR_MAX_VALUEOFDOUBLE
#define RTL_USTR_MAX_VALUEOFDOUBLE
Definition: ustring.h:1041
SAL_DEPRECATED
#define SAL_DEPRECATED(message)
Use as follows: SAL_DEPRECATED("Don&#39;t use, it&#39;s evil.") void doit(int nPara);.
Definition: types.h:509
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:593
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:235
rtl::OString::getLength
sal_Int32 getLength() const
Returns the length of this string.
Definition: string.hxx:404
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:1263
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:316
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:768
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:2106
rtl::OUString::hashCode
sal_Int32 hashCode() const
Returns a hashcode for this string.
Definition: ustring.hxx:1531
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:1992
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:2124
rtl::OUString::OUString
OUString(const sal_Unicode *value)
New string from a Unicode character buffer array.
Definition: ustring.hxx:199
rtl::OUString::compareToIgnoreAsciiCase
sal_Int32 compareToIgnoreAsciiCase(const OUString &str) const
Perform a ASCII lowercase comparison of two strings.
Definition: ustring.hxx:714
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:1894
rtl::OUString::createFromAscii
static OUString createFromAscii(const sal_Char *value)
Returns a OUString copied without conversion from an ASCII character string.
Definition: ustring.hxx:2701
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:1840
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:1230
rtl::OUString::operator+=
OUString & operator+=(const OUString &str)
Append a string to this string.
Definition: ustring.hxx:459
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:2524
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:1601
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:916
rtl::OUString::~OUString
~OUString()
Release the string data.
Definition: ustring.hxx:376
rtl::OUString::number
static OUString number(double d)
Returns the string representation of the double argument.
Definition: ustring.hxx:2573
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:895
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:1714
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:1181
rtl::OUString::equalsIgnoreAsciiCase
bool equalsIgnoreAsciiCase(const OUString &str) const
Perform a ASCII lowercase comparison of two strings.
Definition: ustring.hxx:689
rtl::OUString::OUString
OUString(rtl_uString *str, __sal_NoAcquire)
New OUString from OUString data without acquiring it.
Definition: ustring.hxx:169
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:1400
rtl::OUString::startsWith
bool startsWith(OUString const &str, OUString *rest=NULL) const
Check whether this string starts with a given substring.
Definition: ustring.hxx:1110
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:1343
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:1961
ustring.h
rtl::OUString::OUString
OUString(const sal_Unicode *value, sal_Int32 length)
New string from a Unicode character buffer array.
Definition: ustring.hxx:213
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:2503
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:2039
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:438
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