LibreOffice LibreOffice 5.3 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 // The unittest uses slightly different code to help check that the proper
38 // calls are made. The class is put into a different namespace to make
39 // sure the compiler generates a different (if generating also non-inline)
40 // copy of the function and does not merge them together. The class
41 // is "brought" into the proper rtl namespace by a typedef below.
42 #ifdef RTL_STRING_UNITTEST
43 #define rtl rtlunittest
44 #endif
45
46 namespace rtl
47 {
48
50 #ifdef RTL_STRING_UNITTEST
51 #undef rtl
52 // helper macro to make functions appear more readable
53 #define RTL_STRING_CONST_FUNCTION rtl_string_unittest_const_literal_function = true;
54 #else
55 #define RTL_STRING_CONST_FUNCTION
56 #endif
57
61 class SAL_WARN_UNUSED OStringBuffer
62 {
63 public:
68 OStringBuffer()
69 : pData(NULL)
70 , nCapacity( 16 )
71 {
72 rtl_string_new_WithLength( &pData, nCapacity );
73 }
74
81 OStringBuffer( const OStringBuffer & value )
82 : pData(NULL)
83 , nCapacity( value.nCapacity )
84 {
85 rtl_stringbuffer_newFromStringBuffer( &pData, value.nCapacity, value.pData );
86 }
87
94 explicit OStringBuffer(int length)
95 : pData(NULL)
96 , nCapacity( length )
97 {
98 rtl_string_new_WithLength( &pData, length );
99 }
100 #if __cplusplus >= 201103L
101 explicit OStringBuffer(unsigned int length)
102 : OStringBuffer(static_cast<int>(length))
103 {
104 }
105 #if SAL_TYPES_SIZEOFLONG == 4
106 // additional overloads for sal_Int32 sal_uInt32
107 explicit OStringBuffer(long length)
108 : OStringBuffer(static_cast<int>(length))
109 {
110 }
111 explicit OStringBuffer(unsigned long length)
112 : OStringBuffer(static_cast<int>(length))
113 {
114 }
115 #endif
116 // avoid obvious bugs
117 explicit OStringBuffer(char) = delete;
118 explicit OStringBuffer(sal_Unicode) = delete;
119 #endif
120
131 OStringBuffer(const OString& value)
132 : pData(NULL)
133 , nCapacity( value.getLength() + 16 )
134 {
135 rtl_stringbuffer_newFromStr_WithLength( &pData, value.getStr(), value.getLength() );
136 }
137
142 template< typename T >
143 OStringBuffer( const T& value, typename libreoffice_internal::CharPtrDetector< T, libreoffice_internal::Dummy >::Type = libreoffice_internal::Dummy())
144 : pData(NULL)
145 {
146 sal_Int32 length = rtl_str_getLength( value );
147 nCapacity = length + 16;
148 rtl_stringbuffer_newFromStr_WithLength( &pData, value, length );
149 }
150
151 template< typename T >
152 OStringBuffer( T& value, typename libreoffice_internal::NonConstCharArrayDetector< T, libreoffice_internal::Dummy >::Type = libreoffice_internal::Dummy())
153 : pData(NULL)
154 {
155 sal_Int32 length = rtl_str_getLength( value );
156 nCapacity = length + 16;
157 rtl_stringbuffer_newFromStr_WithLength( &pData, value, length );
158 }
159
171 template< typename T >
172 OStringBuffer( T& literal, typename libreoffice_internal::ConstCharArrayDetector< T, libreoffice_internal::Dummy >::Type = libreoffice_internal::Dummy())
173 : pData(NULL)
174 , nCapacity( libreoffice_internal::ConstCharArrayDetector<T>::length + 16 )
175 {
176 assert(
177 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
178 rtl_string_newFromLiteral(
179 &pData,
180 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal),
181 libreoffice_internal::ConstCharArrayDetector<T>::length, 16);
182 #ifdef RTL_STRING_UNITTEST
183 rtl_string_unittest_const_literal = true;
184 #endif
185 }
186
199 OStringBuffer(const sal_Char * value, sal_Int32 length)
200 : pData(NULL)
201 , nCapacity( length + 16 )
202 {
203 rtl_stringbuffer_newFromStr_WithLength( &pData, value, length );
204 }
205
206 #ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
207
211 template< typename T1, typename T2 >
212 OStringBuffer( const OStringConcat< T1, T2 >& c )
213 {
214 const sal_Int32 l = c.length();
215 nCapacity = l + 16;
216 pData = rtl_string_alloc( nCapacity );
217 char* end = c.addData( pData->buffer );
218 *end = '\0';
219 pData->length = l;
220 }
221 #endif
222
225 OStringBuffer& operator = ( const OStringBuffer& value )
226 {
227 if (this != &value)
228 {
229 rtl_stringbuffer_newFromStringBuffer(&pData,
230 value.nCapacity,
231 value.pData);
232 nCapacity = value.nCapacity;
233 }
234 return *this;
235 }
236
241 OStringBuffer & operator =(OString const & string) {
242 sal_Int32 n = string.getLength();
243 if (n >= nCapacity) {
244 ensureCapacity(n + 16); //TODO: check for overflow
245 }
246 std::memcpy(pData->buffer, string.pData->buffer, n + 1);
247 pData->length = n;
248 return *this;
249 }
250
255 template<typename T>
256 typename
257 libreoffice_internal::ConstCharArrayDetector<T, OStringBuffer &>::Type
258 operator =(T & literal) {
259 assert(
260 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
261 sal_Int32 const n
262 = libreoffice_internal::ConstCharArrayDetector<T>::length;
263 if (n >= nCapacity) {
264 ensureCapacity(n + 16); //TODO: check for overflow
265 }
266 std::memcpy(
267 pData->buffer,
268 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal),
269 n + 1);
270 pData->length = n;
271 return *this;
272 }
273
274 #if defined LIBO_INTERNAL_ONLY
275
276 template<typename T1, typename T2>
277 OStringBuffer & operator =(OStringConcat<T1, T2> const & concat) {
278 sal_Int32 const n = concat.length();
279 if (n >= nCapacity) {
280 ensureCapacity(n + 16); //TODO: check for overflow
281 }
282 *concat.addData(pData->buffer) = 0;
283 pData->length = n;
284 return *this;
285 }
286 #endif
287
291 ~OStringBuffer()
292 {
293 rtl_string_release( pData );
294 }
295
304 OString makeStringAndClear()
305 {
306 OString aRet( pData );
307 rtl_string_new(&pData);
308 nCapacity = 0;
309 return aRet;
310 }
311
317 sal_Int32 getLength() const
318 {
319 return pData->length;
320 }
321
330 bool isEmpty() const
331 {
332 return pData->length == 0;
333 }
334
345 sal_Int32 getCapacity() const
346 {
347 return nCapacity;
348 }
349
361 void ensureCapacity(sal_Int32 minimumCapacity)
362 {
363 rtl_stringbuffer_ensureCapacity( &pData, &nCapacity, minimumCapacity );
364 }
365
384 void setLength(sal_Int32 newLength)
385 {
386 assert(newLength >= 0);
387 // Avoid modifications if pData points to const empty string:
388 if( newLength != pData->length )
389 {
390 if( newLength > nCapacity )
391 rtl_stringbuffer_ensureCapacity(&pData, &nCapacity, newLength);
392 else
393 pData->buffer[newLength] = '\0';
394 pData->length = newLength;
395 }
396 }
397
411 SAL_DEPRECATED("use rtl::OStringBuffer::operator [] instead")
412 sal_Char charAt( sal_Int32 index )
413 {
414 assert(index >= 0 && index < pData->length);
415 return pData->buffer[ index ];
416 }
417
428 SAL_DEPRECATED("use rtl::OStringBuffer::operator [] instead")
429 OStringBuffer & setCharAt(sal_Int32 index, sal_Char ch)
430 {
431 assert(index >= 0 && index < pData->length);
432 pData->buffer[ index ] = ch;
433 return *this;
434 }
435
439 const sal_Char* getStr() const { return pData->buffer; }
440
450 sal_Char & operator [](sal_Int32 index)
451 {
452 assert(index >= 0 && index < pData->length);
453 return pData->buffer[index];
454 }
455
460 const OString toString() const
461 {
462 return OString(pData->buffer, pData->length);
463 }
464
475 OStringBuffer & append(const OString &str)
476 {
477 return append( str.getStr(), str.getLength() );
478 }
479
491 template< typename T >
492 typename libreoffice_internal::CharPtrDetector< T, OStringBuffer& >::Type append( const T& str )
493 {
494 return append( str, rtl_str_getLength( str ) );
495 }
496
497 template< typename T >
498 typename libreoffice_internal::NonConstCharArrayDetector< T, OStringBuffer& >::Type append( T& str )
499 {
500 return append( str, rtl_str_getLength( str ) );
501 }
502
508 template< typename T >
509 typename libreoffice_internal::ConstCharArrayDetector< T, OStringBuffer& >::Type append( T& literal )
510 {
511 RTL_STRING_CONST_FUNCTION
512 assert(
513 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
514 rtl_stringbuffer_insert(
515 &pData, &nCapacity, getLength(),
516 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal),
517 libreoffice_internal::ConstCharArrayDetector<T>::length);
518 return *this;
519 }
520
534 OStringBuffer & append( const sal_Char * str, sal_Int32 len)
535 {
536 assert( len == 0 || str != NULL ); // cannot assert that in rtl_stringbuffer_insert
537 rtl_stringbuffer_insert( &pData, &nCapacity, getLength(), str, len );
538 return *this;
539 }
540
541 #ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
542
546 template< typename T1, typename T2 >
547 OStringBuffer& append( const OStringConcat< T1, T2 >& c )
548 {
549 sal_Int32 l = c.length();
550 if( l == 0 )
551 return *this;
552 l += pData->length;
553 rtl_stringbuffer_ensureCapacity( &pData, &nCapacity, l );
554 char* end = c.addData( pData->buffer + pData->length );
555 *end = '\0';
556 pData->length = l;
557 return *this;
558 }
559 #endif
560
572 OStringBuffer & append(sal_Bool b)
573 {
574 sal_Char sz[RTL_STR_MAX_VALUEOFBOOLEAN];
575 return append( sz, rtl_str_valueOfBoolean( sz, b ) );
576 }
577
591 OStringBuffer & append(bool b)
592 {
593 sal_Char sz[RTL_STR_MAX_VALUEOFBOOLEAN];
594 return append( sz, rtl_str_valueOfBoolean( sz, b ) );
595 }
596
598 // Pointer can be automatically converted to bool, which is unwanted here.
599 // Explicitly delete all pointer append() overloads to prevent this
600 // (except for char* overload, which is handled elsewhere).
601 template< typename T >
602 typename libreoffice_internal::Enable< void,
603 !libreoffice_internal::CharPtrDetector< T* >::ok >::Type
604 append( T* ) SAL_DELETED_FUNCTION;
606
617 OStringBuffer & append(sal_Char c)
618 {
619 return append( &c, 1 );
620 }
621
634 OStringBuffer & append(sal_Int32 i, sal_Int16 radix = 10 )
635 {
636 sal_Char sz[RTL_STR_MAX_VALUEOFINT32];
637 return append( sz, rtl_str_valueOfInt32( sz, i, radix ) );
638 }
639
652 OStringBuffer & append(sal_Int64 l, sal_Int16 radix = 10 )
653 {
654 sal_Char sz[RTL_STR_MAX_VALUEOFINT64];
655 return append( sz, rtl_str_valueOfInt64( sz, l, radix ) );
656 }
657
669 OStringBuffer & append(float f)
670 {
671 sal_Char sz[RTL_STR_MAX_VALUEOFFLOAT];
672 return append( sz, rtl_str_valueOfFloat( sz, f ) );
673 }
674
686 OStringBuffer & append(double d)
687 {
688 sal_Char sz[RTL_STR_MAX_VALUEOFDOUBLE];
689 return append( sz, rtl_str_valueOfDouble( sz, d ) );
690 }
691
707 char * appendUninitialized(sal_Int32 length) {
708 sal_Int32 n = getLength();
709 rtl_stringbuffer_insert(&pData, &nCapacity, n, NULL, length);
710 return pData->buffer + n;
711 }
712
728 OStringBuffer & insert(sal_Int32 offset, const OString & str)
729 {
730 return insert( offset, str.getStr(), str.getLength() );
731 }
732
750 template< typename T >
751 typename libreoffice_internal::CharPtrDetector< T, OStringBuffer& >::Type insert( sal_Int32 offset, const T& str )
752 {
753 return insert( offset, str, rtl_str_getLength( str ) );
754 }
755
756 template< typename T >
757 typename libreoffice_internal::NonConstCharArrayDetector< T, OStringBuffer& >::Type insert( sal_Int32 offset, T& str )
758 {
759 return insert( offset, str, rtl_str_getLength( str ) );
760 }
761
767 template< typename T >
768 typename libreoffice_internal::ConstCharArrayDetector< T, OStringBuffer& >::Type insert( sal_Int32 offset, T& literal )
769 {
770 RTL_STRING_CONST_FUNCTION
771 assert(
772 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
773 rtl_stringbuffer_insert(
774 &pData, &nCapacity, offset,
775 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal),
776 libreoffice_internal::ConstCharArrayDetector<T>::length);
777 return *this;
778 }
779
798 OStringBuffer & insert( sal_Int32 offset, const sal_Char * str, sal_Int32 len)
799 {
800 assert( len == 0 || str != NULL ); // cannot assert that in rtl_stringbuffer_insert
801 rtl_stringbuffer_insert( &pData, &nCapacity, offset, str, len );
802 return *this;
803 }
804
822 OStringBuffer & insert(sal_Int32 offset, sal_Bool b)
823 {
824 sal_Char sz[RTL_STR_MAX_VALUEOFBOOLEAN];
825 return insert( offset, sz, rtl_str_valueOfBoolean( sz, b ) );
826 }
827
847 OStringBuffer & insert(sal_Int32 offset, bool b)
848 {
849 sal_Char sz[RTL_STR_MAX_VALUEOFBOOLEAN];
850 return insert( offset, sz, rtl_str_valueOfBoolean( sz, b ) );
851 }
852
869 OStringBuffer & insert(sal_Int32 offset, sal_Char c)
870 {
871 return insert( offset, &c, 1 );
872 }
873
892 OStringBuffer & insert(sal_Int32 offset, sal_Int32 i, sal_Int16 radix = 10 )
893 {
894 sal_Char sz[RTL_STR_MAX_VALUEOFINT32];
895 return insert( offset, sz, rtl_str_valueOfInt32( sz, i, radix ) );
896 }
897
916 OStringBuffer & insert(sal_Int32 offset, sal_Int64 l, sal_Int16 radix = 10 )
917 {
918 sal_Char sz[RTL_STR_MAX_VALUEOFINT64];
919 return insert( offset, sz, rtl_str_valueOfInt64( sz, l, radix ) );
920 }
921
939 OStringBuffer insert(sal_Int32 offset, float f)
940 {
941 sal_Char sz[RTL_STR_MAX_VALUEOFFLOAT];
942 return insert( offset, sz, rtl_str_valueOfFloat( sz, f ) );
943 }
944
962 OStringBuffer & insert(sal_Int32 offset, double d)
963 {
964 sal_Char sz[RTL_STR_MAX_VALUEOFDOUBLE];
965 return insert( offset, sz, rtl_str_valueOfDouble( sz, d ) );
966 }
967
980 OStringBuffer & remove( sal_Int32 start, sal_Int32 len )
981 {
982 rtl_stringbuffer_remove( &pData, start, len );
983 return *this;
984 }
985
986 private:
990 rtl_String * pData;
991
995 sal_Int32 nCapacity;
996 };
997
998 }
999
1000 #ifdef RTL_STRING_UNITTEST
1001 namespace rtl
1002 {
1003 typedef rtlunittest::OStringBuffer OStringBuffer;
1004 }
1005 #undef RTL_STRING_CONST_FUNCTION
1006 #endif
1007
1008 #if defined LIBO_INTERNAL_ONLY && !defined RTL_STRING_UNITTEST
1009 using ::rtl::OStringBuffer;
1010 #endif
1011
1012 #endif // INCLUDED_RTL_STRBUF_HXX
1013
1014
1015 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
rtl::OStringBuffer::insert
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:892
rtl::OStringBuffer::OStringBuffer
OStringBuffer(T &value, typename libreoffice_internal::NonConstCharArrayDetector< T, libreoffice_internal::Dummy >::Type=libreoffice_internal::Dummy())
Definition: strbuf.hxx:152
RTL_STR_MAX_VALUEOFINT32
#define RTL_STR_MAX_VALUEOFINT32
Definition: string.h:627
rtl::OStringBuffer::insert
OStringBuffer & insert(sal_Int32 offset, double d)
Inserts the string representation of the double argument into this string buffer. ...
Definition: strbuf.hxx:962
rtl::libreoffice_internal::NonConstCharArrayDetector
Definition: stringutils.hxx:135
rtl::OStringBuffer::append
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:509
RTL_STR_MAX_VALUEOFFLOAT
#define RTL_STR_MAX_VALUEOFFLOAT
Definition: string.h:692
rtl_str_valueOfInt32
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.
rtl::OStringBuffer::OStringBuffer
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:199
rtl::libreoffice_internal::ConstCharArrayDetector
Definition: stringutils.hxx:158
RTL_STR_MAX_VALUEOFINT64
#define RTL_STR_MAX_VALUEOFINT64
Definition: string.h:650
rtl::OStringBuffer::insert
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:768
rtl_string_newFromLiteral
SAL_DLLPUBLIC void rtl_string_newFromLiteral(rtl_String **newStr, const sal_Char *value, sal_Int32 len, sal_Int32 allocExtra) SAL_THROW_EXTERN_C()
rtl::OStringBuffer::append
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:634
rtl::OStringBuffer::append
libreoffice_internal::NonConstCharArrayDetector< T, OStringBuffer &>::Type append(T &str)
Definition: strbuf.hxx:498
rtl_string_new_WithLength
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.
rtl::OStringBuffer::getCapacity
sal_Int32 getCapacity() const
Returns the current capacity of the String buffer.
Definition: strbuf.hxx:345
SAL_DELETED_FUNCTION
#define SAL_DELETED_FUNCTION
short-circuit extra-verbose API namespaces
Definition: types.h:410
rtl::OString::getStr
const sal_Char * getStr() const
Returns a pointer to the characters of this string.
Definition: string.hxx:430
rtl::OStringBuffer::OStringBuffer
OStringBuffer(const OString &value)
Constructs a string buffer so that it represents the same sequence of characters as the string argume...
Definition: strbuf.hxx:131
rtl_stringbuffer_insert
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.
rtl::OStringBuffer::insert
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:798
rtl::OStringBuffer::append
OStringBuffer & append(sal_Bool b)
Appends the string representation of the sal_Bool argument to the string buffer.
Definition: strbuf.hxx:572
rtl_string_new
SAL_DLLPUBLIC void rtl_string_new(rtl_String **newStr) SAL_THROW_EXTERN_C()
Allocate a new string containing no characters.
rtl::OStringBuffer::OStringBuffer
OStringBuffer(int length)
Constructs a string buffer with no characters in it and an initial capacity specified by the length a...
Definition: strbuf.hxx:94
rtl::OStringBuffer::insert
OStringBuffer & insert(sal_Int32 offset, sal_Char c)
Inserts the string representation of the char argument into this string buffer.
Definition: strbuf.hxx:869
rtl::OStringBuffer::append
OStringBuffer & append(const OString &str)
Appends the string to this string buffer.
Definition: strbuf.hxx:475
SAL_DEPRECATED
#define SAL_DEPRECATED(message)
Use as follows: SAL_DEPRECATED("Don&#39;t use, it&#39;s evil.") void doit(int nPara);.
Definition: types.h:509
SAL_WARN_UNUSED
#define SAL_WARN_UNUSED
Annotate classes where a compiler should warn if an instance is unused.
Definition: types.h:624
rtl_stringbuffer_newFromStr_WithLength
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.
rtl::libreoffice_internal::Enable
Definition: stringutils.hxx:267
rtl::OStringBuffer::insert
OStringBuffer insert(sal_Int32 offset, float f)
Inserts the string representation of the float argument into this string buffer.
Definition: strbuf.hxx:939
rtl::OStringBuffer::getStr
const sal_Char * getStr() const
Return a null terminated character array.
Definition: strbuf.hxx:439
rtl::OStringBuffer::OStringBuffer
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:172
rtl::OStringBuffer::OStringBuffer
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:143
rtl::OStringBuffer::append
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:492
rtl::OStringBuffer::ensureCapacity
void ensureCapacity(sal_Int32 minimumCapacity)
Ensures that the capacity of the buffer is at least equal to the specified minimum.
Definition: strbuf.hxx:361
rtl_stringbuffer_remove
SAL_DLLPUBLIC void rtl_stringbuffer_remove(rtl_String **This, sal_Int32 start, sal_Int32 len)
Removes the characters in a substring of this sequence.
rtl::OString
This String class provide base functionality for C++ like 8-Bit character array handling.
Definition: string.hxx:90
rtl_string_release
SAL_DLLPUBLIC void rtl_string_release(rtl_String *str) SAL_THROW_EXTERN_C()
Decrement the reference count of a string.
RTL_STR_MAX_VALUEOFDOUBLE
#define RTL_STR_MAX_VALUEOFDOUBLE
Definition: string.h:711
sal_Unicode
sal_uInt16 sal_Unicode
Definition: types.h:155
sal_Bool
unsigned char sal_Bool
Definition: types.h:48
RTL_STR_MAX_VALUEOFBOOLEAN
#define RTL_STR_MAX_VALUEOFBOOLEAN
Definition: string.h:585
rtl::OStringBuffer::toString
const OString toString() const
Return a OString instance reflecting the current content of this OStringBuffer.
Definition: strbuf.hxx:460
rtl::OStringBuffer::insert
OStringBuffer & insert(sal_Int32 offset, const OString &str)
Inserts the string into this string buffer.
Definition: strbuf.hxx:728
rtl::OStringBuffer::isEmpty
bool isEmpty() const
Checks if a string buffer is empty.
Definition: strbuf.hxx:330
rtl::OStringBuffer::setLength
void setLength(sal_Int32 newLength)
Sets the length of this String buffer.
Definition: strbuf.hxx:384
rtl::OStringBuffer::append
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:534
rtl::libreoffice_internal::CharPtrDetector
Definition: stringutils.hxx:117
rtl::OStringBuffer::insert
OStringBuffer & insert(sal_Int32 offset, sal_Bool b)
Inserts the string representation of the sal_Bool argument into this string buffer.
Definition: strbuf.hxx:822
rtl_stringbuffer_ensureCapacity
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.
rtl::OStringBuffer::appendUninitialized
char * appendUninitialized(sal_Int32 length)
Unsafe way to make space for a fixed amount of characters to be appended into this OStringBuffer...
Definition: strbuf.hxx:707
rtl::OStringBuffer::append
OStringBuffer & append(sal_Int64 l, sal_Int16 radix=10)
Appends the string representation of the long argument to this string buffer.
Definition: strbuf.hxx:652
rtl_str_getLength
SAL_DLLPUBLIC sal_Int32 rtl_str_getLength(const sal_Char *str) SAL_THROW_EXTERN_C()
Return the length of a string.
rtl::OStringBuffer::append
OStringBuffer & append(double d)
Appends the string representation of the double argument to this string buffer.
Definition: strbuf.hxx:686
rtl_str_valueOfBoolean
SAL_DLLPUBLIC sal_Int32 rtl_str_valueOfBoolean(sal_Char *str, sal_Bool b) SAL_THROW_EXTERN_C()
Create the string representation of a boolean.
rtl::OStringBuffer::append
OStringBuffer & append(bool b)
Appends the string representation of the bool argument to the string buffer.
Definition: strbuf.hxx:591
string.hxx
rtl::OStringBuffer::append
OStringBuffer & append(float f)
Appends the string representation of the float argument to this string buffer.
Definition: strbuf.hxx:669
config.h
rtl::OStringBuffer::~OStringBuffer
~OStringBuffer()
Release the string data.
Definition: strbuf.hxx:291
rtl::OStringBuffer
A string buffer implements a mutable sequence of characters.
Definition: strbuf.hxx:61
rtl_stringbuffer_newFromStringBuffer
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...
rtl::OStringBuffer::append
OStringBuffer & append(sal_Char c)
Appends the string representation of the char argument to this string buffer.
Definition: strbuf.hxx:617
rtl::OStringBuffer::OStringBuffer
OStringBuffer(const OStringBuffer &value)
Allocates a new string buffer that contains the same sequence of characters as the string buffer argu...
Definition: strbuf.hxx:81
sal_Char
char sal_Char
A legacy synonym for char.
Definition: types.h:130
rtl::OStringBuffer::insert
libreoffice_internal::NonConstCharArrayDetector< T, OStringBuffer &>::Type insert(sal_Int32 offset, T &str)
Definition: strbuf.hxx:757
stringutils.hxx
rtl_str_valueOfInt64
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.
rtl::OStringBuffer::insert
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:916
rtl::libreoffice_internal::Dummy
Definition: stringutils.hxx:115
rtl_str_valueOfFloat
SAL_DLLPUBLIC sal_Int32 rtl_str_valueOfFloat(sal_Char *str, float f) SAL_THROW_EXTERN_C()
Create the string representation of a float.
rtl::OStringBuffer::makeStringAndClear
OString makeStringAndClear()
Fill the string data in the new string and clear the buffer.
Definition: strbuf.hxx:304
rtl_str_valueOfDouble
SAL_DLLPUBLIC sal_Int32 rtl_str_valueOfDouble(sal_Char *str, double d) SAL_THROW_EXTERN_C()
Create the string representation of a double.
rtl::OStringBuffer::insert
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:751
stringconcat.hxx
rtl::OString::getLength
sal_Int32 getLength() const
Returns the length of this string.
Definition: string.hxx:404
rtl
Definition: bootstrap.hxx:29
rtl::OStringBuffer::getLength
sal_Int32 getLength() const
Returns the length (character count) of this string buffer.
Definition: strbuf.hxx:317
strbuf.h
rtl::OStringBuffer::insert
OStringBuffer & insert(sal_Int32 offset, bool b)
Inserts the string representation of the bool argument into this string buffer.
Definition: strbuf.hxx:847
rtl_string_alloc
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.
rtl::OStringBuffer::OStringBuffer
OStringBuffer()
Constructs a string buffer with no characters in it and an initial capacity of 16 characters...
Definition: strbuf.hxx:68