20 #ifndef INCLUDED_RTL_STRBUF_HXX
21 #define INCLUDED_RTL_STRBUF_HXX
32 #ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
41 #ifdef RTL_STRING_UNITTEST
42 #define rtl rtlunittest
49 #ifdef RTL_STRING_UNITTEST
52 #define RTL_STRING_CONST_FUNCTION rtl_string_unittest_const_literal_function = true;
54 #define RTL_STRING_CONST_FUNCTION
82 , nCapacity( value.nCapacity )
99 #if __cplusplus >= 201103L
104 #if SAL_TYPES_SIZEOFLONG == 4
106 explicit OStringBuffer(
long length)
107 : OStringBuffer(static_cast<int>(length))
110 explicit OStringBuffer(
unsigned long length)
111 : OStringBuffer(static_cast<int>(length))
116 explicit OStringBuffer(
char) =
delete;
132 , nCapacity( value.getLength() + 16 )
141 template<
typename T >
146 nCapacity = length + 16;
150 template<
typename T >
155 nCapacity = length + 16;
170 template<
typename T >
173 , nCapacity( libreoffice_internal::ConstCharArrayDetector< T, void >::size - 1 + 16 )
177 #ifdef RTL_STRING_UNITTEST
178 rtl_string_unittest_const_literal =
true;
196 , nCapacity( length + 16 )
201 #ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
206 template<
typename T1,
typename T2 >
209 const sal_Int32 l = c.length();
212 char* end = c.addData( pData->buffer );
214 pData->length = end - pData->buffer;
227 nCapacity = value.nCapacity;
263 return pData->length;
276 return pData->length == 0;
330 assert(newLength >= 0);
332 if( newLength != pData->length )
334 if( newLength > nCapacity )
337 pData->buffer[newLength] =
'\0';
338 pData->length = newLength;
358 assert(index >= 0 && index < pData->length);
359 return pData->buffer[ index ];
375 assert(index >= 0 && index < pData->length);
376 pData->buffer[ index ] = ch;
396 assert(index >= 0 && index < pData->length);
397 return pData->buffer[index];
406 return OString(pData->buffer, pData->length);
435 template<
typename T >
441 template<
typename T >
452 template<
typename T >
455 RTL_STRING_CONST_FUNCTION
476 assert( len == 0 || str != 0 );
481 #ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
486 template<
typename T1,
typename T2 >
489 const int l = c.length();
493 char* end = c.addData( pData->buffer + pData->length );
495 pData->length = end - pData->buffer;
540 template<
typename T >
558 return append( &c, 1 );
647 sal_Int32 n = getLength();
649 return pData->buffer + n;
689 template<
typename T >
695 template<
typename T >
706 template<
typename T >
709 RTL_STRING_CONST_FUNCTION
735 assert( len == 0 || str != 0 );
806 return insert( offset, &c, 1 );
933 #ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
938 struct ToStringHelper< OStringBuffer >
940 static int length(
const OStringBuffer& s ) {
return s.getLength(); }
941 static char* addData(
char* buffer,
const OStringBuffer& s ) {
return addDataHelper( buffer, s.getStr(), s.getLength()); }
942 static const bool allowOStringConcat =
true;
943 static const bool allowOUStringConcat =
false;
950 #ifdef RTL_STRING_UNITTEST
953 typedef rtlunittest::OStringBuffer OStringBuffer;
955 #undef RTL_STRING_CONST_FUNCTION
958 #if defined LIBO_INTERNAL_ONLY && !defined RTL_STRING_UNITTEST
959 using ::rtl::OStringBuffer;
962 #endif // INCLUDED_RTL_STRBUF_HXX