LibreOffice
LibreOffice 6.4 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 <cstring>
27 
28 #include "rtl/strbuf.h"
29 #include "rtl/string.hxx"
30 #include "rtl/stringutils.hxx"
31 
32 #ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
33 #include "rtl/stringconcat.hxx"
34 #endif
35 
36 #ifdef RTL_STRING_UNITTEST
37 extern bool rtl_string_unittest_const_literal;
38 extern bool rtl_string_unittest_const_literal_function;
39 #endif
40 
41 // The unittest uses slightly different code to help check that the proper
42 // calls are made. The class is put into a different namespace to make
43 // sure the compiler generates a different (if generating also non-inline)
44 // copy of the function and does not merge them together. The class
45 // is "brought" into the proper rtl namespace by a typedef below.
46 #ifdef RTL_STRING_UNITTEST
47 #define rtl rtlunittest
48 #endif
49 
50 namespace rtl
51 {
52 
54 #ifdef RTL_STRING_UNITTEST
55 #undef rtl
56 // helper macro to make functions appear more readable
57 #define RTL_STRING_CONST_FUNCTION rtl_string_unittest_const_literal_function = true;
58 #else
59 #define RTL_STRING_CONST_FUNCTION
60 #endif
61 
66 {
67 public:
73  : pData(NULL)
74  , nCapacity( 16 )
75  {
76  rtl_string_new_WithLength( &pData, nCapacity );
77  }
78 
85  OStringBuffer( const OStringBuffer & value )
86  : pData(NULL)
87  , nCapacity( value.nCapacity )
88  {
89  rtl_stringbuffer_newFromStringBuffer( &pData, value.nCapacity, value.pData );
90  }
91 
98  explicit OStringBuffer(int length)
99  : pData(NULL)
100  , nCapacity( length )
101  {
102  rtl_string_new_WithLength( &pData, length );
103  }
104 #if __cplusplus >= 201103L
105  explicit OStringBuffer(unsigned int length)
106  : OStringBuffer(static_cast<int>(length))
107  {
108  }
109 #if SAL_TYPES_SIZEOFLONG == 4
110  // additional overloads for sal_Int32 sal_uInt32
111  explicit OStringBuffer(long length)
112  : OStringBuffer(static_cast<int>(length))
113  {
114  }
115  explicit OStringBuffer(unsigned long length)
116  : OStringBuffer(static_cast<int>(length))
117  {
118  }
119 #endif
120  // avoid obvious bugs
121  explicit OStringBuffer(char) = delete;
122  explicit OStringBuffer(sal_Unicode) = delete;
123 #endif
124 
135  OStringBuffer(const OString& value)
136  : pData(NULL)
137  , nCapacity( value.getLength() + 16 )
138  {
139  rtl_stringbuffer_newFromStr_WithLength( &pData, value.getStr(), value.getLength() );
140  }
141 
146  template< typename T >
148  : pData(NULL)
149  {
150  sal_Int32 length = rtl_str_getLength( value );
151  nCapacity = length + 16;
152  rtl_stringbuffer_newFromStr_WithLength( &pData, value, length );
153  }
154 
155  template< typename T >
157  : pData(NULL)
158  {
159  sal_Int32 length = rtl_str_getLength( value );
160  nCapacity = length + 16;
161  rtl_stringbuffer_newFromStr_WithLength( &pData, value, length );
162  }
163 
175  template< typename T >
177  : pData(NULL)
178  , nCapacity( libreoffice_internal::ConstCharArrayDetector<T>::length + 16 )
179  {
180  assert(
183  &pData,
186 #ifdef RTL_STRING_UNITTEST
187  rtl_string_unittest_const_literal = true;
188 #endif
189  }
190 
203  OStringBuffer(const sal_Char * value, sal_Int32 length)
204  : pData(NULL)
205  , nCapacity( length + 16 )
206  {
207  rtl_stringbuffer_newFromStr_WithLength( &pData, value, length );
208  }
209 
210 #ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
211 
215  template< typename T1, typename T2 >
216  OStringBuffer( OStringConcat< T1, T2 >&& c )
217  {
218  const sal_Int32 l = c.length();
219  nCapacity = l + 16;
220  pData = rtl_string_alloc( nCapacity );
221  char* end = c.addData( pData->buffer );
222  *end = '\0';
223  pData->length = l;
224  }
225 
230  template< typename T >
231  OStringBuffer( OStringNumber< T >&& n )
232  : OStringBuffer( OString( n ))
233  {}
234 #endif
235 
238  OStringBuffer& operator = ( const OStringBuffer& value )
239  {
240  if (this != &value)
241  {
243  value.nCapacity,
244  value.pData);
245  nCapacity = value.nCapacity;
246  }
247  return *this;
248  }
249 
254  OStringBuffer & operator =(OString const & string) {
255  sal_Int32 n = string.getLength();
256  if (n >= nCapacity) {
257  ensureCapacity(n + 16); //TODO: check for overflow
258  }
259  std::memcpy(pData->buffer, string.pData->buffer, n + 1);
260  pData->length = n;
261  return *this;
262  }
263 
268  template<typename T>
269  typename
271  operator =(T & literal) {
272  assert(
274  sal_Int32 const n
276  if (n >= nCapacity) {
277  ensureCapacity(n + 16); //TODO: check for overflow
278  }
279  std::memcpy(
280  pData->buffer,
282  n + 1);
283  pData->length = n;
284  return *this;
285  }
286 
287 #if defined LIBO_INTERNAL_ONLY
288 
289  template<typename T1, typename T2>
290  OStringBuffer & operator =(OStringConcat<T1, T2> && concat) {
291  sal_Int32 const n = concat.length();
292  if (n >= nCapacity) {
293  ensureCapacity(n + 16); //TODO: check for overflow
294  }
295  *concat.addData(pData->buffer) = 0;
296  pData->length = n;
297  return *this;
298  }
299 
301  template<typename T>
302  OStringBuffer & operator =(OStringNumber<T> && n)
303  {
304  return *this = OStringBuffer( std::move ( n ));
305  }
306 #endif
307 
312  {
313  rtl_string_release( pData );
314  }
315 
325  {
326  OString aRet( pData );
327  rtl_string_new(&pData);
328  nCapacity = 0;
329  return aRet;
330  }
331 
337  sal_Int32 getLength() const
338  {
339  return pData->length;
340  }
341 
350  bool isEmpty() const
351  {
352  return pData->length == 0;
353  }
354 
365  sal_Int32 getCapacity() const
366  {
367  return nCapacity;
368  }
369 
381  void ensureCapacity(sal_Int32 minimumCapacity)
382  {
383  rtl_stringbuffer_ensureCapacity( &pData, &nCapacity, minimumCapacity );
384  }
385 
404  void setLength(sal_Int32 newLength)
405  {
406  assert(newLength >= 0);
407  // Avoid modifications if pData points to const empty string:
408  if( newLength != pData->length )
409  {
410  if( newLength > nCapacity )
411  rtl_stringbuffer_ensureCapacity(&pData, &nCapacity, newLength);
412  else
413  pData->buffer[newLength] = '\0';
414  pData->length = newLength;
415  }
416  }
417 
431  SAL_DEPRECATED("use rtl::OStringBuffer::operator [] instead")
432  sal_Char charAt( sal_Int32 index )
433  {
434  assert(index >= 0 && index < pData->length);
435  return pData->buffer[ index ];
436  }
437 
448  SAL_DEPRECATED("use rtl::OStringBuffer::operator [] instead")
449  OStringBuffer & setCharAt(sal_Int32 index, sal_Char ch)
450  {
451  assert(index >= 0 && index < pData->length);
452  pData->buffer[ index ] = ch;
453  return *this;
454  }
455 
459  const sal_Char* getStr() const SAL_RETURNS_NONNULL { return pData->buffer; }
460 
470  sal_Char & operator [](sal_Int32 index)
471  {
472  assert(index >= 0 && index < pData->length);
473  return pData->buffer[index];
474  }
475 
480  const OString toString() const
481  {
482  return OString(pData->buffer, pData->length);
483  }
484 
496  {
497  return append( str.getStr(), str.getLength() );
498  }
499 
511  template< typename T >
513  {
514  return append( str, rtl_str_getLength( str ) );
515  }
516 
517  template< typename T >
519  {
520  return append( str, rtl_str_getLength( str ) );
521  }
522 
528  template< typename T >
530  {
531  RTL_STRING_CONST_FUNCTION
532  assert(
534  return append(
537  }
538 
552  OStringBuffer & append( const sal_Char * str, sal_Int32 len)
553  {
554  assert( len == 0 || str != NULL ); // cannot assert that in rtl_stringbuffer_insert
555  rtl_stringbuffer_insert( &pData, &nCapacity, getLength(), str, len );
556  return *this;
557  }
558 
559 #ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
560 
564  template< typename T1, typename T2 >
565  OStringBuffer& append( OStringConcat< T1, T2 >&& c )
566  {
567  sal_Int32 l = c.length();
568  if( l == 0 )
569  return *this;
570  l += pData->length;
571  rtl_stringbuffer_ensureCapacity( &pData, &nCapacity, l );
572  char* end = c.addData( pData->buffer + pData->length );
573  *end = '\0';
574  pData->length = l;
575  return *this;
576  }
577 
582  template< typename T >
583  OStringBuffer& append( OStringNumber< T >&& c )
584  {
585  return append( c.buf, c.length );
586  }
587 
588 #endif
589 
602  {
604  return append( sz, rtl_str_valueOfBoolean( sz, b ) );
605  }
606 
621  {
623  return append( sz, rtl_str_valueOfBoolean( sz, b ) );
624  }
625 
627  // Pointer can be automatically converted to bool, which is unwanted here.
628  // Explicitly delete all pointer append() overloads to prevent this
629  // (except for char* overload, which is handled elsewhere).
630  template< typename T >
631  typename libreoffice_internal::Enable< void,
633  append( T* ) SAL_DELETED_FUNCTION;
635 
647  {
648  return append( &c, 1 );
649  }
650 
663  OStringBuffer & append(sal_Int32 i, sal_Int16 radix = 10 )
664  {
666  return append( sz, rtl_str_valueOfInt32( sz, i, radix ) );
667  }
668 
681  OStringBuffer & append(sal_Int64 l, sal_Int16 radix = 10 )
682  {
684  return append( sz, rtl_str_valueOfInt64( sz, l, radix ) );
685  }
686 
699  {
701  return append( sz, rtl_str_valueOfFloat( sz, f ) );
702  }
703 
715  OStringBuffer & append(double d)
716  {
718  return append( sz, rtl_str_valueOfDouble( sz, d ) );
719  }
720 
736  char * appendUninitialized(sal_Int32 length) SAL_RETURNS_NONNULL {
737  sal_Int32 n = getLength();
738  rtl_stringbuffer_insert(&pData, &nCapacity, n, NULL, length);
739  return pData->buffer + n;
740  }
741 
757  OStringBuffer & insert(sal_Int32 offset, const OString & str)
758  {
759  return insert( offset, str.getStr(), str.getLength() );
760  }
761 
779  template< typename T >
781  {
782  return insert( offset, str, rtl_str_getLength( str ) );
783  }
784 
785  template< typename T >
787  {
788  return insert( offset, str, rtl_str_getLength( str ) );
789  }
790 
796  template< typename T >
798  {
799  RTL_STRING_CONST_FUNCTION
800  assert(
802  return insert(
803  offset,
806  }
807 
826  OStringBuffer & insert( sal_Int32 offset, const sal_Char * str, sal_Int32 len)
827  {
828  assert( len == 0 || str != NULL ); // cannot assert that in rtl_stringbuffer_insert
829  rtl_stringbuffer_insert( &pData, &nCapacity, offset, str, len );
830  return *this;
831  }
832 
850  OStringBuffer & insert(sal_Int32 offset, sal_Bool b)
851  {
853  return insert( offset, sz, rtl_str_valueOfBoolean( sz, b ) );
854  }
855 
875  OStringBuffer & insert(sal_Int32 offset, bool b)
876  {
878  return insert( offset, sz, rtl_str_valueOfBoolean( sz, b ) );
879  }
880 
897  OStringBuffer & insert(sal_Int32 offset, sal_Char c)
898  {
899  return insert( offset, &c, 1 );
900  }
901 
920  OStringBuffer & insert(sal_Int32 offset, sal_Int32 i, sal_Int16 radix = 10 )
921  {
923  return insert( offset, sz, rtl_str_valueOfInt32( sz, i, radix ) );
924  }
925 
944  OStringBuffer & insert(sal_Int32 offset, sal_Int64 l, sal_Int16 radix = 10 )
945  {
947  return insert( offset, sz, rtl_str_valueOfInt64( sz, l, radix ) );
948  }
949 
967  OStringBuffer insert(sal_Int32 offset, float f)
968  {
970  return insert( offset, sz, rtl_str_valueOfFloat( sz, f ) );
971  }
972 
990  OStringBuffer & insert(sal_Int32 offset, double d)
991  {
993  return insert( offset, sz, rtl_str_valueOfDouble( sz, d ) );
994  }
995 
1008  OStringBuffer & remove( sal_Int32 start, sal_Int32 len )
1009  {
1010  rtl_stringbuffer_remove( &pData, start, len );
1011  return *this;
1012  }
1013 
1032  rtl_String *** pInternalData, sal_Int32 ** pInternalCapacity)
1033  {
1034  *pInternalData = &pData;
1035  *pInternalCapacity = &nCapacity;
1036  }
1037 
1038 #if defined LIBO_INTERNAL_ONLY
1039  explicit operator OStringView() const
1040  {
1041  return OStringView(getStr(), getLength());
1042  }
1043 #endif
1044 
1045 private:
1049  rtl_String * pData;
1050 
1054  sal_Int32 nCapacity;
1055 };
1056 
1057 }
1058 
1059 #ifdef RTL_STRING_UNITTEST
1060 namespace rtl
1061 {
1062 typedef rtlunittest::OStringBuffer OStringBuffer;
1063 }
1064 #undef RTL_STRING_CONST_FUNCTION
1065 #endif
1066 
1067 #if defined LIBO_INTERNAL_ONLY && !defined RTL_STRING_UNITTEST
1068 using ::rtl::OStringBuffer;
1069 #endif
1070 
1071 #endif // INCLUDED_RTL_STRBUF_HXX
1072 
1073 
1074 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
OStringBuffer & insert(sal_Int32 offset, const OString &str)
Inserts the string into this string buffer.
Definition: strbuf.hxx:757
OStringBuffer(int length)
Constructs a string buffer with no characters in it and an initial capacity specified by the length a...
Definition: strbuf.hxx:98
sal_Int32 getLength() const
Returns the length of this string.
Definition: string.hxx:433
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:920
OStringBuffer & insert(sal_Int32 offset, bool b)
Inserts the string representation of the bool argument into this string buffer.
Definition: strbuf.hxx:875
void setLength(sal_Int32 newLength)
Sets the length of this String buffer.
Definition: strbuf.hxx:404
#define RTL_STR_MAX_VALUEOFINT32
Definition: string.h:627
OStringBuffer & append(sal_Bool b)
Appends the string representation of the sal_Bool argument to the string buffer.
Definition: strbuf.hxx:601
OStringBuffer & insert(sal_Int32 offset, sal_Char c)
Inserts the string representation of the char argument into this string buffer.
Definition: strbuf.hxx:897
#define RTL_STR_MAX_VALUEOFFLOAT
Definition: string.h:692
const sal_Char * getStr() const SAL_RETURNS_NONNULL
Return a null terminated character array.
Definition: strbuf.hxx:459
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.
#define RTL_STR_MAX_VALUEOFINT64
Definition: string.h:650
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:203
SAL_DLLPUBLIC void rtl_string_newFromLiteral(rtl_String **newStr, const sal_Char *value, sal_Int32 len, sal_Int32 allocExtra) SAL_THROW_EXTERN_C()
OStringBuffer & append(const OString &str)
Appends the string to this string buffer.
Definition: strbuf.hxx:495
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:552
~OStringBuffer()
Release the string data.
Definition: strbuf.hxx:311
A string buffer implements a mutable sequence of characters.
Definition: strbuf.hxx:65
OStringBuffer & append(bool b)
Appends the string representation of the bool argument to the string buffer.
Definition: strbuf.hxx:620
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:176
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:736
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.
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:826
#define SAL_DELETED_FUNCTION
short-circuit extra-verbose API namespaces
Definition: types.h:396
const OString toString() const
Return an OString instance reflecting the current content of this OStringBuffer.
Definition: strbuf.hxx:480
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.
OStringBuffer insert(sal_Int32 offset, float f)
Inserts the string representation of the float argument into this string buffer.
Definition: strbuf.hxx:967
OStringBuffer(const OString &value)
Constructs a string buffer so that it represents the same sequence of characters as the string argume...
Definition: strbuf.hxx:135
SAL_DLLPUBLIC void rtl_string_new(rtl_String **newStr) SAL_THROW_EXTERN_C()
Allocate a new string containing no characters.
Definition: stringutils.hxx:130
#define SAL_DEPRECATED(message)
Use as follows: SAL_DEPRECATED("Don&#39;t use, it&#39;s evil.") void doit(int nPara);.
Definition: types.h:465
#define SAL_WARN_UNUSED
Annotate classes where a compiler should warn if an instance is unused.
Definition: types.h:578
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.
libreoffice_internal::NonConstCharArrayDetector< T, OStringBuffer &>::Type append(T &str)
Definition: strbuf.hxx:518
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:780
sal_Int32 getCapacity() const
Returns the current capacity of the String buffer.
Definition: strbuf.hxx:365
SAL_DLLPUBLIC void rtl_stringbuffer_remove(rtl_String **This, sal_Int32 start, sal_Int32 len)
Removes the characters in a substring of this sequence.
SAL_DLLPUBLIC void rtl_string_release(rtl_String *str) SAL_THROW_EXTERN_C()
Decrement the reference count of a string.
#define RTL_STR_MAX_VALUEOFDOUBLE
Definition: string.h:711
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:663
sal_uInt16 sal_Unicode
Definition: types.h:141
sal_Int32 getLength() const
Returns the length (character count) of this string buffer.
Definition: strbuf.hxx:337
void ensureCapacity(sal_Int32 minimumCapacity)
Ensures that the capacity of the buffer is at least equal to the specified minimum.
Definition: strbuf.hxx:381
unsigned char sal_Bool
Definition: types.h:38
const sal_Char * getStr() const SAL_RETURNS_NONNULL
Returns a pointer to the characters of this string.
Definition: string.hxx:459
#define RTL_STR_MAX_VALUEOFBOOLEAN
Definition: string.h:585
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 ...
Definition: strbuf.hxx:797
OStringBuffer & append(sal_Char c)
Appends the string representation of the char argument to this string buffer.
Definition: strbuf.hxx:646
Definition: stringutils.hxx:337
OStringBuffer()
Constructs a string buffer with no characters in it and an initial capacity of 16 characters...
Definition: strbuf.hxx:72
Definition: bootstrap.hxx:29
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.
SAL_DLLPUBLIC sal_Int32 rtl_str_getLength(const sal_Char *str) SAL_THROW_EXTERN_C()
Return the length of a string.
libreoffice_internal::NonConstCharArrayDetector< T, OStringBuffer &>::Type insert(sal_Int32 offset, T &str)
Definition: strbuf.hxx:786
This String class provide base functionality for C++ like 8-Bit character array handling.
Definition: string.hxx:97
OStringBuffer & append(float f)
Appends the string representation of the float argument to this string buffer.
Definition: strbuf.hxx:698
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, double d)
Inserts the string representation of the double argument into this string buffer. ...
Definition: strbuf.hxx:990
OStringBuffer(T &value, typename libreoffice_internal::NonConstCharArrayDetector< T, libreoffice_internal::Dummy >::Type=libreoffice_internal::Dummy())
Definition: strbuf.hxx:156
libreoffice_internal::ConstCharArrayDetector< T, OStringBuffer &>::Type append(T &literal)
This is an overloaded member function, provided for convenience. It differs from the above function ...
Definition: strbuf.hxx:529
OStringBuffer & insert(sal_Int32 offset, sal_Bool b)
Inserts the string representation of the sal_Bool argument into this string buffer.
Definition: strbuf.hxx:850
Definition: stringutils.hxx:132
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_RESULT
Use this as markup for functions and methods whose return value must be checked.
Definition: types.h:302
char sal_Char
A legacy synonym for char.
Definition: types.h:120
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:512
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:944
OStringBuffer(const OStringBuffer &value)
Allocates a new string buffer that contains the same sequence of characters as the string buffer argu...
Definition: strbuf.hxx:85
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 & append(double d)
Appends the string representation of the double argument to this string buffer.
Definition: strbuf.hxx:715
bool isEmpty() const
Checks if a string buffer is empty.
Definition: strbuf.hxx:350
SAL_DLLPUBLIC sal_Int32 rtl_str_valueOfFloat(sal_Char *str, float f) SAL_THROW_EXTERN_C()
Create the string representation of a float.
SAL_DLLPUBLIC sal_Int32 rtl_str_valueOfDouble(sal_Char *str, double d) SAL_THROW_EXTERN_C()
Create the string representation of a double.
SAL_WARN_UNUSED_RESULT OString makeStringAndClear()
Fill the string data in the new string and clear the buffer.
Definition: strbuf.hxx:324
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:147
OStringBuffer & append(sal_Int64 l, sal_Int16 radix=10)
Appends the string representation of the long argument to this string buffer.
Definition: strbuf.hxx:681
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.
void accessInternals(rtl_String ***pInternalData, sal_Int32 **pInternalCapacity)
Allows access to the internal data of this OStringBuffer, for effective manipulation.
Definition: strbuf.hxx:1031