LibreOffice
LibreOffice 4.4 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 <rtl/ustring.h>
31 #include <rtl/string.hxx>
32 #include <rtl/stringutils.hxx>
33 #include <rtl/textenc.h>
34 #include <sal/log.hxx>
35 
36 #ifdef RTL_FAST_STRING
37 #include <rtl/stringconcat.hxx>
38 #endif
39 
40 // The unittest uses slightly different code to help check that the proper
41 // calls are made. The class is put into a different namespace to make
42 // sure the compiler generates a different (if generating also non-inline)
43 // copy of the function and does not merge them together. The class
44 // is "brought" into the proper rtl namespace by a typedef below.
45 #ifdef RTL_STRING_UNITTEST
46 #define rtl rtlunittest
47 #endif
48 
49 namespace rtl
50 {
51 
52 #ifdef RTL_STRING_UNITTEST
53 #undef rtl
54 #endif
55 
56 /* ======================================================================= */
57 
82 {
83 public:
85  rtl_uString * pData;
87 
92  {
93  pData = 0;
94  rtl_uString_new( &pData );
95  }
96 
102  OUString( const OUString & str )
103  {
104  pData = str.pData;
105  rtl_uString_acquire( pData );
106  }
107 
113  OUString( rtl_uString * str )
114  {
115  pData = str;
116  rtl_uString_acquire( pData );
117  }
118 
127  inline OUString( rtl_uString * str, __sal_NoAcquire )
128  { pData = str; }
129 
135  explicit OUString( sal_Unicode value )
136  : pData (0)
137  {
138  rtl_uString_newFromStr_WithLength( &pData, &value, 1 );
139  }
140 
146  OUString( const sal_Unicode * value )
147  {
148  pData = 0;
149  rtl_uString_newFromStr( &pData, value );
150  }
151 
160  OUString( const sal_Unicode * value, sal_Int32 length )
161  {
162  pData = 0;
163  rtl_uString_newFromStr_WithLength( &pData, value, length );
164  }
165 
181  template< typename T >
183  {
184  assert( strlen( literal ) == libreoffice_internal::ConstCharArrayDetector< T >::size - 1 );
185  pData = 0;
187  rtl_uString_new( &pData );
188  else
190 #ifdef RTL_STRING_UNITTEST
191  rtl_string_unittest_const_literal = true;
192 #endif
193  }
194 
195 #ifdef RTL_STRING_UNITTEST
196 
200  template< typename T >
202  {
203  pData = 0;
204  rtl_uString_newFromLiteral( &pData, "!!br0ken!!", 10, 0 ); // set to garbage
205  rtl_string_unittest_invalid_conversion = true;
206  }
211  template< typename T >
212  OUString( const T&, typename libreoffice_internal::ExceptCharArrayDetector< T >::Type = libreoffice_internal::Dummy() )
213  {
214  pData = 0;
215  rtl_uString_newFromLiteral( &pData, "!!br0ken!!", 10, 0 ); // set to garbage
216  rtl_string_unittest_invalid_conversion = true;
217  }
218 #endif
219 
234  OUString( const sal_Char * value, sal_Int32 length,
235  rtl_TextEncoding encoding,
236  sal_uInt32 convertFlags = OSTRING_TO_OUSTRING_CVTFLAGS )
237  {
238  pData = 0;
239  rtl_string2UString( &pData, value, length, encoding, convertFlags );
240  if (pData == 0) {
241  throw std::bad_alloc();
242  }
243  }
244 
261  inline explicit OUString(
262  sal_uInt32 const * codePoints, sal_Int32 codePointCount):
263  pData(NULL)
264  {
265  rtl_uString_newFromCodePoints(&pData, codePoints, codePointCount);
266  if (pData == NULL) {
267  throw std::bad_alloc();
268  }
269  }
270 
271 #ifdef RTL_FAST_STRING
272 
276  template< typename T1, typename T2 >
277  OUString( const OUStringConcat< T1, T2 >& c )
278  {
279  const sal_Int32 l = c.length();
280  pData = rtl_uString_alloc( l );
281  if (l != 0)
282  {
283  sal_Unicode* end = c.addData( pData->buffer );
284  pData->length = end - pData->buffer;
285  *end = '\0';
286  // TODO realloc in case pData->length is noticeably smaller than l?
287  }
288  }
289 #endif
290 
295  {
296  rtl_uString_release( pData );
297  }
298 
310  static inline OUString const & unacquired( rtl_uString * const * ppHandle )
311  { return * reinterpret_cast< OUString const * >( ppHandle ); }
312 
318  OUString & operator=( const OUString & str )
319  {
320  rtl_uString_assign( &pData, str.pData );
321  return *this;
322  }
323 
336  template< typename T >
338  {
339  assert( strlen( literal ) == libreoffice_internal::ConstCharArrayDetector< T >::size - 1 );
341  rtl_uString_new( &pData );
342  else
344  return *this;
345  }
346 
352  OUString & operator+=( const OUString & str )
353  {
354  rtl_uString_newConcat( &pData, pData, str.pData );
355  return *this;
356  }
357 
358 #ifdef RTL_FAST_STRING
359 
363  template< typename T1, typename T2 >
364  OUString& operator+=( const OUStringConcat< T1, T2 >& c )
365  {
366  const int l = c.length();
367  if( l == 0 )
368  return *this;
369  rtl_uString_ensureCapacity( &pData, pData->length + l );
370  sal_Unicode* end = c.addData( pData->buffer + pData->length );
371  *end = '\0';
372  pData->length = end - pData->buffer;
373  return *this;
374  }
375 #endif
376 
381  void clear()
382  {
383  rtl_uString_new( &pData );
384  }
385 
394  sal_Int32 getLength() const { return pData->length; }
395 
404  bool isEmpty() const
405  {
406  return pData->length == 0;
407  }
408 
416  const sal_Unicode * getStr() const { return pData->buffer; }
417 
427  sal_Unicode operator [](sal_Int32 index) const {
428  // silence spurious -Werror=strict-overflow warnings from GCC 4.8.2
429  assert(index >= 0 && static_cast<sal_uInt32>(index) < static_cast<sal_uInt32>(getLength()));
430  return getStr()[index];
431  }
432 
445  sal_Int32 compareTo( const OUString & str ) const
446  {
447  return rtl_ustr_compare_WithLength( pData->buffer, pData->length,
448  str.pData->buffer, str.pData->length );
449  }
450 
466  sal_Int32 compareTo( const OUString & str, sal_Int32 maxLength ) const
467  {
468  return rtl_ustr_shortenedCompare_WithLength( pData->buffer, pData->length,
469  str.pData->buffer, str.pData->length, maxLength );
470  }
471 
484  sal_Int32 reverseCompareTo( const OUString & str ) const
485  {
486  return rtl_ustr_reverseCompare_WithLength( pData->buffer, pData->length,
487  str.pData->buffer, str.pData->length );
488  }
489 
495  template< typename T >
497  {
498  assert( strlen( literal ) == libreoffice_internal::ConstCharArrayDetector< T >::size - 1 );
499  return rtl_ustr_asciil_reverseCompare_WithLength( pData->buffer, pData->length,
501  }
502 
514  bool equals( const OUString & str ) const
515  {
516  if ( pData->length != str.pData->length )
517  return false;
518  if ( pData == str.pData )
519  return true;
520  return rtl_ustr_reverseCompare_WithLength( pData->buffer, pData->length,
521  str.pData->buffer, str.pData->length ) == 0;
522  }
523 
538  bool equalsIgnoreAsciiCase( const OUString & str ) const
539  {
540  if ( pData->length != str.pData->length )
541  return false;
542  if ( pData == str.pData )
543  return true;
544  return rtl_ustr_compareIgnoreAsciiCase_WithLength( pData->buffer, pData->length,
545  str.pData->buffer, str.pData->length ) == 0;
546  }
547 
563  sal_Int32 compareToIgnoreAsciiCase( const OUString & str ) const
564  {
565  return rtl_ustr_compareIgnoreAsciiCase_WithLength( pData->buffer, pData->length,
566  str.pData->buffer, str.pData->length );
567  }
568 
569 
575  template< typename T >
577  {
578  assert( strlen( literal ) == libreoffice_internal::ConstCharArrayDetector< T >::size - 1 );
580  return false;
581 
582  return rtl_ustr_ascii_compareIgnoreAsciiCase_WithLength( pData->buffer, pData->length, literal ) == 0;
583  }
584 
600  bool match( const OUString & str, sal_Int32 fromIndex = 0 ) const
601  {
602  return rtl_ustr_shortenedCompare_WithLength( pData->buffer+fromIndex, pData->length-fromIndex,
603  str.pData->buffer, str.pData->length, str.pData->length ) == 0;
604  }
605 
611  template< typename T >
612  typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type match( T& literal, sal_Int32 fromIndex = 0 ) const
613  {
614  assert( strlen( literal ) == libreoffice_internal::ConstCharArrayDetector< T >::size - 1 );
615  return rtl_ustr_ascii_shortenedCompare_WithLength( pData->buffer+fromIndex, pData->length-fromIndex,
617  }
618 
637  bool matchIgnoreAsciiCase( const OUString & str, sal_Int32 fromIndex = 0 ) const
638  {
639  return rtl_ustr_shortenedCompareIgnoreAsciiCase_WithLength( pData->buffer+fromIndex, pData->length-fromIndex,
640  str.pData->buffer, str.pData->length,
641  str.pData->length ) == 0;
642  }
643 
649  template< typename T >
650  typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type matchIgnoreAsciiCase( T& literal, sal_Int32 fromIndex = 0 ) const
651  {
652  assert( strlen( literal ) == libreoffice_internal::ConstCharArrayDetector< T >::size - 1 );
653  return rtl_ustr_ascii_shortenedCompareIgnoreAsciiCase_WithLength( pData->buffer+fromIndex, pData->length-fromIndex,
655  }
656 
673  sal_Int32 compareToAscii( const sal_Char* asciiStr ) const
674  {
675  return rtl_ustr_ascii_compare_WithLength( pData->buffer, pData->length, asciiStr );
676  }
677 
701  "replace s1.compareToAscii(s2, strlen(s2)) == 0 with s1.startsWith(s2)")
702  sal_Int32 compareToAscii( const sal_Char * asciiStr, sal_Int32 maxLength ) const
703  {
704  return rtl_ustr_ascii_shortenedCompare_WithLength( pData->buffer, pData->length,
705  asciiStr, maxLength );
706  }
707 
727  sal_Int32 reverseCompareToAsciiL( const sal_Char * asciiStr, sal_Int32 asciiStrLength ) const
728  {
729  return rtl_ustr_asciil_reverseCompare_WithLength( pData->buffer, pData->length,
730  asciiStr, asciiStrLength );
731  }
732 
748  bool equalsAscii( const sal_Char* asciiStr ) const
749  {
750  return rtl_ustr_ascii_compare_WithLength( pData->buffer, pData->length,
751  asciiStr ) == 0;
752  }
753 
771  bool equalsAsciiL( const sal_Char* asciiStr, sal_Int32 asciiStrLength ) const
772  {
773  if ( pData->length != asciiStrLength )
774  return false;
775 
777  pData->buffer, asciiStr, asciiStrLength );
778  }
779 
798  bool equalsIgnoreAsciiCaseAscii( const sal_Char * asciiStr ) const
799  {
800  return rtl_ustr_ascii_compareIgnoreAsciiCase_WithLength( pData->buffer, pData->length, asciiStr ) == 0;
801  }
802 
821  sal_Int32 compareToIgnoreAsciiCaseAscii( const sal_Char * asciiStr ) const
822  {
823  return rtl_ustr_ascii_compareIgnoreAsciiCase_WithLength( pData->buffer, pData->length, asciiStr );
824  }
825 
846  bool equalsIgnoreAsciiCaseAsciiL( const sal_Char * asciiStr, sal_Int32 asciiStrLength ) const
847  {
848  if ( pData->length != asciiStrLength )
849  return false;
850 
851  return rtl_ustr_ascii_compareIgnoreAsciiCase_WithLength( pData->buffer, pData->length, asciiStr ) == 0;
852  }
853 
875  bool matchAsciiL( const sal_Char* asciiStr, sal_Int32 asciiStrLength, sal_Int32 fromIndex = 0 ) const
876  {
877  return rtl_ustr_ascii_shortenedCompare_WithLength( pData->buffer+fromIndex, pData->length-fromIndex,
878  asciiStr, asciiStrLength ) == 0;
879  }
880 
881  // This overload is left undefined, to detect calls of matchAsciiL that
882  // erroneously use RTL_CONSTASCII_USTRINGPARAM instead of
883  // RTL_CONSTASCII_STRINGPARAM (but would lead to ambiguities on 32 bit
884  // platforms):
885 #if SAL_TYPES_SIZEOFLONG == 8
886  void matchAsciiL(char const *, sal_Int32, rtl_TextEncoding) const;
887 #endif
888 
913  bool matchIgnoreAsciiCaseAsciiL( const sal_Char* asciiStr, sal_Int32 asciiStrLength, sal_Int32 fromIndex = 0 ) const
914  {
915  return rtl_ustr_ascii_shortenedCompareIgnoreAsciiCase_WithLength( pData->buffer+fromIndex, pData->length-fromIndex,
916  asciiStr, asciiStrLength ) == 0;
917  }
918 
919  // This overload is left undefined, to detect calls of
920  // matchIgnoreAsciiCaseAsciiL that erroneously use
921  // RTL_CONSTASCII_USTRINGPARAM instead of RTL_CONSTASCII_STRINGPARAM (but
922  // would lead to ambiguities on 32 bit platforms):
923 #if SAL_TYPES_SIZEOFLONG == 8
924  void matchIgnoreAsciiCaseAsciiL(char const *, sal_Int32, rtl_TextEncoding)
925  const;
926 #endif
927 
942  bool startsWith(OUString const & str, OUString * rest = 0) const {
943  bool b = match(str, 0);
944  if (b && rest != 0) {
945  *rest = copy(str.getLength());
946  }
947  return b;
948  }
949 
955  template< typename T >
957  T & literal, OUString * rest = 0) const
958  {
959  assert( strlen( literal ) == libreoffice_internal::ConstCharArrayDetector< T >::size - 1 );
961  && rtl_ustr_asciil_reverseEquals_WithLength( pData->buffer, literal,
963  if (b && rest != 0) {
965  }
966  return b;
967  }
968 
989  bool startsWithIgnoreAsciiCase(OUString const & str, OUString * rest = 0)
990  const
991  {
992  bool b = matchIgnoreAsciiCase(str, 0);
993  if (b && rest != 0) {
994  *rest = copy(str.getLength());
995  }
996  return b;
997  }
998 
1004  template< typename T >
1006  startsWithIgnoreAsciiCase(T & literal, OUString * rest = 0) const
1007  {
1008  assert( strlen( literal ) == libreoffice_internal::ConstCharArrayDetector< T >::size - 1 );
1010  pData->buffer,
1013  == 0);
1014  if (b && rest != 0) {
1016  }
1017  return b;
1018  }
1019 
1034  bool endsWith(OUString const & str, OUString * rest = 0) const {
1035  bool b = str.getLength() <= getLength()
1036  && match(str, getLength() - str.getLength());
1037  if (b && rest != 0) {
1038  *rest = copy(0, getLength() - str.getLength());
1039  }
1040  return b;
1041  }
1042 
1048  template< typename T >
1050  endsWith(T & literal, OUString * rest = 0) const
1051  {
1052  assert( strlen( literal ) == libreoffice_internal::ConstCharArrayDetector< T >::size - 1 );
1055  pData->buffer + pData->length - ( libreoffice_internal::ConstCharArrayDetector< T, void >::size - 1 ), literal,
1057  if (b && rest != 0) {
1058  *rest = copy(
1059  0,
1060  (getLength()
1062  }
1063  return b;
1064  }
1065 
1077  inline bool endsWithAsciiL(char const * asciiStr, sal_Int32 asciiStrLength)
1078  const
1079  {
1080  return asciiStrLength <= pData->length
1082  pData->buffer + pData->length - asciiStrLength, asciiStr,
1083  asciiStrLength);
1084  }
1085 
1106  bool endsWithIgnoreAsciiCase(OUString const & str, OUString * rest = 0) const
1107  {
1108  bool b = str.getLength() <= getLength()
1109  && matchIgnoreAsciiCase(str, getLength() - str.getLength());
1110  if (b && rest != 0) {
1111  *rest = copy(0, getLength() - str.getLength());
1112  }
1113  return b;
1114  }
1115 
1121  template< typename T >
1123  endsWithIgnoreAsciiCase(T & literal, OUString * rest = 0) const
1124  {
1125  assert( strlen( literal ) == libreoffice_internal::ConstCharArrayDetector< T >::size - 1 );
1128  pData->buffer + pData->length - ( libreoffice_internal::ConstCharArrayDetector< T, void >::size - 1 ),
1131  == 0);
1132  if (b && rest != 0) {
1133  *rest = copy(
1134  0,
1135  (getLength()
1137  }
1138  return b;
1139  }
1140 
1152  char const * asciiStr, sal_Int32 asciiStrLength) const
1153  {
1154  return asciiStrLength <= pData->length
1156  pData->buffer + pData->length - asciiStrLength,
1157  asciiStrLength, asciiStr, asciiStrLength)
1158  == 0);
1159  }
1160 
1161  friend bool operator == ( const OUString& rStr1, const OUString& rStr2 )
1162  { return rStr1.equals(rStr2); }
1163  friend bool operator == ( const OUString& rStr1, const sal_Unicode * pStr2 )
1164  { return rStr1.compareTo( pStr2 ) == 0; }
1165  friend bool operator == ( const sal_Unicode * pStr1, const OUString& rStr2 )
1166  { return OUString( pStr1 ).compareTo( rStr2 ) == 0; }
1167 
1168  friend bool operator != ( const OUString& rStr1, const OUString& rStr2 )
1169  { return !(operator == ( rStr1, rStr2 )); }
1170  friend bool operator != ( const OUString& rStr1, const sal_Unicode * pStr2 )
1171  { return !(operator == ( rStr1, pStr2 )); }
1172  friend bool operator != ( const sal_Unicode * pStr1, const OUString& rStr2 )
1173  { return !(operator == ( pStr1, rStr2 )); }
1174 
1175  friend bool operator < ( const OUString& rStr1, const OUString& rStr2 )
1176  { return rStr1.compareTo( rStr2 ) < 0; }
1177  friend bool operator > ( const OUString& rStr1, const OUString& rStr2 )
1178  { return rStr1.compareTo( rStr2 ) > 0; }
1179  friend bool operator <= ( const OUString& rStr1, const OUString& rStr2 )
1180  { return rStr1.compareTo( rStr2 ) <= 0; }
1181  friend bool operator >= ( const OUString& rStr1, const OUString& rStr2 )
1182  { return rStr1.compareTo( rStr2 ) >= 0; }
1183 
1191  template< typename T >
1192  friend inline typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type operator==( const OUString& string, T& literal )
1193  {
1194  assert( strlen( literal ) == libreoffice_internal::ConstCharArrayDetector< T >::size - 1 );
1195  return string.equalsAsciiL( literal, libreoffice_internal::ConstCharArrayDetector< T, void >::size - 1 );
1196  }
1204  template< typename T >
1205  friend inline typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type operator==( T& literal, const OUString& string )
1206  {
1207  assert( strlen( literal ) == libreoffice_internal::ConstCharArrayDetector< T >::size - 1 );
1208  return string.equalsAsciiL( literal, libreoffice_internal::ConstCharArrayDetector< T, void >::size - 1 );
1209  }
1217  template< typename T >
1218  friend inline typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type operator!=( const OUString& string, T& literal )
1219  {
1220  assert( strlen( literal ) == libreoffice_internal::ConstCharArrayDetector< T >::size - 1 );
1221  return !string.equalsAsciiL( literal, libreoffice_internal::ConstCharArrayDetector< T, void >::size - 1 );
1222  }
1230  template< typename T >
1231  friend inline typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type operator!=( T& literal, const OUString& string )
1232  {
1233  assert( strlen( literal ) == libreoffice_internal::ConstCharArrayDetector< T >::size - 1 );
1234  return !string.equalsAsciiL( literal, libreoffice_internal::ConstCharArrayDetector< T, void >::size - 1 );
1235  }
1236 
1244  sal_Int32 hashCode() const
1245  {
1246  return rtl_ustr_hashCode_WithLength( pData->buffer, pData->length );
1247  }
1248 
1262  sal_Int32 indexOf( sal_Unicode ch, sal_Int32 fromIndex = 0 ) const
1263  {
1264  sal_Int32 ret = rtl_ustr_indexOfChar_WithLength( pData->buffer+fromIndex, pData->length-fromIndex, ch );
1265  return (ret < 0 ? ret : ret+fromIndex);
1266  }
1267 
1277  sal_Int32 lastIndexOf( sal_Unicode ch ) const
1278  {
1279  return rtl_ustr_lastIndexOfChar_WithLength( pData->buffer, pData->length, ch );
1280  }
1281 
1294  sal_Int32 lastIndexOf( sal_Unicode ch, sal_Int32 fromIndex ) const
1295  {
1296  return rtl_ustr_lastIndexOfChar_WithLength( pData->buffer, fromIndex, ch );
1297  }
1298 
1314  sal_Int32 indexOf( const OUString & str, sal_Int32 fromIndex = 0 ) const
1315  {
1316  sal_Int32 ret = rtl_ustr_indexOfStr_WithLength( pData->buffer+fromIndex, pData->length-fromIndex,
1317  str.pData->buffer, str.pData->length );
1318  return (ret < 0 ? ret : ret+fromIndex);
1319  }
1320 
1326  template< typename T >
1327  typename libreoffice_internal::ConstCharArrayDetector< T, sal_Int32 >::Type indexOf( T& literal, sal_Int32 fromIndex = 0 ) const
1328  {
1329  assert( strlen( literal ) == libreoffice_internal::ConstCharArrayDetector< T >::size - 1 );
1330  sal_Int32 ret = rtl_ustr_indexOfAscii_WithLength(
1331  pData->buffer + fromIndex, pData->length - fromIndex, literal,
1333  return ret < 0 ? ret : ret + fromIndex;
1334  }
1335 
1359  sal_Int32 indexOfAsciiL(
1360  char const * str, sal_Int32 len, sal_Int32 fromIndex = 0) const
1361  {
1362  sal_Int32 ret = rtl_ustr_indexOfAscii_WithLength(
1363  pData->buffer + fromIndex, pData->length - fromIndex, str, len);
1364  return ret < 0 ? ret : ret + fromIndex;
1365  }
1366 
1367  // This overload is left undefined, to detect calls of indexOfAsciiL that
1368  // erroneously use RTL_CONSTASCII_USTRINGPARAM instead of
1369  // RTL_CONSTASCII_STRINGPARAM (but would lead to ambiguities on 32 bit
1370  // platforms):
1371 #if SAL_TYPES_SIZEOFLONG == 8
1372  void indexOfAsciiL(char const *, sal_Int32 len, rtl_TextEncoding) const;
1373 #endif
1374 
1390  sal_Int32 lastIndexOf( const OUString & str ) const
1391  {
1392  return rtl_ustr_lastIndexOfStr_WithLength( pData->buffer, pData->length,
1393  str.pData->buffer, str.pData->length );
1394  }
1395 
1413  sal_Int32 lastIndexOf( const OUString & str, sal_Int32 fromIndex ) const
1414  {
1415  return rtl_ustr_lastIndexOfStr_WithLength( pData->buffer, fromIndex,
1416  str.pData->buffer, str.pData->length );
1417  }
1418 
1424  template< typename T >
1426  {
1427  assert( strlen( literal ) == libreoffice_internal::ConstCharArrayDetector< T >::size - 1 );
1429  pData->buffer, pData->length, literal, libreoffice_internal::ConstCharArrayDetector< T, void >::size - 1);
1430  }
1431 
1451  sal_Int32 lastIndexOfAsciiL(char const * str, sal_Int32 len) const
1452  {
1454  pData->buffer, pData->length, str, len);
1455  }
1456 
1467  SAL_WARN_UNUSED_RESULT OUString copy( sal_Int32 beginIndex ) const
1468  {
1469  rtl_uString *pNew = 0;
1470  rtl_uString_newFromSubString( &pNew, pData, beginIndex, getLength() - beginIndex );
1471  return OUString( pNew, SAL_NO_ACQUIRE );
1472  }
1473 
1486  SAL_WARN_UNUSED_RESULT OUString copy( sal_Int32 beginIndex, sal_Int32 count ) const
1487  {
1488  rtl_uString *pNew = 0;
1489  rtl_uString_newFromSubString( &pNew, pData, beginIndex, count );
1490  return OUString( pNew, SAL_NO_ACQUIRE );
1491  }
1492 
1502  {
1503  rtl_uString* pNew = 0;
1504  rtl_uString_newConcat( &pNew, pData, str.pData );
1505  return OUString( pNew, SAL_NO_ACQUIRE );
1506  }
1507 
1508 #ifndef RTL_FAST_STRING
1509  friend OUString operator+( const OUString& rStr1, const OUString& rStr2 )
1510  {
1511  return rStr1.concat( rStr2 );
1512  }
1513 #endif
1514 
1528  SAL_WARN_UNUSED_RESULT OUString replaceAt( sal_Int32 index, sal_Int32 count, const OUString& newStr ) const
1529  {
1530  rtl_uString* pNew = 0;
1531  rtl_uString_newReplaceStrAt( &pNew, pData, index, count, newStr.pData );
1532  return OUString( pNew, SAL_NO_ACQUIRE );
1533  }
1534 
1549  {
1550  rtl_uString* pNew = 0;
1551  rtl_uString_newReplace( &pNew, pData, oldChar, newChar );
1552  return OUString( pNew, SAL_NO_ACQUIRE );
1553  }
1554 
1574  OUString const & from, OUString const & to, sal_Int32 * index = 0) const
1575  {
1576  rtl_uString * s = 0;
1577  sal_Int32 i = 0;
1579  &s, pData, from.pData, to.pData, index == 0 ? &i : index);
1580  return OUString(s, SAL_NO_ACQUIRE);
1581  }
1582 
1601  template< typename T >
1603  sal_Int32 * index = 0) const
1604  {
1605  rtl_uString * s = 0;
1606  sal_Int32 i = 0;
1607  assert( strlen( from ) == libreoffice_internal::ConstCharArrayDetector< T >::size - 1 );
1609  &s, pData, from, libreoffice_internal::ConstCharArrayDetector< T, void >::size - 1, to.pData, index == 0 ? &i : index);
1610  return OUString(s, SAL_NO_ACQUIRE);
1611  }
1612 
1631  template< typename T1, typename T2 >
1633  replaceFirst( T1& from, T2& to, sal_Int32 * index = 0) const
1634  {
1635  rtl_uString * s = 0;
1636  sal_Int32 i = 0;
1637  assert( strlen( from ) == libreoffice_internal::ConstCharArrayDetector< T1 >::size - 1 );
1638  assert( strlen( to ) == libreoffice_internal::ConstCharArrayDetector< T2 >::size - 1 );
1642  return OUString(s, SAL_NO_ACQUIRE);
1643  }
1644 
1661  OUString const & from, OUString const & to, sal_Int32 fromIndex = 0) const
1662  {
1663  rtl_uString * s = 0;
1664  rtl_uString_newReplaceAllFromIndex(&s, pData, from.pData, to.pData, fromIndex);
1665  return OUString(s, SAL_NO_ACQUIRE);
1666  }
1667 
1681  template< typename T >
1683  {
1684  rtl_uString * s = 0;
1685  assert( strlen( from ) == libreoffice_internal::ConstCharArrayDetector< T >::size - 1 );
1687  return OUString(s, SAL_NO_ACQUIRE);
1688  }
1689 
1703  template< typename T1, typename T2 >
1705  replaceAll( T1& from, T2& to ) const
1706  {
1707  rtl_uString * s = 0;
1708  assert( strlen( from ) == libreoffice_internal::ConstCharArrayDetector< T1 >::size - 1 );
1709  assert( strlen( to ) == libreoffice_internal::ConstCharArrayDetector< T2 >::size - 1 );
1713  return OUString(s, SAL_NO_ACQUIRE);
1714  }
1715 
1727  {
1728  rtl_uString* pNew = 0;
1729  rtl_uString_newToAsciiLowerCase( &pNew, pData );
1730  return OUString( pNew, SAL_NO_ACQUIRE );
1731  }
1732 
1744  {
1745  rtl_uString* pNew = 0;
1746  rtl_uString_newToAsciiUpperCase( &pNew, pData );
1747  return OUString( pNew, SAL_NO_ACQUIRE );
1748  }
1749 
1762  {
1763  rtl_uString* pNew = 0;
1764  rtl_uString_newTrim( &pNew, pData );
1765  return OUString( pNew, SAL_NO_ACQUIRE );
1766  }
1767 
1792  OUString getToken( sal_Int32 token, sal_Unicode cTok, sal_Int32& index ) const
1793  {
1794  rtl_uString * pNew = 0;
1795  index = rtl_uString_getToken( &pNew, pData, token, cTok, index );
1796  return OUString( pNew, SAL_NO_ACQUIRE );
1797  }
1798 
1812  OUString getToken(sal_Int32 count, sal_Unicode separator) const {
1813  sal_Int32 n = 0;
1814  return getToken(count, separator, n);
1815  }
1816 
1825  bool toBoolean() const
1826  {
1827  return rtl_ustr_toBoolean( pData->buffer );
1828  }
1829 
1837  {
1838  return pData->buffer[0];
1839  }
1840 
1851  sal_Int32 toInt32( sal_Int16 radix = 10 ) const
1852  {
1853  return rtl_ustr_toInt32( pData->buffer, radix );
1854  }
1855 
1868  sal_uInt32 toUInt32( sal_Int16 radix = 10 ) const
1869  {
1870  return rtl_ustr_toUInt32( pData->buffer, radix );
1871  }
1872 
1883  sal_Int64 toInt64( sal_Int16 radix = 10 ) const
1884  {
1885  return rtl_ustr_toInt64( pData->buffer, radix );
1886  }
1887 
1900  sal_uInt64 toUInt64( sal_Int16 radix = 10 ) const
1901  {
1902  return rtl_ustr_toUInt64( pData->buffer, radix );
1903  }
1904 
1913  float toFloat() const
1914  {
1915  return rtl_ustr_toFloat( pData->buffer );
1916  }
1917 
1926  double toDouble() const
1927  {
1928  return rtl_ustr_toDouble( pData->buffer );
1929  }
1930 
1931 
1948  {
1949  rtl_uString * pNew = 0;
1950  rtl_uString_intern( &pNew, pData );
1951  if (pNew == 0) {
1952  throw std::bad_alloc();
1953  }
1954  return OUString( pNew, SAL_NO_ACQUIRE );
1955  }
1956 
1982  static OUString intern( const sal_Char * value, sal_Int32 length,
1983  rtl_TextEncoding encoding,
1984  sal_uInt32 convertFlags = OSTRING_TO_OUSTRING_CVTFLAGS,
1985  sal_uInt32 *pInfo = NULL )
1986  {
1987  rtl_uString * pNew = 0;
1988  rtl_uString_internConvert( &pNew, value, length, encoding,
1989  convertFlags, pInfo );
1990  if (pNew == 0) {
1991  throw std::bad_alloc();
1992  }
1993  return OUString( pNew, SAL_NO_ACQUIRE );
1994  }
1995 
2020  inline bool convertToString(OString * pTarget, rtl_TextEncoding nEncoding,
2021  sal_uInt32 nFlags) const
2022  {
2023  return rtl_convertUStringToString(&pTarget->pData, pData->buffer,
2024  pData->length, nEncoding, nFlags);
2025  }
2026 
2078  inline sal_uInt32 iterateCodePoints(
2079  sal_Int32 * indexUtf16, sal_Int32 incrementCodePoints = 1) const
2080  {
2082  pData, indexUtf16, incrementCodePoints);
2083  }
2084 
2094  static inline OUString fromUtf8(const OString& rSource)
2095  {
2096  OUString aTarget;
2097  bool bSuccess = rtl_convertStringToUString(&aTarget.pData,
2098  rSource.getStr(),
2099  rSource.getLength(),
2102  (void) bSuccess;
2103  assert(bSuccess);
2104  return aTarget;
2105  }
2106 
2117  inline OString toUtf8() const
2118  {
2119  OString aTarget;
2120  bool bSuccess = rtl_convertUStringToString(&aTarget.pData,
2121  getStr(),
2122  getLength(),
2125  (void) bSuccess;
2126  assert(bSuccess);
2127  return aTarget;
2128  }
2129 
2140  static OUString number( int i, sal_Int16 radix = 10 )
2141  {
2143  rtl_uString* pNewData = 0;
2144  rtl_uString_newFromStr_WithLength( &pNewData, aBuf, rtl_ustr_valueOfInt32( aBuf, i, radix ) );
2145  return OUString( pNewData, SAL_NO_ACQUIRE );
2146  }
2149  static OUString number( unsigned int i, sal_Int16 radix = 10 )
2150  {
2151  return number( static_cast< unsigned long long >( i ), radix );
2152  }
2155  static OUString number( long i, sal_Int16 radix = 10)
2156  {
2157  return number( static_cast< long long >( i ), radix );
2158  }
2161  static OUString number( unsigned long i, sal_Int16 radix = 10 )
2162  {
2163  return number( static_cast< unsigned long long >( i ), radix );
2164  }
2167  static OUString number( long long ll, sal_Int16 radix = 10 )
2168  {
2170  rtl_uString* pNewData = 0;
2171  rtl_uString_newFromStr_WithLength( &pNewData, aBuf, rtl_ustr_valueOfInt64( aBuf, ll, radix ) );
2172  return OUString( pNewData, SAL_NO_ACQUIRE );
2173  }
2176  static OUString number( unsigned long long ll, sal_Int16 radix = 10 )
2177  {
2179  rtl_uString* pNewData = 0;
2180  rtl_uString_newFromStr_WithLength( &pNewData, aBuf, rtl_ustr_valueOfUInt64( aBuf, ll, radix ) );
2181  return OUString( pNewData, SAL_NO_ACQUIRE );
2182  }
2183 
2193  static OUString number( float f )
2194  {
2196  rtl_uString* pNewData = 0;
2197  rtl_uString_newFromStr_WithLength( &pNewData, aBuf, rtl_ustr_valueOfFloat( aBuf, f ) );
2198  return OUString( pNewData, SAL_NO_ACQUIRE );
2199  }
2200 
2210  static OUString number( double d )
2211  {
2213  rtl_uString* pNewData = 0;
2214  rtl_uString_newFromStr_WithLength( &pNewData, aBuf, rtl_ustr_valueOfDouble( aBuf, d ) );
2215  return OUString( pNewData, SAL_NO_ACQUIRE );
2216  }
2217 
2229  SAL_DEPRECATED("use boolean()") static OUString valueOf( sal_Bool b )
2230  {
2231  return boolean(b);
2232  }
2233 
2245  static OUString boolean( bool b )
2246  {
2248  rtl_uString* pNewData = 0;
2249  rtl_uString_newFromStr_WithLength( &pNewData, aBuf, rtl_ustr_valueOfBoolean( aBuf, b ) );
2250  return OUString( pNewData, SAL_NO_ACQUIRE );
2251  }
2252 
2260  SAL_DEPRECATED("convert to OUString or use directly") static OUString valueOf( sal_Unicode c )
2261  {
2262  return OUString( &c, 1 );
2263  }
2264 
2275  SAL_DEPRECATED("use number()") static OUString valueOf( sal_Int32 i, sal_Int16 radix = 10 )
2276  {
2277  return number( i, radix );
2278  }
2279 
2290  SAL_DEPRECATED("use number()") static OUString valueOf( sal_Int64 ll, sal_Int16 radix = 10 )
2291  {
2292  return number( ll, radix );
2293  }
2294 
2304  SAL_DEPRECATED("use number()") static OUString valueOf( float f )
2305  {
2306  return number(f);
2307  }
2308 
2318  SAL_DEPRECATED("use number()") static OUString valueOf( double d )
2319  {
2320  return number(d);
2321  }
2322 
2338  static OUString createFromAscii( const sal_Char * value )
2339  {
2340  rtl_uString* pNew = 0;
2341  rtl_uString_newFromAscii( &pNew, value );
2342  return OUString( pNew, SAL_NO_ACQUIRE );
2343  }
2344 };
2345 
2346 /* ======================================================================= */
2347 
2348 #ifdef RTL_FAST_STRING
2349 
2357 struct SAL_WARN_UNUSED OUStringLiteral
2358 {
2359  template< int N >
2360  OUStringLiteral( const char (&str)[ N ] ) : size( N - 1 ), data( str ) { assert( strlen( str ) == N - 1 ); }
2361  int size;
2362  const char* data;
2363 };
2364 
2368 template<>
2369 struct ToStringHelper< OUString >
2370  {
2371  static int length( const OUString& s ) { return s.getLength(); }
2372  static sal_Unicode* addData( sal_Unicode* buffer, const OUString& s ) { return addDataHelper( buffer, s.getStr(), s.getLength()); }
2373  static const bool allowOStringConcat = false;
2374  static const bool allowOUStringConcat = true;
2375  };
2376 
2380 template<>
2381 struct ToStringHelper< OUStringLiteral >
2382  {
2383  static int length( const OUStringLiteral& str ) { return str.size; }
2384  static sal_Unicode* addData( sal_Unicode* buffer, const OUStringLiteral& str ) { return addDataLiteral( buffer, str.data, str.size ); }
2385  static const bool allowOStringConcat = false;
2386  static const bool allowOUStringConcat = true;
2387  };
2388 
2392 template< typename charT, typename traits, typename T1, typename T2 >
2393 inline std::basic_ostream<charT, traits> & operator <<(
2394  std::basic_ostream<charT, traits> & stream, const OUStringConcat< T1, T2 >& concat)
2395 {
2396  return stream << OUString( concat );
2397 }
2398 #else
2399 // non-RTL_FAST_STRING needs this to compile
2401 typedef OUString OUStringLiteral;
2403 #endif
2404 
2411 {
2421  size_t operator()(const OUString& rString) const
2422  { return (size_t)rString.hashCode(); }
2423 };
2424 
2425 /* ======================================================================= */
2426 
2444 inline OUString OStringToOUString( const OString & rStr,
2445  rtl_TextEncoding encoding,
2446  sal_uInt32 convertFlags = OSTRING_TO_OUSTRING_CVTFLAGS )
2447 {
2448  return OUString( rStr.getStr(), rStr.getLength(), encoding, convertFlags );
2449 }
2450 
2468 inline OString OUStringToOString( const OUString & rUnicode,
2469  rtl_TextEncoding encoding,
2470  sal_uInt32 convertFlags = OUSTRING_TO_OSTRING_CVTFLAGS )
2471 {
2472  return OString( rUnicode.getStr(), rUnicode.getLength(), encoding, convertFlags );
2473 }
2474 
2475 /* ======================================================================= */
2476 
2485 template< typename charT, typename traits >
2486 inline std::basic_ostream<charT, traits> & operator <<(
2487  std::basic_ostream<charT, traits> & stream, OUString const & string)
2488 {
2489  return stream <<
2491  // best effort; potentially loses data due to conversion failures
2492  // (stray surrogate halves) and embedded null characters
2493 }
2494 
2495 } // namespace
2496 
2497 #ifdef RTL_STRING_UNITTEST
2498 namespace rtl
2499 {
2500 typedef rtlunittest::OUString OUString;
2501 }
2502 #endif
2503 
2504 // RTL_USING is defined by gbuild for all modules except those with stable public API
2505 // (as listed in ure/source/README). It allows to use classes like OUString without
2506 // having to explicitly refer to the rtl namespace, which is kind of superfluous
2507 // given that OUString itself is namespaced by its OU prefix.
2508 #ifdef RTL_USING
2509 using ::rtl::OUString;
2510 using ::rtl::OUStringHash;
2513 using ::rtl::OUStringLiteral;
2514 #endif
2515 
2516 #endif /* _RTL_USTRING_HXX */
2517 
2518 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static OUString boolean(bool b)
Returns the string representation of the boolean argument.
Definition: ustring.hxx:2245
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:1359
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:1982
OUString()
New string containing no characters.
Definition: ustring.hxx:91
#define RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR
Definition: textcvt.h:128
definition of a no acquire enum for ctors
Definition: types.h:372
SAL_DLLPUBLIC double rtl_ustr_toDouble(const sal_Unicode *str) SAL_THROW_EXTERN_C()
Interpret a string as a double.
double toDouble() const
Returns the double value from this string.
Definition: ustring.hxx:1926
unsigned char sal_Bool
Definition: types.h:48
sal_Int32 toInt32(sal_Int16 radix=10) const
Returns the int32 value from this string.
Definition: ustring.hxx:1851
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_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:1573
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.
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.
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:496
const sal_Unicode * getStr() const
Returns a pointer to the Unicode character buffer for this string.
Definition: ustring.hxx:416
void clear()
Clears the string, i.e, makes a zero-character string.
Definition: ustring.hxx:381
bool equalsIgnoreAsciiCaseAscii(const sal_Char *asciiStr) const
Perform a ASCII lowercase comparison of two strings.
Definition: ustring.hxx:798
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_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 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.
#define RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR
Definition: textcvt.h:134
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_Int32 getLength() const
Returns the length of this string.
Definition: ustring.hxx:394
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:913
OUString & operator=(const OUString &str)
Assign a new string.
Definition: ustring.hxx:318
OUString intern() const
Return a canonical representation for a string.
Definition: ustring.hxx:1947
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:2444
static OUString const & unacquired(rtl_uString *const *ppHandle)
Provides an OUString const & passing a storage pointer of an rtl_uString * handle.
Definition: ustring.hxx:310
sal_uInt64 toUInt64(sal_Int16 radix=10) const
Returns the uint64 value from this string.
Definition: ustring.hxx:1900
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.
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:2167
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_newFromAscii(rtl_uString **newStr, const sal_Char *value) SAL_THROW_EXTERN_C()
Allocate a new string that contains a copy of a character array.
#define RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR
Definition: textcvt.h:68
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_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.
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.
friend libreoffice_internal::ConstCharArrayDetector< T, bool >::Type operator==(const OUString &string, T &literal)
Compare string to an ASCII string literal.
Definition: ustring.hxx:1192
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...
OUString(sal_Unicode value)
New string from a single Unicode character.
Definition: ustring.hxx:135
#define OUSTRING_TO_OSTRING_CVTFLAGS
Definition: string.h:1324
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:989
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.
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...
Definition: stringutils.hxx:68
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:2149
OUString(sal_uInt32 const *codePoints, sal_Int32 codePointCount)
Create a new string from an array of Unicode code points.
Definition: ustring.hxx:261
SAL_DLLPUBLIC sal_Int32 rtl_ustr_valueOfFloat(sal_Unicode *str, float f) SAL_THROW_EXTERN_C()
Create the string representation of a float.
bool endsWith(OUString const &str, OUString *rest=0) const
Check whether this string ends with a given substring.
Definition: ustring.hxx:1034
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:2155
#define RTL_USTR_MAX_VALUEOFFLOAT
Definition: ustring.h:1022
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.
size_t operator()(const OUString &rString) const
Compute a hash code for a string.
Definition: ustring.hxx:2421
bool toBoolean() const
Returns the Boolean value from this string.
Definition: ustring.hxx:1825
SAL_DLLPUBLIC void rtl_uString_acquire(rtl_uString *str) SAL_THROW_EXTERN_C()
Increment the reference count of a string.
__sal_NoAcquire
Definition: types.h:368
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...
OUString getToken(sal_Int32 count, sal_Unicode separator) const
Returns a token from the string.
Definition: ustring.hxx:1812
SAL_WARN_UNUSED_RESULT OUString concat(const OUString &str) const
Concatenates the specified string to the end of this string.
Definition: ustring.hxx:1501
bool equals(const OUString &str) const
Perform a comparison of two strings.
Definition: ustring.hxx:514
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:875
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:1451
SAL_DLLPUBLIC void rtl_uString_new(rtl_uString **newStr) SAL_THROW_EXTERN_C()
Allocate a new string containing no characters.
SAL_DLLPUBLIC sal_Bool rtl_ustr_toBoolean(const sal_Unicode *str) SAL_THROW_EXTERN_C()
Interpret a string as a boolean.
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.
bool convertToString(OString *pTarget, rtl_TextEncoding nEncoding, sal_uInt32 nFlags) const
Converts to an OString, signalling failure.
Definition: ustring.hxx:2020
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.
Definition: bootstrap.hxx:24
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_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...
#define RTL_STR_MAX_VALUEOFINT64
Definition: string.h:650
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.
friend OUString operator+(const OUString &rStr1, const OUString &rStr2)
Definition: ustring.hxx:1509
sal_Int32 compareTo(const OUString &str, sal_Int32 maxLength) const
Compares two strings with a maximum count of characters.
Definition: ustring.hxx:466
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_uInt16 rtl_TextEncoding
The various supported text encodings.
Definition: textenc.h:39
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:1390
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_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.
#define SAL_WARN_UNUSED_RESULT
Use this as markup for functions and methods whose return value must be checked.
Definition: types.h:309
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_WARN_UNUSED_RESULT libreoffice_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:1602
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:2176
char sal_Char
A legacy synonym for char.
Definition: types.h:130
const sal_Char * getStr() const
Returns a pointer to the characters of this string.
Definition: string.hxx:362
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:1294
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_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 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.
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:576
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.
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:1327
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...
static OUString fromUtf8(const OString &rSource)
Convert an OString to an OUString, assuming that the OString is UTF-8-encoded.
Definition: ustring.hxx:2094
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.
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:1738
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:2078
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:1486
bool equalsAsciiL(const sal_Char *asciiStr, sal_Int32 asciiStrLength) const
Perform a comparison of two strings.
Definition: ustring.hxx:771
friend libreoffice_internal::ConstCharArrayDetector< T, bool >::Type operator!=(T &literal, const OUString &string)
Compare string to an ASCII string literal.
Definition: ustring.hxx:1231
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:574
sal_Int32 reverseCompareTo(const OUString &str) const
Compares two strings in reverse order.
Definition: ustring.hxx:484
SAL_DLLPUBLIC void rtl_uString_intern(rtl_uString **newStr, rtl_uString *str) SAL_THROW_EXTERN_C()
Return a canonical representation for a string.
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:1528
bool match(const OUString &str, sal_Int32 fromIndex=0) const
Match against a substring appearing in this string.
Definition: ustring.hxx:600
#define RTL_USTR_MAX_VALUEOFINT32
Definition: ustring.h:957
sal_uInt32 toUInt32(sal_Int16 radix=10) const
Returns the uint32 value from this string.
Definition: ustring.hxx:1868
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:1682
bool isEmpty() const
Checks if a string is empty.
Definition: ustring.hxx:404
OString toUtf8() const
Convert this string to an OString, assuming that the string can be UTF-8-encoded successfully.
Definition: ustring.hxx:2117
OUString(rtl_uString *str)
New string from OUString data.
Definition: ustring.hxx:113
SAL_WARN_UNUSED_RESULT OUString copy(sal_Int32 beginIndex) const
Returns a new string that is a substring of this string.
Definition: ustring.hxx:1467
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:637
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_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.
libreoffice_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:1006
friend libreoffice_internal::ConstCharArrayDetector< T, bool >::Type operator!=(const OUString &string, T &literal)
Compare string to an ASCII string literal.
Definition: ustring.hxx:1218
SAL_DLLPUBLIC sal_Int32 rtl_ustr_valueOfBoolean(sal_Unicode *str, sal_Bool b) SAL_THROW_EXTERN_C()
Create the string representation of a boolean.
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.
OUString getToken(sal_Int32 token, sal_Unicode cTok, sal_Int32 &index) const
Returns a token in the string.
Definition: ustring.hxx:1792
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:1726
bool operator<(const TTimeValue &rTimeA, const TTimeValue &rTimeB)
Definition: timer.hxx:98
libreoffice_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:1050
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.
sal_Int32 compareToAscii(const sal_Char *asciiStr) const
Compares two strings.
Definition: ustring.hxx:673
sal_Unicode toChar() const
Returns the first character from this string.
Definition: ustring.hxx:1836
bool equalsIgnoreAsciiCaseAsciiL(const sal_Char *asciiStr, sal_Int32 asciiStrLength) const
Perform an ASCII lowercase comparison of two strings.
Definition: ustring.hxx:846
static OUString number(float f)
Returns the string representation of the float argument.
Definition: ustring.hxx:2193
#define RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR
Definition: textcvt.h:64
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:1413
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:1262
bool operator==(const TTimeValue &rTimeA, const TTimeValue &rTimeB)
Definition: timer.hxx:118
float toFloat() const
Returns the float value from this string.
Definition: ustring.hxx:1913
SAL_DLLPUBLIC void rtl_uString_assign(rtl_uString **str, rtl_uString *rightValue) SAL_THROW_EXTERN_C()
Assign a new value to a string.
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:1277
sal_Int64 toInt64(sal_Int16 radix=10) const
Returns the int64 value from this string.
Definition: ustring.hxx:1883
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.
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_Int32 compareToIgnoreAsciiCaseAscii(const sal_Char *asciiStr) const
Compares two ASCII strings ignoring case.
Definition: ustring.hxx:821
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:1705
A helper to use OUStrings with hash maps.
Definition: ustring.hxx:2410
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.
libreoffice_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:956
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...
This String class provides base functionality for C++ like Unicode character array handling...
Definition: ustring.hxx:81
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:650
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.
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.
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.
sal_Int32 compareTo(const OUString &str) const
Compares two strings.
Definition: ustring.hxx:445
SAL_DLLPUBLIC sal_Int32 rtl_ustr_valueOfDouble(sal_Unicode *str, double d) SAL_THROW_EXTERN_C()
Create the string representation of a double.
#define RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR
Definition: textcvt.h:71
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.
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:182
libreoffice_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:1123
sal_Int32 getLength() const
Returns the length of this string.
Definition: string.hxx:336
bool startsWith(OUString const &str, OUString *rest=0) const
Check whether this string starts with a given substring.
Definition: ustring.hxx:942
bool endsWithAsciiL(char const *asciiStr, sal_Int32 asciiStrLength) const
Check whether this string ends with a given ASCII string.
Definition: ustring.hxx:1077
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:234
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:612
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.
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:1743
sal_Int32 hashCode() const
Returns a hashcode for this string.
Definition: ustring.hxx:1244
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:1660
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:1761
#define RTL_STR_MAX_VALUEOFUINT64
Definition: string.h:673
OUString(const sal_Unicode *value)
New string from a Unicode character buffer array.
Definition: ustring.hxx:146
sal_Int32 compareToIgnoreAsciiCase(const OUString &str) const
Perform a ASCII lowercase comparison of two strings.
Definition: ustring.hxx:563
static OUString createFromAscii(const sal_Char *value)
Returns a OUString copied without conversion from an ASCII character string.
Definition: ustring.hxx:2338
sal_uInt16 sal_Unicode
Definition: types.h:152
OUString(const OUString &str)
New string from OUString.
Definition: ustring.hxx:102
SAL_DLLPUBLIC float rtl_ustr_toFloat(const sal_Unicode *str) SAL_THROW_EXTERN_C()
Interpret a string as a float.
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:1548
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_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...
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:1106
OUString & operator+=(const OUString &str)
Append a string to this string.
Definition: ustring.hxx:352
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:2161
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.
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:1314
#define OSTRING_TO_OUSTRING_CVTFLAGS
Definition: ustring.h:1817
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:2468
bool equalsAscii(const sal_Char *asciiStr) const
Perform a comparison of two strings.
Definition: ustring.hxx:748
bool operator>(const TTimeValue &rTimeA, const TTimeValue &rTimeB)
Definition: timer.hxx:108
~OUString()
Release the string data.
Definition: ustring.hxx:294
static OUString number(double d)
Returns the string representation of the double argument.
Definition: ustring.hxx:2210
#define RTL_USTR_MAX_VALUEOFDOUBLE
Definition: ustring.h:1041
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.
sal_Int32 reverseCompareToAsciiL(const sal_Char *asciiStr, sal_Int32 asciiStrLength) const
Compares two strings in reverse order.
Definition: ustring.hxx:727
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:1425
bool equalsIgnoreAsciiCase(const OUString &str) const
Perform a ASCII lowercase comparison of two strings.
Definition: ustring.hxx:538
OUString(rtl_uString *str, __sal_NoAcquire)
New OUString from OUString data without acquiring it.
Definition: ustring.hxx:127
friend libreoffice_internal::ConstCharArrayDetector< T, bool >::Type operator==(T &literal, const OUString &string)
Compare string to an ASCII string literal.
Definition: ustring.hxx:1205
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:1151
OUString(const sal_Unicode *value, sal_Int32 length)
New string from a Unicode character buffer array.
Definition: ustring.hxx:160
SAL_DLLPUBLIC void rtl_uString_newFromLiteral(rtl_uString **newStr, const sal_Char *value, sal_Int32 len, sal_Int32 allocExtra) SAL_THROW_EXTERN_C()
#define SAL_WARN_UNUSED
Annotate classes where a compiler should warn if an instance is unused.
Definition: types.h:588
static OUString number(int i, sal_Int16 radix=10)
Returns the string representation of the integer argument.
Definition: ustring.hxx:2140
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.
#define SAL_DEPRECATED(message)
Use as follows: SAL_DEPRECATED("Dont use, its evil.") void doit(int nPara);.
Definition: types.h:475
#define RTL_TEXTENCODING_UTF8
Definition: textenc.h:121
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:337
SAL_WARN_UNUSED_RESULT libreoffice_internal::ConstCharArrayDetector< T1, typename libreoffice_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:1633
This String class provide base functionality for C++ like 8-Bit character array handling.
Definition: string.hxx:88
#define RTL_USTR_MAX_VALUEOFBOOLEAN
Definition: ustring.h:915