LibreOffice
LibreOffice 6.0 SDK C/C++ API Reference
strbuf.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_STRBUF_HXX
21 #define INCLUDED_RTL_STRBUF_HXX
22 
23 #include <sal/config.h>
24 
25 #include <cassert>
26 #include <cstddef>
27 #include <cstring>
28 
29 #include <rtl/strbuf.h>
30 #include <rtl/string.hxx>
31 #include <rtl/stringutils.hxx>
32 
33 #ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
34 #include <rtl/stringconcat.hxx>
35 #endif
36 
37 #ifdef RTL_STRING_UNITTEST
38 extern bool rtl_string_unittest_const_literal;
39 extern bool rtl_string_unittest_const_literal_function;
40 #endif
41 
42 // The unittest uses slightly different code to help check that the proper
43 // calls are made. The class is put into a different namespace to make
44 // sure the compiler generates a different (if generating also non-inline)
45 // copy of the function and does not merge them together. The class
46 // is "brought" into the proper rtl namespace by a typedef below.
47 #ifdef RTL_STRING_UNITTEST
48 #define rtl rtlunittest
49 #endif
50 
51 namespace rtl
52 {
53 
55 #ifdef RTL_STRING_UNITTEST
56 #undef rtl
57 // helper macro to make functions appear more readable
58 #define RTL_STRING_CONST_FUNCTION rtl_string_unittest_const_literal_function = true;
59 #else
60 #define RTL_STRING_CONST_FUNCTION
61 #endif
62 
67 {
68 public:
74  : pData(NULL)
75  , nCapacity( 16 )
76  {
77  rtl_string_new_WithLength( &pData, nCapacity );
78  }
79 
86  OStringBuffer( const OStringBuffer & value )
87  : pData(NULL)
88  , nCapacity( value.nCapacity )
89  {
90  rtl_stringbuffer_newFromStringBuffer( &pData, value.nCapacity, value.pData );
91  }
92 
99  explicit OStringBuffer(int length)
100  : pData(NULL)
101  , nCapacity( length )
102  {
103  rtl_string_new_WithLength( &pData, length );
104  }
105 #if __cplusplus >= 201103L
106  explicit OStringBuffer(unsigned int length)
107  : OStringBuffer(static_cast<int>(length))
108  {
109  }
110 #if SAL_TYPES_SIZEOFLONG == 4
111  // additional overloads for sal_Int32 sal_uInt32
112  explicit OStringBuffer(long length)
113  : OStringBuffer(static_cast<int>(length))
114  {
115  }
116  explicit OStringBuffer(unsigned long length)
117  : OStringBuffer(static_cast<int>(length))
118  {
119  }
120 #endif
121  // avoid obvious bugs
122  explicit OStringBuffer(char) = delete;
123  explicit OStringBuffer(sal_Unicode) = delete;
124 #endif
125 
136  OStringBuffer(const OString& value)
137  : pData(NULL)
138  , nCapacity( value.getLength() + 16 )
139  {
140  rtl_stringbuffer_newFromStr_WithLength( &pData, value.getStr(), value.getLength() );
141  }
142 
147  template< typename T >
149  : pData(NULL)
150  {
151  sal_Int32 length = rtl_str_getLength( value );
152  nCapacity = length + 16;
153  rtl_stringbuffer_newFromStr_WithLength( &pData, value, length );
154  }
155 
156  template< typename T >
158  : pData(NULL)
159  {
160  sal_Int32 length = rtl_str_getLength( value );
161  nCapacity = length + 16;
162  rtl_stringbuffer_newFromStr_WithLength( &pData, value, length );
163  }
164 
176  template< typename T >
178  : pData(NULL)
179  , nCapacity( libreoffice_internal::ConstCharArrayDetector<T>::length + 16 )
180  {
181  assert(
184  &pData,
187 #ifdef RTL_STRING_UNITTEST
188  rtl_string_unittest_const_literal = true;
189 #endif
190  }
191 
204  OStringBuffer(const sal_Char * value, sal_Int32 length)
205  : pData(NULL)
206  , nCapacity( length + 16 )
207  {
208  rtl_stringbuffer_newFromStr_WithLength( &pData, value, length );
209  }
210 
211 #ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
212 
216  template< typename T1, typename T2 >
217  OStringBuffer( const OStringConcat< T1, T2 >& c )
218  {
219  const sal_Int32 l = c.length();
220  nCapacity = l + 16;
221  pData = rtl_string_alloc( nCapacity );
222  char* end = c.addData( pData->buffer );
223  *end = '\0';
224  pData->length = l;
225  }
226 #endif
227 
230  OStringBuffer& operator = ( const OStringBuffer& value )
231  {
232  if (this != &value)
233  {
235  value.nCapacity,
236  value.pData);
237  nCapacity = value.nCapacity;
238  }
239  return *this;
240  }
241 
246  OStringBuffer & operator =(OString const & string) {
247  sal_Int32 n = string.getLength();
248  if (n >= nCapacity) {
249  ensureCapacity(n + 16); //TODO: check for overflow
250  }
251  std::memcpy(pData->buffer, string.pData->buffer, n + 1);
252  pData->length = n;
253  return *this;
254  }
255 
260  template<typename T>
261  typename
263  operator =(T & literal) {
264  assert(
266  sal_Int32 const n
268  if (n >= nCapacity) {
269  ensureCapacity(n + 16); //TODO: check for overflow
270  }
271  std::memcpy(
272  pData->buffer,
274  n + 1);
275  pData->length = n;
276  return *this;
277  }
278 
279 #if defined LIBO_INTERNAL_ONLY
280 
281  template<typename T1, typename T2>
282  OStringBuffer & operator =(OStringConcat<T1, T2> const & concat) {
283  sal_Int32 const n = concat.length();
284  if (n >= nCapacity) {
285  ensureCapacity(n + 16); //TODO: check for overflow
286  }
287  *concat.addData(pData->buffer) = 0;
288  pData->length = n;
289  return *this;
290  }
291 #endif
292 
297  {
298  rtl_string_release( pData );
299  }
300 
310  {
311  OString aRet( pData );
312  rtl_string_new(&pData);
313  nCapacity = 0;
314  return aRet;
315  }
316 
322  sal_Int32 getLength() const
323  {
324  return pData->length;
325  }
326 
335  bool isEmpty() const
336  {
337  return pData->length == 0;
338  }
339 
350  sal_Int32 getCapacity() const
351  {
352  return nCapacity;
353  }
354 
366  void ensureCapacity(sal_Int32 minimumCapacity)
367  {
368  rtl_stringbuffer_ensureCapacity( &pData, &nCapacity, minimumCapacity );
369  }
370 
389  void setLength(sal_Int32 newLength)
390  {
391  assert(newLength >= 0);
392  // Avoid modifications if pData points to const empty string:
393  if( newLength != pData->length )
394  {
395  if( newLength > nCapacity )
396  rtl_stringbuffer_ensureCapacity(&pData, &nCapacity, newLength);
397  else
398  pData->buffer[newLength] = '\0';
399  pData->length = newLength;
400  }
401  }
402 
416  SAL_DEPRECATED("use rtl::OStringBuffer::operator [] instead")
417  sal_Char charAt( sal_Int32 index )
418  {
419  assert(index >= 0 && index < pData->length);
420  return pData->buffer[ index ];
421  }
422 
433  SAL_DEPRECATED("use rtl::OStringBuffer::operator [] instead")
434  OStringBuffer & setCharAt(sal_Int32 index, sal_Char ch)
435  {
436  assert(index >= 0 && index < pData->length);
437  pData->buffer[ index ] = ch;
438  return *this;
439  }
440 
444  const sal_Char* getStr() const SAL_RETURNS_NONNULL { return pData->buffer; }
445 
455  sal_Char & operator [](sal_Int32 index)
456  {
457  assert(index >= 0 && index < pData->length);
458  return pData->buffer[index];
459  }
460 
465  const OString toString() const
466  {
467  return OString(pData->buffer, pData->length);
468  }
469 
481  {
482  return append( str.getStr(), str.getLength() );
483  }
484 
496  template< typename T >
498  {
499  return append( str, rtl_str_getLength( str ) );
500  }
501 
502  template< typename T >
504  {
505  return append( str, rtl_str_getLength( str ) );
506  }
507 
513  template< typename T >
515  {
516  RTL_STRING_CONST_FUNCTION
517  assert(
520  &pData, &nCapacity, getLength(),
523  return *this;
524  }
525 
539  OStringBuffer & append( const sal_Char * str, sal_Int32 len)
540  {
541  assert( len == 0 || str != NULL ); // cannot assert that in rtl_stringbuffer_insert
542  rtl_stringbuffer_insert( &pData, &nCapacity, getLength(), str, len );
543  return *this;
544  }
545 
546 #ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
547 
551  template< typename T1, typename T2 >
552  OStringBuffer& append( const OStringConcat< T1, T2 >& c )
553  {
554  sal_Int32 l = c.length();
555  if( l == 0 )
556  return *this;
557  l += pData->length;
558  rtl_stringbuffer_ensureCapacity( &pData, &nCapacity, l );
559  char* end = c.addData( pData->buffer + pData->length );
560  *end = '\0';
561  pData->length = l;
562  return *this;
563  }
564 #endif
565 
578  {
580  return append( sz, rtl_str_valueOfBoolean( sz, b ) );
581  }
582 
597  {
599  return append( sz, rtl_str_valueOfBoolean( sz, b ) );
600  }
601 
603  // Pointer can be automatically converted to bool, which is unwanted here.
604  // Explicitly delete all pointer append() overloads to prevent this
605  // (except for char* overload, which is handled elsewhere).
606  template< typename T >
607  typename libreoffice_internal::Enable< void,
609  append( T* ) SAL_DELETED_FUNCTION;
611 
623  {
624  return append( &c, 1 );
625  }
626 
639  OStringBuffer & append(sal_Int32 i, sal_Int16 radix = 10 )
640  {
642  return append( sz, rtl_str_valueOfInt32( sz, i, radix ) );
643  }
644 
657  OStringBuffer & append(sal_Int64 l, sal_Int16 radix = 10 )
658  {
660  return append( sz, rtl_str_valueOfInt64( sz, l, radix ) );
661  }
662 
675  {
677  return append( sz, rtl_str_valueOfFloat( sz, f ) );
678  }
679 
691  OStringBuffer & append(double d)
692  {
694  return append( sz, rtl_str_valueOfDouble( sz, d ) );
695  }
696 
712  char * appendUninitialized(sal_Int32 length) SAL_RETURNS_NONNULL {
713  sal_Int32 n = getLength();
714  rtl_stringbuffer_insert(&pData, &nCapacity, n, NULL, length);
715  return pData->buffer + n;
716  }
717 
733  OStringBuffer & insert(sal_Int32 offset, const OString & str)
734  {
735  return insert( offset, str.getStr(), str.getLength() );
736  }
737 
755  template< typename T >
757  {
758  return insert( offset, str, rtl_str_getLength( str ) );
759  }
760 
761  template< typename T >
763  {
764  return insert( offset, str, rtl_str_getLength( str ) );
765  }
766 
772  template< typename T >
774  {
775  RTL_STRING_CONST_FUNCTION
776  assert(
779  &pData, &nCapacity, offset,
782  return *this;
783  }
784 
803  OStringBuffer & insert( sal_Int32 offset, const sal_Char * str, sal_Int32 len)
804  {
805  assert( len == 0 || str != NULL ); // cannot assert that in rtl_stringbuffer_insert
806  rtl_stringbuffer_insert( &pData, &nCapacity, offset, str, len );
807  return *this;
808  }
809 
827  OStringBuffer & insert(sal_Int32 offset, sal_Bool b)
828  {
830  return insert( offset, sz, rtl_str_valueOfBoolean( sz, b ) );
831  }
832 
852  OStringBuffer & insert(sal_Int32 offset, bool b)
853  {
855  return insert( offset, sz, rtl_str_valueOfBoolean( sz, b ) );
856  }
857 
874  OStringBuffer & insert(sal_Int32 offset, sal_Char c)
875  {
876  return insert( offset, &c, 1 );
877  }
878 
897  OStringBuffer & insert(sal_Int32 offset, sal_Int32 i, sal_Int16 radix = 10 )
898  {
900  return insert( offset, sz, rtl_str_valueOfInt32( sz, i, radix ) );
901  }
902 
921  OStringBuffer & insert(sal_Int32 offset, sal_Int64 l, sal_Int16 radix = 10 )
922  {
924  return insert( offset, sz, rtl_str_valueOfInt64( sz, l, radix ) );
925  }
926 
944  OStringBuffer insert(sal_Int32 offset, float f)
945  {
947  return insert( offset, sz, rtl_str_valueOfFloat( sz, f ) );
948  }
949 
967  OStringBuffer & insert(sal_Int32 offset, double d)
968  {
970  return insert( offset, sz, rtl_str_valueOfDouble( sz, d ) );
971  }
972 
985  OStringBuffer & remove( sal_Int32 start, sal_Int32 len )
986  {
987  rtl_stringbuffer_remove( &pData, start, len );
988  return *this;
989  }
990 
1009  rtl_String *** pInternalData, sal_Int32 ** pInternalCapacity)
1010  {
1011  *pInternalData = &pData;
1012  *pInternalCapacity = &nCapacity;
1013  }
1014 
1015 private:
1019  rtl_String * pData;
1020 
1024  sal_Int32 nCapacity;
1025 };
1026 
1027 }
1028 
1029 #ifdef RTL_STRING_UNITTEST
1030 namespace rtl
1031 {
1032 typedef rtlunittest::OStringBuffer OStringBuffer;
1033 }
1034 #undef RTL_STRING_CONST_FUNCTION
1035 #endif
1036 
1037 #if defined LIBO_INTERNAL_ONLY && !defined RTL_STRING_UNITTEST
1038 using ::rtl::OStringBuffer;
1039 #endif
1040 
1041 #endif // INCLUDED_RTL_STRBUF_HXX
1042 
1043 
1044 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SAL_DLLPUBLIC sal_Int32 rtl_str_valueOfBoolean(sal_Char *str, sal_Bool b) SAL_THROW_EXTERN_C()
Create the string representation of a boolean.
OStringBuffer & insert(sal_Int32 offset, sal_Int64 l, sal_Int16 radix=10)
Inserts the string representation of the long argument into this string buffer.
Definition: strbuf.hxx:921
OStringBuffer & append(const OString &str)
Appends the string to this string buffer.
Definition: strbuf.hxx:480
OStringBuffer(T &literal, typename libreoffice_internal::ConstCharArrayDetector< T, libreoffice_internal::Dummy >::Type=libreoffice_internal::Dummy())
Constructs a string buffer so that it represents the same sequence of characters as the string litera...
Definition: strbuf.hxx:177
OStringBuffer(int length)
Constructs a string buffer with no characters in it and an initial capacity specified by the length a...
Definition: strbuf.hxx:99
SAL_DLLPUBLIC void rtl_stringbuffer_ensureCapacity(rtl_String **This, sal_Int32 *capacity, sal_Int32 minimumCapacity)
Ensures that the capacity of the buffer is at least equal to the specified minimum.
bool isEmpty() const
Checks if a string buffer is empty.
Definition: strbuf.hxx:335
#define RTL_STR_MAX_VALUEOFDOUBLE
Definition: string.h:711
libreoffice_internal::CharPtrDetector< T, OStringBuffer & >::Type append(const T &str)
Appends the string representation of the char array argument to this string buffer.
Definition: strbuf.hxx:497
char sal_Char
A legacy synonym for char.
Definition: types.h:121
OStringBuffer & insert(sal_Int32 offset, const sal_Char *str, sal_Int32 len)
Inserts the string representation of the char array argument into this string buffer.
Definition: strbuf.hxx:803
libreoffice_internal::NonConstCharArrayDetector< T, OStringBuffer & >::Type append(T &str)
Definition: strbuf.hxx:503
const OString toString() const
Return a OString instance reflecting the current content of this OStringBuffer.
Definition: strbuf.hxx:465
OStringBuffer(const OString &value)
Constructs a string buffer so that it represents the same sequence of characters as the string argume...
Definition: strbuf.hxx:136
SAL_DLLPUBLIC void rtl_string_new_WithLength(rtl_String **newStr, sal_Int32 len) SAL_THROW_EXTERN_C()
Allocate a new string containing space for a given number of characters.
#define SAL_DELETED_FUNCTION
short-circuit extra-verbose API namespaces
Definition: types.h:402
SAL_DLLPUBLIC sal_Int32 rtl_stringbuffer_newFromStringBuffer(rtl_String **newStr, sal_Int32 capacity, rtl_String *oldStr)
Allocates a new String that contains the same sequence of characters as the string argument...
#define SAL_WARN_UNUSED
Annotate classes where a compiler should warn if an instance is unused.
Definition: types.h:608
SAL_DLLPUBLIC void rtl_string_newFromLiteral(rtl_String **newStr, const sal_Char *value, sal_Int32 len, sal_Int32 allocExtra) SAL_THROW_EXTERN_C()
libreoffice_internal::CharPtrDetector< T, OStringBuffer & >::Type insert(sal_Int32 offset, const T &str)
Inserts the string representation of the char array argument into this string buffer.
Definition: strbuf.hxx:756
~OStringBuffer()
Release the string data.
Definition: strbuf.hxx:296
SAL_WARN_UNUSED_RESULT OString makeStringAndClear()
Fill the string data in the new string and clear the buffer.
Definition: strbuf.hxx:309
OStringBuffer & append(const sal_Char *str, sal_Int32 len)
Appends the string representation of the char array argument to this string buffer.
Definition: strbuf.hxx:539
OStringBuffer(T &value, typename libreoffice_internal::NonConstCharArrayDetector< T, libreoffice_internal::Dummy >::Type=libreoffice_internal::Dummy())
Definition: strbuf.hxx:157
Definition: stringutils.hxx:267
OStringBuffer & insert(sal_Int32 offset, sal_Char c)
Inserts the string representation of the char argument into this string buffer.
Definition: strbuf.hxx:874
const sal_Char * getStr() const SAL_RETURNS_NONNULL
Returns a pointer to the characters of this string.
Definition: string.hxx:428
OStringBuffer & insert(sal_Int32 offset, sal_Bool b)
Inserts the string representation of the sal_Bool argument into this string buffer.
Definition: strbuf.hxx:827
const sal_Char * getStr() const SAL_RETURNS_NONNULL
Return a null terminated character array.
Definition: strbuf.hxx:444
OStringBuffer()
Constructs a string buffer with no characters in it and an initial capacity of 16 characters...
Definition: strbuf.hxx:73
void setLength(sal_Int32 newLength)
Sets the length of this String buffer.
Definition: strbuf.hxx:389
void ensureCapacity(sal_Int32 minimumCapacity)
Ensures that the capacity of the buffer is at least equal to the specified minimum.
Definition: strbuf.hxx:366
SAL_DLLPUBLIC void rtl_stringbuffer_remove(rtl_String **This, sal_Int32 start, sal_Int32 len)
Removes the characters in a substring of this sequence.
OStringBuffer & append(bool b)
Appends the string representation of the bool argument to the string buffer.
Definition: strbuf.hxx:596
SAL_DLLPUBLIC void rtl_stringbuffer_newFromStr_WithLength(rtl_String **newStr, const sal_Char *value, sal_Int32 count)
Allocates a new String that contains characters from the character array argument.
unsigned char sal_Bool
Definition: types.h:39
OStringBuffer(const OStringBuffer &value)
Allocates a new string buffer that contains the same sequence of characters as the string buffer argu...
Definition: strbuf.hxx:86
SAL_DLLPUBLIC sal_Int32 rtl_str_valueOfInt64(sal_Char *str, sal_Int64 l, sal_Int16 radix) SAL_THROW_EXTERN_C()
Create the string representation of a long integer.
OStringBuffer(const sal_Char *value, sal_Int32 length)
Constructs a string buffer so that it represents the same sequence of characters as the string argume...
Definition: strbuf.hxx:204
#define SAL_WARN_UNUSED_RESULT
Use this as markup for functions and methods whose return value must be checked.
Definition: types.h:307
SAL_DLLPUBLIC void rtl_stringbuffer_insert(rtl_String **This, sal_Int32 *capacity, sal_Int32 offset, const sal_Char *str, sal_Int32 len)
Inserts the string representation of the char array argument into this string buffer.
Definition: stringutils.hxx:117
sal_uInt16 sal_Unicode
Definition: types.h:142
OStringBuffer & insert(sal_Int32 offset, const OString &str)
Inserts the string into this string buffer.
Definition: strbuf.hxx:733
SAL_DLLPUBLIC sal_Int32 rtl_str_valueOfFloat(sal_Char *str, float f) SAL_THROW_EXTERN_C()
Create the string representation of a float.
#define RTL_STR_MAX_VALUEOFBOOLEAN
Definition: string.h:585
SAL_DLLPUBLIC sal_Int32 rtl_str_valueOfDouble(sal_Char *str, double d) SAL_THROW_EXTERN_C()
Create the string representation of a double.
OStringBuffer & append(float f)
Appends the string representation of the float argument to this string buffer.
Definition: strbuf.hxx:674
SAL_DLLPUBLIC void rtl_string_release(rtl_String *str) SAL_THROW_EXTERN_C()
Decrement the reference count of a string.
A string buffer implements a mutable sequence of characters.
Definition: strbuf.hxx:66
char * appendUninitialized(sal_Int32 length) SAL_RETURNS_NONNULL
Unsafe way to make space for a fixed amount of characters to be appended into this OStringBuffer...
Definition: strbuf.hxx:712
OStringBuffer & insert(sal_Int32 offset, sal_Int32 i, sal_Int16 radix=10)
Inserts the string representation of the second sal_Int32 argument into this string buffer...
Definition: strbuf.hxx:897
OStringBuffer & append(sal_Bool b)
Appends the string representation of the sal_Bool argument to the string buffer.
Definition: strbuf.hxx:577
libreoffice_internal::NonConstCharArrayDetector< T, OStringBuffer & >::Type insert(sal_Int32 offset, T &str)
Definition: strbuf.hxx:762
Definition: bootstrap.hxx:29
OStringBuffer & append(sal_Char c)
Appends the string representation of the char argument to this string buffer.
Definition: strbuf.hxx:622
void accessInternals(rtl_String ***pInternalData, sal_Int32 **pInternalCapacity)
Allows access to the internal data of this OStringBuffer, for effective manipulation.
Definition: strbuf.hxx:1008
#define SAL_DEPRECATED(message)
Use as follows: SAL_DEPRECATED("Don&#39;t use, it&#39;s evil.") void doit(int nPara);.
Definition: types.h:493
OStringBuffer insert(sal_Int32 offset, float f)
Inserts the string representation of the float argument into this string buffer.
Definition: strbuf.hxx:944
SAL_DLLPUBLIC void rtl_string_new(rtl_String **newStr) SAL_THROW_EXTERN_C()
Allocate a new string containing no characters.
OStringBuffer & insert(sal_Int32 offset, bool b)
Inserts the string representation of the bool argument into this string buffer.
Definition: strbuf.hxx:852
libreoffice_internal::ConstCharArrayDetector< T, OStringBuffer & >::Type append(T &literal)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: strbuf.hxx:514
sal_Int32 getLength() const
Returns the length of this string.
Definition: string.hxx:402
SAL_DLLPUBLIC sal_Int32 rtl_str_valueOfInt32(sal_Char *str, sal_Int32 i, sal_Int16 radix) SAL_THROW_EXTERN_C()
Create the string representation of an integer.
SAL_DLLPUBLIC sal_Int32 rtl_str_getLength(const sal_Char *str) SAL_THROW_EXTERN_C()
Return the length of a string.
OStringBuffer(const T &value, typename libreoffice_internal::CharPtrDetector< T, libreoffice_internal::Dummy >::Type=libreoffice_internal::Dummy())
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: strbuf.hxx:148
Definition: stringutils.hxx:115
OStringBuffer & append(sal_Int64 l, sal_Int16 radix=10)
Appends the string representation of the long argument to this string buffer.
Definition: strbuf.hxx:657
OStringBuffer & append(double d)
Appends the string representation of the double argument to this string buffer.
Definition: strbuf.hxx:691
OStringBuffer & append(sal_Int32 i, sal_Int16 radix=10)
Appends the string representation of the sal_Int32 argument to this string buffer.
Definition: strbuf.hxx:639
SAL_DLLPUBLIC rtl_String * rtl_string_alloc(sal_Int32 nLen) SAL_THROW_EXTERN_C()
Allocate a new string containing space for a given number of characters.
libreoffice_internal::ConstCharArrayDetector< T, OStringBuffer & >::Type insert(sal_Int32 offset, T &literal)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: strbuf.hxx:773
#define RTL_STR_MAX_VALUEOFINT64
Definition: string.h:650
sal_Int32 getCapacity() const
Returns the current capacity of the String buffer.
Definition: strbuf.hxx:350
#define RTL_STR_MAX_VALUEOFINT32
Definition: string.h:627
sal_Int32 getLength() const
Returns the length (character count) of this string buffer.
Definition: strbuf.hxx:322
#define RTL_STR_MAX_VALUEOFFLOAT
Definition: string.h:692
This String class provide base functionality for C++ like 8-Bit character array handling.
Definition: string.hxx:94
OStringBuffer & insert(sal_Int32 offset, double d)
Inserts the string representation of the double argument into this string buffer. ...
Definition: strbuf.hxx:967