use boost flat_map for faster map
[LibreOffice.git] / sal / rtl / string.cxx
blobb8a96d43a07b5f86f287009984b76ef8db4a723d
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <sal/config.h>
22 #include <cassert>
23 #include <cstdlib>
25 #include <osl/interlck.h>
26 #include <osl/diagnose.h>
27 #include <rtl/tencinfo.h>
29 #include "strimp.hxx"
30 #include <rtl/character.hxx>
31 #include <rtl/string.h>
33 #include <rtl/math.h>
35 #if defined _WIN32
36 // Temporary check to verify that the #pragma pack around rtl_String is indeed cargo cult and can
37 // safely be removed:
38 static_assert(alignof (rtl_String) == 4);
39 static_assert(sizeof (rtl_String) == 12);
40 #endif
42 /* ======================================================================= */
44 #if USE_SDT_PROBES
45 #define RTL_LOG_STRING_BITS 8
46 #endif
48 #include "strtmpl.hxx"
50 /* static data to be referenced by all empty strings
51 * the refCount is predefined to 1 and must never become 0 !
53 template<>
54 rtl_String rtl::str::EmptyStringImpl<rtl_String>::data =
56 SAL_STRING_STATIC_FLAG|1,
57 /* sal_Int32 refCount; */
58 0, /* sal_Int32 length; */
59 { 0 } /* char buffer[1]; */
62 /* ======================================================================= */
64 sal_Int32 SAL_CALL rtl_str_valueOfFloat(char * pStr, float f)
65 SAL_THROW_EXTERN_C()
67 assert(pStr);
68 rtl_String * pResult = nullptr;
69 sal_Int32 nLen;
70 rtl_math_doubleToString(
71 &pResult, nullptr, 0, f, rtl_math_StringFormat_G,
72 RTL_STR_MAX_VALUEOFFLOAT - RTL_CONSTASCII_LENGTH("-x.E-xxx"), '.', nullptr, 0,
73 true);
74 nLen = pResult->length;
75 OSL_ASSERT(nLen < RTL_STR_MAX_VALUEOFFLOAT);
76 memcpy(pStr, pResult->buffer, (nLen + 1) * sizeof(char));
77 rtl_string_release(pResult);
78 return nLen;
81 sal_Int32 SAL_CALL rtl_str_valueOfDouble(char * pStr, double d)
82 SAL_THROW_EXTERN_C()
84 assert(pStr);
85 rtl_String * pResult = nullptr;
86 sal_Int32 nLen;
87 rtl_math_doubleToString(
88 &pResult, nullptr, 0, d, rtl_math_StringFormat_G,
89 RTL_STR_MAX_VALUEOFDOUBLE - RTL_CONSTASCII_LENGTH("-x.E-xxx"), '.', nullptr,
90 0, true);
91 nLen = pResult->length;
92 OSL_ASSERT(nLen < RTL_STR_MAX_VALUEOFDOUBLE);
93 memcpy(pStr, pResult->buffer, (nLen + 1) * sizeof(char));
94 rtl_string_release(pResult);
95 return nLen;
98 float SAL_CALL rtl_str_toFloat(char const * pStr) SAL_THROW_EXTERN_C()
100 assert(pStr);
101 return static_cast<float>(rtl_math_stringToDouble(pStr, pStr + rtl_str_getLength(pStr),
102 '.', 0, nullptr, nullptr));
105 double SAL_CALL rtl_str_toDouble(char const * pStr) SAL_THROW_EXTERN_C()
107 assert(pStr);
108 return rtl_math_stringToDouble(pStr, pStr + rtl_str_getLength(pStr), '.', 0,
109 nullptr, nullptr);
112 /* ======================================================================= */
114 static int rtl_ImplGetFastUTF8ByteLen( const sal_Unicode* pStr, sal_Int32 nLen )
116 int n;
117 sal_Unicode c;
118 sal_uInt32 nUCS4Char;
119 const sal_Unicode* pEndStr;
121 n = 0;
122 pEndStr = pStr+nLen;
123 while ( pStr < pEndStr )
125 c = *pStr;
127 if ( c < 0x80 )
128 n++;
129 else if ( c < 0x800 )
130 n += 2;
131 else
133 if ( !rtl::isHighSurrogate(c) )
134 n += 3;
135 else
137 nUCS4Char = c;
139 if ( pStr+1 < pEndStr )
141 c = *(pStr+1);
142 if ( rtl::isLowSurrogate(c) )
144 nUCS4Char = rtl::combineSurrogates(nUCS4Char, c);
145 pStr++;
149 if ( nUCS4Char < 0x10000 )
150 n += 3;
151 else if ( nUCS4Char < 0x200000 )
152 n += 4;
153 else if ( nUCS4Char < 0x4000000 )
154 n += 5;
155 else
156 n += 6;
160 pStr++;
163 return n;
166 /* ----------------------------------------------------------------------- */
168 static bool rtl_impl_convertUStringToString(rtl_String ** pTarget,
169 sal_Unicode const * pSource,
170 sal_Int32 nLength,
171 rtl_TextEncoding nEncoding,
172 sal_uInt32 nFlags,
173 bool bCheckErrors)
175 assert(pTarget != nullptr);
176 assert(pSource != nullptr || nLength == 0);
177 assert(nLength >= 0);
178 OSL_ASSERT(nLength == 0 || rtl_isOctetTextEncoding(nEncoding));
180 if ( !nLength )
181 rtl_string_new( pTarget );
182 else
184 rtl_String* pTemp;
185 rtl_UnicodeToTextConverter hConverter;
186 sal_uInt32 nInfo;
187 sal_Size nSrcChars;
188 sal_Size nDestBytes;
189 sal_Size nNewLen;
190 sal_Size nNotConvertedChars;
191 sal_Size nMaxCharLen;
193 /* Optimization for UTF-8 - we try to calculate the exact length */
194 /* For all other encoding we try a good estimation */
195 if ( nEncoding == RTL_TEXTENCODING_UTF8 )
197 nNewLen = rtl_ImplGetFastUTF8ByteLen( pSource, nLength );
198 /* Includes the string only ASCII, then we could copy
199 the buffer faster */
200 if ( nNewLen == static_cast<sal_Size>(nLength) )
202 char* pBuffer;
203 if ( *pTarget )
204 rtl_string_release( *pTarget );
205 *pTarget = rtl_string_ImplAlloc( nLength );
206 OSL_ASSERT(*pTarget != nullptr);
207 pBuffer = (*pTarget)->buffer;
210 /* Check ASCII range */
211 OSL_ENSURE( *pSource <= 127,
212 "rtl_uString2String() - UTF8 test is encoding is wrong" );
214 *pBuffer = static_cast<char>(static_cast<unsigned char>(*pSource));
215 pBuffer++;
216 pSource++;
217 nLength--;
219 while ( nLength );
220 return true;
223 nMaxCharLen = 4;
225 else
227 rtl_TextEncodingInfo aTextEncInfo;
228 aTextEncInfo.StructSize = sizeof( aTextEncInfo );
229 if ( !rtl_getTextEncodingInfo( nEncoding, &aTextEncInfo ) )
231 aTextEncInfo.AverageCharSize = 1;
232 aTextEncInfo.MaximumCharSize = 8;
235 nNewLen = nLength * static_cast<sal_Size>(aTextEncInfo.AverageCharSize);
236 nMaxCharLen = aTextEncInfo.MaximumCharSize;
239 nFlags |= RTL_UNICODETOTEXT_FLAGS_FLUSH;
240 hConverter = rtl_createUnicodeToTextConverter( nEncoding );
242 for (;;)
244 pTemp = rtl_string_ImplAlloc( nNewLen );
245 OSL_ASSERT(pTemp != nullptr);
246 nDestBytes = rtl_convertUnicodeToText( hConverter, nullptr,
247 pSource, nLength,
248 pTemp->buffer, nNewLen,
249 nFlags,
250 &nInfo, &nSrcChars );
251 if (bCheckErrors && (nInfo & RTL_UNICODETOTEXT_INFO_ERROR) != 0)
253 rtl_freeString(pTemp);
254 rtl_destroyUnicodeToTextConverter(hConverter);
255 return false;
258 if ((nInfo & RTL_UNICODETOTEXT_INFO_DESTBUFFERTOSMALL) == 0)
259 break;
261 /* Buffer not big enough, try again with enough space */
262 rtl_freeString( pTemp );
264 /* Try with the max. count of characters with
265 additional overhead for replacing functionality */
266 nNotConvertedChars = nLength-nSrcChars;
267 nNewLen = nDestBytes+(nNotConvertedChars*nMaxCharLen)+nNotConvertedChars+4;
270 /* Set the buffer to the correct size or is there to
271 much overhead, reallocate to the correct size */
272 if ( nNewLen > nDestBytes+8 )
274 rtl_String* pTemp2 = rtl_string_ImplAlloc( nDestBytes );
275 OSL_ASSERT(pTemp2 != nullptr);
276 rtl::str::Copy(pTemp2->buffer, pTemp->buffer, nDestBytes);
277 rtl_freeString( pTemp );
278 pTemp = pTemp2;
280 else
282 pTemp->length = nDestBytes;
283 pTemp->buffer[nDestBytes] = 0;
286 rtl_destroyUnicodeToTextConverter( hConverter );
287 if ( *pTarget )
288 rtl_string_release( *pTarget );
289 *pTarget = pTemp;
291 /* Results the conversion in an empty buffer -
292 create an empty string */
293 if ( pTemp && !nDestBytes )
294 rtl_string_new( pTarget );
296 return true;
299 void SAL_CALL rtl_uString2String( rtl_String** ppThis,
300 const sal_Unicode* pUStr,
301 sal_Int32 nULen,
302 rtl_TextEncoding eTextEncoding,
303 sal_uInt32 nCvtFlags )
304 SAL_THROW_EXTERN_C()
306 rtl_impl_convertUStringToString(ppThis, pUStr, nULen, eTextEncoding,
307 nCvtFlags, false);
310 sal_Bool SAL_CALL rtl_convertUStringToString(rtl_String ** pTarget,
311 sal_Unicode const * pSource,
312 sal_Int32 nLength,
313 rtl_TextEncoding nEncoding,
314 sal_uInt32 nFlags)
315 SAL_THROW_EXTERN_C()
317 return rtl_impl_convertUStringToString(pTarget, pSource, nLength, nEncoding,
318 nFlags, true);
321 void rtl_string_newReplaceFirst(
322 rtl_String ** newStr, rtl_String * str, char const * from,
323 sal_Int32 fromLength, char const * to, sal_Int32 toLength,
324 sal_Int32 * index) SAL_THROW_EXTERN_C()
326 assert(str != nullptr);
327 assert(index != nullptr);
328 assert(*index >= 0 && *index <= str->length);
329 assert(fromLength >= 0);
330 assert(toLength >= 0);
331 sal_Int32 i = rtl_str_indexOfStr_WithLength(
332 str->buffer + *index, str->length - *index, from, fromLength);
333 if (i == -1) {
334 rtl_string_assign(newStr, str);
335 } else {
336 assert(i <= str->length - *index);
337 i += *index;
338 assert(fromLength <= str->length);
339 if (str->length - fromLength > SAL_MAX_INT32 - toLength) {
340 std::abort();
342 sal_Int32 n = str->length - fromLength + toLength;
343 rtl_string_acquire(str); // in case *newStr == str
344 rtl_string_new_WithLength(newStr, n);
345 if (n != 0) {
346 (*newStr)->length = n;
347 assert(i >= 0 && i < str->length);
348 memcpy((*newStr)->buffer, str->buffer, i);
349 memcpy((*newStr)->buffer + i, to, toLength);
350 memcpy(
351 (*newStr)->buffer + i + toLength, str->buffer + i + fromLength,
352 str->length - i - fromLength);
354 rtl_string_release(str);
356 *index = i;
359 void rtl_string_newReplaceAll(
360 rtl_String ** newStr, rtl_String * str, char const * from,
361 sal_Int32 fromLength, char const * to, sal_Int32 toLength)
362 SAL_THROW_EXTERN_C()
364 rtl_string_assign(newStr, str);
365 for (sal_Int32 i = 0;; i += toLength) {
366 rtl_string_newReplaceFirst(
367 newStr, *newStr, from, fromLength, to, toLength, &i);
368 if (i == -1) {
369 break;
374 sal_Int32 SAL_CALL rtl_str_getLength(const char* pStr) SAL_THROW_EXTERN_C()
376 return rtl::str::getLength(pStr);
379 sal_Int32 SAL_CALL rtl_str_compare(const char* pStr1, const char* pStr2) SAL_THROW_EXTERN_C()
381 return rtl::str::compare(pStr1, pStr2);
384 sal_Int32 SAL_CALL rtl_str_compare_WithLength(const char* pStr1, sal_Int32 nStr1Len,
385 const char* pStr2, sal_Int32 nStr2Len)
386 SAL_THROW_EXTERN_C()
388 return rtl::str::compare_WithLength(pStr1, nStr1Len, pStr2, nStr2Len);
391 sal_Int32 SAL_CALL rtl_str_shortenedCompare_WithLength(const char* pStr1, sal_Int32 nStr1Len,
392 const char* pStr2, sal_Int32 nStr2Len,
393 sal_Int32 nShortenedLength)
394 SAL_THROW_EXTERN_C()
396 return rtl::str::shortenedCompare_WithLength(pStr1, nStr1Len, pStr2, nStr2Len, nShortenedLength);
399 sal_Int32 SAL_CALL rtl_str_reverseCompare_WithLength(const char* pStr1, sal_Int32 nStr1Len,
400 const char* pStr2, sal_Int32 nStr2Len)
401 SAL_THROW_EXTERN_C()
403 return rtl::str::reverseCompare_WithLength(pStr1, nStr1Len, pStr2, nStr2Len);
406 sal_Int32 SAL_CALL rtl_str_compareIgnoreAsciiCase(const char* pStr1, const char* pStr2)
407 SAL_THROW_EXTERN_C()
409 return rtl::str::compareIgnoreAsciiCase(pStr1, pStr2);
412 sal_Int32 SAL_CALL rtl_str_compareIgnoreAsciiCase_WithLength(const char* pStr1, sal_Int32 nStr1Len,
413 const char* pStr2, sal_Int32 nStr2Len)
414 SAL_THROW_EXTERN_C()
416 return rtl::str::compareIgnoreAsciiCase_WithLength(pStr1, nStr1Len, pStr2, nStr2Len);
419 sal_Int32 SAL_CALL rtl_str_shortenedCompareIgnoreAsciiCase_WithLength(
420 const char* pStr1, sal_Int32 nStr1Len, const char* pStr2, sal_Int32 nStr2Len,
421 sal_Int32 nShortenedLength) SAL_THROW_EXTERN_C()
423 return rtl::str::shortenedCompareIgnoreAsciiCase_WithLength(pStr1, nStr1Len, pStr2, nStr2Len,
424 nShortenedLength);
427 sal_Int32 SAL_CALL rtl_str_hashCode(const char* pStr) SAL_THROW_EXTERN_C()
429 return rtl::str::hashCode(pStr);
432 sal_Int32 SAL_CALL rtl_str_hashCode_WithLength(const char* pStr, sal_Int32 nLen)
433 SAL_THROW_EXTERN_C()
435 return rtl::str::hashCode_WithLength(pStr, nLen);
438 sal_Int32 SAL_CALL rtl_str_indexOfChar(const char* pStr, char c) SAL_THROW_EXTERN_C()
440 return rtl::str::indexOfChar(pStr, c);
443 sal_Int32 SAL_CALL rtl_str_indexOfChar_WithLength(const char* pStr, sal_Int32 nLen, char c)
444 SAL_THROW_EXTERN_C()
446 return rtl::str::indexOfChar_WithLength(pStr, nLen, c);
449 sal_Int32 SAL_CALL rtl_str_lastIndexOfChar(const char* pStr, char c) SAL_THROW_EXTERN_C()
451 return rtl::str::lastIndexOfChar(pStr, c);
454 sal_Int32 SAL_CALL rtl_str_lastIndexOfChar_WithLength(const char* pStr, sal_Int32 nLen, char c)
455 SAL_THROW_EXTERN_C()
457 return rtl::str::lastIndexOfChar_WithLength(pStr, nLen, c);
460 sal_Int32 SAL_CALL rtl_str_indexOfStr(const char* pStr, const char* pSubStr) SAL_THROW_EXTERN_C()
462 return rtl::str::indexOfStr(pStr, pSubStr);
465 sal_Int32 SAL_CALL rtl_str_indexOfStr_WithLength(const char* pStr, sal_Int32 nStrLen,
466 const char* pSubStr, sal_Int32 nSubLen)
467 SAL_THROW_EXTERN_C()
469 return rtl::str::indexOfStr_WithLength(pStr, nStrLen, pSubStr, nSubLen);
472 sal_Int32 SAL_CALL rtl_str_lastIndexOfStr(const char* pStr, const char* pSubStr)
473 SAL_THROW_EXTERN_C()
475 return rtl::str::lastIndexOfStr(pStr, pSubStr);
478 sal_Int32 SAL_CALL rtl_str_lastIndexOfStr_WithLength(const char* pStr, sal_Int32 nStrLen,
479 const char* pSubStr, sal_Int32 nSubLen)
480 SAL_THROW_EXTERN_C()
482 return rtl::str::lastIndexOfStr_WithLength(pStr, nStrLen, pSubStr, nSubLen);
485 void SAL_CALL rtl_str_replaceChar(char* pStr, char cOld, char cNew) SAL_THROW_EXTERN_C()
487 return rtl::str::replaceChar(pStr, cOld, cNew);
490 void SAL_CALL rtl_str_replaceChar_WithLength(char* pStr, sal_Int32 nLen, char cOld, char cNew)
491 SAL_THROW_EXTERN_C()
493 return rtl::str::replaceChar_WithLength(pStr, nLen, cOld, cNew);
496 void SAL_CALL rtl_str_toAsciiLowerCase(char* pStr) SAL_THROW_EXTERN_C()
498 return rtl::str::toAsciiLowerCase(pStr);
501 void SAL_CALL rtl_str_toAsciiLowerCase_WithLength(char* pStr, sal_Int32 nLen) SAL_THROW_EXTERN_C()
503 return rtl::str::toAsciiLowerCase_WithLength(pStr, nLen);
506 void SAL_CALL rtl_str_toAsciiUpperCase(char* pStr) SAL_THROW_EXTERN_C()
508 return rtl::str::toAsciiUpperCase(pStr);
511 void SAL_CALL rtl_str_toAsciiUpperCase_WithLength(char* pStr, sal_Int32 nLen) SAL_THROW_EXTERN_C()
513 return rtl::str::toAsciiUpperCase_WithLength(pStr, nLen);
516 sal_Int32 SAL_CALL rtl_str_trim(char* pStr) SAL_THROW_EXTERN_C() { return rtl::str::trim(pStr); }
518 sal_Int32 SAL_CALL rtl_str_trim_WithLength(char* pStr, sal_Int32 nLen) SAL_THROW_EXTERN_C()
520 return rtl::str::trim_WithLength(pStr, nLen);
523 sal_Int32 SAL_CALL rtl_str_valueOfBoolean(char* pStr, sal_Bool b) SAL_THROW_EXTERN_C()
525 return rtl::str::valueOfBoolean(pStr, b);
528 sal_Int32 SAL_CALL rtl_str_valueOfChar(char* pStr, char c) SAL_THROW_EXTERN_C()
530 return rtl::str::valueOfChar(pStr, c);
533 sal_Int32 SAL_CALL rtl_str_valueOfInt32(char* pStr, sal_Int32 n, sal_Int16 nRadix)
534 SAL_THROW_EXTERN_C()
536 return rtl::str::valueOfInt32(pStr, n, nRadix);
539 sal_Int32 SAL_CALL rtl_str_valueOfInt64(char* pStr, sal_Int64 n, sal_Int16 nRadix)
540 SAL_THROW_EXTERN_C()
542 return rtl::str::valueOfInt64(pStr, n, nRadix);
545 sal_Int32 SAL_CALL rtl_str_valueOfUInt64(char* pStr, sal_uInt64 n, sal_Int16 nRadix)
546 SAL_THROW_EXTERN_C()
548 return rtl::str::valueOfUInt64(pStr, n, nRadix);
551 sal_Bool SAL_CALL rtl_str_toBoolean(const char* pStr) SAL_THROW_EXTERN_C()
553 return rtl::str::toBoolean(pStr);
556 sal_Int32 SAL_CALL rtl_str_toInt32(const char* pStr, sal_Int16 nRadix) SAL_THROW_EXTERN_C()
558 return rtl::str::toInt32(pStr, nRadix);
561 sal_Int64 SAL_CALL rtl_str_toInt64(const char* pStr, sal_Int16 nRadix) SAL_THROW_EXTERN_C()
563 return rtl::str::toInt64(pStr, nRadix);
566 sal_Int64 SAL_CALL rtl_str_toInt64_WithLength(const char* pStr, sal_Int16 nRadix,
567 sal_Int32 nStrLength) SAL_THROW_EXTERN_C()
569 return rtl::str::toInt64_WithLength(pStr, nRadix, nStrLength);
572 sal_uInt32 SAL_CALL rtl_str_toUInt32(const char* pStr, sal_Int16 nRadix) SAL_THROW_EXTERN_C()
574 return rtl::str::toUInt32(pStr, nRadix);
577 sal_uInt64 SAL_CALL rtl_str_toUInt64(const char* pStr, sal_Int16 nRadix) SAL_THROW_EXTERN_C()
579 return rtl::str::toUInt64(pStr, nRadix);
582 rtl_String* rtl_string_ImplAlloc(sal_Int32 nLen) { return rtl::str::Alloc<rtl_String>(nLen); }
584 void SAL_CALL rtl_string_acquire(rtl_String* pThis) SAL_THROW_EXTERN_C()
586 return rtl::str::acquire(pThis);
589 void SAL_CALL rtl_string_release(rtl_String* pThis) SAL_THROW_EXTERN_C()
591 return rtl::str::release(pThis);
594 void SAL_CALL rtl_string_new(rtl_String** ppThis) SAL_THROW_EXTERN_C()
596 return rtl::str::new_(ppThis);
599 rtl_String* SAL_CALL rtl_string_alloc(sal_Int32 nLen) SAL_THROW_EXTERN_C()
601 assert(nLen >= 0);
602 return rtl::str::Alloc<rtl_String>(nLen);
605 void SAL_CALL rtl_string_new_WithLength(rtl_String** ppThis, sal_Int32 nLen) SAL_THROW_EXTERN_C()
607 rtl::str::new_WithLength(ppThis, nLen);
610 void SAL_CALL rtl_string_newFromString(rtl_String** ppThis, const rtl_String* pStr)
611 SAL_THROW_EXTERN_C()
613 rtl::str::newFromString(ppThis, pStr);
616 void SAL_CALL rtl_string_newFromStr(rtl_String** ppThis, const char* pCharStr) SAL_THROW_EXTERN_C()
618 rtl::str::newFromStr(ppThis, pCharStr);
621 void SAL_CALL rtl_string_newFromStr_WithLength(rtl_String** ppThis, const char* pCharStr,
622 sal_Int32 nLen) SAL_THROW_EXTERN_C()
624 rtl::str::newFromStr_WithLength(ppThis, pCharStr, nLen);
627 void SAL_CALL rtl_string_newFromSubString(rtl_String** ppThis, const rtl_String* pFrom,
628 sal_Int32 beginIndex, sal_Int32 count)
629 SAL_THROW_EXTERN_C()
631 rtl::str::newFromSubString(ppThis, pFrom, beginIndex, count);
634 // Used when creating from string literals.
635 void SAL_CALL rtl_string_newFromLiteral(rtl_String** ppThis, const char* pCharStr, sal_Int32 nLen,
636 sal_Int32 allocExtra) SAL_THROW_EXTERN_C()
638 rtl::str::newFromLiteral(ppThis, pCharStr, nLen, allocExtra);
641 void SAL_CALL rtl_string_assign(rtl_String** ppThis, rtl_String* pStr) SAL_THROW_EXTERN_C()
643 rtl::str::assign(ppThis, pStr);
646 sal_Int32 SAL_CALL rtl_string_getLength(const rtl_String* pThis) SAL_THROW_EXTERN_C()
648 return rtl::str::getLength(pThis);
651 char* SAL_CALL rtl_string_getStr(rtl_String* pThis) SAL_THROW_EXTERN_C()
653 return rtl::str::getStr(pThis);
656 void SAL_CALL rtl_string_newConcat(rtl_String** ppThis, rtl_String* pLeft, rtl_String* pRight)
657 SAL_THROW_EXTERN_C()
659 rtl::str::newConcat(ppThis, pLeft, pRight);
662 void SAL_CALL rtl_string_ensureCapacity(rtl_String** ppThis, sal_Int32 size) SAL_THROW_EXTERN_C()
664 rtl::str::ensureCapacity(ppThis, size);
667 void SAL_CALL rtl_string_newReplaceStrAt(rtl_String** ppThis, rtl_String* pStr, sal_Int32 nIndex,
668 sal_Int32 nCount, rtl_String* pNewSubStr)
669 SAL_THROW_EXTERN_C()
671 rtl::str::newReplaceStrAt(ppThis, pStr, nIndex, nCount, pNewSubStr);
674 void SAL_CALL rtl_string_newReplace(rtl_String** ppThis, rtl_String* pStr, char cOld, char cNew)
675 SAL_THROW_EXTERN_C()
677 rtl::str::newReplace(ppThis, pStr, cOld, cNew);
680 void SAL_CALL rtl_string_newToAsciiLowerCase(rtl_String** ppThis, rtl_String* pStr)
681 SAL_THROW_EXTERN_C()
683 rtl::str::newToAsciiLowerCase(ppThis, pStr);
686 void SAL_CALL rtl_string_newToAsciiUpperCase(rtl_String** ppThis, rtl_String* pStr)
687 SAL_THROW_EXTERN_C()
689 rtl::str::newToAsciiUpperCase(ppThis, pStr);
692 void SAL_CALL rtl_string_newTrim(rtl_String** ppThis, rtl_String* pStr) SAL_THROW_EXTERN_C()
694 rtl::str::newTrim(ppThis, pStr);
697 sal_Int32 SAL_CALL rtl_string_getToken(rtl_String** ppThis, rtl_String* pStr, sal_Int32 nToken,
698 char cTok, sal_Int32 nIndex) SAL_THROW_EXTERN_C()
700 return rtl::str::getToken(ppThis, pStr, nToken, cTok, nIndex);
703 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */