LibreOffice
LibreOffice 4.3 SDK C/C++ API Reference
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 <new>
27 #include <ostream>
28 #include <string.h>
29 
30 #include <osl/diagnose.h>
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 RTL_FAST_STRING
38 #include <rtl/stringconcat.hxx>
39 #endif
40 
41 // The unittest uses slightly different code to help check that the proper
42 // calls are made. The class is put into a different namespace to make
43 // sure the compiler generates a different (if generating also non-inline)
44 // copy of the function and does not merge them together. The class
45 // is "brought" into the proper rtl namespace by a typedef below.
46 #ifdef RTL_STRING_UNITTEST
47 #define rtl rtlunittest
48 #endif
49 
50 namespace rtl
51 {
52 
53 #ifdef RTL_STRING_UNITTEST
54 #undef rtl
55 #endif
56 
57 /* ======================================================================= */
58 
83 {
84 public:
86  rtl_uString * pData;
88 
93  {
94  pData = 0;
95  rtl_uString_new( &pData );
96  }
97 
103  OUString( const OUString & str ) SAL_THROW(())
104  {
105  pData = str.pData;
106  rtl_uString_acquire( pData );
107  }
108 
114  OUString( rtl_uString * str ) SAL_THROW(())
115  {
116  pData = str;
117  rtl_uString_acquire( pData );
118  }
119 
128  inline OUString( rtl_uString * str, __sal_NoAcquire ) SAL_THROW(())
129  { pData = str; }
130 
136  explicit OUString( sal_Unicode value ) SAL_THROW(())
137  : pData (0)
138  {
139  rtl_uString_newFromStr_WithLength( &pData, &value, 1 );
140  }
141 
147  OUString( const sal_Unicode * value ) SAL_THROW(())
148  {
149  pData = 0;
150  rtl_uString_newFromStr( &pData, value );
151  }
152 
161  OUString( const sal_Unicode * value, sal_Int32 length ) SAL_THROW(())
162  {
163  pData = 0;
164  rtl_uString_newFromStr_WithLength( &pData, value, length );
165  }
166 
182  template< typename T >
184  {
185  assert( strlen( literal ) == internal::ConstCharArrayDetector< T >::size - 1 );
186  pData = 0;
187  if( internal::ConstCharArrayDetector< T, void >::size - 1 == 0 ) // empty string
188  rtl_uString_new( &pData );
189  else
191 #ifdef RTL_STRING_UNITTEST
192  rtl_string_unittest_const_literal = true;
193 #endif
194  }
195 
196 #ifdef RTL_STRING_UNITTEST
197 
201  template< typename T >
203  {
204  pData = 0;
205  rtl_uString_newFromLiteral( &pData, "!!br0ken!!", 10, 0 ); // set to garbage
206  rtl_string_unittest_invalid_conversion = true;
207  }
212  template< typename T >
213  OUString( const T&, typename internal::ExceptCharArrayDetector< T >::Type = internal::Dummy() )
214  {
215  pData = 0;
216  rtl_uString_newFromLiteral( &pData, "!!br0ken!!", 10, 0 ); // set to garbage
217  rtl_string_unittest_invalid_conversion = true;
218  }
219 #endif
220 
235  OUString( const sal_Char * value, sal_Int32 length,
236  rtl_TextEncoding encoding,
237  sal_uInt32 convertFlags = OSTRING_TO_OUSTRING_CVTFLAGS )
238  {
239  pData = 0;
240  rtl_string2UString( &pData, value, length, encoding, convertFlags );
241  if (pData == 0) {
242  throw std::bad_alloc();
243  }
244  }
245 
262  inline explicit OUString(
263  sal_uInt32 const * codePoints, sal_Int32 codePointCount):
264  pData(NULL)
265  {
266  rtl_uString_newFromCodePoints(&pData, codePoints, codePointCount);
267  if (pData == NULL) {
268  throw std::bad_alloc();
269  }
270  }
271 
272 #ifdef RTL_FAST_STRING
273 
277  template< typename T1, typename T2 >
278  OUString( const OUStringConcat< T1, T2 >& c )
279  {
280  const sal_Int32 l = c.length();
281  pData = rtl_uString_alloc( l );
282  if (l != 0)
283  {
284  sal_Unicode* end = c.addData( pData->buffer );
285  pData->length = end - pData->buffer;
286  *end = '\0';
287  // TODO realloc in case pData->length is noticeably smaller than l?
288  }
289  }
290 #endif
291 
296  {
297  rtl_uString_release( pData );
298  }
299 
311  static inline OUString const & unacquired( rtl_uString * const * ppHandle )
312  { return * reinterpret_cast< OUString const * >( ppHandle ); }
313 
319  OUString & operator=( const OUString & str ) SAL_THROW(())
320  {
321  rtl_uString_assign( &pData, str.pData );
322  return *this;
323  }
324 
337  template< typename T >
339  {
340  assert( strlen( literal ) == internal::ConstCharArrayDetector< T >::size - 1 );
341  if( internal::ConstCharArrayDetector< T, void >::size - 1 == 0 ) // empty string
342  rtl_uString_new( &pData );
343  else
345  return *this;
346  }
347 
353  OUString & operator+=( const OUString & str ) SAL_THROW(())
354  {
355  rtl_uString_newConcat( &pData, pData, str.pData );
356  return *this;
357  }
358 
359 #ifdef RTL_FAST_STRING
360 
364  template< typename T1, typename T2 >
365  OUString& operator+=( const OUStringConcat< T1, T2 >& c )
366  {
367  const int l = c.length();
368  if( l == 0 )
369  return *this;
370  rtl_uString_ensureCapacity( &pData, pData->length + l );
371  sal_Unicode* end = c.addData( pData->buffer + pData->length );
372  *end = '\0';
373  pData->length = end - pData->buffer;
374  return *this;
375  }
376 #endif
377 
386  sal_Int32 getLength() const SAL_THROW(()) { return pData->length; }
387 
396  bool isEmpty() const SAL_THROW(())
397  {
398  return pData->length == 0;
399  }
400 
408  const sal_Unicode * getStr() const SAL_THROW(()) { return pData->buffer; }
409 
419  sal_Unicode operator [](sal_Int32 index) const {
420  // silence spurious -Werror=strict-overflow warnings from GCC 4.8.2
421  assert(index >= 0 && static_cast<sal_uInt32>(index) < static_cast<sal_uInt32>(getLength()));
422  return getStr()[index];
423  }
424 
437  sal_Int32 compareTo( const OUString & str ) const SAL_THROW(())
438  {
439  return rtl_ustr_compare_WithLength( pData->buffer, pData->length,
440  str.pData->buffer, str.pData->length );
441  }
442 
458  sal_Int32 compareTo( const OUString & str, sal_Int32 maxLength ) const SAL_THROW(())
459  {
460  return rtl_ustr_shortenedCompare_WithLength( pData->buffer, pData->length,
461  str.pData->buffer, str.pData->length, maxLength );
462  }
463 
476  sal_Int32 reverseCompareTo( const OUString & str ) const SAL_THROW(())
477  {
478  return rtl_ustr_reverseCompare_WithLength( pData->buffer, pData->length,
479  str.pData->buffer, str.pData->length );
480  }
481 
487  template< typename T >
489  {
490  assert( strlen( literal ) == internal::ConstCharArrayDetector< T >::size - 1 );
491  return rtl_ustr_asciil_reverseCompare_WithLength( pData->buffer, pData->length,
493  }
494 
506  bool equals( const OUString & str ) const SAL_THROW(())
507  {
508  if ( pData->length != str.pData->length )
509  return false;
510  if ( pData == str.pData )
511  return true;
512  return rtl_ustr_reverseCompare_WithLength( pData->buffer, pData->length,
513  str.pData->buffer, str.pData->length ) == 0;
514  }
515 
530  bool equalsIgnoreAsciiCase( const OUString & str ) const SAL_THROW(())
531  {
532  if ( pData->length != str.pData->length )
533  return false;
534  if ( pData == str.pData )
535  return true;
536  return rtl_ustr_compareIgnoreAsciiCase_WithLength( pData->buffer, pData->length,
537  str.pData->buffer, str.pData->length ) == 0;
538  }
539 
555  sal_Int32 compareToIgnoreAsciiCase( const OUString & str ) const SAL_THROW(())
556  {
557  return rtl_ustr_compareIgnoreAsciiCase_WithLength( pData->buffer, pData->length,
558  str.pData->buffer, str.pData->length );
559  }
560 
561 
567  template< typename T >
569  {
570  assert( strlen( literal ) == internal::ConstCharArrayDetector< T >::size - 1 );
571  if ( pData->length != internal::ConstCharArrayDetector< T, void >::size - 1 )
572  return false;
573 
574  return rtl_ustr_ascii_compareIgnoreAsciiCase_WithLength( pData->buffer, pData->length, literal ) == 0;
575  }
576 
592  bool match( const OUString & str, sal_Int32 fromIndex = 0 ) const SAL_THROW(())
593  {
594  return rtl_ustr_shortenedCompare_WithLength( pData->buffer+fromIndex, pData->length-fromIndex,
595  str.pData->buffer, str.pData->length, str.pData->length ) == 0;
596  }
597 
603  template< typename T >
604  typename internal::ConstCharArrayDetector< T, bool >::Type match( T& literal, sal_Int32 fromIndex = 0 ) const SAL_THROW(())
605  {
606  assert( strlen( literal ) == internal::ConstCharArrayDetector< T >::size - 1 );
607  return rtl_ustr_ascii_shortenedCompare_WithLength( pData->buffer+fromIndex, pData->length-fromIndex,
609  }
610 
629  bool matchIgnoreAsciiCase( const OUString & str, sal_Int32 fromIndex = 0 ) const SAL_THROW(())
630  {
631  return rtl_ustr_shortenedCompareIgnoreAsciiCase_WithLength( pData->buffer+fromIndex, pData->length-fromIndex,
632  str.pData->buffer, str.pData->length,
633  str.pData->length ) == 0;
634  }
635 
641  template< typename T >
642  typename internal::ConstCharArrayDetector< T, bool >::Type matchIgnoreAsciiCase( T& literal, sal_Int32 fromIndex = 0 ) const SAL_THROW(())
643  {
644  assert( strlen( literal ) == internal::ConstCharArrayDetector< T >::size - 1 );
645  return rtl_ustr_ascii_shortenedCompareIgnoreAsciiCase_WithLength( pData->buffer+fromIndex, pData->length-fromIndex,
647  }
648 
665  sal_Int32 compareToAscii( const sal_Char* asciiStr ) const SAL_THROW(())
666  {
667  return rtl_ustr_ascii_compare_WithLength( pData->buffer, pData->length, asciiStr );
668  }
669 
693  "replace s1.compareToAscii(s2, strlen(s2)) == 0 with s1.startsWith(s2)")
694  sal_Int32 compareToAscii( const sal_Char * asciiStr, sal_Int32 maxLength ) const SAL_THROW(())
695  {
696  return rtl_ustr_ascii_shortenedCompare_WithLength( pData->buffer, pData->length,
697  asciiStr, maxLength );
698  }
699 
719  sal_Int32 reverseCompareToAsciiL( const sal_Char * asciiStr, sal_Int32 asciiStrLength ) const SAL_THROW(())
720  {
721  return rtl_ustr_asciil_reverseCompare_WithLength( pData->buffer, pData->length,
722  asciiStr, asciiStrLength );
723  }
724 
740  bool equalsAscii( const sal_Char* asciiStr ) const SAL_THROW(())
741  {
742  return rtl_ustr_ascii_compare_WithLength( pData->buffer, pData->length,
743  asciiStr ) == 0;
744  }
745 
763  bool equalsAsciiL( const sal_Char* asciiStr, sal_Int32 asciiStrLength ) const SAL_THROW(())
764  {
765  if ( pData->length != asciiStrLength )
766  return false;
767 
769  pData->buffer, asciiStr, asciiStrLength );
770  }
771 
790  bool equalsIgnoreAsciiCaseAscii( const sal_Char * asciiStr ) const SAL_THROW(())
791  {
792  return rtl_ustr_ascii_compareIgnoreAsciiCase_WithLength( pData->buffer, pData->length, asciiStr ) == 0;
793  }
794 
813  sal_Int32 compareToIgnoreAsciiCaseAscii( const sal_Char * asciiStr ) const SAL_THROW(())
814  {
815  return rtl_ustr_ascii_compareIgnoreAsciiCase_WithLength( pData->buffer, pData->length, asciiStr );
816  }
817 
838  bool equalsIgnoreAsciiCaseAsciiL( const sal_Char * asciiStr, sal_Int32 asciiStrLength ) const SAL_THROW(())
839  {
840  if ( pData->length != asciiStrLength )
841  return false;
842 
843  return rtl_ustr_ascii_compareIgnoreAsciiCase_WithLength( pData->buffer, pData->length, asciiStr ) == 0;
844  }
845 
867  bool matchAsciiL( const sal_Char* asciiStr, sal_Int32 asciiStrLength, sal_Int32 fromIndex = 0 ) const SAL_THROW(())
868  {
869  return rtl_ustr_ascii_shortenedCompare_WithLength( pData->buffer+fromIndex, pData->length-fromIndex,
870  asciiStr, asciiStrLength ) == 0;
871  }
872 
873  // This overload is left undefined, to detect calls of matchAsciiL that
874  // erroneously use RTL_CONSTASCII_USTRINGPARAM instead of
875  // RTL_CONSTASCII_STRINGPARAM (but would lead to ambiguities on 32 bit
876  // platforms):
877 #if SAL_TYPES_SIZEOFLONG == 8
878  void matchAsciiL(char const *, sal_Int32, rtl_TextEncoding) const;
879 #endif
880 
905  bool matchIgnoreAsciiCaseAsciiL( const sal_Char* asciiStr, sal_Int32 asciiStrLength, sal_Int32 fromIndex = 0 ) const SAL_THROW(())
906  {
907  return rtl_ustr_ascii_shortenedCompareIgnoreAsciiCase_WithLength( pData->buffer+fromIndex, pData->length-fromIndex,
908  asciiStr, asciiStrLength ) == 0;
909  }
910 
911  // This overload is left undefined, to detect calls of
912  // matchIgnoreAsciiCaseAsciiL that erroneously use
913  // RTL_CONSTASCII_USTRINGPARAM instead of RTL_CONSTASCII_STRINGPARAM (but
914  // would lead to ambiguities on 32 bit platforms):
915 #if SAL_TYPES_SIZEOFLONG == 8
916  void matchIgnoreAsciiCaseAsciiL(char const *, sal_Int32, rtl_TextEncoding)
917  const;
918 #endif
919 
934  bool startsWith(OUString const & str, OUString * rest = 0) const {
935  bool b = match(str, 0);
936  if (b && rest != 0) {
937  *rest = copy(str.getLength());
938  }
939  return b;
940  }
941 
947  template< typename T >
949  T & literal, OUString * rest = 0) const
950  {
951  assert( strlen( literal ) == internal::ConstCharArrayDetector< T >::size - 1 );
952  bool b = internal::ConstCharArrayDetector< T, void >::size - 1 <= pData->length
953  && rtl_ustr_asciil_reverseEquals_WithLength( pData->buffer, literal,
955  if (b && rest != 0) {
957  }
958  return b;
959  }
960 
981  bool startsWithIgnoreAsciiCase(OUString const & str, OUString * rest = 0)
982  const
983  {
984  bool b = matchIgnoreAsciiCase(str, 0);
985  if (b && rest != 0) {
986  *rest = copy(str.getLength());
987  }
988  return b;
989  }
990 
996  template< typename T >
998  startsWithIgnoreAsciiCase(T & literal, OUString * rest = 0) const
999  {
1000  assert( strlen( literal ) == internal::ConstCharArrayDetector< T >::size - 1 );
1002  pData->buffer,
1005  == 0);
1006  if (b && rest != 0) {
1008  }
1009  return b;
1010  }
1011 
1026  bool endsWith(OUString const & str, OUString * rest = 0) const {
1027  bool b = str.getLength() <= getLength()
1028  && match(str, getLength() - str.getLength());
1029  if (b && rest != 0) {
1030  *rest = copy(0, getLength() - str.getLength());
1031  }
1032  return b;
1033  }
1034 
1040  template< typename T >
1042  endsWith(T & literal, OUString * rest = 0) const
1043  {
1044  assert( strlen( literal ) == internal::ConstCharArrayDetector< T >::size - 1 );
1045  bool b = internal::ConstCharArrayDetector< T, void >::size - 1 <= pData->length
1047  pData->buffer + pData->length - ( internal::ConstCharArrayDetector< T, void >::size - 1 ), literal,
1049  if (b && rest != 0) {
1050  *rest = copy(
1051  0,
1052  (getLength()
1054  }
1055  return b;
1056  }
1057 
1069  inline bool endsWithAsciiL(char const * asciiStr, sal_Int32 asciiStrLength)
1070  const
1071  {
1072  return asciiStrLength <= pData->length
1074  pData->buffer + pData->length - asciiStrLength, asciiStr,
1075  asciiStrLength);
1076  }
1077 
1098  bool endsWithIgnoreAsciiCase(OUString const & str, OUString * rest = 0) const
1099  {
1100  bool b = str.getLength() <= getLength()
1101  && matchIgnoreAsciiCase(str, getLength() - str.getLength());
1102  if (b && rest != 0) {
1103  *rest = copy(0, getLength() - str.getLength());
1104  }
1105  return b;
1106  }
1107 
1113  template< typename T >
1115  endsWithIgnoreAsciiCase(T & literal, OUString * rest = 0) const
1116  {
1117  assert( strlen( literal ) == internal::ConstCharArrayDetector< T >::size - 1 );
1118  bool b = internal::ConstCharArrayDetector< T, void >::size - 1 <= pData->length
1120  pData->buffer + pData->length - ( internal::ConstCharArrayDetector< T, void >::size - 1 ),
1123  == 0);
1124  if (b && rest != 0) {
1125  *rest = copy(
1126  0,
1127  (getLength()
1129  }
1130  return b;
1131  }
1132 
1144  char const * asciiStr, sal_Int32 asciiStrLength) const
1145  {
1146  return asciiStrLength <= pData->length
1148  pData->buffer + pData->length - asciiStrLength,
1149  asciiStrLength, asciiStr, asciiStrLength)
1150  == 0);
1151  }
1152 
1153  friend bool operator == ( const OUString& rStr1, const OUString& rStr2 ) SAL_THROW(())
1154  { return rStr1.equals(rStr2); }
1155  friend bool operator == ( const OUString& rStr1, const sal_Unicode * pStr2 ) SAL_THROW(())
1156  { return rStr1.compareTo( pStr2 ) == 0; }
1157  friend bool operator == ( const sal_Unicode * pStr1, const OUString& rStr2 ) SAL_THROW(())
1158  { return OUString( pStr1 ).compareTo( rStr2 ) == 0; }
1159 
1160  friend bool operator != ( const OUString& rStr1, const OUString& rStr2 ) SAL_THROW(())
1161  { return !(operator == ( rStr1, rStr2 )); }
1162  friend bool operator != ( const OUString& rStr1, const sal_Unicode * pStr2 ) SAL_THROW(())
1163  { return !(operator == ( rStr1, pStr2 )); }
1164  friend bool operator != ( const sal_Unicode * pStr1, const OUString& rStr2 ) SAL_THROW(())
1165  { return !(operator == ( pStr1, rStr2 )); }
1166 
1167  friend bool operator < ( const OUString& rStr1, const OUString& rStr2 ) SAL_THROW(())
1168  { return rStr1.compareTo( rStr2 ) < 0; }
1169  friend bool operator > ( const OUString& rStr1, const OUString& rStr2 ) SAL_THROW(())
1170  { return rStr1.compareTo( rStr2 ) > 0; }
1171  friend bool operator <= ( const OUString& rStr1, const OUString& rStr2 ) SAL_THROW(())
1172  { return rStr1.compareTo( rStr2 ) <= 0; }
1173  friend bool operator >= ( const OUString& rStr1, const OUString& rStr2 ) SAL_THROW(())
1174  { return rStr1.compareTo( rStr2 ) >= 0; }
1175 
1183  template< typename T >
1184  friend inline typename internal::ConstCharArrayDetector< T, bool >::Type operator==( const OUString& string, T& literal )
1185  {
1186  assert( strlen( literal ) == internal::ConstCharArrayDetector< T >::size - 1 );
1187  return string.equalsAsciiL( literal, internal::ConstCharArrayDetector< T, void >::size - 1 );
1188  }
1196  template< typename T >
1197  friend inline typename internal::ConstCharArrayDetector< T, bool >::Type operator==( T& literal, const OUString& string )
1198  {
1199  assert( strlen( literal ) == internal::ConstCharArrayDetector< T >::size - 1 );
1200  return string.equalsAsciiL( literal, internal::ConstCharArrayDetector< T, void >::size - 1 );
1201  }
1209  template< typename T >
1210  friend inline typename internal::ConstCharArrayDetector< T, bool >::Type operator!=( const OUString& string, T& literal )
1211  {
1212  assert( strlen( literal ) == internal::ConstCharArrayDetector< T >::size - 1 );
1213  return !string.equalsAsciiL( literal, internal::ConstCharArrayDetector< T, void >::size - 1 );
1214  }
1222  template< typename T >
1223  friend inline typename internal::ConstCharArrayDetector< T, bool >::Type operator!=( T& literal, const OUString& string )
1224  {
1225  assert( strlen( literal ) == internal::ConstCharArrayDetector< T >::size - 1 );
1226  return !string.equalsAsciiL( literal, internal::ConstCharArrayDetector< T, void >::size - 1 );
1227  }
1228 
1236  sal_Int32 hashCode() const SAL_THROW(())
1237  {
1238  return rtl_ustr_hashCode_WithLength( pData->buffer, pData->length );
1239  }
1240 
1254  sal_Int32 indexOf( sal_Unicode ch, sal_Int32 fromIndex = 0 ) const SAL_THROW(())
1255  {
1256  sal_Int32 ret = rtl_ustr_indexOfChar_WithLength( pData->buffer+fromIndex, pData->length-fromIndex, ch );
1257  return (ret < 0 ? ret : ret+fromIndex);
1258  }
1259 
1269  sal_Int32 lastIndexOf( sal_Unicode ch ) const SAL_THROW(())
1270  {
1271  return rtl_ustr_lastIndexOfChar_WithLength( pData->buffer, pData->length, ch );
1272  }
1273 
1286  sal_Int32 lastIndexOf( sal_Unicode ch, sal_Int32 fromIndex ) const SAL_THROW(())
1287  {
1288  return rtl_ustr_lastIndexOfChar_WithLength( pData->buffer, fromIndex, ch );
1289  }
1290 
1306  sal_Int32 indexOf( const OUString & str, sal_Int32 fromIndex = 0 ) const SAL_THROW(())
1307  {
1308  sal_Int32 ret = rtl_ustr_indexOfStr_WithLength( pData->buffer+fromIndex, pData->length-fromIndex,
1309  str.pData->buffer, str.pData->length );
1310  return (ret < 0 ? ret : ret+fromIndex);
1311  }
1312 
1318  template< typename T >
1319  typename internal::ConstCharArrayDetector< T, sal_Int32 >::Type indexOf( T& literal, sal_Int32 fromIndex = 0 ) const SAL_THROW(())
1320  {
1321  assert( strlen( literal ) == internal::ConstCharArrayDetector< T >::size - 1 );
1322  sal_Int32 ret = rtl_ustr_indexOfAscii_WithLength(
1323  pData->buffer + fromIndex, pData->length - fromIndex, literal,
1325  return ret < 0 ? ret : ret + fromIndex;
1326  }
1327 
1351  sal_Int32 indexOfAsciiL(
1352  char const * str, sal_Int32 len, sal_Int32 fromIndex = 0) const
1353  SAL_THROW(())
1354  {
1355  sal_Int32 ret = rtl_ustr_indexOfAscii_WithLength(
1356  pData->buffer + fromIndex, pData->length - fromIndex, str, len);
1357  return ret < 0 ? ret : ret + fromIndex;
1358  }
1359 
1360  // This overload is left undefined, to detect calls of indexOfAsciiL that
1361  // erroneously use RTL_CONSTASCII_USTRINGPARAM instead of
1362  // RTL_CONSTASCII_STRINGPARAM (but would lead to ambiguities on 32 bit
1363  // platforms):
1364 #if SAL_TYPES_SIZEOFLONG == 8
1365  void indexOfAsciiL(char const *, sal_Int32 len, rtl_TextEncoding) const;
1366 #endif
1367 
1383  sal_Int32 lastIndexOf( const OUString & str ) const SAL_THROW(())
1384  {
1385  return rtl_ustr_lastIndexOfStr_WithLength( pData->buffer, pData->length,
1386  str.pData->buffer, str.pData->length );
1387  }
1388 
1406  sal_Int32 lastIndexOf( const OUString & str, sal_Int32 fromIndex ) const SAL_THROW(())
1407  {
1408  return rtl_ustr_lastIndexOfStr_WithLength( pData->buffer, fromIndex,
1409  str.pData->buffer, str.pData->length );
1410  }
1411 
1417  template< typename T >
1419  {
1420  assert( strlen( literal ) == internal::ConstCharArrayDetector< T >::size - 1 );
1422  pData->buffer, pData->length, literal, internal::ConstCharArrayDetector< T, void >::size - 1);
1423  }
1424 
1444  sal_Int32 lastIndexOfAsciiL(char const * str, sal_Int32 len) const
1445  SAL_THROW(())
1446  {
1448  pData->buffer, pData->length, str, len);
1449  }
1450 
1461  SAL_WARN_UNUSED_RESULT OUString copy( sal_Int32 beginIndex ) const SAL_THROW(())
1462  {
1463  rtl_uString *pNew = 0;
1464  rtl_uString_newFromSubString( &pNew, pData, beginIndex, getLength() - beginIndex );
1465  return OUString( pNew, SAL_NO_ACQUIRE );
1466  }
1467 
1480  SAL_WARN_UNUSED_RESULT OUString copy( sal_Int32 beginIndex, sal_Int32 count ) const SAL_THROW(())
1481  {
1482  rtl_uString *pNew = 0;
1483  rtl_uString_newFromSubString( &pNew, pData, beginIndex, count );
1484  return OUString( pNew, SAL_NO_ACQUIRE );
1485  }
1486 
1496  {
1497  rtl_uString* pNew = 0;
1498  rtl_uString_newConcat( &pNew, pData, str.pData );
1499  return OUString( pNew, SAL_NO_ACQUIRE );
1500  }
1501 
1502 #ifndef RTL_FAST_STRING
1503  friend OUString operator+( const OUString& rStr1, const OUString& rStr2 ) SAL_THROW(())
1504  {
1505  return rStr1.concat( rStr2 );
1506  }
1507 #endif
1508 
1522  SAL_WARN_UNUSED_RESULT OUString replaceAt( sal_Int32 index, sal_Int32 count, const OUString& newStr ) const SAL_THROW(())
1523  {
1524  rtl_uString* pNew = 0;
1525  rtl_uString_newReplaceStrAt( &pNew, pData, index, count, newStr.pData );
1526  return OUString( pNew, SAL_NO_ACQUIRE );
1527  }
1528 
1543  {
1544  rtl_uString* pNew = 0;
1545  rtl_uString_newReplace( &pNew, pData, oldChar, newChar );
1546  return OUString( pNew, SAL_NO_ACQUIRE );
1547  }
1548 
1568  OUString const & from, OUString const & to, sal_Int32 * index = 0) const
1569  {
1570  rtl_uString * s = 0;
1571  sal_Int32 i = 0;
1573  &s, pData, from.pData, to.pData, index == 0 ? &i : index);
1574  return OUString(s, SAL_NO_ACQUIRE);
1575  }
1576 
1595  template< typename T >
1597  sal_Int32 * index = 0) const
1598  {
1599  rtl_uString * s = 0;
1600  sal_Int32 i = 0;
1601  assert( strlen( from ) == internal::ConstCharArrayDetector< T >::size - 1 );
1603  &s, pData, from, internal::ConstCharArrayDetector< T, void >::size - 1, to.pData, index == 0 ? &i : index);
1604  return OUString(s, SAL_NO_ACQUIRE);
1605  }
1606 
1625  template< typename T1, typename T2 >
1627  replaceFirst( T1& from, T2& to, sal_Int32 * index = 0) const
1628  {
1629  rtl_uString * s = 0;
1630  sal_Int32 i = 0;
1631  assert( strlen( from ) == internal::ConstCharArrayDetector< T1 >::size - 1 );
1632  assert( strlen( to ) == internal::ConstCharArrayDetector< T2 >::size - 1 );
1634  &s, pData, from, internal::ConstCharArrayDetector< T1, void >::size - 1, to,
1635  internal::ConstCharArrayDetector< T2, void >::size - 1, index == 0 ? &i : index);
1636  return OUString(s, SAL_NO_ACQUIRE);
1637  }
1638 
1655  OUString const & from, OUString const & to, sal_Int32 fromIndex = 0) const
1656  {
1657  rtl_uString * s = 0;
1658  rtl_uString_newReplaceAllFromIndex(&s, pData, from.pData, to.pData, fromIndex);
1659  return OUString(s, SAL_NO_ACQUIRE);
1660  }
1661 
1675  template< typename T >
1677  {
1678  rtl_uString * s = 0;
1679  assert( strlen( from ) == internal::ConstCharArrayDetector< T >::size - 1 );
1681  return OUString(s, SAL_NO_ACQUIRE);
1682  }
1683 
1697  template< typename T1, typename T2 >
1699  replaceAll( T1& from, T2& to ) const
1700  {
1701  rtl_uString * s = 0;
1702  assert( strlen( from ) == internal::ConstCharArrayDetector< T1 >::size - 1 );
1703  assert( strlen( to ) == internal::ConstCharArrayDetector< T2 >::size - 1 );
1707  return OUString(s, SAL_NO_ACQUIRE);
1708  }
1709 
1721  {
1722  rtl_uString* pNew = 0;
1723  rtl_uString_newToAsciiLowerCase( &pNew, pData );
1724  return OUString( pNew, SAL_NO_ACQUIRE );
1725  }
1726 
1738  {
1739  rtl_uString* pNew = 0;
1740  rtl_uString_newToAsciiUpperCase( &pNew, pData );
1741  return OUString( pNew, SAL_NO_ACQUIRE );
1742  }
1743 
1756  {
1757  rtl_uString* pNew = 0;
1758  rtl_uString_newTrim( &pNew, pData );
1759  return OUString( pNew, SAL_NO_ACQUIRE );
1760  }
1761 
1786  OUString getToken( sal_Int32 token, sal_Unicode cTok, sal_Int32& index ) const SAL_THROW(())
1787  {
1788  rtl_uString * pNew = 0;
1789  index = rtl_uString_getToken( &pNew, pData, token, cTok, index );
1790  return OUString( pNew, SAL_NO_ACQUIRE );
1791  }
1792 
1806  OUString getToken(sal_Int32 count, sal_Unicode separator) const {
1807  sal_Int32 n = 0;
1808  return getToken(count, separator, n);
1809  }
1810 
1819  bool toBoolean() const SAL_THROW(())
1820  {
1821  return rtl_ustr_toBoolean( pData->buffer );
1822  }
1823 
1831  {
1832  return pData->buffer[0];
1833  }
1834 
1845  sal_Int32 toInt32( sal_Int16 radix = 10 ) const SAL_THROW(())
1846  {
1847  return rtl_ustr_toInt32( pData->buffer, radix );
1848  }
1849 
1862  sal_uInt32 toUInt32( sal_Int16 radix = 10 ) const SAL_THROW(())
1863  {
1864  return rtl_ustr_toUInt32( pData->buffer, radix );
1865  }
1866 
1877  sal_Int64 toInt64( sal_Int16 radix = 10 ) const SAL_THROW(())
1878  {
1879  return rtl_ustr_toInt64( pData->buffer, radix );
1880  }
1881 
1894  sal_uInt64 toUInt64( sal_Int16 radix = 10 ) const SAL_THROW(())
1895  {
1896  return rtl_ustr_toUInt64( pData->buffer, radix );
1897  }
1898 
1907  float toFloat() const SAL_THROW(())
1908  {
1909  return rtl_ustr_toFloat( pData->buffer );
1910  }
1911 
1920  double toDouble() const SAL_THROW(())
1921  {
1922  return rtl_ustr_toDouble( pData->buffer );
1923  }
1924 
1925 
1942  {
1943  rtl_uString * pNew = 0;
1944  rtl_uString_intern( &pNew, pData );
1945  if (pNew == 0) {
1946  throw std::bad_alloc();
1947  }
1948  return OUString( pNew, SAL_NO_ACQUIRE );
1949  }
1950 
1976  static OUString intern( const sal_Char * value, sal_Int32 length,
1977  rtl_TextEncoding encoding,
1978  sal_uInt32 convertFlags = OSTRING_TO_OUSTRING_CVTFLAGS,
1979  sal_uInt32 *pInfo = NULL )
1980  {
1981  rtl_uString * pNew = 0;
1982  rtl_uString_internConvert( &pNew, value, length, encoding,
1983  convertFlags, pInfo );
1984  if (pNew == 0) {
1985  throw std::bad_alloc();
1986  }
1987  return OUString( pNew, SAL_NO_ACQUIRE );
1988  }
1989 
2014  inline bool convertToString(OString * pTarget, rtl_TextEncoding nEncoding,
2015  sal_uInt32 nFlags) const
2016  {
2017  return rtl_convertUStringToString(&pTarget->pData, pData->buffer,
2018  pData->length, nEncoding, nFlags);
2019  }
2020 
2072  inline sal_uInt32 iterateCodePoints(
2073  sal_Int32 * indexUtf16, sal_Int32 incrementCodePoints = 1) const
2074  {
2076  pData, indexUtf16, incrementCodePoints);
2077  }
2078 
2089  static OUString number( int i, sal_Int16 radix = 10 )
2090  {
2092  rtl_uString* pNewData = 0;
2093  rtl_uString_newFromStr_WithLength( &pNewData, aBuf, rtl_ustr_valueOfInt32( aBuf, i, radix ) );
2094  return OUString( pNewData, SAL_NO_ACQUIRE );
2095  }
2098  static OUString number( unsigned int i, sal_Int16 radix = 10 )
2099  {
2100  return number( static_cast< unsigned long long >( i ), radix );
2101  }
2104  static OUString number( long i, sal_Int16 radix = 10)
2105  {
2106  return number( static_cast< long long >( i ), radix );
2107  }
2110  static OUString number( unsigned long i, sal_Int16 radix = 10 )
2111  {
2112  return number( static_cast< unsigned long long >( i ), radix );
2113  }
2116  static OUString number( long long ll, sal_Int16 radix = 10 )
2117  {
2119  rtl_uString* pNewData = 0;
2120  rtl_uString_newFromStr_WithLength( &pNewData, aBuf, rtl_ustr_valueOfInt64( aBuf, ll, radix ) );
2121  return OUString( pNewData, SAL_NO_ACQUIRE );
2122  }
2125  static OUString number( unsigned long long ll, sal_Int16 radix = 10 )
2126  {
2128  rtl_uString* pNewData = 0;
2129  rtl_uString_newFromStr_WithLength( &pNewData, aBuf, rtl_ustr_valueOfUInt64( aBuf, ll, radix ) );
2130  return OUString( pNewData, SAL_NO_ACQUIRE );
2131  }
2132 
2142  static OUString number( float f )
2143  {
2145  rtl_uString* pNewData = 0;
2146  rtl_uString_newFromStr_WithLength( &pNewData, aBuf, rtl_ustr_valueOfFloat( aBuf, f ) );
2147  return OUString( pNewData, SAL_NO_ACQUIRE );
2148  }
2149 
2159  static OUString number( double d )
2160  {
2162  rtl_uString* pNewData = 0;
2163  rtl_uString_newFromStr_WithLength( &pNewData, aBuf, rtl_ustr_valueOfDouble( aBuf, d ) );
2164  return OUString( pNewData, SAL_NO_ACQUIRE );
2165  }
2166 
2178  SAL_DEPRECATED("use boolean()") static OUString valueOf( sal_Bool b ) SAL_THROW(())
2179  {
2180  return boolean(b);
2181  }
2182 
2194  static OUString boolean( bool b ) SAL_THROW(())
2195  {
2197  rtl_uString* pNewData = 0;
2198  rtl_uString_newFromStr_WithLength( &pNewData, aBuf, rtl_ustr_valueOfBoolean( aBuf, b ) );
2199  return OUString( pNewData, SAL_NO_ACQUIRE );
2200  }
2201 
2209  SAL_DEPRECATED("convert to OUString or use directly") static OUString valueOf( sal_Unicode c ) SAL_THROW(())
2210  {
2211  return OUString( &c, 1 );
2212  }
2213 
2224  SAL_DEPRECATED("use number()") static OUString valueOf( sal_Int32 i, sal_Int16 radix = 10 ) SAL_THROW(())
2225  {
2226  return number( i, radix );
2227  }
2228 
2239  SAL_DEPRECATED("use number()") static OUString valueOf( sal_Int64 ll, sal_Int16 radix = 10 ) SAL_THROW(())
2240  {
2241  return number( ll, radix );
2242  }
2243 
2253  SAL_DEPRECATED("use number()") static OUString valueOf( float f ) SAL_THROW(())
2254  {
2255  return number(f);
2256  }
2257 
2267  SAL_DEPRECATED("use number()") static OUString valueOf( double d ) SAL_THROW(())
2268  {
2269  return number(d);
2270  }
2271 
2287  static OUString createFromAscii( const sal_Char * value ) SAL_THROW(())
2288  {
2289  rtl_uString* pNew = 0;
2290  rtl_uString_newFromAscii( &pNew, value );
2291  return OUString( pNew, SAL_NO_ACQUIRE );
2292  }
2293 };
2294 
2295 /* ======================================================================= */
2296 
2297 #ifdef RTL_FAST_STRING
2298 
2306 struct SAL_WARN_UNUSED OUStringLiteral
2307 {
2308  template< int N >
2309  OUStringLiteral( const char (&str)[ N ] ) : size( N - 1 ), data( str ) { assert( strlen( str ) == N - 1 ); }
2310  int size;
2311  const char* data;
2312 };
2313 
2317 template<>
2318 struct ToStringHelper< OUString >
2319  {
2320  static int length( const OUString& s ) { return s.getLength(); }
2321  static sal_Unicode* addData( sal_Unicode* buffer, const OUString& s ) { return addDataHelper( buffer, s.getStr(), s.getLength()); }
2322  static const bool allowOStringConcat = false;
2323  static const bool allowOUStringConcat = true;
2324  };
2325 
2329 template<>
2330 struct ToStringHelper< OUStringLiteral >
2331  {
2332  static int length( const OUStringLiteral& str ) { return str.size; }
2333  static sal_Unicode* addData( sal_Unicode* buffer, const OUStringLiteral& str ) { return addDataLiteral( buffer, str.data, str.size ); }
2334  static const bool allowOStringConcat = false;
2335  static const bool allowOUStringConcat = true;
2336  };
2337 
2341 template< typename charT, typename traits, typename T1, typename T2 >
2342 inline std::basic_ostream<charT, traits> & operator <<(
2343  std::basic_ostream<charT, traits> & stream, const OUStringConcat< T1, T2 >& concat)
2344 {
2345  return stream << OUString( concat );
2346 }
2347 #else
2348 // non-RTL_FAST_STRING needs this to compile
2350 typedef OUString OUStringLiteral;
2352 #endif
2353 
2360 {
2370  size_t operator()(const OUString& rString) const
2371  { return (size_t)rString.hashCode(); }
2372 };
2373 
2374 /* ======================================================================= */
2375 
2393 inline OUString OStringToOUString( const OString & rStr,
2394  rtl_TextEncoding encoding,
2395  sal_uInt32 convertFlags = OSTRING_TO_OUSTRING_CVTFLAGS )
2396 {
2397  return OUString( rStr.getStr(), rStr.getLength(), encoding, convertFlags );
2398 }
2399 
2417 inline OString OUStringToOString( const OUString & rUnicode,
2418  rtl_TextEncoding encoding,
2419  sal_uInt32 convertFlags = OUSTRING_TO_OSTRING_CVTFLAGS )
2420 {
2421  return OString( rUnicode.getStr(), rUnicode.getLength(), encoding, convertFlags );
2422 }
2423 
2424 /* ======================================================================= */
2425 
2434 template< typename charT, typename traits >
2435 inline std::basic_ostream<charT, traits> & operator <<(
2436  std::basic_ostream<charT, traits> & stream, OUString const & string)
2437 {
2438  return stream <<
2440  // best effort; potentially loses data due to conversion failures
2441  // (stray surrogate halves) and embedded null characters
2442 }
2443 
2444 } // namespace
2445 
2446 #ifdef RTL_STRING_UNITTEST
2447 namespace rtl
2448 {
2449 typedef rtlunittest::OUString OUString;
2450 }
2451 #endif
2452 
2453 // RTL_USING is defined by gbuild for all modules except those with stable public API
2454 // (as listed in ure/source/README). It allows to use classes like OUString without
2455 // having to explicitly refer to the rtl namespace, which is kind of superfluous
2456 // given that OUString itself is namespaced by its OU prefix.
2457 #ifdef RTL_USING
2458 using ::rtl::OUString;
2459 using ::rtl::OUStringHash;
2462 using ::rtl::OUStringLiteral;
2463 #endif
2464 
2465 #endif /* _RTL_USTRING_HXX */
2466 
2467 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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...
SAL_DLLPUBLIC void rtl_uString_release(rtl_uString *str) SAL_THROW_EXTERN_C()
Decrement the reference count of a string.
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...
sal_Int32 compareTo(const OUString &str, sal_Int32 maxLength) const SAL_THROW(())
Compares two strings with a maximum count of characters.
Definition: ustring.hxx:458
SAL_DLLPUBLIC void rtl_uString_intern(rtl_uString **newStr, rtl_uString *str) SAL_THROW_EXTERN_C()
Return a canonical representation for a string.
internal::ConstCharArrayDetector< T, bool >::Type match(T &literal, sal_Int32 fromIndex=0) const SAL_THROW(())
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: ustring.hxx:604
#define SAL_DEPRECATED(message)
Use as follows: SAL_DEPRECATED("Dont use, its evil.") void doit(int nPara);.
Definition: types.h:491
bool operator!=(const Any &rAny, const C &value) SAL_THROW(())
Template unequality operator: compares set value of left side any to right side value.
Definition: Any.hxx:582
sal_uInt64 toUInt64(sal_Int16 radix=10) const SAL_THROW(())
Returns the uint64 value from this string.
Definition: ustring.hxx:1894
SAL_DLLPUBLIC void rtl_uString_new(rtl_uString **newStr) SAL_THROW_EXTERN_C()
Allocate a new string containing no characters.
float toFloat() const SAL_THROW(())
Returns the float value from this string.
Definition: ustring.hxx:1907
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:235
OUString(const OUString &str) SAL_THROW(())
New string from OUString.
Definition: ustring.hxx:103
size_t operator()(const OUString &rString) const
Compute a hash code for a string.
Definition: ustring.hxx:2370
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.
OUString(const sal_Unicode *value, sal_Int32 length) SAL_THROW(())
New string from a Unicode character buffer array.
Definition: ustring.hxx:161
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.
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.
friend internal::ConstCharArrayDetector< T, bool >::Type operator!=(T &literal, const OUString &string)
Compare string to an ASCII string literal.
Definition: ustring.hxx:1223
const sal_Char * getStr() const SAL_THROW(())
Returns a pointer to the characters of this string.
Definition: string.hxx:353
sal_Int32 indexOf(const OUString &str, sal_Int32 fromIndex=0) const SAL_THROW(())
Returns the index within this string of the first occurrence of the specified substring, starting at the specified index.
Definition: ustring.hxx:1306
sal_Int32 lastIndexOf(const OUString &str) const SAL_THROW(())
Returns the index within this string of the last occurrence of the specified substring, searching backward starting at the end.
Definition: ustring.hxx:1383
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.
unsigned char sal_Bool
Definition: types.h:46
bool operator<(const TTimeValue &rTimeA, const TTimeValue &rTimeB)
Definition: timer.hxx:98
SAL_DLLPUBLIC sal_Int32 rtl_ustr_valueOfBoolean(sal_Unicode *str, sal_Bool b) SAL_THROW_EXTERN_C()
Create the string representation of a boolean.
friend OUString operator+(const OUString &rStr1, const OUString &rStr2) SAL_THROW(())
Definition: ustring.hxx:1503
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...
Definition: bootstrap.hxx:24
static OUString number(int i, sal_Int16 radix=10)
Returns the string representation of the integer argument.
Definition: ustring.hxx:2089
Definition: stringutils.hxx:67
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.
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.
internal::ConstCharArrayDetector< T, bool >::Type endsWithIgnoreAsciiCase(T &literal, OUString *rest=0) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: ustring.hxx:1115
definition of a no acquire enum for ctors
Definition: types.h:388
#define RTL_USTR_MAX_VALUEOFINT32
Definition: ustring.h:957
OUString(sal_uInt32 const *codePoints, sal_Int32 codePointCount)
Create a new string from an array of Unicode code points.
Definition: ustring.hxx:262
bool startsWith(OUString const &str, OUString *rest=0) const
Check whether this string starts with a given substring.
Definition: ustring.hxx:934
bool endsWithAsciiL(char const *asciiStr, sal_Int32 asciiStrLength) const
Check whether this string ends with a given ASCII string.
Definition: ustring.hxx:1069
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.
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...
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.
SAL_DLLPUBLIC double rtl_ustr_toDouble(const sal_Unicode *str) SAL_THROW_EXTERN_C()
Interpret a string as a double.
#define OSTRING_TO_OUSTRING_CVTFLAGS
Definition: ustring.h:1817
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:2104
SAL_WARN_UNUSED_RESULT OUString trim() const SAL_THROW(())
Returns a new string resulting from removing white space from both ends of the string.
Definition: ustring.hxx:1755
SAL_DLLPUBLIC float rtl_ustr_toFloat(const sal_Unicode *str) SAL_THROW_EXTERN_C()
Interpret a string as a float.
sal_Int32 reverseCompareToAsciiL(const sal_Char *asciiStr, sal_Int32 asciiStrLength) const SAL_THROW(())
Compares two strings in reverse order.
Definition: ustring.hxx:719
OUString & operator+=(const OUString &str) SAL_THROW(())
Append a string to this string.
Definition: ustring.hxx:353
OUString() SAL_THROW(())
New string containing no characters.
Definition: ustring.hxx:92
sal_Int32 hashCode() const SAL_THROW(())
Returns a hashcode for this string.
Definition: ustring.hxx:1236
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:338
friend internal::ConstCharArrayDetector< T, bool >::Type operator!=(const OUString &string, T &literal)
Compare string to an ASCII string literal.
Definition: ustring.hxx:1210
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.
A helper to use OUStrings with hash maps.
Definition: ustring.hxx:2359
static OUString createFromAscii(const sal_Char *value) SAL_THROW(())
Returns a OUString copied without conversion from an ASCII character string.
Definition: ustring.hxx:2287
SAL_WARN_UNUSED_RESULT 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:1676
const sal_Unicode * getStr() const SAL_THROW(())
Returns a pointer to the Unicode character buffer for this string.
Definition: ustring.hxx:408
OUString(rtl_uString *str) SAL_THROW(())
New string from OUString data.
Definition: ustring.hxx:114
__sal_NoAcquire
Definition: types.h:384
double toDouble() const SAL_THROW(())
Returns the double value from this string.
Definition: ustring.hxx:1920
SAL_DLLPUBLIC void rtl_uString_assign(rtl_uString **str, rtl_uString *rightValue) SAL_THROW_EXTERN_C()
Assign a new value to a string.
bool endsWithIgnoreAsciiCase(OUString const &str, OUString *rest=0) const
Check whether this string ends with a given string, ignoring the case of ASCII letters.
Definition: ustring.hxx:1098
OUString(sal_Unicode value) SAL_THROW(())
New string from a single Unicode character.
Definition: ustring.hxx:136
bool toBoolean() const SAL_THROW(())
Returns the Boolean value from this string.
Definition: ustring.hxx:1819
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...
internal::ConstCharArrayDetector< T, bool >::Type startsWithIgnoreAsciiCase(T &literal, OUString *rest=0) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: ustring.hxx:998
bool match(const OUString &str, sal_Int32 fromIndex=0) const SAL_THROW(())
Match against a substring appearing in this string.
Definition: ustring.hxx:592
sal_Int32 lastIndexOf(sal_Unicode ch, sal_Int32 fromIndex) const SAL_THROW(())
Returns the index within this string of the last occurrence of the specified character, searching backward starting before the specified index.
Definition: ustring.hxx:1286
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.
friend internal::ConstCharArrayDetector< T, bool >::Type operator==(const OUString &string, T &literal)
Compare string to an ASCII string literal.
Definition: ustring.hxx:1184
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.
bool startsWithIgnoreAsciiCase(OUString const &str, OUString *rest=0) const
Check whether this string starts with a given string, ignoring the case of ASCII letters.
Definition: ustring.hxx:981
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...
SAL_WARN_UNUSED_RESULT OUString copy(sal_Int32 beginIndex) const SAL_THROW(())
Returns a new string that is a substring of this string.
Definition: ustring.hxx:1461
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:2072
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.
static OUString const & unacquired(rtl_uString *const *ppHandle)
Provides an OUString const & passing a storage pointer of an rtl_uString * handle.
Definition: ustring.hxx:311
SAL_WARN_UNUSED_RESULT OUString toAsciiUpperCase() const SAL_THROW(())
Converts from this string all ASCII lowercase characters (97-122) to ASCII uppercase characters (65-9...
Definition: ustring.hxx:1737
sal_Int64 toInt64(sal_Int16 radix=10) const SAL_THROW(())
Returns the int64 value from this string.
Definition: ustring.hxx:1877
#define SAL_WARN_UNUSED_RESULT
Use this as markup for functions and methods whose return value must be checked.
Definition: types.h:307
SAL_WARN_UNUSED_RESULT OUString copy(sal_Int32 beginIndex, sal_Int32 count) const SAL_THROW(())
Returns a new string that is a substring of this string.
Definition: ustring.hxx:1480
char sal_Char
A legacy synonym for char.
Definition: types.h:128
SAL_WARN_UNUSED_RESULT internal::ConstCharArrayDetector< T, OUString >::Type replaceFirst(T &from, OUString const &to, sal_Int32 *index=0) const
Returns a new string resulting from replacing the first occurrence of a given substring with another ...
Definition: ustring.hxx:1596
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:2393
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...
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.
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.
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.
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.
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:2417
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:2098
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:1976
bool equalsIgnoreAsciiCaseAscii(const sal_Char *asciiStr) const SAL_THROW(())
Perform a ASCII lowercase comparison of two strings.
Definition: ustring.hxx:790
OUString & operator=(const OUString &str) SAL_THROW(())
Assign a new string.
Definition: ustring.hxx:319
SAL_DLLPUBLIC sal_Bool rtl_ustr_toBoolean(const sal_Unicode *str) SAL_THROW_EXTERN_C()
Interpret a string as a boolean.
sal_Int32 lastIndexOf(sal_Unicode ch) const SAL_THROW(())
Returns the index within this string of the last occurrence of the specified character, searching backward starting at the end.
Definition: ustring.hxx:1269
bool operator==(const TTimeValue &rTimeA, const TTimeValue &rTimeB)
Definition: timer.hxx:118
sal_Int32 toInt32(sal_Int16 radix=10) const SAL_THROW(())
Returns the int32 value from this string.
Definition: ustring.hxx:1845
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...
bool matchIgnoreAsciiCaseAsciiL(const sal_Char *asciiStr, sal_Int32 asciiStrLength, sal_Int32 fromIndex=0) const SAL_THROW(())
Match against a substring appearing in this string, ignoring the case of ASCII letters.
Definition: ustring.hxx:905
sal_Int32 getLength() const SAL_THROW(())
Returns the length of this string.
Definition: string.hxx:327
OUString getToken(sal_Int32 count, sal_Unicode separator) const
Returns a token from the string.
Definition: ustring.hxx:1806
#define RTL_STR_MAX_VALUEOFUINT64
Definition: string.h:673
#define RTL_TEXTENCODING_UTF8
Definition: textenc.h:121
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.
internal::ConstCharArrayDetector< T, bool >::Type matchIgnoreAsciiCase(T &literal, sal_Int32 fromIndex=0) const SAL_THROW(())
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: ustring.hxx:642
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.
SAL_WARN_UNUSED_RESULT OUString concat(const OUString &str) const SAL_THROW(())
Concatenates the specified string to the end of this string.
Definition: ustring.hxx:1495
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:2110
This String class provide base functionality for C++ like 8-Bit character array handling.
Definition: string.hxx:89
OUString(T &literal, typename internal::ConstCharArrayDetector< T, internal::Dummy >::Type=internal::Dummy())
New string from an 8-Bit string literal that is expected to contain only characters in the ASCII set ...
Definition: ustring.hxx:183
Definition: stringutils.hxx:110
sal_Int32 compareTo(const OUString &str) const SAL_THROW(())
Compares two strings.
Definition: ustring.hxx:437
internal::ConstCharArrayDetector< T, bool >::Type startsWith(T &literal, OUString *rest=0) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: ustring.hxx:948
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.
#define SAL_THROW(x)
Exception specification documentation.
Definition: types.h:361
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.
sal_Int32 lastIndexOf(const OUString &str, sal_Int32 fromIndex) const SAL_THROW(())
Returns the index within this string of the last occurrence of the specified substring, searching backward starting before the specified index.
Definition: ustring.hxx:1406
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.
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.
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.
~OUString() SAL_THROW(())
Release the string data.
Definition: ustring.hxx:295
internal::ConstCharArrayDetector< T, sal_Int32 >::Type lastIndexOf(T &literal) const SAL_THROW(())
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: ustring.hxx:1418
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.
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...
SAL_DLLPUBLIC void rtl_uString_acquire(rtl_uString *str) SAL_THROW_EXTERN_C()
Increment the reference count of a string.
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:1351
bool operator>(const TTimeValue &rTimeA, const TTimeValue &rTimeB)
Definition: timer.hxx:108
bool endsWith(OUString const &str, OUString *rest=0) const
Check whether this string ends with a given substring.
Definition: ustring.hxx:1026
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.
sal_uInt16 rtl_TextEncoding
The various supported text encodings.
Definition: textenc.h:39
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.
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_Int32 indexOf(sal_Unicode ch, sal_Int32 fromIndex=0) const SAL_THROW(())
Returns the index within this string of the first occurrence of the specified character, starting the search at the specified index.
Definition: ustring.hxx:1254
bool matchAsciiL(const sal_Char *asciiStr, sal_Int32 asciiStrLength, sal_Int32 fromIndex=0) const SAL_THROW(())
Match against a substring appearing in this string.
Definition: ustring.hxx:867
OUString(rtl_uString *str, __sal_NoAcquire) SAL_THROW(())
New OUString from OUString data without acquiring it.
Definition: ustring.hxx:128
internal::ConstCharArrayDetector< T, sal_Int32 >::Type reverseCompareTo(T &literal) const SAL_THROW(())
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: ustring.hxx:488
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.
sal_uInt32 toUInt32(sal_Int16 radix=10) const SAL_THROW(())
Returns the uint32 value from this string.
Definition: ustring.hxx:1862
sal_Unicode toChar() const SAL_THROW(())
Returns the first character from this string.
Definition: ustring.hxx:1830
bool equalsAscii(const sal_Char *asciiStr) const SAL_THROW(())
Perform a comparison of two strings.
Definition: ustring.hxx:740
bool equalsIgnoreAsciiCase(const OUString &str) const SAL_THROW(())
Perform a ASCII lowercase comparison of two strings.
Definition: ustring.hxx:530
OUString getToken(sal_Int32 token, sal_Unicode cTok, sal_Int32 &index) const SAL_THROW(())
Returns a token in the string.
Definition: ustring.hxx:1786
bool isEmpty() const SAL_THROW(())
Checks if a string is empty.
Definition: ustring.hxx:396
internal::ConstCharArrayDetector< T, bool >::Type endsWith(T &literal, OUString *rest=0) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: ustring.hxx:1042
bool matchIgnoreAsciiCase(const OUString &str, sal_Int32 fromIndex=0) const SAL_THROW(())
Match against a substring appearing in this string, ignoring the case of ASCII letters.
Definition: ustring.hxx:629
SAL_WARN_UNUSED_RESULT internal::ConstCharArrayDetector< T1, typename 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:1699
#define RTL_USTR_MAX_VALUEOFDOUBLE
Definition: ustring.h:1041
bool equals(const OUString &str) const SAL_THROW(())
Perform a comparison of two strings.
Definition: ustring.hxx:506
bool equalsIgnoreAsciiCaseAsciiL(const sal_Char *asciiStr, sal_Int32 asciiStrLength) const SAL_THROW(())
Perform an ASCII lowercase comparison of two strings.
Definition: ustring.hxx:838
friend internal::ConstCharArrayDetector< T, bool >::Type operator==(T &literal, const OUString &string)
Compare string to an ASCII string literal.
Definition: ustring.hxx:1197
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.
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.
#define RTL_USTR_MAX_VALUEOFFLOAT
Definition: ustring.h:1022
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.
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...
bool convertToString(OString *pTarget, rtl_TextEncoding nEncoding, sal_uInt32 nFlags) const
Converts to an OString, signalling failure.
Definition: ustring.hxx:2014
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:1729
internal::ConstCharArrayDetector< T, bool >::Type equalsIgnoreAsciiCase(T &literal) const SAL_THROW(())
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: ustring.hxx:568
#define OUSTRING_TO_OSTRING_CVTFLAGS
Definition: string.h:1324
sal_Int32 compareToIgnoreAsciiCase(const OUString &str) const SAL_THROW(())
Perform a ASCII lowercase comparison of two strings.
Definition: ustring.hxx:555
sal_Int32 reverseCompareTo(const OUString &str) const SAL_THROW(())
Compares two strings in reverse order.
Definition: ustring.hxx:476
SAL_WARN_UNUSED_RESULT OUString replaceFirst(OUString const &from, OUString const &to, sal_Int32 *index=0) const
Returns a new string resulting from replacing the first occurrence of a given substring with another ...
Definition: ustring.hxx:1567
static OUString number(double d)
Returns the string representation of the double argument.
Definition: ustring.hxx:2159
SAL_WARN_UNUSED_RESULT OUString replaceAt(sal_Int32 index, sal_Int32 count, const OUString &newStr) const SAL_THROW(())
Returns a new string resulting from replacing n = count characters from position index in this string...
Definition: ustring.hxx:1522
sal_Int32 getLength() const SAL_THROW(())
Returns the length of this string.
Definition: ustring.hxx:386
#define RTL_USTR_MAX_VALUEOFBOOLEAN
Definition: ustring.h:915
#define SAL_WARN_UNUSED
Annotate classes where a compiler should warn if an instance is unused.
Definition: types.h:603
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.
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.
static OUString number(float f)
Returns the string representation of the float argument.
Definition: ustring.hxx:2142
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.
SAL_WARN_UNUSED_RESULT OUString replace(sal_Unicode oldChar, sal_Unicode newChar) const SAL_THROW(())
Returns a new string resulting from replacing all occurrences of oldChar in this string with newChar...
Definition: ustring.hxx:1542
OUString intern() const
Return a canonical representation for a string.
Definition: ustring.hxx:1941
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:2125
SAL_DLLPUBLIC sal_Int32 rtl_ustr_valueOfDouble(sal_Unicode *str, double d) SAL_THROW_EXTERN_C()
Create the string representation of a double.
sal_Int32 compareToAscii(const sal_Char *asciiStr) const SAL_THROW(())
Compares two strings.
Definition: ustring.hxx:665
This String class provides base functionality for C++ like Unicode character array handling...
Definition: ustring.hxx:82
SAL_DLLPUBLIC void rtl_uString_newFromLiteral(rtl_uString **newStr, const sal_Char *value, sal_Int32 len, sal_Int32 allocExtra) SAL_THROW_EXTERN_C()
sal_uInt16 sal_Unicode
Definition: types.h:150
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.
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.
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:2116
static OUString boolean(bool b) SAL_THROW(())
Returns the string representation of the boolean argument.
Definition: ustring.hxx:2194
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.
bool equalsAsciiL(const sal_Char *asciiStr, sal_Int32 asciiStrLength) const SAL_THROW(())
Perform a comparison of two strings.
Definition: ustring.hxx:763
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...
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:1444
SAL_DLLPUBLIC sal_Int32 rtl_ustr_valueOfFloat(sal_Unicode *str, float f) SAL_THROW_EXTERN_C()
Create the string representation of a float.
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.
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:1143
#define RTL_STR_MAX_VALUEOFINT64
Definition: string.h:650
sal_Int32 compareToIgnoreAsciiCaseAscii(const sal_Char *asciiStr) const SAL_THROW(())
Compares two ASCII strings ignoring case.
Definition: ustring.hxx:813
OUString(const sal_Unicode *value) SAL_THROW(())
New string from a Unicode character buffer array.
Definition: ustring.hxx:147
SAL_WARN_UNUSED_RESULT OUString toAsciiLowerCase() const SAL_THROW(())
Converts from this string all ASCII uppercase characters (65-90) to ASCII lowercase characters (97-12...
Definition: ustring.hxx:1720
SAL_WARN_UNUSED_RESULT internal::ConstCharArrayDetector< T1, typename internal::ConstCharArrayDetector< T2, OUString >::Type >::Type replaceFirst(T1 &from, T2 &to, sal_Int32 *index=0) const
Returns a new string resulting from replacing the first occurrence of a given substring with another ...
Definition: ustring.hxx:1627
SAL_DLLPUBLIC sal_Int32 rtl_ustr_toInt32(const sal_Unicode *str, sal_Int16 radix) SAL_THROW_EXTERN_C()
Interpret a string as an integer.
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:1654
internal::ConstCharArrayDetector< T, sal_Int32 >::Type indexOf(T &literal, sal_Int32 fromIndex=0) const SAL_THROW(())
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: ustring.hxx:1319