My Project
UDK 3.2.7 C/C++ API Reference
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
string.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
3  *
4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5  *
6  * Copyright 2000, 2010 Oracle and/or its affiliates.
7  *
8  * OpenOffice.org - a multi-platform office productivity suite
9  *
10  * This file is part of OpenOffice.org.
11  *
12  * OpenOffice.org is free software: you can redistribute it and/or modify
13  * it under the terms of the GNU Lesser General Public License version 3
14  * only, as published by the Free Software Foundation.
15  *
16  * OpenOffice.org is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Lesser General Public License version 3 for more details
20  * (a copy is included in the LICENSE file that accompanied this code).
21  *
22  * You should have received a copy of the GNU Lesser General Public License
23  * version 3 along with OpenOffice.org. If not, see
24  * <http://www.openoffice.org/license.html>
25  * for a copy of the LGPLv3 License.
26  *
27  ************************************************************************/
28 
29 #ifndef _RTL_STRING_HXX_
30 #define _RTL_STRING_HXX_
31 
32 #include "sal/config.h"
33 
34 #include <cassert>
35 
36 #include <osl/diagnose.h>
37 #include <rtl/memory.h>
38 #include <rtl/textenc.h>
39 #include <rtl/string.h>
40 #include <rtl/stringutils.hxx>
41 
42 #include "sal/log.hxx"
43 
44 #if !defined EXCEPTIONS_OFF
45 #include <new>
46 #endif
47 
48 // The unittest uses slightly different code to help check that the proper
49 // calls are made. The class is put into a different namespace to make
50 // sure the compiler generates a different (if generating also non-inline)
51 // copy of the function and does not merge them together. The class
52 // is "brought" into the proper rtl namespace by a typedef below.
53 #ifdef RTL_STRING_UNITTEST
54 #define rtl rtlunittest
55 #endif
56 
57 namespace rtl
58 {
59 
60 #ifdef RTL_STRING_UNITTEST
61 #undef rtl
62 // helper macro to make functions appear more readable
63 #define RTL_STRING_CONST_FUNCTION rtl_string_unittest_const_literal_function = true;
64 #else
65 #define RTL_STRING_CONST_FUNCTION
66 #endif
67 
68 /* ======================================================================= */
69 
94 class OString
95 {
96 public:
98  rtl_String * pData;
100 
101 private:
102  class DO_NOT_ACQUIRE;
103 
104  OString( rtl_String * value, SAL_UNUSED_PARAMETER DO_NOT_ACQUIRE * )
105  {
106  pData = value;
107  }
108 
109 public:
114  {
115  pData = 0;
116  rtl_string_new( &pData );
117  }
118 
124  OString( const OString & str ) SAL_THROW(())
125  {
126  pData = str.pData;
127  rtl_string_acquire( pData );
128  }
129 
135  OString( rtl_String * str ) SAL_THROW(())
136  {
137  pData = str;
138  rtl_string_acquire( pData );
139  }
140 
148  inline OString( rtl_String * str, __sal_NoAcquire ) SAL_THROW(())
149  {
150  pData = str;
151  }
152 
158  explicit OString( sal_Char value ) SAL_THROW(())
159  : pData (0)
160  {
161  rtl_string_newFromStr_WithLength( &pData, &value, 1 );
162  }
163 
172 #ifdef HAVE_SFINAE_ANONYMOUS_BROKEN
173  // Old gcc can try to convert anonymous enums to OString and give compile error.
174  // So there's no special-cased handling of string literals.
175  // These are inline functions and technically both variants should work
176  // the same in practice, so there should be no compatibility problem.
177  OString( const sal_Char * value ) SAL_THROW(())
178  {
179  pData = 0;
180  rtl_string_newFromStr( &pData, value );
181  }
182 #else
183  template< typename T >
185  {
186  pData = 0;
187  rtl_string_newFromStr( &pData, value );
188  }
189 
190  template< typename T >
192  {
193  pData = 0;
194  rtl_string_newFromStr( &pData, value );
195  }
196 
207  template< typename T >
209  {
210  pData = 0;
212 #ifdef RTL_STRING_UNITTEST
213  rtl_string_unittest_const_literal = true;
214 #endif
215  }
216 
217 #endif // HAVE_SFINAE_ANONYMOUS_BROKEN
218 
227  OString( const sal_Char * value, sal_Int32 length ) SAL_THROW(())
228  {
229  pData = 0;
230  rtl_string_newFromStr_WithLength( &pData, value, length );
231  }
232 
247  OString( const sal_Unicode * value, sal_Int32 length,
248  rtl_TextEncoding encoding,
249  sal_uInt32 convertFlags = OUSTRING_TO_OSTRING_CVTFLAGS )
250  {
251  pData = 0;
252  rtl_uString2String( &pData, value, length, encoding, convertFlags );
253  if (pData == 0) {
254 #if defined EXCEPTIONS_OFF
255  abort();
256 #else
257  throw std::bad_alloc();
258 #endif
259  }
260  }
261 
266  {
267  rtl_string_release( pData );
268  }
269 
275  OString & operator=( const OString & str ) SAL_THROW(())
276  {
277  rtl_string_assign( &pData, str.pData );
278  return *this;
279  }
280 
286  template< typename T >
288  {
291  return *this;
292  }
293 
299  OString & operator+=( const OString & str ) SAL_THROW(())
300  {
301  rtl_string_newConcat( &pData, pData, str.pData );
302  return *this;
303  }
304 
313  sal_Int32 getLength() const SAL_THROW(()) { return pData->length; }
314 
324  {
325  if ( pData->length )
326  return sal_False;
327  else
328  return sal_True;
329  }
330 
342  const sal_Char * getStr() const SAL_THROW(()) { return pData->buffer; }
343 
353  sal_Char operator [](sal_Int32 index) const { return getStr()[index]; }
354 
367  sal_Int32 compareTo( const OString & str ) const SAL_THROW(())
368  {
369  return rtl_str_compare_WithLength( pData->buffer, pData->length,
370  str.pData->buffer, str.pData->length );
371  }
372 
386  sal_Int32 compareTo( const OString & rObj, sal_Int32 maxLength ) const SAL_THROW(())
387  {
388  return rtl_str_shortenedCompare_WithLength( pData->buffer, pData->length,
389  rObj.pData->buffer, rObj.pData->length, maxLength );
390  }
391 
404  sal_Int32 reverseCompareTo( const OString & str ) const SAL_THROW(())
405  {
406  return rtl_str_reverseCompare_WithLength( pData->buffer, pData->length,
407  str.pData->buffer, str.pData->length );
408  }
409 
421  sal_Bool equals( const OString & str ) const SAL_THROW(())
422  {
423  if ( pData->length != str.pData->length )
424  return sal_False;
425  if ( pData == str.pData )
426  return sal_True;
427  return rtl_str_reverseCompare_WithLength( pData->buffer, pData->length,
428  str.pData->buffer, str.pData->length ) == 0;
429  }
430 
446  sal_Bool equalsL( const sal_Char* value, sal_Int32 length ) const SAL_THROW(())
447  {
448  if ( pData->length != length )
449  return sal_False;
450 
451  return rtl_str_reverseCompare_WithLength( pData->buffer, pData->length,
452  value, length ) == 0;
453  }
454 
470  {
471  if ( pData->length != str.pData->length )
472  return sal_False;
473  if ( pData == str.pData )
474  return sal_True;
475  return rtl_str_compareIgnoreAsciiCase_WithLength( pData->buffer, pData->length,
476  str.pData->buffer, str.pData->length ) == 0;
477  }
478 
500 #ifdef HAVE_SFINAE_ANONYMOUS_BROKEN
501  sal_Bool equalsIgnoreAsciiCase( const sal_Char * asciiStr ) const SAL_THROW(())
502  {
503  return rtl_str_compareIgnoreAsciiCase( pData->buffer, asciiStr ) == 0;
504  }
505 #else
506  template< typename T >
508  {
509  return rtl_str_compareIgnoreAsciiCase( pData->buffer, asciiStr ) == 0;
510  }
511 
512  template< typename T >
514  {
515  return rtl_str_compareIgnoreAsciiCase( pData->buffer, asciiStr ) == 0;
516  }
517 
523  template< typename T >
525  {
527  if ( pData->length != internal::ConstCharArrayDetector< T, void >::size - 1 )
528  return false;
529  return rtl_str_compareIgnoreAsciiCase_WithLength( pData->buffer, pData->length,
531  }
532 #endif
533 
553  sal_Bool equalsIgnoreAsciiCaseL( const sal_Char * asciiStr, sal_Int32 asciiStrLength ) const SAL_THROW(())
554  {
555  if ( pData->length != asciiStrLength )
556  return sal_False;
557 
558  return rtl_str_compareIgnoreAsciiCase_WithLength( pData->buffer, pData->length,
559  asciiStr, asciiStrLength ) == 0;
560  }
561 
577  sal_Bool match( const OString & str, sal_Int32 fromIndex = 0 ) const SAL_THROW(())
578  {
579  return rtl_str_shortenedCompare_WithLength( pData->buffer+fromIndex, pData->length-fromIndex,
580  str.pData->buffer, str.pData->length, str.pData->length ) == 0;
581  }
582 
588  template< typename T >
589  typename internal::ConstCharArrayDetector< T, bool >::Type match( T& literal, sal_Int32 fromIndex = 0 ) const SAL_THROW(())
590  {
593  pData->buffer + fromIndex, pData->length - fromIndex,
595  }
596 
613  bool matchL(
614  char const * str, sal_Int32 strLength, sal_Int32 fromIndex = 0)
615  const
616  {
618  pData->buffer + fromIndex, pData->length - fromIndex,
619  str, strLength, strLength) == 0;
620  }
621 
622  // This overload is left undefined, to detect calls of matchL that
623  // erroneously use RTL_CONSTASCII_USTRINGPARAM instead of
624  // RTL_CONSTASCII_STRINGPARAM (but would lead to ambiguities on 32 bit
625  // platforms):
626 #if SAL_TYPES_SIZEOFLONG == 8
627  void matchL(char const *, sal_Int32, rtl_TextEncoding) const;
628 #endif
629 
648  sal_Bool matchIgnoreAsciiCase( const OString & str, sal_Int32 fromIndex = 0 ) const SAL_THROW(())
649  {
650  return rtl_str_shortenedCompareIgnoreAsciiCase_WithLength( pData->buffer+fromIndex, pData->length-fromIndex,
651  str.pData->buffer, str.pData->length,
652  str.pData->length ) == 0;
653  }
654 
660  template< typename T >
661  typename internal::ConstCharArrayDetector< T, bool >::Type matchIgnoreAsciiCase( T& literal, sal_Int32 fromIndex = 0 ) const
662  {
664  return rtl_str_shortenedCompareIgnoreAsciiCase_WithLength( pData->buffer+fromIndex, pData->length-fromIndex,
666  }
667 
678  bool endsWith(OString const & str) const {
679  return str.getLength() <= getLength()
680  && match(str, getLength() - str.getLength());
681  }
682 
688  template< typename T >
690  {
693  && match(literal, getLength() - ( internal::ConstCharArrayDetector< T, void >::size - 1 ));
694  }
695 
709  bool endsWithL(char const * str, sal_Int32 strLength) const {
710  return strLength <= getLength()
711  && matchL(str, strLength, getLength() - strLength);
712  }
713 
714  friend sal_Bool operator == ( const OString& rStr1, const OString& rStr2 ) SAL_THROW(())
715  { return rStr1.equals(rStr2); }
716  friend sal_Bool operator != ( const OString& rStr1, const OString& rStr2 ) SAL_THROW(())
717  { return !(operator == ( rStr1, rStr2 )); }
718  friend sal_Bool operator < ( const OString& rStr1, const OString& rStr2 ) SAL_THROW(())
719  { return rStr1.compareTo( rStr2 ) < 0; }
720  friend sal_Bool operator > ( const OString& rStr1, const OString& rStr2 ) SAL_THROW(())
721  { return rStr1.compareTo( rStr2 ) > 0; }
722  friend sal_Bool operator <= ( const OString& rStr1, const OString& rStr2 ) SAL_THROW(())
723  { return rStr1.compareTo( rStr2 ) <= 0; }
724  friend sal_Bool operator >= ( const OString& rStr1, const OString& rStr2 ) SAL_THROW(())
725  { return rStr1.compareTo( rStr2 ) >= 0; }
726 
727  template< typename T >
728  friend typename internal::CharPtrDetector< T, bool >::Type operator==( const OString& rStr1, const T& value ) SAL_THROW(())
729  {
730  return rStr1.compareTo( value ) == 0;
731  }
732 
733  template< typename T >
735  {
736  return rStr1.compareTo( value ) == 0;
737  }
738 
739  template< typename T >
740  friend typename internal::CharPtrDetector< T, bool >::Type operator==( const T& value, const OString& rStr2 ) SAL_THROW(())
741  {
742  return rStr2.compareTo( value ) == 0;
743  }
744 
745  template< typename T >
747  {
748  return rStr2.compareTo( value ) == 0;
749  }
750 
756  template< typename T >
757  friend typename internal::ConstCharArrayDetector< T, bool >::Type operator==( const OString& rStr, T& literal ) SAL_THROW(())
758  {
760  return rStr.getLength() == internal::ConstCharArrayDetector< T, void >::size - 1
761  && rtl_str_compare_WithLength( rStr.pData->buffer, rStr.pData->length, literal,
763  }
764 
770  template< typename T >
771  friend typename internal::ConstCharArrayDetector< T, bool >::Type operator==( T& literal, const OString& rStr ) SAL_THROW(())
772  {
774  return rStr.getLength() == internal::ConstCharArrayDetector< T, void >::size - 1
775  && rtl_str_compare_WithLength( rStr.pData->buffer, rStr.pData->length, literal,
777  }
778 
779  template< typename T >
780  friend typename internal::CharPtrDetector< T, bool >::Type operator!=( const OString& rStr1, const T& value ) SAL_THROW(())
781  {
782  return !(operator == ( rStr1, value ));
783  }
784 
785  template< typename T >
787  {
788  return !(operator == ( rStr1, value ));
789  }
790 
791  template< typename T >
792  friend typename internal::CharPtrDetector< T, bool >::Type operator!=( const T& value, const OString& rStr2 ) SAL_THROW(())
793  {
794  return !(operator == ( value, rStr2 ));
795  }
796 
797  template< typename T >
799  {
800  return !(operator == ( value, rStr2 ));
801  }
802 
808  template< typename T >
809  friend typename internal::ConstCharArrayDetector< T, bool >::Type operator!=( const OString& rStr, T& literal ) SAL_THROW(())
810  {
811  return !( rStr == literal );
812  }
813 
819  template< typename T >
820  friend typename internal::ConstCharArrayDetector< T, bool >::Type operator!=( T& literal, const OString& rStr ) SAL_THROW(())
821  {
822  return !( literal == rStr );
823  }
824 
832  sal_Int32 hashCode() const SAL_THROW(())
833  {
834  return rtl_str_hashCode_WithLength( pData->buffer, pData->length );
835  }
836 
850  sal_Int32 indexOf( sal_Char ch, sal_Int32 fromIndex = 0 ) const SAL_THROW(())
851  {
852  sal_Int32 ret = rtl_str_indexOfChar_WithLength( pData->buffer+fromIndex, pData->length-fromIndex, ch );
853  return (ret < 0 ? ret : ret+fromIndex);
854  }
855 
865  sal_Int32 lastIndexOf( sal_Char ch ) const SAL_THROW(())
866  {
867  return rtl_str_lastIndexOfChar_WithLength( pData->buffer, pData->length, ch );
868  }
869 
882  sal_Int32 lastIndexOf( sal_Char ch, sal_Int32 fromIndex ) const SAL_THROW(())
883  {
884  return rtl_str_lastIndexOfChar_WithLength( pData->buffer, fromIndex, ch );
885  }
886 
902  sal_Int32 indexOf( const OString & str, sal_Int32 fromIndex = 0 ) const SAL_THROW(())
903  {
904  sal_Int32 ret = rtl_str_indexOfStr_WithLength( pData->buffer+fromIndex, pData->length-fromIndex,
905  str.pData->buffer, str.pData->length );
906  return (ret < 0 ? ret : ret+fromIndex);
907  }
908 
914  template< typename T >
915  typename internal::ConstCharArrayDetector< T, sal_Int32 >::Type indexOf( T& literal, sal_Int32 fromIndex = 0 ) const SAL_THROW(())
916  {
918  sal_Int32 n = rtl_str_indexOfStr_WithLength(
919  pData->buffer + fromIndex, pData->length - fromIndex, literal, internal::ConstCharArrayDetector< T, void >::size - 1);
920  return n < 0 ? n : n + fromIndex;
921  }
922 
941  sal_Int32 indexOfL(char const * str, sal_Int32 len, sal_Int32 fromIndex = 0)
942  const SAL_THROW(())
943  {
944  sal_Int32 n = rtl_str_indexOfStr_WithLength(
945  pData->buffer + fromIndex, pData->length - fromIndex, str, len);
946  return n < 0 ? n : n + fromIndex;
947  }
948 
949  // This overload is left undefined, to detect calls of indexOfL that
950  // erroneously use RTL_CONSTASCII_USTRINGPARAM instead of
951  // RTL_CONSTASCII_STRINGPARAM (but would lead to ambiguities on 32 bit
952  // platforms):
953 #if SAL_TYPES_SIZEOFLONG == 8
954  void indexOfL(char const *, sal_Int32, rtl_TextEncoding) const;
955 #endif
956 
972  sal_Int32 lastIndexOf( const OString & str ) const SAL_THROW(())
973  {
974  return rtl_str_lastIndexOfStr_WithLength( pData->buffer, pData->length,
975  str.pData->buffer, str.pData->length );
976  }
977 
995  sal_Int32 lastIndexOf( const OString & str, sal_Int32 fromIndex ) const SAL_THROW(())
996  {
997  return rtl_str_lastIndexOfStr_WithLength( pData->buffer, fromIndex,
998  str.pData->buffer, str.pData->length );
999  }
1000 
1010  OString copy( sal_Int32 beginIndex ) const SAL_THROW(())
1011  {
1012  assert(beginIndex >= 0 && beginIndex <= getLength());
1013  if ( beginIndex == 0 )
1014  return *this;
1015  else
1016  {
1017  rtl_String* pNew = 0;
1018  rtl_string_newFromStr_WithLength( &pNew, pData->buffer+beginIndex, getLength()-beginIndex );
1019  return OString( pNew, (DO_NOT_ACQUIRE*)0 );
1020  }
1021  }
1022 
1034  OString copy( sal_Int32 beginIndex, sal_Int32 count ) const SAL_THROW(())
1035  {
1036  assert(beginIndex >= 0 && beginIndex <= getLength() && count >= 0
1037  && sal::static_int_cast<sal_uInt32>(count) <=
1038  sal::static_int_cast<sal_uInt32>(getLength() - beginIndex));
1039  if ( (beginIndex == 0) && (count == getLength()) )
1040  return *this;
1041  else
1042  {
1043  rtl_String* pNew = 0;
1044  rtl_string_newFromStr_WithLength( &pNew, pData->buffer+beginIndex, count );
1045  return OString( pNew, (DO_NOT_ACQUIRE*)0 );
1046  }
1047  }
1048 
1057  OString concat( const OString & str ) const SAL_THROW(())
1058  {
1059  rtl_String* pNew = 0;
1060  rtl_string_newConcat( &pNew, pData, str.pData );
1061  return OString( pNew, (DO_NOT_ACQUIRE*)0 );
1062  }
1063 
1064  friend OString operator+( const OString & str1, const OString & str2 ) SAL_THROW(())
1065  {
1066  return str1.concat( str2 );
1067  }
1068 
1082  OString replaceAt( sal_Int32 index, sal_Int32 count, const OString& newStr ) const SAL_THROW(())
1083  {
1084  rtl_String* pNew = 0;
1085  rtl_string_newReplaceStrAt( &pNew, pData, index, count, newStr.pData );
1086  return OString( pNew, (DO_NOT_ACQUIRE*)0 );
1087  }
1088 
1102  OString replace( sal_Char oldChar, sal_Char newChar ) const SAL_THROW(())
1103  {
1104  rtl_String* pNew = 0;
1105  rtl_string_newReplace( &pNew, pData, oldChar, newChar );
1106  return OString( pNew, (DO_NOT_ACQUIRE*)0 );
1107  }
1108 
1128  OString const & from, OString const & to, sal_Int32 * index = 0) const
1129  {
1130  rtl_String * s = 0;
1131  sal_Int32 i = 0;
1133  &s, pData, from.pData->buffer, from.pData->length,
1134  to.pData->buffer, to.pData->length, index == 0 ? &i : index);
1135  return OString(s, SAL_NO_ACQUIRE);
1136  }
1137 
1151  OString replaceAll(OString const & from, OString const & to) const {
1152  rtl_String * s = 0;
1154  &s, pData, from.pData->buffer, from.pData->length,
1155  to.pData->buffer, to.pData->length);
1156  return OString(s, SAL_NO_ACQUIRE);
1157  }
1158 
1170  {
1171  rtl_String* pNew = 0;
1172  rtl_string_newToAsciiLowerCase( &pNew, pData );
1173  return OString( pNew, (DO_NOT_ACQUIRE*)0 );
1174  }
1175 
1187  {
1188  rtl_String* pNew = 0;
1189  rtl_string_newToAsciiUpperCase( &pNew, pData );
1190  return OString( pNew, (DO_NOT_ACQUIRE*)0 );
1191  }
1192 
1204  OString trim() const SAL_THROW(())
1205  {
1206  rtl_String* pNew = 0;
1207  rtl_string_newTrim( &pNew, pData );
1208  return OString( pNew, (DO_NOT_ACQUIRE*)0 );
1209  }
1210 
1235  OString getToken( sal_Int32 token, sal_Char cTok, sal_Int32& index ) const SAL_THROW(())
1236  {
1237  rtl_String * pNew = 0;
1238  index = rtl_string_getToken( &pNew, pData, token, cTok, index );
1239  return OString( pNew, (DO_NOT_ACQUIRE *)0 );
1240  }
1241 
1255  OString getToken(sal_Int32 count, char separator) const {
1256  sal_Int32 n = 0;
1257  return getToken(count, separator, n);
1258  }
1259 
1269  {
1270  return rtl_str_toBoolean( pData->buffer );
1271  }
1272 
1280  {
1281  return pData->buffer[0];
1282  }
1283 
1293  sal_Int32 toInt32( sal_Int16 radix = 10 ) const SAL_THROW(())
1294  {
1295  return rtl_str_toInt32( pData->buffer, radix );
1296  }
1297 
1307  sal_Int64 toInt64( sal_Int16 radix = 10 ) const SAL_THROW(())
1308  {
1309  return rtl_str_toInt64( pData->buffer, radix );
1310  }
1311 
1320  float toFloat() const SAL_THROW(())
1321  {
1322  return rtl_str_toFloat( pData->buffer );
1323  }
1324 
1333  double toDouble() const SAL_THROW(())
1334  {
1335  return rtl_str_toDouble( pData->buffer );
1336  }
1337 
1349  {
1351  rtl_String* pNewData = 0;
1352  rtl_string_newFromStr_WithLength( &pNewData, aBuf, rtl_str_valueOfBoolean( aBuf, b ) );
1353  return OString( pNewData, (DO_NOT_ACQUIRE*)0 );
1354  }
1355 
1363  {
1364  return OString( &c, 1 );
1365  }
1366 
1376  static OString valueOf( sal_Int32 i, sal_Int16 radix = 10 ) SAL_THROW(())
1377  {
1379  rtl_String* pNewData = 0;
1380  rtl_string_newFromStr_WithLength( &pNewData, aBuf, rtl_str_valueOfInt32( aBuf, i, radix ) );
1381  return OString( pNewData, (DO_NOT_ACQUIRE*)0 );
1382  }
1383 
1393  static OString valueOf( sal_Int64 ll, sal_Int16 radix = 10 ) SAL_THROW(())
1394  {
1396  rtl_String* pNewData = 0;
1397  rtl_string_newFromStr_WithLength( &pNewData, aBuf, rtl_str_valueOfInt64( aBuf, ll, radix ) );
1398  return OString( pNewData, (DO_NOT_ACQUIRE*)0 );
1399  }
1400 
1409  static OString valueOf( float f ) SAL_THROW(())
1410  {
1412  rtl_String* pNewData = 0;
1413  rtl_string_newFromStr_WithLength( &pNewData, aBuf, rtl_str_valueOfFloat( aBuf, f ) );
1414  return OString( pNewData, (DO_NOT_ACQUIRE*)0 );
1415  }
1416 
1425  static OString valueOf( double d ) SAL_THROW(())
1426  {
1428  rtl_String* pNewData = 0;
1429  rtl_string_newFromStr_WithLength( &pNewData, aBuf, rtl_str_valueOfDouble( aBuf, d ) );
1430  return OString( pNewData, (DO_NOT_ACQUIRE*)0 );
1431  }
1432 };
1433 
1434 /* ======================================================================= */
1435 
1436 } /* Namespace */
1437 
1438 #ifdef RTL_STRING_UNITTEST
1439 namespace rtl
1440 {
1441 typedef rtlunittest::OString OString;
1442 }
1443 #undef RTL_STRING_CONST_FUNCTION
1444 #endif
1445 
1446 namespace rtl
1447 {
1448 
1455 {
1465  size_t operator()( const OString& rString ) const
1466  { return (size_t)rString.hashCode(); }
1467 };
1468 
1469 /* ======================================================================= */
1470 
1471 } /* Namespace */
1472 
1473 #endif /* _RTL_STRING_HXX_ */
1474 
1475 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */