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 
323  bool isEmpty() const SAL_THROW(())
324  {
325  return pData->length == 0;
326  }
327 
339  const sal_Char * getStr() const SAL_THROW(()) { return pData->buffer; }
340 
350  sal_Char operator [](sal_Int32 index) const { return getStr()[index]; }
351 
364  sal_Int32 compareTo( const OString & str ) const SAL_THROW(())
365  {
366  return rtl_str_compare_WithLength( pData->buffer, pData->length,
367  str.pData->buffer, str.pData->length );
368  }
369 
383  sal_Int32 compareTo( const OString & rObj, sal_Int32 maxLength ) const SAL_THROW(())
384  {
385  return rtl_str_shortenedCompare_WithLength( pData->buffer, pData->length,
386  rObj.pData->buffer, rObj.pData->length, maxLength );
387  }
388 
401  sal_Int32 reverseCompareTo( const OString & str ) const SAL_THROW(())
402  {
403  return rtl_str_reverseCompare_WithLength( pData->buffer, pData->length,
404  str.pData->buffer, str.pData->length );
405  }
406 
418  sal_Bool equals( const OString & str ) const SAL_THROW(())
419  {
420  if ( pData->length != str.pData->length )
421  return sal_False;
422  if ( pData == str.pData )
423  return sal_True;
424  return rtl_str_reverseCompare_WithLength( pData->buffer, pData->length,
425  str.pData->buffer, str.pData->length ) == 0;
426  }
427 
443  sal_Bool equalsL( const sal_Char* value, sal_Int32 length ) const SAL_THROW(())
444  {
445  if ( pData->length != length )
446  return sal_False;
447 
448  return rtl_str_reverseCompare_WithLength( pData->buffer, pData->length,
449  value, length ) == 0;
450  }
451 
467  {
468  if ( pData->length != str.pData->length )
469  return sal_False;
470  if ( pData == str.pData )
471  return sal_True;
472  return rtl_str_compareIgnoreAsciiCase_WithLength( pData->buffer, pData->length,
473  str.pData->buffer, str.pData->length ) == 0;
474  }
475 
497 #ifdef HAVE_SFINAE_ANONYMOUS_BROKEN
498  sal_Bool equalsIgnoreAsciiCase( const sal_Char * asciiStr ) const SAL_THROW(())
499  {
500  return rtl_str_compareIgnoreAsciiCase( pData->buffer, asciiStr ) == 0;
501  }
502 #else
503  template< typename T >
505  {
506  return rtl_str_compareIgnoreAsciiCase( pData->buffer, asciiStr ) == 0;
507  }
508 
509  template< typename T >
511  {
512  return rtl_str_compareIgnoreAsciiCase( pData->buffer, asciiStr ) == 0;
513  }
514 
520  template< typename T >
522  {
524  if ( pData->length != internal::ConstCharArrayDetector< T, void >::size - 1 )
525  return false;
526  return rtl_str_compareIgnoreAsciiCase_WithLength( pData->buffer, pData->length,
528  }
529 #endif
530 
550  sal_Bool equalsIgnoreAsciiCaseL( const sal_Char * asciiStr, sal_Int32 asciiStrLength ) const SAL_THROW(())
551  {
552  if ( pData->length != asciiStrLength )
553  return sal_False;
554 
555  return rtl_str_compareIgnoreAsciiCase_WithLength( pData->buffer, pData->length,
556  asciiStr, asciiStrLength ) == 0;
557  }
558 
574  sal_Bool match( const OString & str, sal_Int32 fromIndex = 0 ) const SAL_THROW(())
575  {
576  return rtl_str_shortenedCompare_WithLength( pData->buffer+fromIndex, pData->length-fromIndex,
577  str.pData->buffer, str.pData->length, str.pData->length ) == 0;
578  }
579 
585  template< typename T >
586  typename internal::ConstCharArrayDetector< T, bool >::Type match( T& literal, sal_Int32 fromIndex = 0 ) const SAL_THROW(())
587  {
590  pData->buffer + fromIndex, pData->length - fromIndex,
592  }
593 
610  bool matchL(
611  char const * str, sal_Int32 strLength, sal_Int32 fromIndex = 0)
612  const
613  {
615  pData->buffer + fromIndex, pData->length - fromIndex,
616  str, strLength, strLength) == 0;
617  }
618 
619  // This overload is left undefined, to detect calls of matchL that
620  // erroneously use RTL_CONSTASCII_USTRINGPARAM instead of
621  // RTL_CONSTASCII_STRINGPARAM (but would lead to ambiguities on 32 bit
622  // platforms):
623 #if SAL_TYPES_SIZEOFLONG == 8
624  void matchL(char const *, sal_Int32, rtl_TextEncoding) const;
625 #endif
626 
645  sal_Bool matchIgnoreAsciiCase( const OString & str, sal_Int32 fromIndex = 0 ) const SAL_THROW(())
646  {
647  return rtl_str_shortenedCompareIgnoreAsciiCase_WithLength( pData->buffer+fromIndex, pData->length-fromIndex,
648  str.pData->buffer, str.pData->length,
649  str.pData->length ) == 0;
650  }
651 
657  template< typename T >
658  typename internal::ConstCharArrayDetector< T, bool >::Type matchIgnoreAsciiCase( T& literal, sal_Int32 fromIndex = 0 ) const
659  {
661  return rtl_str_shortenedCompareIgnoreAsciiCase_WithLength( pData->buffer+fromIndex, pData->length-fromIndex,
663  }
664 
675  bool endsWith(OString const & str) const {
676  return str.getLength() <= getLength()
677  && match(str, getLength() - str.getLength());
678  }
679 
685  template< typename T >
687  {
690  && match(literal, getLength() - ( internal::ConstCharArrayDetector< T, void >::size - 1 ));
691  }
692 
706  bool endsWithL(char const * str, sal_Int32 strLength) const {
707  return strLength <= getLength()
708  && matchL(str, strLength, getLength() - strLength);
709  }
710 
711  friend sal_Bool operator == ( const OString& rStr1, const OString& rStr2 ) SAL_THROW(())
712  { return rStr1.equals(rStr2); }
713  friend sal_Bool operator != ( const OString& rStr1, const OString& rStr2 ) SAL_THROW(())
714  { return !(operator == ( rStr1, rStr2 )); }
715  friend sal_Bool operator < ( const OString& rStr1, const OString& rStr2 ) SAL_THROW(())
716  { return rStr1.compareTo( rStr2 ) < 0; }
717  friend sal_Bool operator > ( const OString& rStr1, const OString& rStr2 ) SAL_THROW(())
718  { return rStr1.compareTo( rStr2 ) > 0; }
719  friend sal_Bool operator <= ( const OString& rStr1, const OString& rStr2 ) SAL_THROW(())
720  { return rStr1.compareTo( rStr2 ) <= 0; }
721  friend sal_Bool operator >= ( const OString& rStr1, const OString& rStr2 ) SAL_THROW(())
722  { return rStr1.compareTo( rStr2 ) >= 0; }
723 
724  template< typename T >
725  friend typename internal::CharPtrDetector< T, bool >::Type operator==( const OString& rStr1, const T& value ) SAL_THROW(())
726  {
727  return rStr1.compareTo( value ) == 0;
728  }
729 
730  template< typename T >
732  {
733  return rStr1.compareTo( value ) == 0;
734  }
735 
736  template< typename T >
737  friend typename internal::CharPtrDetector< T, bool >::Type operator==( const T& value, const OString& rStr2 ) SAL_THROW(())
738  {
739  return rStr2.compareTo( value ) == 0;
740  }
741 
742  template< typename T >
744  {
745  return rStr2.compareTo( value ) == 0;
746  }
747 
753  template< typename T >
754  friend typename internal::ConstCharArrayDetector< T, bool >::Type operator==( const OString& rStr, T& literal ) SAL_THROW(())
755  {
757  return rStr.getLength() == internal::ConstCharArrayDetector< T, void >::size - 1
758  && rtl_str_compare_WithLength( rStr.pData->buffer, rStr.pData->length, literal,
760  }
761 
767  template< typename T >
768  friend typename internal::ConstCharArrayDetector< T, bool >::Type operator==( T& literal, const OString& rStr ) SAL_THROW(())
769  {
771  return rStr.getLength() == internal::ConstCharArrayDetector< T, void >::size - 1
772  && rtl_str_compare_WithLength( rStr.pData->buffer, rStr.pData->length, literal,
774  }
775 
776  template< typename T >
777  friend typename internal::CharPtrDetector< T, bool >::Type operator!=( const OString& rStr1, const T& value ) SAL_THROW(())
778  {
779  return !(operator == ( rStr1, value ));
780  }
781 
782  template< typename T >
784  {
785  return !(operator == ( rStr1, value ));
786  }
787 
788  template< typename T >
789  friend typename internal::CharPtrDetector< T, bool >::Type operator!=( const T& value, const OString& rStr2 ) SAL_THROW(())
790  {
791  return !(operator == ( value, rStr2 ));
792  }
793 
794  template< typename T >
796  {
797  return !(operator == ( value, rStr2 ));
798  }
799 
805  template< typename T >
806  friend typename internal::ConstCharArrayDetector< T, bool >::Type operator!=( const OString& rStr, T& literal ) SAL_THROW(())
807  {
808  return !( rStr == literal );
809  }
810 
816  template< typename T >
817  friend typename internal::ConstCharArrayDetector< T, bool >::Type operator!=( T& literal, const OString& rStr ) SAL_THROW(())
818  {
819  return !( literal == rStr );
820  }
821 
829  sal_Int32 hashCode() const SAL_THROW(())
830  {
831  return rtl_str_hashCode_WithLength( pData->buffer, pData->length );
832  }
833 
847  sal_Int32 indexOf( sal_Char ch, sal_Int32 fromIndex = 0 ) const SAL_THROW(())
848  {
849  sal_Int32 ret = rtl_str_indexOfChar_WithLength( pData->buffer+fromIndex, pData->length-fromIndex, ch );
850  return (ret < 0 ? ret : ret+fromIndex);
851  }
852 
862  sal_Int32 lastIndexOf( sal_Char ch ) const SAL_THROW(())
863  {
864  return rtl_str_lastIndexOfChar_WithLength( pData->buffer, pData->length, ch );
865  }
866 
879  sal_Int32 lastIndexOf( sal_Char ch, sal_Int32 fromIndex ) const SAL_THROW(())
880  {
881  return rtl_str_lastIndexOfChar_WithLength( pData->buffer, fromIndex, ch );
882  }
883 
899  sal_Int32 indexOf( const OString & str, sal_Int32 fromIndex = 0 ) const SAL_THROW(())
900  {
901  sal_Int32 ret = rtl_str_indexOfStr_WithLength( pData->buffer+fromIndex, pData->length-fromIndex,
902  str.pData->buffer, str.pData->length );
903  return (ret < 0 ? ret : ret+fromIndex);
904  }
905 
911  template< typename T >
912  typename internal::ConstCharArrayDetector< T, sal_Int32 >::Type indexOf( T& literal, sal_Int32 fromIndex = 0 ) const SAL_THROW(())
913  {
915  sal_Int32 n = rtl_str_indexOfStr_WithLength(
916  pData->buffer + fromIndex, pData->length - fromIndex, literal, internal::ConstCharArrayDetector< T, void >::size - 1);
917  return n < 0 ? n : n + fromIndex;
918  }
919 
938  sal_Int32 indexOfL(char const * str, sal_Int32 len, sal_Int32 fromIndex = 0)
939  const SAL_THROW(())
940  {
941  sal_Int32 n = rtl_str_indexOfStr_WithLength(
942  pData->buffer + fromIndex, pData->length - fromIndex, str, len);
943  return n < 0 ? n : n + fromIndex;
944  }
945 
946  // This overload is left undefined, to detect calls of indexOfL that
947  // erroneously use RTL_CONSTASCII_USTRINGPARAM instead of
948  // RTL_CONSTASCII_STRINGPARAM (but would lead to ambiguities on 32 bit
949  // platforms):
950 #if SAL_TYPES_SIZEOFLONG == 8
951  void indexOfL(char const *, sal_Int32, rtl_TextEncoding) const;
952 #endif
953 
969  sal_Int32 lastIndexOf( const OString & str ) const SAL_THROW(())
970  {
971  return rtl_str_lastIndexOfStr_WithLength( pData->buffer, pData->length,
972  str.pData->buffer, str.pData->length );
973  }
974 
992  sal_Int32 lastIndexOf( const OString & str, sal_Int32 fromIndex ) const SAL_THROW(())
993  {
994  return rtl_str_lastIndexOfStr_WithLength( pData->buffer, fromIndex,
995  str.pData->buffer, str.pData->length );
996  }
997 
1007  OString copy( sal_Int32 beginIndex ) const SAL_THROW(())
1008  {
1009  assert(beginIndex >= 0 && beginIndex <= getLength());
1010  if ( beginIndex == 0 )
1011  return *this;
1012  else
1013  {
1014  rtl_String* pNew = 0;
1015  rtl_string_newFromStr_WithLength( &pNew, pData->buffer+beginIndex, getLength()-beginIndex );
1016  return OString( pNew, (DO_NOT_ACQUIRE*)0 );
1017  }
1018  }
1019 
1031  OString copy( sal_Int32 beginIndex, sal_Int32 count ) const SAL_THROW(())
1032  {
1033  assert(beginIndex >= 0 && beginIndex <= getLength() && count >= 0
1034  && sal::static_int_cast<sal_uInt32>(count) <=
1035  sal::static_int_cast<sal_uInt32>(getLength() - beginIndex));
1036  if ( (beginIndex == 0) && (count == getLength()) )
1037  return *this;
1038  else
1039  {
1040  rtl_String* pNew = 0;
1041  rtl_string_newFromStr_WithLength( &pNew, pData->buffer+beginIndex, count );
1042  return OString( pNew, (DO_NOT_ACQUIRE*)0 );
1043  }
1044  }
1045 
1054  OString concat( const OString & str ) const SAL_THROW(())
1055  {
1056  rtl_String* pNew = 0;
1057  rtl_string_newConcat( &pNew, pData, str.pData );
1058  return OString( pNew, (DO_NOT_ACQUIRE*)0 );
1059  }
1060 
1061  friend OString operator+( const OString & str1, const OString & str2 ) SAL_THROW(())
1062  {
1063  return str1.concat( str2 );
1064  }
1065 
1079  OString replaceAt( sal_Int32 index, sal_Int32 count, const OString& newStr ) const SAL_THROW(())
1080  {
1081  rtl_String* pNew = 0;
1082  rtl_string_newReplaceStrAt( &pNew, pData, index, count, newStr.pData );
1083  return OString( pNew, (DO_NOT_ACQUIRE*)0 );
1084  }
1085 
1099  OString replace( sal_Char oldChar, sal_Char newChar ) const SAL_THROW(())
1100  {
1101  rtl_String* pNew = 0;
1102  rtl_string_newReplace( &pNew, pData, oldChar, newChar );
1103  return OString( pNew, (DO_NOT_ACQUIRE*)0 );
1104  }
1105 
1125  OString const & from, OString const & to, sal_Int32 * index = 0) const
1126  {
1127  rtl_String * s = 0;
1128  sal_Int32 i = 0;
1130  &s, pData, from.pData->buffer, from.pData->length,
1131  to.pData->buffer, to.pData->length, index == 0 ? &i : index);
1132  return OString(s, SAL_NO_ACQUIRE);
1133  }
1134 
1148  OString replaceAll(OString const & from, OString const & to) const {
1149  rtl_String * s = 0;
1151  &s, pData, from.pData->buffer, from.pData->length,
1152  to.pData->buffer, to.pData->length);
1153  return OString(s, SAL_NO_ACQUIRE);
1154  }
1155 
1167  {
1168  rtl_String* pNew = 0;
1169  rtl_string_newToAsciiLowerCase( &pNew, pData );
1170  return OString( pNew, (DO_NOT_ACQUIRE*)0 );
1171  }
1172 
1184  {
1185  rtl_String* pNew = 0;
1186  rtl_string_newToAsciiUpperCase( &pNew, pData );
1187  return OString( pNew, (DO_NOT_ACQUIRE*)0 );
1188  }
1189 
1201  OString trim() const SAL_THROW(())
1202  {
1203  rtl_String* pNew = 0;
1204  rtl_string_newTrim( &pNew, pData );
1205  return OString( pNew, (DO_NOT_ACQUIRE*)0 );
1206  }
1207 
1232  OString getToken( sal_Int32 token, sal_Char cTok, sal_Int32& index ) const SAL_THROW(())
1233  {
1234  rtl_String * pNew = 0;
1235  index = rtl_string_getToken( &pNew, pData, token, cTok, index );
1236  return OString( pNew, (DO_NOT_ACQUIRE *)0 );
1237  }
1238 
1252  OString getToken(sal_Int32 count, char separator) const {
1253  sal_Int32 n = 0;
1254  return getToken(count, separator, n);
1255  }
1256 
1266  {
1267  return rtl_str_toBoolean( pData->buffer );
1268  }
1269 
1277  {
1278  return pData->buffer[0];
1279  }
1280 
1290  sal_Int32 toInt32( sal_Int16 radix = 10 ) const SAL_THROW(())
1291  {
1292  return rtl_str_toInt32( pData->buffer, radix );
1293  }
1294 
1304  sal_Int64 toInt64( sal_Int16 radix = 10 ) const SAL_THROW(())
1305  {
1306  return rtl_str_toInt64( pData->buffer, radix );
1307  }
1308 
1317  float toFloat() const SAL_THROW(())
1318  {
1319  return rtl_str_toFloat( pData->buffer );
1320  }
1321 
1330  double toDouble() const SAL_THROW(())
1331  {
1332  return rtl_str_toDouble( pData->buffer );
1333  }
1334 
1346  {
1348  rtl_String* pNewData = 0;
1349  rtl_string_newFromStr_WithLength( &pNewData, aBuf, rtl_str_valueOfBoolean( aBuf, b ) );
1350  return OString( pNewData, (DO_NOT_ACQUIRE*)0 );
1351  }
1352 
1360  {
1361  return OString( &c, 1 );
1362  }
1363 
1373  static OString valueOf( sal_Int32 i, sal_Int16 radix = 10 ) SAL_THROW(())
1374  {
1376  rtl_String* pNewData = 0;
1377  rtl_string_newFromStr_WithLength( &pNewData, aBuf, rtl_str_valueOfInt32( aBuf, i, radix ) );
1378  return OString( pNewData, (DO_NOT_ACQUIRE*)0 );
1379  }
1380 
1390  static OString valueOf( sal_Int64 ll, sal_Int16 radix = 10 ) SAL_THROW(())
1391  {
1393  rtl_String* pNewData = 0;
1394  rtl_string_newFromStr_WithLength( &pNewData, aBuf, rtl_str_valueOfInt64( aBuf, ll, radix ) );
1395  return OString( pNewData, (DO_NOT_ACQUIRE*)0 );
1396  }
1397 
1406  static OString valueOf( float f ) SAL_THROW(())
1407  {
1409  rtl_String* pNewData = 0;
1410  rtl_string_newFromStr_WithLength( &pNewData, aBuf, rtl_str_valueOfFloat( aBuf, f ) );
1411  return OString( pNewData, (DO_NOT_ACQUIRE*)0 );
1412  }
1413 
1422  static OString valueOf( double d ) SAL_THROW(())
1423  {
1425  rtl_String* pNewData = 0;
1426  rtl_string_newFromStr_WithLength( &pNewData, aBuf, rtl_str_valueOfDouble( aBuf, d ) );
1427  return OString( pNewData, (DO_NOT_ACQUIRE*)0 );
1428  }
1429 };
1430 
1431 /* ======================================================================= */
1432 
1433 } /* Namespace */
1434 
1435 #ifdef RTL_STRING_UNITTEST
1436 namespace rtl
1437 {
1438 typedef rtlunittest::OString OString;
1439 }
1440 #undef RTL_STRING_CONST_FUNCTION
1441 #endif
1442 
1443 namespace rtl
1444 {
1445 
1452 {
1462  size_t operator()( const OString& rString ) const
1463  { return (size_t)rString.hashCode(); }
1464 };
1465 
1466 /* ======================================================================= */
1467 
1468 } /* Namespace */
1469 
1470 #endif /* _RTL_STRING_HXX_ */
1471 
1472 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */