20 #ifndef _RTL_USTRBUF_HXX_
21 #define _RTL_USTRBUF_HXX_
34 #ifdef RTL_FAST_STRING
43 #ifdef RTL_STRING_UNITTEST
44 #define rtl rtlunittest
50 #ifdef RTL_STRING_UNITTEST
114 , nCapacity( value.nCapacity )
127 , nCapacity( length )
144 , nCapacity( value.getLength() + 16 )
149 template<
typename T >
152 , nCapacity( internal::ConstCharArrayDetector< T, void >::size - 1 + 16 )
156 #ifdef RTL_STRING_UNITTEST
157 rtl_string_unittest_const_literal =
true;
161 #ifdef RTL_STRING_UNITTEST
166 template<
typename T >
172 rtl_string_unittest_invalid_conversion =
true;
178 template<
typename T >
179 OUStringBuffer(
const T&,
typename internal::ExceptCharArrayDetector< T >::Type = internal::Dummy() )
184 rtl_string_unittest_invalid_conversion =
true;
188 #ifdef RTL_FAST_STRING
193 template<
typename T1,
typename T2 >
194 OUStringBuffer(
const OUStringConcat< T1, T2 >& c )
196 const sal_Int32 l = c.length();
201 pData->length = end - pData->buffer;
214 nCapacity = value.nCapacity;
249 return pData->length;
262 return pData->length == 0;
316 assert(newLength >= 0);
318 if( newLength != pData->length )
320 if( newLength > nCapacity )
323 pData->buffer[newLength] = 0;
324 pData->length = newLength;
344 assert(index >= 0 && index < pData->length);
345 return pData->buffer[ index ];
361 assert(index >= 0 && index < pData->length);
362 pData->buffer[ index ] = ch;
382 assert(index >= 0 && index < pData->length);
383 return pData->buffer[index];
392 return OUString(pData->buffer, pData->length);
472 template<
typename T >
481 #ifdef RTL_FAST_STRING
486 template<
typename T1,
typename T2 >
489 const int l = c.length();
493 sal_Unicode* end = c.addData( pData->buffer + pData->length );
495 pData->length = end - pData->buffer;
567 template<
typename T >
613 assert(static_cast< unsigned char >(c) <= 0x7F);
629 return append( &c, 1 );
716 return insertUtf32(getLength(), c);
791 template<
typename T >
844 return insert( offset, &u, 1 );
865 return insert( offset, &c, 1 );
1032 sal_Int32 index = 0;
1033 while((index = indexOf(oldChar, index)) >= 0)
1035 pData->buffer[ index ] = newChar;
1056 sal_Int32 ** pInternalCapacity)
1058 *pInternalData = &pData;
1059 *pInternalCapacity = &nCapacity;
1081 return (ret < 0 ? ret : ret+fromIndex);
1139 str.pData->buffer, str.pData->length );
1140 return (ret < 0 ? ret : ret+fromIndex);
1149 template<
typename T >
1154 pData->buffer + fromIndex, pData->length - fromIndex, literal,
1156 return ret < 0 ? ret : ret + fromIndex;
1179 str.pData->buffer, str.pData->length );
1204 str.pData->buffer, str.pData->length );
1212 template<
typename T >
1232 for(index = 0; index < getLength() ; index++)
1234 if(pData->buffer[ index ] != c)
1257 sal_Int32 result = getLength();
1259 for(index = getLength(); index > 0 ; index--)
1261 if(pData->buffer[ index - 1 ] != c)
1266 if(index < getLength())
1270 return result - getLength();
1283 return stripStart(c) + stripEnd(c);
1298 assert(beginIndex >= 0 && beginIndex <= getLength());
1299 return copy( beginIndex, getLength() - beginIndex );
1317 assert(beginIndex >= 0 && beginIndex <= getLength());
1318 assert(count >= 0 && count <= getLength() - beginIndex);
1319 rtl_uString *pNew = 0;
1324 #ifdef LIBO_INTERNAL_ONLY
1327 #ifndef RTL_FAST_STRING
1334 return OUString( str1.pData ).concat( str2.pData );
1340 OUStringBuffer( rtl_uString * value,
const sal_Int32 capacity )
1343 nCapacity = capacity;
1349 rtl_uString * pData;
1354 sal_Int32 nCapacity;
1357 #ifdef RTL_FAST_STRING
1362 struct ToStringHelper< OUStringBuffer >
1364 static int length(
const OUStringBuffer& s ) {
return s.
getLength(); }
1365 static sal_Unicode* addData(
sal_Unicode* buffer,
const OUStringBuffer& s ) {
return addDataHelper( buffer, s.getStr(), s.getLength()); }
1366 static const bool allowOStringConcat =
false;
1367 static const bool allowOUStringConcat =
true;
1373 #ifdef RTL_STRING_UNITTEST
1376 typedef rtlunittest::OUStringBuffer OUStringBuffer;
1381 using ::rtl::OUStringBuffer;