20 #ifndef INCLUDED_RTL_STRBUF_HXX
21 #define INCLUDED_RTL_STRBUF_HXX
32 #ifdef 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
118 , nCapacity( value.nCapacity )
131 , nCapacity( length )
148 , nCapacity( value.getLength() + 16 )
157 template<
typename T >
162 nCapacity = length + 16;
166 template<
typename T >
171 nCapacity = length + 16;
186 template<
typename T >
189 , nCapacity( libreoffice_internal::ConstCharArrayDetector< T, void >::size - 1 + 16 )
193 #ifdef RTL_STRING_UNITTEST
194 rtl_string_unittest_const_literal =
true;
212 , nCapacity( length + 16 )
217 #ifdef RTL_FAST_STRING
222 template<
typename T1,
typename T2 >
225 const sal_Int32 l = c.length();
228 char* end = c.addData( pData->buffer );
230 pData->length = end - pData->buffer;
243 nCapacity = value.nCapacity;
279 return pData->length;
292 return pData->length == 0;
346 assert(newLength >= 0);
348 if( newLength != pData->length )
350 if( newLength > nCapacity )
353 pData->buffer[newLength] =
'\0';
354 pData->length = newLength;
374 assert(index >= 0 && index < pData->length);
375 return pData->buffer[ index ];
391 assert(index >= 0 && index < pData->length);
392 pData->buffer[ index ] = ch;
412 assert(index >= 0 && index < pData->length);
413 return pData->buffer[index];
422 return OString(pData->buffer, pData->length);
451 template<
typename T >
457 template<
typename T >
468 template<
typename T >
471 RTL_STRING_CONST_FUNCTION
493 assert( len == 0 || str != 0 );
498 #ifdef RTL_FAST_STRING
503 template<
typename T1,
typename T2 >
506 const int l = c.length();
510 char* end = c.addData( pData->buffer + pData->length );
512 pData->length = end - pData->buffer;
557 template<
typename T >
575 return append( &c, 1 );
665 sal_Int32 n = getLength();
667 return pData->buffer + n;
707 template<
typename T >
713 template<
typename T >
724 template<
typename T >
727 RTL_STRING_CONST_FUNCTION
753 assert( offset >= 0 && offset <= pData->length );
755 assert( len == 0 || str != 0 );
826 return insert( offset, &c, 1 );
937 assert( start >= 0 && start <= pData->length );
943 #ifdef LIBO_INTERNAL_ONLY
946 #ifndef RTL_FAST_STRING
970 #ifdef RTL_FAST_STRING
975 struct ToStringHelper< OStringBuffer >
977 static int length(
const OStringBuffer& s ) {
return s.
getLength(); }
978 static char* addData(
char* buffer,
const OStringBuffer& s ) {
return addDataHelper( buffer, s.getStr(), s.getLength()); }
979 static const bool allowOStringConcat =
true;
980 static const bool allowOUStringConcat =
false;
987 #ifdef RTL_STRING_UNITTEST
990 typedef rtlunittest::OStringBuffer OStringBuffer;
992 #undef RTL_STRING_CONST_FUNCTION
996 using ::rtl::OStringBuffer;
999 #endif // INCLUDED_RTL_STRBUF_HXX