LibreOffice LibreOffice 6.1 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
66 class SAL_WARN_UNUSED OStringBuffer
67 {
68 public:
73 OStringBuffer()
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 >
148 OStringBuffer( const T& value, typename libreoffice_internal::CharPtrDetector< T, libreoffice_internal::Dummy >::Type = libreoffice_internal::Dummy())
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 >
157 OStringBuffer( T& value, typename libreoffice_internal::NonConstCharArrayDetector< T, libreoffice_internal::Dummy >::Type = libreoffice_internal::Dummy())
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 >
177 OStringBuffer( T& literal, typename libreoffice_internal::ConstCharArrayDetector< T, libreoffice_internal::Dummy >::Type = libreoffice_internal::Dummy())
178 : pData(NULL)
179 , nCapacity( libreoffice_internal::ConstCharArrayDetector<T>::length + 16 )
180 {
181 assert(
182 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
183 rtl_string_newFromLiteral(
184 &pData,
185 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal),
186 libreoffice_internal::ConstCharArrayDetector<T>::length, 16);
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( 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 {
234 rtl_stringbuffer_newFromStringBuffer(&pData,
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
262 libreoffice_internal::ConstCharArrayDetector<T, OStringBuffer &>::Type
263 operator =(T & literal) {
264 assert(
265 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
266 sal_Int32 const n
267 = libreoffice_internal::ConstCharArrayDetector<T>::length;
268 if (n >= nCapacity) {
269 ensureCapacity(n + 16); //TODO: check for overflow
270 }
271 std::memcpy(
272 pData->buffer,
273 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal),
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> && 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
296 ~OStringBuffer()
297 {
298 rtl_string_release( pData );
299 }
300
309 SAL_WARN_UNUSED_RESULT OString makeStringAndClear()
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
480 OStringBuffer & append(const OString &str)
481 {
482 return append( str.getStr(), str.getLength() );
483 }
484
496 template< typename T >
497 typename libreoffice_internal::CharPtrDetector< T, OStringBuffer& >::Type append( const T& str )
498 {
499 return append( str, rtl_str_getLength( str ) );
500 }
501
502 template< typename T >
503 typename libreoffice_internal::NonConstCharArrayDetector< T, OStringBuffer& >::Type append( T& str )
504 {
505 return append( str, rtl_str_getLength( str ) );
506 }
507
513 template< typename T >
514 typename libreoffice_internal::ConstCharArrayDetector< T, OStringBuffer& >::Type append( T& literal )
515 {
516 RTL_STRING_CONST_FUNCTION
517 assert(
518 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
519 rtl_stringbuffer_insert(
520 &pData, &nCapacity, getLength(),
521 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal),
522 libreoffice_internal::ConstCharArrayDetector<T>::length);
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( 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
577 OStringBuffer & append(sal_Bool b)
578 {
579 sal_Char sz[RTL_STR_MAX_VALUEOFBOOLEAN];
580 return append( sz, rtl_str_valueOfBoolean( sz, b ) );
581 }
582
596 OStringBuffer & append(bool b)
597 {
598 sal_Char sz[RTL_STR_MAX_VALUEOFBOOLEAN];
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,
608 !libreoffice_internal::CharPtrDetector< T* >::ok >::Type
609 append( T* ) SAL_DELETED_FUNCTION;
611
622 OStringBuffer & append(sal_Char c)
623 {
624 return append( &c, 1 );
625 }
626
639 OStringBuffer & append(sal_Int32 i, sal_Int16 radix = 10 )
640 {
641 sal_Char sz[RTL_STR_MAX_VALUEOFINT32];
642 return append( sz, rtl_str_valueOfInt32( sz, i, radix ) );
643 }
644
657 OStringBuffer & append(sal_Int64 l, sal_Int16 radix = 10 )
658 {
659 sal_Char sz[RTL_STR_MAX_VALUEOFINT64];
660 return append( sz, rtl_str_valueOfInt64( sz, l, radix ) );
661 }
662
674 OStringBuffer & append(float f)
675 {
676 sal_Char sz[RTL_STR_MAX_VALUEOFFLOAT];
677 return append( sz, rtl_str_valueOfFloat( sz, f ) );
678 }
679
691 OStringBuffer & append(double d)
692 {
693 sal_Char sz[RTL_STR_MAX_VALUEOFDOUBLE];
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 >
756 typename libreoffice_internal::CharPtrDetector< T, OStringBuffer& >::Type insert( sal_Int32 offset, const T& str )
757 {
758 return insert( offset, str, rtl_str_getLength( str ) );
759 }
760
761 template< typename T >
762 typename libreoffice_internal::NonConstCharArrayDetector< T, OStringBuffer& >::Type insert( sal_Int32 offset, T& str )
763 {
764 return insert( offset, str, rtl_str_getLength( str ) );
765 }
766
772 template< typename T >
773 typename libreoffice_internal::ConstCharArrayDetector< T, OStringBuffer& >::Type insert( sal_Int32 offset, T& literal )
774 {
775 RTL_STRING_CONST_FUNCTION
776 assert(
777 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
778 rtl_stringbuffer_insert(
779 &pData, &nCapacity, offset,
780 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal),
781 libreoffice_internal::ConstCharArrayDetector<T>::length);
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 {
829 sal_Char sz[RTL_STR_MAX_VALUEOFBOOLEAN];
830 return insert( offset, sz, rtl_str_valueOfBoolean( sz, b ) );
831 }
832
852 OStringBuffer & insert(sal_Int32 offset, bool b)
853 {
854 sal_Char sz[RTL_STR_MAX_VALUEOFBOOLEAN];
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 {
899 sal_Char sz[RTL_STR_MAX_VALUEOFINT32];
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 {
923 sal_Char sz[RTL_STR_MAX_VALUEOFINT64];
924 return insert( offset, sz, rtl_str_valueOfInt64( sz, l, radix ) );
925 }
926
944 OStringBuffer insert(sal_Int32 offset, float f)
945 {
946 sal_Char sz[RTL_STR_MAX_VALUEOFFLOAT];
947 return insert( offset, sz, rtl_str_valueOfFloat( sz, f ) );
948 }
949
967 OStringBuffer & insert(sal_Int32 offset, double d)
968 {
969 sal_Char sz[RTL_STR_MAX_VALUEOFDOUBLE];
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
1008 void accessInternals(
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: */
rtl::libreoffice_internal::ConstCharArrayDetector
Definition: stringutils.hxx:158
rtl::OStringBuffer::append
libreoffice_internal::NonConstCharArrayDetector< T, OStringBuffer &>::Type append(T &str)
Definition: strbuf.hxx:503
RTL_STR_MAX_VALUEOFINT32
#define RTL_STR_MAX_VALUEOFINT32
Definition: string.h:627
rtl::OStringBuffer::OStringBuffer
OStringBuffer()
Constructs a string buffer with no characters in it and an initial capacity of 16 characters...
Definition: strbuf.hxx:73
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:921
RTL_STR_MAX_VALUEOFFLOAT
#define RTL_STR_MAX_VALUEOFFLOAT
Definition: string.h:692
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:204
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::insert
OStringBuffer & insert(sal_Int32 offset, double d)
Inserts the string representation of the double argument into this string buffer. ...
Definition: strbuf.hxx:967
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:366
RTL_STR_MAX_VALUEOFINT64
#define RTL_STR_MAX_VALUEOFINT64
Definition: string.h:650
rtl::OStringBuffer::getStr
const sal_Char * getStr() const SAL_RETURNS_NONNULL
Return a null terminated character array.
Definition: strbuf.hxx:444
rtl::libreoffice_internal::Enable
Definition: stringutils.hxx:267
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::OStringBuffer
OStringBuffer(T &value, typename libreoffice_internal::NonConstCharArrayDetector< T, libreoffice_internal::Dummy >::Type=libreoffice_internal::Dummy())
Definition: strbuf.hxx:157
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 ...
Definition: strbuf.hxx:514
rtl::OStringBuffer::insert
OStringBuffer & insert(sal_Int32 offset, const OString &str)
Inserts the string into this string buffer.
Definition: strbuf.hxx:733
rtl::OStringBuffer::append
OStringBuffer & append(const OString &str)
Appends the string to this string buffer.
Definition: strbuf.hxx:480
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.
SAL_DELETED_FUNCTION
#define SAL_DELETED_FUNCTION
short-circuit extra-verbose API namespaces
Definition: types.h:394
rtl::OString
This String class provide base functionality for C++ like 8-Bit character array handling.
Definition: string.hxx:95
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:803
rtl_string_new
SAL_DLLPUBLIC void rtl_string_new(rtl_String **newStr) SAL_THROW_EXTERN_C()
Allocate a new string containing no characters.
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:485
SAL_WARN_UNUSED
#define SAL_WARN_UNUSED
Annotate classes where a compiler should warn if an instance is unused.
Definition: types.h:598
rtl::OStringBuffer::append
OStringBuffer & append(double d)
Appends the string representation of the double argument to this string buffer.
Definition: strbuf.hxx:691
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::OStringBuffer::getCapacity
sal_Int32 getCapacity() const
Returns the current capacity of the String buffer.
Definition: strbuf.hxx:350
rtl::libreoffice_internal::NonConstCharArrayDetector
Definition: stringutils.hxx:135
rtl::libreoffice_internal::CharPtrDetector
Definition: stringutils.hxx:117
rtl::OStringBuffer::makeStringAndClear
SAL_WARN_UNUSED_RESULT OString makeStringAndClear()
Fill the string data in the new string and clear the buffer.
Definition: strbuf.hxx:309
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:827
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:148
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:639
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:874
rtl::OStringBuffer
A string buffer implements a mutable sequence of characters.
Definition: strbuf.hxx:66
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_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
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:497
sal_Unicode
sal_uInt16 sal_Unicode
Definition: types.h:141
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 ...
Definition: strbuf.hxx:773
rtl::OStringBuffer::append
OStringBuffer & append(bool b)
Appends the string representation of the bool argument to the string buffer.
Definition: strbuf.hxx:596
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:86
rtl::OStringBuffer::accessInternals
void accessInternals(rtl_String ***pInternalData, sal_Int32 **pInternalCapacity)
Allows access to the internal data of this OStringBuffer, for effective manipulation.
Definition: strbuf.hxx:1008
sal_Bool
unsigned char sal_Bool
Definition: types.h:38
RTL_STR_MAX_VALUEOFBOOLEAN
#define RTL_STR_MAX_VALUEOFBOOLEAN
Definition: string.h:585
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:99
rtl::libreoffice_internal::Dummy
Definition: stringutils.hxx:115
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:539
rtl
Definition: bootstrap.hxx:29
rtl::OStringBuffer::append
OStringBuffer & append(sal_Char c)
Appends the string representation of the char argument to this string buffer.
Definition: strbuf.hxx:622
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:177
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::append
OStringBuffer & append(sal_Bool b)
Appends the string representation of the sal_Bool argument to the string buffer.
Definition: strbuf.hxx:577
rtl::OStringBuffer::toString
const OString toString() const
Return a OString instance reflecting the current content of this OStringBuffer.
Definition: strbuf.hxx:465
rtl::OStringBuffer::isEmpty
bool isEmpty() const
Checks if a string buffer is empty.
Definition: strbuf.hxx:335
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(sal_Int64 l, sal_Int16 radix=10)
Appends the string representation of the long argument to this string buffer.
Definition: strbuf.hxx:657
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:944
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.
string.hxx
rtl::OStringBuffer::insert
libreoffice_internal::NonConstCharArrayDetector< T, OStringBuffer &>::Type insert(sal_Int32 offset, T &str)
Definition: strbuf.hxx:762
config.h
rtl::OStringBuffer::getLength
sal_Int32 getLength() const
Returns the length (character count) of this string buffer.
Definition: strbuf.hxx:322
rtl::OString::getStr
const sal_Char * getStr() const SAL_RETURNS_NONNULL
Returns a pointer to the characters of this string.
Definition: string.hxx:429
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::appendUninitialized
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
SAL_WARN_UNUSED_RESULT
#define SAL_WARN_UNUSED_RESULT
Use this as markup for functions and methods whose return value must be checked.
Definition: types.h:300
sal_Char
char sal_Char
A legacy synonym for char.
Definition: types.h:120
stringutils.hxx
rtl::OStringBuffer::setLength
void setLength(sal_Int32 newLength)
Sets the length of this String buffer.
Definition: strbuf.hxx:389
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_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_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.
stringconcat.hxx
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:756
strbuf.h
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::append
OStringBuffer & append(float f)
Appends the string representation of the float argument to this string buffer.
Definition: strbuf.hxx:674
rtl::OString::getLength
sal_Int32 getLength() const
Returns the length of this string.
Definition: string.hxx:403
rtl::OStringBuffer::~OStringBuffer
~OStringBuffer()
Release the string data.
Definition: strbuf.hxx:296
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:897
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:852
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:136