LibreOffice: rtl/ustring.hxx Source File

LibreOffice LibreOffice 25.8 SDK C/C++ API Reference

Loading...
Searching...
No Matches
ustring.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/*
21 * This file is part of LibreOffice published API.
22 */
23
24#ifndef INCLUDED_RTL_USTRING_HXX
25#define INCLUDED_RTL_USTRING_HXX
26
27#include "sal/config.h"
28
29#include <cassert>
30#include <cstddef>
31#include <cstdlib>
32#include <limits>
33#include <new>
34#include <ostream>
35#include <utility>
36
37#if defined LIBO_INTERNAL_ONLY
38#include <algorithm>
39#include <string_view>
40#include <type_traits>
41#endif
42
43#include "rtl/math.h"
44#include "rtl/ustring.h"
45#include "rtl/string.hxx"
46#include "rtl/stringutils.hxx"
47#include "rtl/textenc.h"
48
49#ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
50#include "config_global.h"
51#include "o3tl/safeint.hxx"
52#include "rtl/stringconcat.hxx"
53#endif
54
55#ifdef RTL_STRING_UNITTEST
56extern bool rtl_string_unittest_invalid_conversion;
57#endif
58
59// The unittest uses slightly different code to help check that the proper
60// calls are made. The class is put into a different namespace to make
61// sure the compiler generates a different (if generating also non-inline)
62// copy of the function and does not merge them together. The class
63// is "brought" into the proper rtl namespace by a typedef below.
64#ifdef RTL_STRING_UNITTEST
65#define rtl rtlunittest
66#endif
67
68namespace rtl
69{
70
71class OUStringBuffer;
72
73#ifdef RTL_STRING_UNITTEST
74#undef rtl
75#endif
76
77#if defined LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
79
86template<std::size_t N> class SAL_WARN_UNUSED OUStringLiteral {
87 static_assert(N != 0);
88 static_assert(N - 1 <= std::numeric_limits<sal_Int32>::max(), "literal too long");
89
90public:
91#if HAVE_CPP_CONSTEVAL
92 consteval
93#else
94 constexpr
95#endif
96 OUStringLiteral(char16_t const (&literal)[N]) {
97 assertLayout();
98 assert(literal[N - 1] == '\0');
99 std::copy_n(literal, N, more.buffer);
100 }
101
102 constexpr sal_Int32 getLength() const { return more.length; }
103
104 constexpr sal_Unicode const * getStr() const SAL_RETURNS_NONNULL { return more.buffer; }
105
106 constexpr operator std::u16string_view() const { return {more.buffer, sal_uInt32(more.length)}; }
107
108private:
109 static constexpr void assertLayout() {
110 // These static_asserts verifying the layout compatibility with rtl_uString cannot be class
111 // member declarations, as offsetof requires a complete type, so defer them to here:
112 static_assert(std::is_standard_layout_v<OUStringLiteral>);
113 static_assert(offsetof(OUStringLiteral, str.refCount) == offsetof(OUStringLiteral, more.refCount));
114 static_assert(offsetof(OUStringLiteral, str.length) == offsetof(OUStringLiteral, more.length));
115 static_assert(offsetof(OUStringLiteral, str.buffer) == offsetof(OUStringLiteral, more.buffer));
116 }
117
118 struct Data {
119 Data() = default;
120
121 oslInterlockedCount refCount = 0x40000000; // SAL_STRING_STATIC_FLAG (sal/rtl/strimp.hxx)
122 sal_Int32 length = N - 1;
123 sal_Unicode buffer[N];
124 };
125
126public:
127 // (Data members must be public so that OUStringLiteral is a structural type that can be used as
128 // a non-type template parameter type for operator ""_ustr:)
129 union {
130 rtl_uString str;
131 Data more = {};
132 };
133};
134
135#if defined RTL_STRING_UNITTEST
136namespace libreoffice_internal {
137template<std::size_t N> struct ExceptConstCharArrayDetector<OUStringLiteral<N>> {};
138template<std::size_t N> struct ExceptCharArrayDetector<OUStringLiteral<N>> {};
139}
140#endif
141
143#endif
144
145/* ======================================================================= */
146
169
170// coverity[ missing_move_assignment : SUPPRESS] - don't report the suppressed move assignment
171 class SAL_WARN_UNUSED SAL_DLLPUBLIC_RTTI OUString
172{
173public:
175 rtl_uString * pData;
177
181 OUString()
182 {
183 pData = NULL;
184 rtl_uString_new( &pData );
185 }
186
192#if defined LIBO_INTERNAL_ONLY && !(defined _MSC_VER && _MSC_VER <= 1929 && defined _MANAGED)
193 constexpr
194#endif
195 OUString( const OUString & str )
196 {
197 pData = str.pData;
198#if defined LIBO_INTERNAL_ONLY && !(defined _MSC_VER && _MSC_VER <= 1929 && defined _MANAGED)
199 if (std::is_constant_evaluated()) {
200 //TODO: We would want to
201 //
202 // assert(SAL_STRING_IS_STATIC(pData));
203 //
204 // here, but that wouldn't work because read of member `str` of OUStringLiteral's
205 // anonymous union with active member `more` is not allowed in a constant expression.
206 } else
207#endif
208 rtl_uString_acquire( pData );
209 }
210
211#if defined LIBO_INTERNAL_ONLY
212#if !defined(__COVERITY__) // suppress COPY_INSTEAD_OF_MOVE suggestions
219#if !(defined _MSC_VER && _MSC_VER <= 1929 && defined _MANAGED)
220 constexpr
221#endif
222 OUString( OUString && str ) noexcept
223 {
224 pData = str.pData;
225#if !(defined _MSC_VER && _MSC_VER <= 1929 && defined _MANAGED)
226 if (std::is_constant_evaluated()) {
227 //TODO: We would want to
228 //
229 // assert(SAL_STRING_IS_STATIC(pData));
230 //
231 // here, but that wouldn't work because read of member `str` of OUStringLiteral's
232 // anonymous union with active member `more` is not allowed in a constant expression.
233 return;
234 }
235#endif
236 str.pData = nullptr;
237 rtl_uString_new( &str.pData );
238 }
239#endif
240#endif
241
247 OUString( rtl_uString * str )
248 {
249 pData = str;
250 rtl_uString_acquire( pData );
251 }
252
253#if defined LIBO_INTERNAL_ONLY
255 // Catch inadvertent conversions to the above ctor:
256 OUString(std::nullptr_t) = delete;
258#endif
259
268 OUString( rtl_uString * str, __sal_NoAcquire )
269 { pData = str; }
270
276 explicit OUString( sal_Unicode value )
277 : pData (NULL)
278 {
279 rtl_uString_newFromStr_WithLength( &pData, &value, 1 );
280 }
281
282#if defined LIBO_INTERNAL_ONLY && !defined RTL_STRING_UNITTEST_CONCAT
284 // Catch inadvertent conversions to the above ctor (but still allow
285 // construction from char literals):
286 OUString(int) = delete;
287 explicit OUString(char c):
288 OUString(sal_Unicode(static_cast<unsigned char>(c)))
289 {}
291#endif
292
293#if defined LIBO_INTERNAL_ONLY
294
295 template<typename T> explicit OUString(
296 T const & value,
297 typename libreoffice_internal::CharPtrDetector<T, libreoffice_internal::Dummy>::TypeUtf16
298 = libreoffice_internal::Dummy()):
299 pData(nullptr)
300 { rtl_uString_newFromStr(&pData, value); }
301
302 template<typename T> explicit OUString(
303 T & value,
304 typename
305 libreoffice_internal::NonConstCharArrayDetector<T, libreoffice_internal::Dummy>::TypeUtf16
306 = libreoffice_internal::Dummy()):
307 pData(nullptr)
308 { rtl_uString_newFromStr(&pData, value); }
309
310#else
311
317 OUString( const sal_Unicode * value )
318 {
319 pData = NULL;
320 rtl_uString_newFromStr( &pData, value );
321 }
322
323#endif
324
333 OUString( const sal_Unicode * value, sal_Int32 length )
334 {
335 pData = NULL;
336 rtl_uString_newFromStr_WithLength( &pData, value, length );
337 }
338
354 template< typename T >
355 OUString( T& literal, typename libreoffice_internal::ConstCharArrayDetector< T, libreoffice_internal::Dummy >::Type = libreoffice_internal::Dummy() )
356 {
357 assert(
358 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
359 pData = NULL;
360 if SAL_CONSTEXPR (libreoffice_internal::ConstCharArrayDetector<T>::length == 0) {
361 rtl_uString_new(&pData);
362 } else {
363 rtl_uString_newFromLiteral(
364 &pData,
365 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
366 literal),
367 libreoffice_internal::ConstCharArrayDetector<T>::length, 0);
368 }
369#ifdef RTL_STRING_UNITTEST
370 rtl_string_unittest_const_literal = true;
371#endif
372 }
373
374#if defined LIBO_INTERNAL_ONLY
375 // Rather use a u""_ustr literal (but don't remove this entirely, to avoid implicit support for
376 // it via std::u16string_view from kicking in):
377 template<typename T> OUString(
378 T &,
379 typename libreoffice_internal::ConstCharArrayDetector<
380 T, libreoffice_internal::Dummy>::TypeUtf16
381 = libreoffice_internal::Dummy()) = delete;
382
383 OUString(OUStringChar c): pData(nullptr) { rtl_uString_newFromStr_WithLength(&pData, &c.c, 1); }
384#endif
385
386#if defined LIBO_INTERNAL_ONLY && defined RTL_STRING_UNITTEST
388
392 template< typename T >
393 OUString( T&, typename libreoffice_internal::ExceptConstCharArrayDetector< T >::Type = libreoffice_internal::Dummy() )
394 {
395 pData = NULL;
396 rtl_uString_newFromLiteral( &pData, "!!br0ken!!", 10, 0 ); // set to garbage
397 rtl_string_unittest_invalid_conversion = true;
398 }
403 template< typename T >
404 OUString( const T&, typename libreoffice_internal::ExceptCharArrayDetector< T >::Type = libreoffice_internal::Dummy() )
405 {
406 pData = NULL;
407 rtl_uString_newFromLiteral( &pData, "!!br0ken!!", 10, 0 ); // set to garbage
408 rtl_string_unittest_invalid_conversion = true;
409 }
411#endif
412
413#ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
415
420 template<std::size_t N> constexpr OUString(OUStringLiteral<N> const & literal):
421 pData(const_cast<rtl_uString *>(&literal.str)) {}
422 template<std::size_t N> OUString(OUStringLiteral<N> &&) = delete;
424#endif
425
426#if defined LIBO_INTERNAL_ONLY && !(defined _MSC_VER && _MSC_VER <= 1929 && defined _MANAGED)
427 // For operator ""_tstr:
428 template<OStringLiteral L> OUString(detail::OStringHolder<L> const & holder) {
429 pData = nullptr;
430 if (holder.literal.getLength() == 0) {
431 rtl_uString_new(&pData);
432 } else {
433 rtl_uString_newFromLiteral(
434 &pData, holder.literal.getStr(), holder.literal.getLength(), 0);
435 }
436 }
437#endif
438
453 OUString( const char * value, sal_Int32 length,
454 rtl_TextEncoding encoding,
455 sal_uInt32 convertFlags = OSTRING_TO_OUSTRING_CVTFLAGS )
456 {
457 pData = NULL;
458 rtl_string2UString( &pData, value, length, encoding, convertFlags );
459 if (pData == NULL) {
460 throw std::bad_alloc();
461 }
462 }
463
480 explicit OUString(
481 sal_uInt32 const * codePoints, sal_Int32 codePointCount):
482 pData(NULL)
483 {
484 rtl_uString_newFromCodePoints(&pData, codePoints, codePointCount);
485 if (pData == NULL) {
486 throw std::bad_alloc();
487 }
488 }
489
490#ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
495 template< typename T1, typename T2 >
496 OUString( OUStringConcat< T1, T2 >&& c )
497 {
498 const sal_Int32 l = c.length();
499 pData = rtl_uString_alloc( l );
500 if (l != 0)
501 {
502 sal_Unicode* end = c.addData( pData->buffer );
503 pData->length = l;
504 *end = '\0';
505 }
506 }
507
512 template< std::size_t N >
513 OUString( OUStringNumber< N >&& n )
514 : OUString( n.buf, n.length )
515 {}
516#endif
517
518#if defined LIBO_INTERNAL_ONLY
519 explicit OUString(std::u16string_view sv) {
520 if (sv.size() > sal_uInt32(std::numeric_limits<sal_Int32>::max())) {
521 throw std::bad_alloc();
522 }
523 pData = nullptr;
524 rtl_uString_newFromStr_WithLength(&pData, sv.data(), sv.size());
525 }
526#endif
527
531#if defined LIBO_INTERNAL_ONLY && !(defined _MSC_VER && _MSC_VER <= 1929 && defined _MANAGED)
532 constexpr
533#endif
534 ~OUString()
535 {
536#if defined LIBO_INTERNAL_ONLY && !(defined _MSC_VER && _MSC_VER <= 1929 && defined _MANAGED)
537 if (std::is_constant_evaluated()) {
538 //TODO: We would want to
539 //
540 // assert(SAL_STRING_IS_STATIC(pData));
541 //
542 // here, but that wouldn't work because read of member `str` of OUStringLiteral's
543 // anonymous union with active member `more` is not allowed in a constant expression.
544 } else
545#endif
546 rtl_uString_release( pData );
547 }
548
560 static OUString const & unacquired( rtl_uString * const * ppHandle )
561 { return * reinterpret_cast< OUString const * >( ppHandle ); }
562
563#if defined LIBO_INTERNAL_ONLY
576 static OUString const& unacquired(const OUStringBuffer& str);
577#endif
578
584 OUString & operator=( const OUString & str )
585 {
586 rtl_uString_assign( &pData, str.pData );
587 return *this;
588 }
589
590#if defined LIBO_INTERNAL_ONLY
591#if !defined(__COVERITY__) // suppress COPY_INSTEAD_OF_MOVE suggestions
598 OUString & operator=( OUString && str ) noexcept
599 {
600 std::swap(pData, str.pData);
601 return *this;
602 }
603#endif
604#endif
605
618 template< typename T >
619 typename libreoffice_internal::ConstCharArrayDetector< T, OUString& >::Type operator=( T& literal )
620 {
621 assert(
622 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
623 if SAL_CONSTEXPR (libreoffice_internal::ConstCharArrayDetector<T>::length == 0) {
624 rtl_uString_new(&pData);
625 } else {
626 rtl_uString_newFromLiteral(
627 &pData,
628 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
629 literal),
630 libreoffice_internal::ConstCharArrayDetector<T>::length, 0);
631 }
632 return *this;
633 }
634
635#if defined LIBO_INTERNAL_ONLY
636 // Rather assign from a u""_ustr literal (but don't remove this entirely, to avoid implicit
637 // support for it via std::u16string_view from kicking in):
638 template<typename T>
639 typename
640 libreoffice_internal::ConstCharArrayDetector<T, OUString &>::TypeUtf16
641 operator =(T &) = delete;
642
643 OUString & operator =(OUStringChar c) {
644 rtl_uString_newFromStr_WithLength(&pData, &c.c, 1);
645 return *this;
646 }
647
649 template<std::size_t N> OUString & operator =(OUStringLiteral<N> const & literal) {
650 rtl_uString_release(pData);
651 pData = const_cast<rtl_uString *>(&literal.str);
652 return *this;
653 }
654 template<std::size_t N> OUString & operator =(OUStringLiteral<N> &&) = delete;
655
656 template <std::size_t N>
657 OUString & operator =(OUStringNumber<N> && n) {
658 // n.length should never be zero, so no need to add an optimization for that case
659 rtl_uString_newFromStr_WithLength(&pData, n.buf, n.length);
660 return *this;
661 }
662
663 OUString & operator =(std::u16string_view sv) {
664 if (sv.empty()) {
665 rtl_uString_new(&pData);
666 } else {
667 rtl_uString_newFromStr_WithLength(&pData, sv.data(), sv.size());
668 }
669 return *this;
670 }
671#endif
672
673#if defined LIBO_INTERNAL_ONLY
682 inline OUString & operator+=( const OUStringBuffer & str ) &;
683#endif
684
692 OUString & operator+=( const OUString & str )
693#if defined LIBO_INTERNAL_ONLY
694 &
695#endif
696 {
697 return internalAppend(str.pData);
698 }
699#if defined LIBO_INTERNAL_ONLY
700 void operator+=(OUString const &) && = delete;
701#endif
702
709 template<typename T>
710 typename libreoffice_internal::ConstCharArrayDetector<T, OUString &>::Type
711 operator +=(T & literal)
712#if defined LIBO_INTERNAL_ONLY
713 &
714#endif
715 {
716 assert(
717 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
718 rtl_uString_newConcatAsciiL(
719 &pData, pData,
720 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal),
721 libreoffice_internal::ConstCharArrayDetector<T>::length);
722 return *this;
723 }
724#if defined LIBO_INTERNAL_ONLY
725 template<typename T>
726 typename libreoffice_internal::ConstCharArrayDetector<T, OUString &>::Type
727 operator +=(T &) && = delete;
728#endif
729
730#if defined LIBO_INTERNAL_ONLY
732 template<typename T>
733 typename
734 libreoffice_internal::ConstCharArrayDetector<T, OUString &>::TypeUtf16
735 operator +=(T & literal) & {
736 rtl_uString_newConcatUtf16L(
737 &pData, pData,
738 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal),
739 libreoffice_internal::ConstCharArrayDetector<T>::length);
740 return *this;
741 }
742 template<typename T>
743 typename
744 libreoffice_internal::ConstCharArrayDetector<T, OUString &>::TypeUtf16
745 operator +=(T &) && = delete;
746
748 template<std::size_t N> OUString & operator +=(OUStringLiteral<N> const & literal) & {
749 rtl_uString_newConcatUtf16L(&pData, pData, literal.getStr(), literal.getLength());
750 return *this;
751 }
752 template<std::size_t N> void operator +=(OUStringLiteral<N> const &) && = delete;
753
754 OUString & operator +=(std::u16string_view sv) & {
755 if (sv.size() > sal_uInt32(std::numeric_limits<sal_Int32>::max())) {
756 throw std::bad_alloc();
757 }
758 rtl_uString_newConcatUtf16L(&pData, pData, sv.data(), sv.size());
759 return *this;
760 }
761 void operator +=(std::u16string_view) && = delete;
762#endif
763
764#ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
769 template< typename T1, typename T2 >
770 OUString& operator+=( OUStringConcat< T1, T2 >&& c ) & {
771 sal_Int32 l = c.length();
772 if( l == 0 )
773 return *this;
774 l += pData->length;
775 rtl_uString_ensureCapacity( &pData, l );
776 sal_Unicode* end = c.addData( pData->buffer + pData->length );
777 *end = '\0';
778 pData->length = l;
779 return *this;
780 }
781 template<typename T1, typename T2> void operator +=(
782 OUStringConcat<T1, T2> &&) && = delete;
783
788 template< std::size_t N >
789 OUString& operator+=( OUStringNumber< N >&& n ) & {
790 sal_Int32 l = n.length;
791 if( l == 0 )
792 return *this;
793 l += pData->length;
794 rtl_uString_ensureCapacity( &pData, l );
795 sal_Unicode* end = addDataHelper( pData->buffer + pData->length, n.buf, n.length );
796 *end = '\0';
797 pData->length = l;
798 return *this;
799 }
800 template<std::size_t N> void operator +=(
801 OUStringNumber<N> &&) && = delete;
802#endif
803
808 void clear()
809 {
810 rtl_uString_new( &pData );
811 }
812
821 sal_Int32 getLength() const { return pData->length; }
822
831 bool isEmpty() const
832 {
833 return pData->length == 0;
834 }
835
843 const sal_Unicode * getStr() const SAL_RETURNS_NONNULL { return pData->buffer; }
844
854 sal_Unicode operator [](sal_Int32 index) const {
855 // silence spurious -Werror=strict-overflow warnings from GCC 4.8.2
856 assert(index >= 0 && static_cast<sal_uInt32>(index) < static_cast<sal_uInt32>(getLength()));
857 return getStr()[index];
858 }
859
872#if defined LIBO_INTERNAL_ONLY
873 sal_Int32 compareTo( std::u16string_view str ) const
874 {
875 return rtl_ustr_compare_WithLength( pData->buffer, pData->length,
876 str.data(), str.length() );
877 }
878#else
879 sal_Int32 compareTo( const OUString & str ) const
880 {
881 return rtl_ustr_compare_WithLength( pData->buffer, pData->length,
882 str.pData->buffer, str.pData->length );
883 }
884#endif
885
901#if defined LIBO_INTERNAL_ONLY
902 sal_Int32 compareTo( std::u16string_view str, sal_Int32 maxLength ) const
903 {
904 return rtl_ustr_shortenedCompare_WithLength( pData->buffer, pData->length,
905 str.data(), str.length(), maxLength );
906 }
907#else
908 sal_Int32 compareTo( const OUString & str, sal_Int32 maxLength ) const
909 {
910 return rtl_ustr_shortenedCompare_WithLength( pData->buffer, pData->length,
911 str.pData->buffer, str.pData->length, maxLength );
912 }
913#endif
914
927#if defined LIBO_INTERNAL_ONLY
928 sal_Int32 reverseCompareTo(std::u16string_view sv) const {
929 return rtl_ustr_reverseCompare_WithLength(
930 pData->buffer, pData->length, sv.data(), sv.size());
931 }
932#else
933 sal_Int32 reverseCompareTo( const OUString & str ) const
934 {
935 return rtl_ustr_reverseCompare_WithLength( pData->buffer, pData->length,
936 str.pData->buffer, str.pData->length );
937 }
938#endif
939
945 template< typename T >
946 typename libreoffice_internal::ConstCharArrayDetector< T, sal_Int32 >::Type reverseCompareTo( T& literal ) const
947 {
948 assert(
949 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
950 return rtl_ustr_asciil_reverseCompare_WithLength(
951 pData->buffer, pData->length,
952 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal),
953 libreoffice_internal::ConstCharArrayDetector<T>::length);
954 }
955
967 bool equals( const OUString & str ) const
968 {
969 if ( pData->length != str.pData->length )
970 return false;
971 if ( pData == str.pData )
972 return true;
973 return rtl_ustr_reverseCompare_WithLength( pData->buffer, pData->length,
974 str.pData->buffer, str.pData->length ) == 0;
975 }
976
991#if defined LIBO_INTERNAL_ONLY
992 bool equalsIgnoreAsciiCase(std::u16string_view sv) const {
993 if ( sal_uInt32(pData->length) != sv.size() )
994 return false;
995 if ( pData->buffer == sv.data() )
996 return true;
997 return
998 rtl_ustr_compareIgnoreAsciiCase_WithLength(
999 pData->buffer, pData->length, sv.data(), sv.size())
1000 == 0;
1001 }
1002#else
1003 bool equalsIgnoreAsciiCase( const OUString & str ) const
1004 {
1005 if ( pData->length != str.pData->length )
1006 return false;
1007 if ( pData == str.pData )
1008 return true;
1009 return rtl_ustr_compareIgnoreAsciiCase_WithLength( pData->buffer, pData->length,
1010 str.pData->buffer, str.pData->length ) == 0;
1011 }
1012#endif
1013
1029#if defined LIBO_INTERNAL_ONLY
1030 sal_Int32 compareToIgnoreAsciiCase(std::u16string_view sv) const {
1031 return rtl_ustr_compareIgnoreAsciiCase_WithLength(
1032 pData->buffer, pData->length, sv.data(), sv.size());
1033 }
1034#else
1035 sal_Int32 compareToIgnoreAsciiCase( const OUString & str ) const
1036 {
1037 return rtl_ustr_compareIgnoreAsciiCase_WithLength( pData->buffer, pData->length,
1038 str.pData->buffer, str.pData->length );
1039 }
1040#endif
1041
1047 template< typename T >
1048 typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type equalsIgnoreAsciiCase( T& literal ) const
1049 {
1050 assert(
1051 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
1052 return
1053 (pData->length
1054 == libreoffice_internal::ConstCharArrayDetector<T>::length)
1055 && (rtl_ustr_ascii_compareIgnoreAsciiCase_WithLength(
1056 pData->buffer, pData->length,
1057 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
1058 literal))
1059 == 0);
1060 }
1061
1077#if defined LIBO_INTERNAL_ONLY
1078 bool match(std::u16string_view sv, sal_Int32 fromIndex = 0) const {
1079 assert(fromIndex >= 0);
1080 return
1081 rtl_ustr_shortenedCompare_WithLength(
1082 pData->buffer + fromIndex, pData->length - fromIndex, sv.data(), sv.size(),
1083 sv.size())
1084 == 0;
1085 }
1086#else
1087 bool match( const OUString & str, sal_Int32 fromIndex = 0 ) const
1088 {
1089 assert(fromIndex >= 0);
1090 return rtl_ustr_shortenedCompare_WithLength( pData->buffer+fromIndex, pData->length-fromIndex,
1091 str.pData->buffer, str.pData->length, str.pData->length ) == 0;
1092 }
1093#endif
1094
1100 template< typename T >
1101 typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type match( T& literal, sal_Int32 fromIndex = 0 ) const
1102 {
1103 assert(
1104 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
1105 assert(fromIndex >= 0);
1106 return
1107 rtl_ustr_ascii_shortenedCompare_WithLength(
1108 pData->buffer+fromIndex, pData->length-fromIndex,
1109 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
1110 literal),
1111 libreoffice_internal::ConstCharArrayDetector<T>::length)
1112 == 0;
1113 }
1114
1133#if defined LIBO_INTERNAL_ONLY
1134 bool matchIgnoreAsciiCase(std::u16string_view sv, sal_Int32 fromIndex = 0) const {
1135 assert(fromIndex >= 0);
1136 return
1137 rtl_ustr_shortenedCompareIgnoreAsciiCase_WithLength(
1138 pData->buffer + fromIndex, pData->length - fromIndex, sv.data(), sv.size(),
1139 sv.size())
1140 == 0;
1141 }
1142#else
1143 bool matchIgnoreAsciiCase( const OUString & str, sal_Int32 fromIndex = 0 ) const
1144 {
1145 assert(fromIndex >= 0);
1146 return rtl_ustr_shortenedCompareIgnoreAsciiCase_WithLength( pData->buffer+fromIndex, pData->length-fromIndex,
1147 str.pData->buffer, str.pData->length,
1148 str.pData->length ) == 0;
1149 }
1150#endif
1151
1157 template< typename T >
1158 typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type matchIgnoreAsciiCase( T& literal, sal_Int32 fromIndex = 0 ) const
1159 {
1160 assert(
1161 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
1162 return matchIgnoreAsciiCaseAsciiL(
1163 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal),
1164 libreoffice_internal::ConstCharArrayDetector<T>::length, fromIndex);
1165 }
1166
1183 sal_Int32 compareToAscii( const char* asciiStr ) const
1184 {
1185 return rtl_ustr_ascii_compare_WithLength( pData->buffer, pData->length, asciiStr );
1186 }
1187
1210 SAL_DEPRECATED(
1211 "replace s1.compareToAscii(s2, strlen(s2)) == 0 with s1.startsWith(s2)")
1212 sal_Int32 compareToAscii( const char * asciiStr, sal_Int32 maxLength ) const
1213 {
1214 return rtl_ustr_ascii_shortenedCompare_WithLength( pData->buffer, pData->length,
1215 asciiStr, maxLength );
1216 }
1217
1236 sal_Int32 reverseCompareToAsciiL( const char * asciiStr, sal_Int32 asciiStrLength ) const
1237 {
1238 return rtl_ustr_asciil_reverseCompare_WithLength( pData->buffer, pData->length,
1239 asciiStr, asciiStrLength );
1240 }
1241
1257 bool equalsAscii( const char* asciiStr ) const
1258 {
1259 return rtl_ustr_ascii_compare_WithLength( pData->buffer, pData->length,
1260 asciiStr ) == 0;
1261 }
1262
1279 bool equalsAsciiL( const char* asciiStr, sal_Int32 asciiStrLength ) const
1280 {
1281 if ( pData->length != asciiStrLength )
1282 return false;
1283
1284 return rtl_ustr_asciil_reverseEquals_WithLength(
1285 pData->buffer, asciiStr, asciiStrLength );
1286 }
1287
1306 bool equalsIgnoreAsciiCaseAscii( const char * asciiStr ) const
1307 {
1308 return rtl_ustr_ascii_compareIgnoreAsciiCase_WithLength( pData->buffer, pData->length, asciiStr ) == 0;
1309 }
1310
1311#if defined LIBO_INTERNAL_ONLY
1312 bool equalsIgnoreAsciiCaseAscii( std::string_view asciiStr ) const
1313 {
1314 return o3tl::make_unsigned(pData->length) == asciiStr.length()
1315 && rtl_ustr_ascii_compareIgnoreAsciiCase_WithLengths(
1316 pData->buffer, pData->length, asciiStr.data(), asciiStr.length()) == 0;
1317 }
1318#endif
1319
1338 sal_Int32 compareToIgnoreAsciiCaseAscii( const char * asciiStr ) const
1339 {
1340 return rtl_ustr_ascii_compareIgnoreAsciiCase_WithLength( pData->buffer, pData->length, asciiStr );
1341 }
1342
1343#if defined LIBO_INTERNAL_ONLY
1344 sal_Int32 compareToIgnoreAsciiCaseAscii( std::string_view asciiStr ) const
1345 {
1346 sal_Int32 nMax = std::min<size_t>(asciiStr.length(), std::numeric_limits<sal_Int32>::max());
1347 sal_Int32 result = rtl_ustr_ascii_compareIgnoreAsciiCase_WithLengths(
1348 pData->buffer, pData->length, asciiStr.data(), nMax);
1349 if (result == 0 && o3tl::make_unsigned(pData->length) < asciiStr.length())
1350 result = -1;
1351 return result;
1352 }
1353#endif
1354
1374 bool equalsIgnoreAsciiCaseAsciiL( const char * asciiStr, sal_Int32 asciiStrLength ) const
1375 {
1376 if ( pData->length != asciiStrLength )
1377 return false;
1378
1379 return rtl_ustr_ascii_compareIgnoreAsciiCase_WithLength( pData->buffer, pData->length, asciiStr ) == 0;
1380 }
1381
1402 bool matchAsciiL( const char* asciiStr, sal_Int32 asciiStrLength, sal_Int32 fromIndex = 0 ) const
1403 {
1404 assert(fromIndex >= 0);
1405 return rtl_ustr_ascii_shortenedCompare_WithLength( pData->buffer+fromIndex, pData->length-fromIndex,
1406 asciiStr, asciiStrLength ) == 0;
1407 }
1408
1409 // This overload is left undefined, to detect calls of matchAsciiL that
1410 // erroneously use RTL_CONSTASCII_USTRINGPARAM instead of
1411 // RTL_CONSTASCII_STRINGPARAM (but would lead to ambiguities on 32 bit
1412 // platforms):
1413#if SAL_TYPES_SIZEOFLONG == 8
1414 void matchAsciiL(char const *, sal_Int32, rtl_TextEncoding) const;
1415#endif
1416
1440 bool matchIgnoreAsciiCaseAsciiL( const char* asciiStr, sal_Int32 asciiStrLength, sal_Int32 fromIndex = 0 ) const
1441 {
1442 assert(fromIndex >= 0);
1443 return rtl_ustr_ascii_shortenedCompareIgnoreAsciiCase_WithLength( pData->buffer+fromIndex, pData->length-fromIndex,
1444 asciiStr, asciiStrLength ) == 0;
1445 }
1446
1447 // This overload is left undefined, to detect calls of
1448 // matchIgnoreAsciiCaseAsciiL that erroneously use
1449 // RTL_CONSTASCII_USTRINGPARAM instead of RTL_CONSTASCII_STRINGPARAM (but
1450 // would lead to ambiguities on 32 bit platforms):
1451#if SAL_TYPES_SIZEOFLONG == 8
1452 void matchIgnoreAsciiCaseAsciiL(char const *, sal_Int32, rtl_TextEncoding)
1453 const;
1454#endif
1455
1456#if defined LIBO_INTERNAL_ONLY
1467 bool startsWith(std::u16string_view sv) const {
1468 return match(sv);
1469 }
1484 bool startsWith(std::u16string_view sv, OUString * rest) const {
1485 assert(rest);
1486 auto const b = startsWith(sv);
1487 if (b) {
1488 *rest = copy(sv.size());
1489 }
1490 return b;
1491 }
1505 bool startsWith(std::u16string_view sv, std::u16string_view * rest) const {
1506 assert(rest);
1507 auto const b = startsWith(sv);
1508 if (b) {
1509 *rest = subView(sv.size());
1510 }
1511 return b;
1512 }
1513#else
1528 bool startsWith(OUString const & str, OUString * rest = NULL) const {
1529 bool b = match(str);
1530 if (b && rest != NULL) {
1531 *rest = copy(str.getLength());
1532 }
1533 return b;
1534 }
1535#endif
1536
1537#if defined LIBO_INTERNAL_ONLY
1542 template< typename T >
1543 typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type startsWith(
1544 T & literal) const
1545 {
1546 assert(
1547 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
1548 bool b
1549 = (libreoffice_internal::ConstCharArrayDetector<T>::length
1550 <= sal_uInt32(pData->length))
1551 && rtl_ustr_asciil_reverseEquals_WithLength(
1552 pData->buffer,
1553 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
1554 literal),
1555 libreoffice_internal::ConstCharArrayDetector<T>::length);
1556 return b;
1557 }
1563 template< typename T >
1564 typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type startsWith(
1565 T & literal, OUString * rest) const
1566 {
1567 assert(rest);
1568 bool b = startsWith(literal);
1569 if (b) {
1570 *rest = copy(
1571 libreoffice_internal::ConstCharArrayDetector<T>::length);
1572 }
1573 return b;
1574 }
1579 template< typename T >
1580 typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type startsWith(
1581 T & literal, std::u16string_view * rest) const
1582 {
1583 assert(rest);
1584 bool b = startsWith(literal);
1585 if (b) {
1586 *rest = subView(
1587 libreoffice_internal::ConstCharArrayDetector<T>::length);
1588 }
1589 return b;
1590 }
1591#else
1597 template< typename T >
1598 typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type startsWith(
1599 T & literal, OUString * rest = NULL) const
1600 {
1601 assert(
1602 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
1603 bool b
1604 = (libreoffice_internal::ConstCharArrayDetector<T>::length
1605 <= sal_uInt32(pData->length))
1606 && rtl_ustr_asciil_reverseEquals_WithLength(
1607 pData->buffer,
1608 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
1609 literal),
1610 libreoffice_internal::ConstCharArrayDetector<T>::length);
1611 if (b && rest != NULL) {
1612 *rest = copy(
1613 libreoffice_internal::ConstCharArrayDetector<T>::length);
1614 }
1615 return b;
1616 }
1617#endif
1618
1639#if defined LIBO_INTERNAL_ONLY
1640 bool startsWithIgnoreAsciiCase(std::u16string_view sv) const {
1641 return matchIgnoreAsciiCase(sv);
1642 }
1643 bool startsWithIgnoreAsciiCase(std::u16string_view sv, OUString * rest) const {
1644 assert(rest);
1645 auto const b = startsWithIgnoreAsciiCase(sv);
1646 if (b) {
1647 *rest = copy(sv.size());
1648 }
1649 return b;
1650 }
1651 bool startsWithIgnoreAsciiCase(std::u16string_view sv, std::u16string_view * rest) const {
1652 assert(rest);
1653 auto const b = startsWithIgnoreAsciiCase(sv);
1654 if (b) {
1655 *rest = subView(sv.size());
1656 }
1657 return b;
1658 }
1659#else
1660 bool startsWithIgnoreAsciiCase(OUString const & str, OUString * rest = NULL)
1661 const
1662 {
1663 bool b = matchIgnoreAsciiCase(str);
1664 if (b && rest != NULL) {
1665 *rest = copy(str.getLength());
1666 }
1667 return b;
1668 }
1669#endif
1670
1671#if defined LIBO_INTERNAL_ONLY
1677 template< typename T >
1678 typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type
1679 startsWithIgnoreAsciiCase(T & literal) const
1680 {
1681 assert(
1682 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
1683 bool b
1684 = (libreoffice_internal::ConstCharArrayDetector<T>::length
1685 <= sal_uInt32(pData->length))
1686 && (rtl_ustr_ascii_compareIgnoreAsciiCase_WithLengths(
1687 pData->buffer,
1688 libreoffice_internal::ConstCharArrayDetector<T>::length,
1689 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
1690 literal),
1691 libreoffice_internal::ConstCharArrayDetector<T>::length)
1692 == 0);
1693 return b;
1694 }
1700 template< typename T >
1701 typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type
1702 startsWithIgnoreAsciiCase(T & literal, OUString * rest) const
1703 {
1704 assert(rest);
1705 bool b = startsWithIgnoreAsciiCase(literal);
1706 if (b) {
1707 *rest = copy(
1708 libreoffice_internal::ConstCharArrayDetector<T>::length);
1709 }
1710 return b;
1711 }
1716 template< typename T >
1717 typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type
1718 startsWithIgnoreAsciiCase(T & literal, std::u16string_view * rest) const
1719 {
1720 assert(rest);
1721 bool b = startsWithIgnoreAsciiCase(literal);
1722 if (b) {
1723 *rest = subView(
1724 libreoffice_internal::ConstCharArrayDetector<T>::length);
1725 }
1726 return b;
1727 }
1728#else
1734 template< typename T >
1735 typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type
1736 startsWithIgnoreAsciiCase(T & literal, OUString * rest = NULL) const
1737 {
1738 assert(
1739 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
1740 bool b
1741 = (libreoffice_internal::ConstCharArrayDetector<T>::length
1742 <= sal_uInt32(pData->length))
1743 && (rtl_ustr_ascii_compareIgnoreAsciiCase_WithLengths(
1744 pData->buffer,
1745 libreoffice_internal::ConstCharArrayDetector<T>::length,
1746 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
1747 literal),
1748 libreoffice_internal::ConstCharArrayDetector<T>::length)
1749 == 0);
1750 if (b && rest != NULL) {
1751 *rest = copy(
1752 libreoffice_internal::ConstCharArrayDetector<T>::length);
1753 }
1754 return b;
1755 }
1756#endif
1757
1758#if defined LIBO_INTERNAL_ONLY
1769 bool endsWith(std::u16string_view sv) const {
1770 return sv.size() <= sal_uInt32(pData->length)
1771 && match(sv, pData->length - sv.size());
1772 }
1773 bool endsWith(std::u16string_view sv, OUString * rest) const {
1774 auto const b = endsWith(sv);
1775 if (b && rest != nullptr) {
1776 *rest = copy(0, (pData->length - sv.size()));
1777 }
1778 return b;
1779 }
1793 bool endsWith(std::u16string_view sv, std::u16string_view * rest) const {
1794 assert(rest);
1795 auto const b = endsWith(sv);
1796 if (b) {
1797 *rest = subView(0, (pData->length - sv.size()));
1798 }
1799 return b;
1800 }
1801#else
1816 bool endsWith(OUString const & str, OUString * rest = NULL) const {
1817 bool b = str.getLength() <= getLength()
1818 && match(str, getLength() - str.getLength());
1819 if (b && rest != NULL) {
1820 *rest = copy(0, getLength() - str.getLength());
1821 }
1822 return b;
1823 }
1824#endif
1825
1826#if defined LIBO_INTERNAL_ONLY
1832 template< typename T >
1833 typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type
1834 endsWith(T & literal) const
1835 {
1836 assert(
1837 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
1838 bool b
1839 = (libreoffice_internal::ConstCharArrayDetector<T>::length
1840 <= sal_uInt32(pData->length))
1841 && rtl_ustr_asciil_reverseEquals_WithLength(
1842 (pData->buffer + pData->length
1843 - libreoffice_internal::ConstCharArrayDetector<T>::length),
1844 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
1845 literal),
1846 libreoffice_internal::ConstCharArrayDetector<T>::length);
1847 return b;
1848 }
1849 template< typename T >
1850 typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type
1851 endsWith(T & literal, OUString * rest) const
1852 {
1853 assert(rest);
1854 bool b = endsWith(literal);
1855 if (b) {
1856 *rest = copy(
1857 0,
1858 (getLength()
1859 - libreoffice_internal::ConstCharArrayDetector<T>::length));
1860 }
1861 return b;
1862 }
1863 template< typename T >
1864 typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type
1865 endsWith(T & literal, std::u16string_view * rest) const
1866 {
1867 assert(rest);
1868 bool b = endsWith(literal);
1869 if (b) {
1870 *rest = subView(
1871 0,
1872 (getLength()
1873 - libreoffice_internal::ConstCharArrayDetector<T>::length));
1874 }
1875 return b;
1876 }
1877#else
1883 template< typename T >
1884 typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type
1885 endsWith(T & literal, OUString * rest = NULL) const
1886 {
1887 assert(
1888 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
1889 bool b
1890 = (libreoffice_internal::ConstCharArrayDetector<T>::length
1891 <= sal_uInt32(pData->length))
1892 && rtl_ustr_asciil_reverseEquals_WithLength(
1893 (pData->buffer + pData->length
1894 - libreoffice_internal::ConstCharArrayDetector<T>::length),
1895 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
1896 literal),
1897 libreoffice_internal::ConstCharArrayDetector<T>::length);
1898 if (b && rest != NULL) {
1899 *rest = copy(
1900 0,
1901 (getLength()
1902 - libreoffice_internal::ConstCharArrayDetector<T>::length));
1903 }
1904 return b;
1905 }
1906#endif
1907
1919 bool endsWithAsciiL(char const * asciiStr, sal_Int32 asciiStrLength)
1920 const
1921 {
1922 return asciiStrLength <= pData->length
1923 && rtl_ustr_asciil_reverseEquals_WithLength(
1924 pData->buffer + pData->length - asciiStrLength, asciiStr,
1925 asciiStrLength);
1926 }
1927
1928#if defined LIBO_INTERNAL_ONLY
1949 bool endsWithIgnoreAsciiCase(std::u16string_view sv) const {
1950 return sv.size() <= sal_uInt32(pData->length)
1951 && matchIgnoreAsciiCase(sv, pData->length - sv.size());
1952 }
1953 bool endsWithIgnoreAsciiCase(std::u16string_view sv, OUString * rest) const {
1954 auto const b = endsWithIgnoreAsciiCase(sv);
1955 if (b && rest != nullptr) {
1956 *rest = copy(0, pData->length - sv.size());
1957 }
1958 return b;
1959 }
1979 bool endsWithIgnoreAsciiCase(std::u16string_view sv, std::u16string_view * rest) const {
1980 assert(rest);
1981 auto const b = endsWithIgnoreAsciiCase(sv);
1982 if (b) {
1983 *rest = subView(0, pData->length - sv.size());
1984 }
1985 return b;
1986 }
1987#else
2008 bool endsWithIgnoreAsciiCase(OUString const & str, OUString * rest = NULL) const
2009 {
2010 bool b = str.getLength() <= getLength()
2011 && matchIgnoreAsciiCase(str, getLength() - str.getLength());
2012 if (b && rest != NULL) {
2013 *rest = copy(0, getLength() - str.getLength());
2014 }
2015 return b;
2016 }
2017#endif
2018
2019#if defined LIBO_INTERNAL_ONLY
2024 template< typename T >
2025 typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type
2026 endsWithIgnoreAsciiCase(T & literal) const
2027 {
2028 assert(
2029 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
2030 bool b
2031 = (libreoffice_internal::ConstCharArrayDetector<T>::length
2032 <= sal_uInt32(pData->length))
2033 && (rtl_ustr_ascii_compareIgnoreAsciiCase_WithLengths(
2034 (pData->buffer + pData->length
2035 - libreoffice_internal::ConstCharArrayDetector<T>::length),
2036 libreoffice_internal::ConstCharArrayDetector<T>::length,
2037 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
2038 literal),
2039 libreoffice_internal::ConstCharArrayDetector<T>::length)
2040 == 0);
2041 return b;
2042 }
2047 template< typename T >
2048 typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type
2049 endsWithIgnoreAsciiCase(T & literal, std::u16string_view * rest) const
2050 {
2051 assert(rest);
2052 bool b = endsWithIgnoreAsciiCase(literal);
2053 if (b) {
2054 *rest = subView(
2055 0,
2056 (getLength()
2057 - libreoffice_internal::ConstCharArrayDetector<T>::length));
2058 }
2059 return b;
2060 }
2061#else
2067 template< typename T >
2068 typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type
2069 endsWithIgnoreAsciiCase(T & literal, OUString * rest = NULL) const
2070 {
2071 assert(
2072 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
2073 bool b
2074 = (libreoffice_internal::ConstCharArrayDetector<T>::length
2075 <= sal_uInt32(pData->length))
2076 && (rtl_ustr_ascii_compareIgnoreAsciiCase_WithLengths(
2077 (pData->buffer + pData->length
2078 - libreoffice_internal::ConstCharArrayDetector<T>::length),
2079 libreoffice_internal::ConstCharArrayDetector<T>::length,
2080 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
2081 literal),
2082 libreoffice_internal::ConstCharArrayDetector<T>::length)
2083 == 0);
2084 if (b && rest != NULL) {
2085 *rest = copy(
2086 0,
2087 (getLength()
2088 - libreoffice_internal::ConstCharArrayDetector<T>::length));
2089 }
2090 return b;
2091 }
2092#endif
2093
2104 bool endsWithIgnoreAsciiCaseAsciiL(
2105 char const * asciiStr, sal_Int32 asciiStrLength) const
2106 {
2107 return asciiStrLength <= pData->length
2108 && (rtl_ustr_ascii_compareIgnoreAsciiCase_WithLengths(
2109 pData->buffer + pData->length - asciiStrLength,
2110 asciiStrLength, asciiStr, asciiStrLength)
2111 == 0);
2112 }
2113
2114 friend bool operator == ( const OUString& rStr1, const OUString& rStr2 )
2115 { return rStr1.equals(rStr2); }
2116
2117 friend bool operator != ( const OUString& rStr1, const OUString& rStr2 )
2118 { return !(operator == ( rStr1, rStr2 )); }
2119
2120 friend bool operator < ( const OUString& rStr1, const OUString& rStr2 )
2121 { return rStr1.compareTo( rStr2 ) < 0; }
2122 friend bool operator > ( const OUString& rStr1, const OUString& rStr2 )
2123 { return rStr1.compareTo( rStr2 ) > 0; }
2124 friend bool operator <= ( const OUString& rStr1, const OUString& rStr2 )
2125 { return rStr1.compareTo( rStr2 ) <= 0; }
2126 friend bool operator >= ( const OUString& rStr1, const OUString& rStr2 )
2127 { return rStr1.compareTo( rStr2 ) >= 0; }
2128
2129#if defined LIBO_INTERNAL_ONLY
2130
2131 template<typename T> friend typename libreoffice_internal::CharPtrDetector<T, bool>::TypeUtf16
2132 operator ==(OUString const & s1, T const & s2) {
2133 return rtl_ustr_compare_WithLength(s1.getStr(), s1.getLength(), s2, rtl_ustr_getLength(s2))
2134 == 0;
2135 }
2136
2137 template<typename T>
2138 friend typename libreoffice_internal::NonConstCharArrayDetector<T, bool>::TypeUtf16
2139 operator ==(OUString const & s1, T & s2) {
2140 return rtl_ustr_compare_WithLength(s1.getStr(), s1.getLength(), s2, rtl_ustr_getLength(s2))
2141 == 0;
2142 }
2143
2144 template<typename T> friend typename libreoffice_internal::CharPtrDetector<T, bool>::TypeUtf16
2145 operator ==(T const & s1, OUString const & s2) {
2146 return rtl_ustr_compare_WithLength(s1, rtl_ustr_getLength(s1), s2.getStr(), s2.getLength())
2147 == 0;
2148 }
2149
2150 template<typename T>
2151 friend typename libreoffice_internal::NonConstCharArrayDetector<T, bool>::TypeUtf16
2152 operator ==(T & s1, OUString const & s2) {
2153 return rtl_ustr_compare_WithLength(s1, rtl_ustr_getLength(s1), s2.getStr(), s2.getLength())
2154 == 0;
2155 }
2156
2157 template<typename T> friend typename libreoffice_internal::CharPtrDetector<T, bool>::TypeUtf16
2158 operator !=(OUString const & s1, T const & s2) { return !(s1 == s2); }
2159
2160 template<typename T>
2161 friend typename libreoffice_internal::NonConstCharArrayDetector<T, bool>::TypeUtf16
2162 operator !=(OUString const & s1, T & s2) { return !(s1 == s2); }
2163
2164 template<typename T> friend typename libreoffice_internal::CharPtrDetector<T, bool>::TypeUtf16
2165 operator !=(T const & s1, OUString const & s2) { return !(s1 == s2); }
2166
2167 template<typename T>
2168 friend typename libreoffice_internal::NonConstCharArrayDetector<T, bool>::TypeUtf16
2169 operator !=(T & s1, OUString const & s2) { return !(s1 == s2); }
2170
2171#else
2172
2173 friend bool operator == ( const OUString& rStr1, const sal_Unicode * pStr2 )
2174 { return rStr1.compareTo( pStr2 ) == 0; }
2175 friend bool operator == ( const sal_Unicode * pStr1, const OUString& rStr2 )
2176 { return OUString( pStr1 ).compareTo( rStr2 ) == 0; }
2177
2178 friend bool operator != ( const OUString& rStr1, const sal_Unicode * pStr2 )
2179 { return !(operator == ( rStr1, pStr2 )); }
2180 friend bool operator != ( const sal_Unicode * pStr1, const OUString& rStr2 )
2181 { return !(operator == ( pStr1, rStr2 )); }
2182
2183#endif
2184
2192 template< typename T >
2193 friend typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type operator==( const OUString& rString, T& literal )
2194 {
2195 assert(
2196 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
2197 return rString.equalsAsciiL(
2198 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal),
2199 libreoffice_internal::ConstCharArrayDetector<T>::length);
2200 }
2201
2208 template< typename T >
2209 friend typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type operator==( T& literal, const OUString& rString )
2210 {
2211 assert(
2212 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
2213 return rString.equalsAsciiL(
2214 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal),
2215 libreoffice_internal::ConstCharArrayDetector<T>::length);
2216 }
2217
2224 template< typename T >
2225 friend typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type operator!=( const OUString& rString, T& literal )
2226 {
2227 assert(
2228 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
2229 return !rString.equalsAsciiL(
2230 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal),
2231 libreoffice_internal::ConstCharArrayDetector<T>::length);
2232 }
2233
2240 template< typename T >
2241 friend typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type operator!=( T& literal, const OUString& rString )
2242 {
2243 assert(
2244 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
2245 return !rString.equalsAsciiL(
2246 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal),
2247 libreoffice_internal::ConstCharArrayDetector<T>::length);
2248 }
2249
2250#if defined LIBO_INTERNAL_ONLY
2252 template<typename T> friend typename libreoffice_internal::ConstCharArrayDetector<T, bool>::TypeUtf16
2253 operator ==(OUString const & string, T & literal) {
2254 return
2255 rtl_ustr_reverseCompare_WithLength(
2256 string.pData->buffer, string.pData->length,
2257 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
2258 literal),
2259 libreoffice_internal::ConstCharArrayDetector<T>::length)
2260 == 0;
2261 }
2263 template<typename T> friend typename libreoffice_internal::ConstCharArrayDetector<T, bool>::TypeUtf16
2264 operator ==(T & literal, OUString const & string) {
2265 return
2266 rtl_ustr_reverseCompare_WithLength(
2267 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
2268 literal),
2269 libreoffice_internal::ConstCharArrayDetector<T>::length,
2270 string.pData->buffer, string.pData->length)
2271 == 0;
2272 }
2274 template<typename T> friend typename libreoffice_internal::ConstCharArrayDetector<T, bool>::TypeUtf16
2275 operator !=(OUString const & string, T & literal) {
2276 return
2277 rtl_ustr_reverseCompare_WithLength(
2278 string.pData->buffer, string.pData->length,
2279 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
2280 literal),
2281 libreoffice_internal::ConstCharArrayDetector<T>::length)
2282 != 0;
2283 }
2285 template<typename T> friend typename libreoffice_internal::ConstCharArrayDetector<T, bool>::TypeUtf16
2286 operator !=(T & literal, OUString const & string) {
2287 return
2288 rtl_ustr_reverseCompare_WithLength(
2289 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
2290 literal),
2291 libreoffice_internal::ConstCharArrayDetector<T>::length,
2292 string.pData->buffer, string.pData->length)
2293 != 0;
2294 }
2295#endif
2296
2304 sal_Int32 hashCode() const
2305 {
2306 return rtl_ustr_hashCode_WithLength( pData->buffer, pData->length );
2307 }
2308
2322 sal_Int32 indexOf( sal_Unicode ch, sal_Int32 fromIndex = 0 ) const
2323 {
2324 assert(fromIndex >= 0);
2325 sal_Int32 ret = rtl_ustr_indexOfChar_WithLength( pData->buffer+fromIndex, pData->length-fromIndex, ch );
2326 return (ret < 0 ? ret : ret+fromIndex);
2327 }
2328
2338 sal_Int32 lastIndexOf( sal_Unicode ch ) const
2339 {
2340 return rtl_ustr_lastIndexOfChar_WithLength( pData->buffer, pData->length, ch );
2341 }
2342
2355 sal_Int32 lastIndexOf( sal_Unicode ch, sal_Int32 fromIndex ) const
2356 {
2357 return rtl_ustr_lastIndexOfChar_WithLength( pData->buffer, fromIndex, ch );
2358 }
2359
2375#if defined LIBO_INTERNAL_ONLY
2376 sal_Int32 indexOf(std::u16string_view sv, sal_Int32 fromIndex = 0) const {
2377 assert(fromIndex >= 0);
2378 auto const n = rtl_ustr_indexOfStr_WithLength(
2379 pData->buffer + fromIndex, pData->length - fromIndex, sv.data(), sv.size());
2380 return n < 0 ? n : n + fromIndex;
2381 }
2382#else
2383 sal_Int32 indexOf( const OUString & str, sal_Int32 fromIndex = 0 ) const
2384 {
2385 assert(fromIndex >= 0);
2386 sal_Int32 ret = rtl_ustr_indexOfStr_WithLength( pData->buffer+fromIndex, pData->length-fromIndex,
2387 str.pData->buffer, str.pData->length );
2388 return (ret < 0 ? ret : ret+fromIndex);
2389 }
2390#endif
2391
2397 template< typename T >
2398 typename libreoffice_internal::ConstCharArrayDetector< T, sal_Int32 >::Type indexOf( T& literal, sal_Int32 fromIndex = 0 ) const
2399 {
2400 assert(
2401 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
2402 assert(fromIndex >= 0);
2403 sal_Int32 n = rtl_ustr_indexOfAscii_WithLength(
2404 pData->buffer + fromIndex, pData->length - fromIndex,
2405 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal),
2406 libreoffice_internal::ConstCharArrayDetector<T>::length);
2407 return n < 0 ? n : n + fromIndex;
2408 }
2409
2433 sal_Int32 indexOfAsciiL(
2434 char const * str, sal_Int32 len, sal_Int32 fromIndex = 0) const
2435 {
2436 assert(fromIndex >= 0);
2437 sal_Int32 ret = rtl_ustr_indexOfAscii_WithLength(
2438 pData->buffer + fromIndex, pData->length - fromIndex, str, len);
2439 return ret < 0 ? ret : ret + fromIndex;
2440 }
2441
2442 // This overload is left undefined, to detect calls of indexOfAsciiL that
2443 // erroneously use RTL_CONSTASCII_USTRINGPARAM instead of
2444 // RTL_CONSTASCII_STRINGPARAM (but would lead to ambiguities on 32 bit
2445 // platforms):
2446#if SAL_TYPES_SIZEOFLONG == 8
2447 void indexOfAsciiL(char const *, sal_Int32 len, rtl_TextEncoding) const;
2448#endif
2449
2465#if defined LIBO_INTERNAL_ONLY
2466 sal_Int32 lastIndexOf(std::u16string_view sv) const {
2467 return rtl_ustr_lastIndexOfStr_WithLength(
2468 pData->buffer, pData->length, sv.data(), sv.size());
2469 }
2470#else
2471 sal_Int32 lastIndexOf( const OUString & str ) const
2472 {
2473 return rtl_ustr_lastIndexOfStr_WithLength( pData->buffer, pData->length,
2474 str.pData->buffer, str.pData->length );
2475 }
2476#endif
2477
2495#if defined LIBO_INTERNAL_ONLY
2496 sal_Int32 lastIndexOf(std::u16string_view sv, sal_Int32 fromIndex) const {
2497 return rtl_ustr_lastIndexOfStr_WithLength(pData->buffer, fromIndex, sv.data(), sv.size());
2498 }
2499#else
2500 sal_Int32 lastIndexOf( const OUString & str, sal_Int32 fromIndex ) const
2501 {
2502 return rtl_ustr_lastIndexOfStr_WithLength( pData->buffer, fromIndex,
2503 str.pData->buffer, str.pData->length );
2504 }
2505#endif
2506
2512 template< typename T >
2513 typename libreoffice_internal::ConstCharArrayDetector< T, sal_Int32 >::Type lastIndexOf( T& literal ) const
2514 {
2515 assert(
2516 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
2517 return rtl_ustr_lastIndexOfAscii_WithLength(
2518 pData->buffer, pData->length,
2519 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal),
2520 libreoffice_internal::ConstCharArrayDetector<T>::length);
2521 }
2522
2542 sal_Int32 lastIndexOfAsciiL(char const * str, sal_Int32 len) const
2543 {
2544 return rtl_ustr_lastIndexOfAscii_WithLength(
2545 pData->buffer, pData->length, str, len);
2546 }
2547
2558 SAL_WARN_UNUSED_RESULT OUString copy( sal_Int32 beginIndex ) const
2559 {
2560 return copy(beginIndex, getLength() - beginIndex);
2561 }
2562
2575 SAL_WARN_UNUSED_RESULT OUString copy( sal_Int32 beginIndex, sal_Int32 count ) const
2576 {
2577 rtl_uString *pNew = NULL;
2578 rtl_uString_newFromSubString( &pNew, pData, beginIndex, count );
2579 return OUString( pNew, SAL_NO_ACQUIRE );
2580 }
2581
2582#if defined LIBO_INTERNAL_ONLY
2593 SAL_WARN_UNUSED_RESULT std::u16string_view subView( sal_Int32 beginIndex ) const
2594 {
2595 assert(beginIndex >= 0);
2596 assert(beginIndex <= getLength());
2597 return subView(beginIndex, getLength() - beginIndex);
2598 }
2599
2612 SAL_WARN_UNUSED_RESULT std::u16string_view subView( sal_Int32 beginIndex, sal_Int32 count ) const
2613 {
2614 assert(beginIndex >= 0);
2615 assert(count >= 0);
2616 assert(beginIndex <= getLength());
2617 assert(count <= getLength() - beginIndex);
2618 return std::u16string_view(*this).substr(beginIndex, count);
2619 }
2620#endif
2621
2622#ifndef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
2631 SAL_WARN_UNUSED_RESULT OUString concat( const OUString & str ) const
2632 {
2633 rtl_uString* pNew = NULL;
2634 rtl_uString_newConcat( &pNew, pData, str.pData );
2635 return OUString( pNew, SAL_NO_ACQUIRE );
2636 }
2637#endif
2638
2639#ifndef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
2640 friend OUString operator+( const OUString& rStr1, const OUString& rStr2 )
2641 {
2642 return rStr1.concat( rStr2 );
2643 }
2644#endif
2645
2659 SAL_WARN_UNUSED_RESULT OUString replaceAt( sal_Int32 index, sal_Int32 count, const OUString& newStr ) const
2660 {
2661 rtl_uString* pNew = NULL;
2662 rtl_uString_newReplaceStrAt( &pNew, pData, index, count, newStr.pData );
2663 return OUString( pNew, SAL_NO_ACQUIRE );
2664 }
2665
2666#ifdef LIBO_INTERNAL_ONLY
2667 SAL_WARN_UNUSED_RESULT OUString replaceAt( sal_Int32 index, sal_Int32 count, std::u16string_view newStr ) const
2668 {
2669 rtl_uString* pNew = NULL;
2670 rtl_uString_newReplaceStrAtUtf16L( &pNew, pData, index, count, newStr.data(), newStr.size() );
2671 return OUString( pNew, SAL_NO_ACQUIRE );
2672 }
2673 // Disambiguation
2674 template <std::size_t N>
2675 SAL_WARN_UNUSED_RESULT OUString replaceAt( sal_Int32 index, sal_Int32 count, const sal_Unicode (&newStr)[N] ) const
2676 {
2677 return replaceAt(index, count, std::u16string_view(newStr, N - 1));
2678 }
2679 template <class T, std::enable_if_t<std::is_convertible_v<T, std::u16string_view>, int> = 0>
2680 SAL_WARN_UNUSED_RESULT OUString replaceAt( sal_Int32 index, sal_Int32 count, const T& newStr ) const
2681 {
2682 return replaceAt(index, count, std::u16string_view(newStr));
2683 }
2684#endif
2685
2699 SAL_WARN_UNUSED_RESULT OUString replace( sal_Unicode oldChar, sal_Unicode newChar ) const
2700 {
2701 rtl_uString* pNew = NULL;
2702 rtl_uString_newReplace( &pNew, pData, oldChar, newChar );
2703 return OUString( pNew, SAL_NO_ACQUIRE );
2704 }
2705
2724#if defined LIBO_INTERNAL_ONLY
2725 [[nodiscard]] OUString replaceFirst(
2726 std::u16string_view from, std::u16string_view to, sal_Int32 * index = nullptr) const
2727 {
2728 rtl_uString * s = nullptr;
2729 sal_Int32 i = 0;
2730 rtl_uString_newReplaceFirstUtf16LUtf16L(
2731 &s, pData, from.data(), from.size(), to.data(), to.size(),
2732 index == nullptr ? &i : index);
2733 return OUString(s, SAL_NO_ACQUIRE);
2734 }
2735#else
2736 SAL_WARN_UNUSED_RESULT OUString replaceFirst(
2737 OUString const & from, OUString const & to, sal_Int32 * index = NULL) const
2738 {
2739 rtl_uString * s = NULL;
2740 sal_Int32 i = 0;
2741 rtl_uString_newReplaceFirst(
2742 &s, pData, from.pData, to.pData, index == NULL ? &i : index);
2743 return OUString(s, SAL_NO_ACQUIRE);
2744 }
2745#endif
2746
2765#if defined LIBO_INTERNAL_ONLY
2766 template<typename T> [[nodiscard]]
2767 typename libreoffice_internal::ConstCharArrayDetector<T, OUString >::Type replaceFirst(
2768 T & from, std::u16string_view to, sal_Int32 * index = nullptr) const
2769 {
2770 assert(libreoffice_internal::ConstCharArrayDetector<T>::isValid(from));
2771 rtl_uString * s = nullptr;
2772 sal_Int32 i = 0;
2773 rtl_uString_newReplaceFirstAsciiLUtf16L(
2774 &s, pData, libreoffice_internal::ConstCharArrayDetector<T>::toPointer(from),
2775 libreoffice_internal::ConstCharArrayDetector<T>::length, to.data(), to.size(),
2776 index == nullptr ? &i : index);
2777 return OUString(s, SAL_NO_ACQUIRE);
2778 }
2779#else
2780 template< typename T >
2781 SAL_WARN_UNUSED_RESULT typename libreoffice_internal::ConstCharArrayDetector< T, OUString >::Type replaceFirst( T& from, OUString const & to,
2782 sal_Int32 * index = NULL) const
2783 {
2784 assert(libreoffice_internal::ConstCharArrayDetector<T>::isValid(from));
2785 rtl_uString * s = NULL;
2786 sal_Int32 i = 0;
2787 rtl_uString_newReplaceFirstAsciiL(
2788 &s, pData,
2789 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(from),
2790 libreoffice_internal::ConstCharArrayDetector<T>::length, to.pData,
2791 index == NULL ? &i : index);
2792 return OUString(s, SAL_NO_ACQUIRE);
2793 }
2794#endif
2795
2814#if defined LIBO_INTERNAL_ONLY
2815 template<typename T> [[nodiscard]]
2816 typename libreoffice_internal::ConstCharArrayDetector<T, OUString >::Type replaceFirst(
2817 std::u16string_view from, T & to, sal_Int32 * index = nullptr) const
2818 {
2819 assert(libreoffice_internal::ConstCharArrayDetector<T>::isValid(to));
2820 rtl_uString * s = nullptr;
2821 sal_Int32 i = 0;
2822 rtl_uString_newReplaceFirstUtf16LAsciiL(
2823 &s, pData, from.data(), from.size(),
2824 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(to),
2825 libreoffice_internal::ConstCharArrayDetector<T>::length, index == nullptr ? &i : index);
2826 return OUString(s, SAL_NO_ACQUIRE);
2827 }
2828#else
2829 template< typename T >
2830 SAL_WARN_UNUSED_RESULT typename libreoffice_internal::ConstCharArrayDetector< T, OUString >::Type replaceFirst( OUString const & from, T& to,
2831 sal_Int32 * index = NULL) const
2832 {
2833 assert(libreoffice_internal::ConstCharArrayDetector<T>::isValid(to));
2834 rtl_uString * s = NULL;
2835 sal_Int32 i = 0;
2836 rtl_uString_newReplaceFirstToAsciiL(
2837 &s, pData, from.pData,
2838 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(to),
2839 libreoffice_internal::ConstCharArrayDetector<T>::length,
2840 index == NULL ? &i : index);
2841 return OUString(s, SAL_NO_ACQUIRE);
2842 }
2843#endif
2844
2863 template< typename T1, typename T2 >
2864 SAL_WARN_UNUSED_RESULT typename libreoffice_internal::ConstCharArrayDetector< T1, typename libreoffice_internal::ConstCharArrayDetector< T2, OUString >::Type >::Type
2865 replaceFirst( T1& from, T2& to, sal_Int32 * index = NULL) const
2866 {
2867 assert(libreoffice_internal::ConstCharArrayDetector<T1>::isValid(from));
2868 assert(libreoffice_internal::ConstCharArrayDetector<T2>::isValid(to));
2869 rtl_uString * s = NULL;
2870 sal_Int32 i = 0;
2871 rtl_uString_newReplaceFirstAsciiLAsciiL(
2872 &s, pData,
2873 libreoffice_internal::ConstCharArrayDetector<T1>::toPointer(from),
2874 libreoffice_internal::ConstCharArrayDetector<T1>::length,
2875 libreoffice_internal::ConstCharArrayDetector<T2>::toPointer(to),
2876 libreoffice_internal::ConstCharArrayDetector<T2>::length,
2877 index == NULL ? &i : index);
2878 return OUString(s, SAL_NO_ACQUIRE);
2879 }
2880
2896#if defined LIBO_INTERNAL_ONLY
2897 [[nodiscard]] OUString replaceAll(
2898 std::u16string_view from, std::u16string_view to, sal_Int32 fromIndex = 0) const
2899 {
2900 rtl_uString * s = nullptr;
2901 rtl_uString_newReplaceAllFromIndexUtf16LUtf16L(
2902 &s, pData, from.data(), from.size(), to.data(), to.size(), fromIndex);
2903 return OUString(s, SAL_NO_ACQUIRE);
2904 }
2905#else
2906 SAL_WARN_UNUSED_RESULT OUString replaceAll(
2907 OUString const & from, OUString const & to, sal_Int32 fromIndex = 0) const
2908 {
2909 rtl_uString * s = NULL;
2910 rtl_uString_newReplaceAllFromIndex(&s, pData, from.pData, to.pData, fromIndex);
2911 return OUString(s, SAL_NO_ACQUIRE);
2912 }
2913#endif
2914
2928#if defined LIBO_INTERNAL_ONLY
2929 template<typename T> [[nodiscard]]
2930 typename libreoffice_internal::ConstCharArrayDetector<T, OUString >::Type replaceAll(
2931 T & from, std::u16string_view to) const
2932 {
2933 assert(libreoffice_internal::ConstCharArrayDetector<T>::isValid(from));
2934 rtl_uString * s = nullptr;
2935 rtl_uString_newReplaceAllAsciiLUtf16L(
2936 &s, pData, libreoffice_internal::ConstCharArrayDetector<T>::toPointer(from),
2937 libreoffice_internal::ConstCharArrayDetector<T>::length, to.data(), to.size());
2938 return OUString(s, SAL_NO_ACQUIRE);
2939 }
2940#else
2941 template< typename T >
2942 SAL_WARN_UNUSED_RESULT typename libreoffice_internal::ConstCharArrayDetector< T, OUString >::Type replaceAll( T& from, OUString const & to) const
2943 {
2944 assert(libreoffice_internal::ConstCharArrayDetector<T>::isValid(from));
2945 rtl_uString * s = NULL;
2946 rtl_uString_newReplaceAllAsciiL(
2947 &s, pData,
2948 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(from),
2949 libreoffice_internal::ConstCharArrayDetector<T>::length, to.pData);
2950 return OUString(s, SAL_NO_ACQUIRE);
2951 }
2952#endif
2953
2967#if defined LIBO_INTERNAL_ONLY
2968 template<typename T> [[nodiscard]]
2969 typename libreoffice_internal::ConstCharArrayDetector<T, OUString >::Type replaceAll(
2970 std::u16string_view from, T & to) const
2971 {
2972 assert(libreoffice_internal::ConstCharArrayDetector<T>::isValid(to));
2973 rtl_uString * s = nullptr;
2974 rtl_uString_newReplaceAllUtf16LAsciiL(
2975 &s, pData, from.data(), from.size(),
2976 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(to),
2977 libreoffice_internal::ConstCharArrayDetector<T>::length);
2978 return OUString(s, SAL_NO_ACQUIRE);
2979 }
2980#else
2981 template< typename T >
2982 SAL_WARN_UNUSED_RESULT typename libreoffice_internal::ConstCharArrayDetector< T, OUString >::Type replaceAll( OUString const & from, T& to) const
2983 {
2984 assert(libreoffice_internal::ConstCharArrayDetector<T>::isValid(to));
2985 rtl_uString * s = NULL;
2986 rtl_uString_newReplaceAllToAsciiL(
2987 &s, pData, from.pData,
2988 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(to),
2989 libreoffice_internal::ConstCharArrayDetector<T>::length);
2990 return OUString(s, SAL_NO_ACQUIRE);
2991 }
2992#endif
2993
3007 template< typename T1, typename T2 >
3008 SAL_WARN_UNUSED_RESULT typename libreoffice_internal::ConstCharArrayDetector< T1, typename libreoffice_internal::ConstCharArrayDetector< T2, OUString >::Type >::Type
3009 replaceAll( T1& from, T2& to ) const
3010 {
3011 assert(libreoffice_internal::ConstCharArrayDetector<T1>::isValid(from));
3012 assert(libreoffice_internal::ConstCharArrayDetector<T2>::isValid(to));
3013 rtl_uString * s = NULL;
3014 rtl_uString_newReplaceAllAsciiLAsciiL(
3015 &s, pData,
3016 libreoffice_internal::ConstCharArrayDetector<T1>::toPointer(from),
3017 libreoffice_internal::ConstCharArrayDetector<T1>::length,
3018 libreoffice_internal::ConstCharArrayDetector<T2>::toPointer(to),
3019 libreoffice_internal::ConstCharArrayDetector<T2>::length);
3020 return OUString(s, SAL_NO_ACQUIRE);
3021 }
3022
3033 SAL_WARN_UNUSED_RESULT OUString toAsciiLowerCase() const
3034 {
3035 rtl_uString* pNew = NULL;
3036 rtl_uString_newToAsciiLowerCase( &pNew, pData );
3037 return OUString( pNew, SAL_NO_ACQUIRE );
3038 }
3039
3050 SAL_WARN_UNUSED_RESULT OUString toAsciiUpperCase() const
3051 {
3052 rtl_uString* pNew = NULL;
3053 rtl_uString_newToAsciiUpperCase( &pNew, pData );
3054 return OUString( pNew, SAL_NO_ACQUIRE );
3055 }
3056
3070 SAL_WARN_UNUSED_RESULT OUString trim() const
3071 {
3072 rtl_uString* pNew = NULL;
3073 rtl_uString_newTrim( &pNew, pData );
3074 return OUString( pNew, SAL_NO_ACQUIRE );
3075 }
3076
3101 OUString getToken( sal_Int32 token, sal_Unicode cTok, sal_Int32& index ) const
3102 {
3103 rtl_uString * pNew = NULL;
3104 index = rtl_uString_getToken( &pNew, pData, token, cTok, index );
3105 return OUString( pNew, SAL_NO_ACQUIRE );
3106 }
3107
3121 OUString getToken(sal_Int32 count, sal_Unicode separator) const {
3122 sal_Int32 n = 0;
3123 return getToken(count, separator, n);
3124 }
3125
3134 bool toBoolean() const
3135 {
3136 return rtl_ustr_toBoolean( pData->buffer );
3137 }
3138
3145 sal_Unicode toChar() const
3146 {
3147 return pData->buffer[0];
3148 }
3149
3160 sal_Int32 toInt32( sal_Int16 radix = 10 ) const
3161 {
3162 return rtl_ustr_toInt32( pData->buffer, radix );
3163 }
3164
3177 sal_uInt32 toUInt32( sal_Int16 radix = 10 ) const
3178 {
3179 return rtl_ustr_toUInt32( pData->buffer, radix );
3180 }
3181
3192 sal_Int64 toInt64( sal_Int16 radix = 10 ) const
3193 {
3194 return rtl_ustr_toInt64( pData->buffer, radix );
3195 }
3196
3209 sal_uInt64 toUInt64( sal_Int16 radix = 10 ) const
3210 {
3211 return rtl_ustr_toUInt64( pData->buffer, radix );
3212 }
3213
3222 float toFloat() const
3223 {
3224 return rtl_ustr_toFloat( pData->buffer );
3225 }
3226
3235 double toDouble() const
3236 {
3237 return rtl_ustr_toDouble( pData->buffer );
3238 }
3239
3240
3256 OUString intern() const
3257 {
3258 rtl_uString * pNew = NULL;
3259 rtl_uString_intern( &pNew, pData );
3260 if (pNew == NULL) {
3261 throw std::bad_alloc();
3262 }
3263 return OUString( pNew, SAL_NO_ACQUIRE );
3264 }
3265
3291 static OUString intern( const char * value, sal_Int32 length,
3292 rtl_TextEncoding encoding,
3293 sal_uInt32 convertFlags = OSTRING_TO_OUSTRING_CVTFLAGS,
3294 sal_uInt32 *pInfo = NULL )
3295 {
3296 rtl_uString * pNew = NULL;
3297 rtl_uString_internConvert( &pNew, value, length, encoding,
3298 convertFlags, pInfo );
3299 if (pNew == NULL) {
3300 throw std::bad_alloc();
3301 }
3302 return OUString( pNew, SAL_NO_ACQUIRE );
3303 }
3304
3329 bool convertToString(OString * pTarget, rtl_TextEncoding nEncoding,
3330 sal_uInt32 nFlags) const
3331 {
3332 return rtl_convertUStringToString(&pTarget->pData, pData->buffer,
3333 pData->length, nEncoding, nFlags);
3334 }
3335
3387 sal_uInt32 iterateCodePoints(
3388 sal_Int32 * indexUtf16, sal_Int32 incrementCodePoints = 1) const
3389 {
3390 return rtl_uString_iterateCodePoints(
3391 pData, indexUtf16, incrementCodePoints);
3392 }
3393
3403#if defined LIBO_INTERNAL_ONLY
3404 static OUString fromUtf8(std::string_view rSource)
3405 {
3406 OUString aTarget;
3407 bool bSuccess = rtl_convertStringToUString(&aTarget.pData,
3408 rSource.data(),
3409 rSource.length(),
3410 RTL_TEXTENCODING_UTF8,
3411 RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR|RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR|RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR);
3412 (void) bSuccess;
3413 assert(bSuccess);
3414 return aTarget;
3415 }
3416#else
3417 static OUString fromUtf8(const OString& rSource)
3418 {
3419 OUString aTarget;
3420 bool bSuccess = rtl_convertStringToUString(&aTarget.pData,
3421 rSource.getStr(),
3422 rSource.getLength(),
3423 RTL_TEXTENCODING_UTF8,
3424 RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR|RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR|RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR);
3425 (void) bSuccess;
3426 assert(bSuccess);
3427 return aTarget;
3428 }
3429#endif
3430
3441 OString toUtf8() const
3442 {
3443 OString aTarget;
3444 bool bSuccess = rtl_convertUStringToString(&aTarget.pData,
3445 getStr(),
3446 getLength(),
3447 RTL_TEXTENCODING_UTF8,
3448 RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR|RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR);
3449 (void) bSuccess;
3450 assert(bSuccess);
3451 return aTarget;
3452 }
3453
3454#ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
3455
3456 static auto number( int i, sal_Int16 radix = 10 )
3457 {
3458 return OUStringNumber<RTL_USTR_MAX_VALUEOFINT32>(rtl_ustr_valueOfInt32, i, radix);
3459 }
3460 static auto number( long long ll, sal_Int16 radix = 10 )
3461 {
3462 return OUStringNumber<RTL_USTR_MAX_VALUEOFINT64>(rtl_ustr_valueOfInt64, ll, radix);
3463 }
3464 static auto number( unsigned long long ll, sal_Int16 radix = 10 )
3465 {
3466 return OUStringNumber<RTL_USTR_MAX_VALUEOFUINT64>(rtl_ustr_valueOfUInt64, ll, radix);
3467 }
3468 static auto number( unsigned int i, sal_Int16 radix = 10 )
3469 {
3470 return number( static_cast< unsigned long long >( i ), radix );
3471 }
3472 static auto number( long i, sal_Int16 radix = 10)
3473 {
3474 return number( static_cast< long long >( i ), radix );
3475 }
3476 static auto number( unsigned long i, sal_Int16 radix = 10 )
3477 {
3478 return number( static_cast< unsigned long long >( i ), radix );
3479 }
3480#else
3491 static OUString number( int i, sal_Int16 radix = 10 )
3492 {
3493 sal_Unicode aBuf[RTL_USTR_MAX_VALUEOFINT32];
3494 return OUString(aBuf, rtl_ustr_valueOfInt32(aBuf, i, radix));
3495 }
3496
3498 static OUString number( unsigned int i, sal_Int16 radix = 10 )
3499 {
3500 return number( static_cast< unsigned long long >( i ), radix );
3501 }
3502
3504 static OUString number( long i, sal_Int16 radix = 10)
3505 {
3506 return number( static_cast< long long >( i ), radix );
3507 }
3508
3510 static OUString number( unsigned long i, sal_Int16 radix = 10 )
3511 {
3512 return number( static_cast< unsigned long long >( i ), radix );
3513 }
3514
3516 static OUString number( long long ll, sal_Int16 radix = 10 )
3517 {
3518 sal_Unicode aBuf[RTL_USTR_MAX_VALUEOFINT64];
3519 return OUString(aBuf, rtl_ustr_valueOfInt64(aBuf, ll, radix));
3520 }
3521
3523 static OUString number( unsigned long long ll, sal_Int16 radix = 10 )
3524 {
3525 sal_Unicode aBuf[RTL_USTR_MAX_VALUEOFUINT64];
3526 return OUString(aBuf, rtl_ustr_valueOfUInt64(aBuf, ll, radix));
3527 }
3528#endif
3529
3539 static OUString number( float f )
3540 {
3541 rtl_uString* pNew = NULL;
3542 // Same as rtl::str::valueOfFP, used for rtl_ustr_valueOfFloat
3543 rtl_math_doubleToUString(&pNew, NULL, 0, f, rtl_math_StringFormat_G,
3544 RTL_USTR_MAX_VALUEOFFLOAT - SAL_N_ELEMENTS("-x.E-xxx") + 1, '.',
3545 NULL, 0, true);
3546 if (pNew == NULL)
3547 throw std::bad_alloc();
3548
3549 return OUString(pNew, SAL_NO_ACQUIRE);
3550 }
3551
3561 static OUString number( double d )
3562 {
3563 rtl_uString* pNew = NULL;
3564 // Same as rtl::str::valueOfFP, used for rtl_ustr_valueOfDouble
3565 rtl_math_doubleToUString(&pNew, NULL, 0, d, rtl_math_StringFormat_G,
3566 RTL_USTR_MAX_VALUEOFDOUBLE - SAL_N_ELEMENTS("-x.E-xxx") + 1, '.',
3567 NULL, 0, true);
3568 if (pNew == NULL)
3569 throw std::bad_alloc();
3570
3571 return OUString(pNew, SAL_NO_ACQUIRE);
3572 }
3573
3574#ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
3575 static auto boolean(bool b)
3576 {
3577 return OUStringNumber<RTL_USTR_MAX_VALUEOFBOOLEAN>(rtl_ustr_valueOfBoolean, b);
3578 }
3579#else
3591 SAL_DEPRECATED("use boolean()") static OUString valueOf( sal_Bool b )
3592 {
3593 return boolean(b);
3594 }
3595
3607 static OUString boolean( bool b )
3608 {
3609 sal_Unicode aBuf[RTL_USTR_MAX_VALUEOFBOOLEAN];
3610 return OUString(aBuf, rtl_ustr_valueOfBoolean(aBuf, b));
3611 }
3612#endif
3613
3621 SAL_DEPRECATED("convert to OUString or use directly") static OUString valueOf( sal_Unicode c )
3622 {
3623 return OUString( &c, 1 );
3624 }
3625
3636 SAL_DEPRECATED("use number()") static OUString valueOf( sal_Int32 i, sal_Int16 radix = 10 )
3637 {
3638 return number( i, radix );
3639 }
3640
3651 SAL_DEPRECATED("use number()") static OUString valueOf( sal_Int64 ll, sal_Int16 radix = 10 )
3652 {
3653 return number( ll, radix );
3654 }
3655
3665 SAL_DEPRECATED("use number()") static OUString valueOf( float f )
3666 {
3667 return number(f);
3668 }
3669
3679 SAL_DEPRECATED("use number()") static OUString valueOf( double d )
3680 {
3681 return number(d);
3682 }
3683
3699 static OUString createFromAscii( const char * value )
3700 {
3701 rtl_uString* pNew = NULL;
3702 rtl_uString_newFromAscii( &pNew, value );
3703 return OUString( pNew, SAL_NO_ACQUIRE );
3704 }
3705
3706#if defined LIBO_INTERNAL_ONLY
3707 static OUString createFromAscii(std::string_view value) {
3708 rtl_uString * p = nullptr;
3709 rtl_uString_newFromLiteral(&p, value.data(), value.size(), 0); //TODO: check for overflow
3710 return OUString(p, SAL_NO_ACQUIRE);
3711 }
3712 #endif
3713
3714#if defined LIBO_INTERNAL_ONLY
3715 operator std::u16string_view() const { return {getStr(), sal_uInt32(getLength())}; }
3716#endif
3717
3718#if defined LIBO_INTERNAL_ONLY
3719 // A wrapper for the first expression in an
3720 //
3721 // OUString::Concat(e1) + e2 + ...
3722 //
3723 // concatenation chain, when neither of the first two e1, e2 is one of our rtl string-related
3724 // classes (so something like
3725 //
3726 // OUString s = "a" + (b ? std::u16string_view(u"c") : std::u16string_view(u"dd"));
3727 //
3728 // would not compile):
3729 template<typename T> [[nodiscard]] static
3730 OUStringConcat<OUStringConcatMarker, T>
3731 Concat(T const & value) { return OUStringConcat<OUStringConcatMarker, T>(value); }
3732
3733 // This overload is needed so that an argument of type 'char const[N]' ends up as
3734 // 'OUStringConcat<rtl::OUStringConcatMarker, char const[N]>' rather than as
3735 // 'OUStringConcat<rtl::OUStringConcatMarker, char[N]>':
3736 template<typename T, std::size_t N> [[nodiscard]] static
3737 OUStringConcat<OUStringConcatMarker, T[N]>
3738 Concat(T (& value)[N]) { return OUStringConcat<OUStringConcatMarker, T[N]>(value); }
3739#endif
3740
3741private:
3742 OUString & internalAppend( rtl_uString* pOtherData )
3743 {
3744 rtl_uString* pNewData = NULL;
3745 rtl_uString_newConcat( &pNewData, pData, pOtherData );
3746 if (pNewData == NULL) {
3747 throw std::bad_alloc();
3748 }
3749 rtl_uString_assign(&pData, pNewData);
3750 rtl_uString_release(pNewData);
3751 return *this;
3752 }
3753
3754};
3755
3756#if defined LIBO_INTERNAL_ONLY
3757// Prevent the operator ==/!= overloads with 'sal_Unicode const *' parameter from
3758// being selected for nonsensical code like
3759//
3760// if (ouIdAttr == nullptr)
3761//
3762void operator ==(OUString const &, std::nullptr_t) = delete;
3763void operator ==(std::nullptr_t, OUString const &) = delete;
3764void operator !=(OUString const &, std::nullptr_t) = delete;
3765void operator !=(std::nullptr_t, OUString const &) = delete;
3766#endif
3767
3768#if defined LIBO_INTERNAL_ONLY && !defined RTL_STRING_UNITTEST
3769inline bool operator ==(OUString const & lhs, StringConcatenation<char16_t> const & rhs)
3770{ return lhs == std::u16string_view(rhs); }
3771inline bool operator !=(OUString const & lhs, StringConcatenation<char16_t> const & rhs)
3772{ return lhs != std::u16string_view(rhs); }
3773inline bool operator ==(StringConcatenation<char16_t> const & lhs, OUString const & rhs)
3774{ return std::u16string_view(lhs) == rhs; }
3775inline bool operator !=(StringConcatenation<char16_t> const & lhs, OUString const & rhs)
3776{ return std::u16string_view(lhs) != rhs; }
3777#endif
3778
3779#if defined LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
3781
3785template<>
3786struct ToStringHelper< OUString >
3787{
3788 static std::size_t length( const OUString& s ) { return s.getLength(); }
3789 sal_Unicode* operator() ( sal_Unicode* buffer, const OUString& s ) const { return addDataHelper( buffer, s.getStr(), s.getLength()); }
3790};
3791
3795template<std::size_t N>
3796struct ToStringHelper< OUStringLiteral<N> >
3797{
3798 static std::size_t length( const OUStringLiteral<N>& str ) { return str.getLength(); }
3799 sal_Unicode* operator()( sal_Unicode* buffer, const OUStringLiteral<N>& str ) const { return addDataHelper( buffer, str.getStr(), str.getLength() ); }
3800};
3801
3805template< typename charT, typename traits, typename T1, typename T2 >
3806inline std::basic_ostream<charT, traits> & operator <<(
3807 std::basic_ostream<charT, traits> & stream, OUStringConcat< T1, T2 >&& concat)
3808{
3809 return stream << OUString( std::move(concat) );
3810}
3811
3813#endif
3814
3820 struct OUStringHash
3821{
3831 size_t operator()(const OUString& rString) const
3832 { return static_cast<size_t>(rString.hashCode()); }
3833};
3834
3835/* ======================================================================= */
3836
3854#if defined LIBO_INTERNAL_ONLY
3855inline OUString OStringToOUString( std::string_view rStr,
3856 rtl_TextEncoding encoding,
3857 sal_uInt32 convertFlags = OSTRING_TO_OUSTRING_CVTFLAGS )
3858{
3859 return OUString( rStr.data(), rStr.length(), encoding, convertFlags );
3860}
3861#else
3862 inline OUString OStringToOUString( const OString & rStr,
3863 rtl_TextEncoding encoding,
3864 sal_uInt32 convertFlags = OSTRING_TO_OUSTRING_CVTFLAGS )
3865{
3866 return OUString( rStr.getStr(), rStr.getLength(), encoding, convertFlags );
3867}
3868#endif
3869
3887#if defined LIBO_INTERNAL_ONLY
3888inline OString OUStringToOString( std::u16string_view rUnicode,
3889 rtl_TextEncoding encoding,
3890 sal_uInt32 convertFlags = OUSTRING_TO_OSTRING_CVTFLAGS )
3891{
3892 return OString( rUnicode.data(), rUnicode.length(), encoding, convertFlags );
3893}
3894#else
3895 inline OString OUStringToOString( const OUString & rUnicode,
3896 rtl_TextEncoding encoding,
3897 sal_uInt32 convertFlags = OUSTRING_TO_OSTRING_CVTFLAGS )
3898{
3899 return OString( rUnicode.getStr(), rUnicode.getLength(), encoding, convertFlags );
3900}
3901#endif
3902
3903/* ======================================================================= */
3904
3913template< typename charT, typename traits >
3914inline std::basic_ostream<charT, traits> & operator <<(
3915 std::basic_ostream<charT, traits> & stream, OUString const & rString)
3916{
3917 return stream <<
3918 OUStringToOString(rString, RTL_TEXTENCODING_UTF8);
3919 // best effort; potentially loses data due to conversion failures
3920 // (stray surrogate halves) and embedded null characters
3921}
3922
3923} // namespace
3924
3925#ifdef RTL_STRING_UNITTEST
3926namespace rtl
3927{
3928typedef rtlunittest::OUString OUString;
3929}
3930#endif
3931
3932// In internal code, allow to use classes like OUString without having to
3933// explicitly refer to the rtl namespace, which is kind of superfluous given
3934// that OUString itself is namespaced by its OU prefix:
3935#if defined LIBO_INTERNAL_ONLY && !defined RTL_STRING_UNITTEST
3936using ::rtl::OUString;
3937using ::rtl::OUStringHash;
3938using ::rtl::OStringToOUString;
3939using ::rtl::OUStringToOString;
3940using ::rtl::OUStringLiteral;
3941using ::rtl::OUStringChar;
3942using ::rtl::Concat2View;
3943using RepeatedUChar = ::rtl::RepeatedChar_t<sal_Unicode>;
3944#endif
3945
3946#if defined LIBO_INTERNAL_ONLY && !(defined _MSC_VER && _MSC_VER <= 1929 && defined _MANAGED)
3947
3948template<
3949#if defined RTL_STRING_UNITTEST
3950 rtlunittest::
3951#endif
3952 OUStringLiteral L>
3953constexpr
3954#if defined RTL_STRING_UNITTEST
3955 rtlunittest::
3956#endif
3957 OUString
3958operator ""_ustr() { return L; }
3959
3960#endif
3961
3963
3968#if defined LIBO_INTERNAL_ONLY
3969namespace std {
3970
3971template<>
3972struct hash<::rtl::OUString>
3973{
3974 std::size_t operator()(::rtl::OUString const & s) const
3975 {
3976 if constexpr (sizeof(std::size_t) == 8)
3977 {
3978 // return a hash that uses the full 64-bit range instead of a 32-bit value
3979 size_t n = s.getLength();
3980 for (sal_Int32 i = 0, len = s.getLength(); i < len; ++i)
3981 n = 37 * n + s[i];
3982 return n;
3983 }
3984 else
3985 return std::size_t(s.hashCode());
3986 }
3987};
3988
3989}
3990
3991#if !(defined _MSC_VER && _MSC_VER <= 1929 && defined _MANAGED)
3998static inline constexpr ::rtl::OUString EMPTY_OUSTRING = u""_ustr;
3999#endif
4000
4001#endif
4003
4004#endif /* _RTL_USTRING_HXX */
4005
4006/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SAL_DEPRECATED
#define SAL_DEPRECATED(message)
Use as follows: SAL_DEPRECATED("Don't use, it's evil.") void doit(int nPara);.
Definition types.h:492
__sal_NoAcquire
__sal_NoAcquire
Definition types.h:371
SAL_NO_ACQUIRE
@ SAL_NO_ACQUIRE
definition of a no acquire enum for ctors
Definition types.h:374
sal_Bool
unsigned char sal_Bool
Definition types.h:38
SAL_CONSTEXPR
#define SAL_CONSTEXPR
C++11 "constexpr" feature.
Definition types.h:422
sal_Unicode
sal_uInt16 sal_Unicode
Definition types.h:123
SAL_WARN_UNUSED_RESULT
#define SAL_WARN_UNUSED_RESULT
Use this as markup for functions and methods whose return value must be used.
Definition types.h:288
SAL_WARN_UNUSED
#define SAL_WARN_UNUSED
Annotate classes where a compiler should warn if an instance is unused.
Definition types.h:611
SAL_N_ELEMENTS
#define SAL_N_ELEMENTS(arr)
Definition macros.h:51
config.h
RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR
#define RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR
Definition textcvt.h:151
RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR
#define RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR
Definition textcvt.h:75
RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR
#define RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR
Definition textcvt.h:72
RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR
#define RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR
Definition textcvt.h:68
RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR
#define RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR
Definition textcvt.h:145
textenc.h
RTL_TEXTENCODING_UTF8
#define RTL_TEXTENCODING_UTF8
Definition textenc.h:117
rtl_TextEncoding
sal_uInt16 rtl_TextEncoding
The various supported text encodings.
Definition textenc.h:37
rtl_convertUStringToString
SAL_DLLPUBLIC sal_Bool rtl_convertUStringToString(rtl_String **pTarget, sal_Unicode const *pSource, sal_Int32 nLength, rtl_TextEncoding nEncoding, sal_uInt32 nFlags) SAL_THROW_EXTERN_C()
Converts a Unicode string to a byte string, signalling failure.
OUSTRING_TO_OSTRING_CVTFLAGS
#define OUSTRING_TO_OSTRING_CVTFLAGS
Definition string.h:1350
stringutils.hxx
math.h
rtl_math_doubleToUString
SAL_DLLPUBLIC void rtl_math_doubleToUString(rtl_uString **pResult, sal_Int32 *pResultCapacity, sal_Int32 nResultOffset, double fValue, enum rtl_math_StringFormat eFormat, sal_Int32 nDecPlaces, sal_Unicode cDecSeparator, sal_Int32 const *pGroups, sal_Unicode cGroupSeparator, sal_Bool bEraseTrailingDecZeros) SAL_THROW_EXTERN_C()
Conversions analogous to sprintf() using internal rounding.
rtl_math_StringFormat_G
@ rtl_math_StringFormat_G
Like sprintf() G, 'F' or 'E' format is used depending on which one is more compact.
Definition math.h:53
ustring.h
rtl_ustr_ascii_compareIgnoreAsciiCase_WithLengths
SAL_DLLPUBLIC sal_Int32 rtl_ustr_ascii_compareIgnoreAsciiCase_WithLengths(sal_Unicode const *first, sal_Int32 firstLen, char const *second, sal_Int32 secondLen) SAL_THROW_EXTERN_C()
Compare two strings, ignoring the case of ASCII characters.
rtl_uString_assign
SAL_DLLPUBLIC void rtl_uString_assign(rtl_uString **str, rtl_uString *rightValue) SAL_THROW_EXTERN_C()
Assign a new value to a string.
rtl_uString_newReplaceFirstUtf16LUtf16L
SAL_DLLPUBLIC void rtl_uString_newReplaceFirstUtf16LUtf16L(rtl_uString **newStr, rtl_uString *str, sal_Unicode const *from, sal_Int32 fromLength, sal_Unicode const *to, sal_Int32 toLength, sal_Int32 *index) SAL_THROW_EXTERN_C()
Create a new string by replacing the first occurrence of a given substring with another substring.
rtl_ustr_toFloat
SAL_DLLPUBLIC float rtl_ustr_toFloat(const sal_Unicode *str) SAL_THROW_EXTERN_C()
Interpret a string as a float.
rtl_ustr_ascii_shortenedCompare_WithLength
SAL_DLLPUBLIC sal_Int32 rtl_ustr_ascii_shortenedCompare_WithLength(const sal_Unicode *first, sal_Int32 firstLen, const char *second, sal_Int32 shortenedLen) SAL_THROW_EXTERN_C()
Compare two strings with a maximum count of characters.
rtl_uString_new
SAL_DLLPUBLIC void rtl_uString_new(rtl_uString **newStr) SAL_THROW_EXTERN_C()
Allocate a new string containing no characters.
OSTRING_TO_OUSTRING_CVTFLAGS
#define OSTRING_TO_OUSTRING_CVTFLAGS
Definition ustring.h:2180
RTL_USTR_MAX_VALUEOFFLOAT
#define RTL_USTR_MAX_VALUEOFFLOAT
Definition ustring.h:1026
rtl_ustr_compare_WithLength
SAL_DLLPUBLIC sal_Int32 rtl_ustr_compare_WithLength(const sal_Unicode *first, sal_Int32 firstLen, const sal_Unicode *second, sal_Int32 secondLen) SAL_THROW_EXTERN_C()
Compare two strings.
rtl_uString_newConcatUtf16L
SAL_DLLPUBLIC void rtl_uString_newConcatUtf16L(rtl_uString **newString, rtl_uString *left, sal_Unicode const *right, sal_Int32 rightLength)
Create a new string that is the concatenation of two other strings.
rtl_uString_newReplaceAllAsciiL
SAL_DLLPUBLIC void rtl_uString_newReplaceAllAsciiL(rtl_uString **newStr, rtl_uString *str, char const *from, sal_Int32 fromLength, rtl_uString const *to) SAL_THROW_EXTERN_C()
Create a new string by replacing all occurrences of a given substring with another substring.
rtl_uString_newReplaceAllFromIndex
SAL_DLLPUBLIC void rtl_uString_newReplaceAllFromIndex(rtl_uString **newStr, rtl_uString *str, rtl_uString const *from, rtl_uString const *to, sal_Int32 fromIndex) SAL_THROW_EXTERN_C()
Create a new string by replacing all occurrences of a given substring with another substring.
rtl_ustr_ascii_shortenedCompareIgnoreAsciiCase_WithLength
SAL_DLLPUBLIC sal_Int32 rtl_ustr_ascii_shortenedCompareIgnoreAsciiCase_WithLength(const sal_Unicode *first, sal_Int32 firstLen, const char *second, sal_Int32 shortenedLen) SAL_THROW_EXTERN_C()
Compare two strings with a maximum count of characters, ignoring the case of ASCII characters.
rtl_uString_getToken
SAL_DLLPUBLIC sal_Int32 rtl_uString_getToken(rtl_uString **newStr, rtl_uString *str, sal_Int32 token, sal_Unicode cTok, sal_Int32 idx) SAL_THROW_EXTERN_C()
Create a new string by extracting a single token from another string.
RTL_USTR_MAX_VALUEOFDOUBLE
#define RTL_USTR_MAX_VALUEOFDOUBLE
Definition ustring.h:1045
rtl_uString_newFromStr_WithLength
SAL_DLLPUBLIC void rtl_uString_newFromStr_WithLength(rtl_uString **newStr, const sal_Unicode *value, sal_Int32 len) SAL_THROW_EXTERN_C()
Allocate a new string that contains a copy of a character array.
rtl_ustr_asciil_reverseEquals_WithLength
SAL_DLLPUBLIC sal_Bool rtl_ustr_asciil_reverseEquals_WithLength(const sal_Unicode *first, const char *second, sal_Int32 len) SAL_THROW_EXTERN_C()
Compare two strings from back to front for equality.
rtl_uString_newFromLiteral
SAL_DLLPUBLIC void rtl_uString_newFromLiteral(rtl_uString **newStr, const char *value, sal_Int32 len, sal_Int32 allocExtra) SAL_THROW_EXTERN_C()
rtl_uString_newReplaceAllAsciiLUtf16L
SAL_DLLPUBLIC void rtl_uString_newReplaceAllAsciiLUtf16L(rtl_uString **newStr, rtl_uString *str, char const *from, sal_Int32 fromLength, sal_Unicode const *to, sal_Int32 toLength) SAL_THROW_EXTERN_C()
Create a new string by replacing all occurrences of a given substring with another substring.
rtl_ustr_valueOfBoolean
SAL_DLLPUBLIC sal_Int32 rtl_ustr_valueOfBoolean(sal_Unicode *str, sal_Bool b) SAL_THROW_EXTERN_C()
Create the string representation of a boolean.
rtl_ustr_toDouble
SAL_DLLPUBLIC double rtl_ustr_toDouble(const sal_Unicode *str) SAL_THROW_EXTERN_C()
Interpret a string as a double.
rtl_uString_newReplaceFirstUtf16LAsciiL
SAL_DLLPUBLIC void rtl_uString_newReplaceFirstUtf16LAsciiL(rtl_uString **newStr, rtl_uString *str, sal_Unicode const *from, sal_Int32 fromLength, char const *to, sal_Int32 toLength, sal_Int32 *index) SAL_THROW_EXTERN_C()
Create a new string by replacing the first occurrence of a given substring with another substring.
rtl_uString_newReplaceFirstToAsciiL
SAL_DLLPUBLIC void rtl_uString_newReplaceFirstToAsciiL(rtl_uString **newStr, rtl_uString *str, rtl_uString const *from, char const *to, sal_Int32 toLength, sal_Int32 *index) SAL_THROW_EXTERN_C()
Create a new string by replacing the first occurrence of a given substring with another substring.
rtl_uString_newConcat
SAL_DLLPUBLIC void rtl_uString_newConcat(rtl_uString **newStr, rtl_uString *left, rtl_uString *right) SAL_THROW_EXTERN_C()
Create a new string that is the concatenation of two other strings.
RTL_USTR_MAX_VALUEOFINT64
#define RTL_USTR_MAX_VALUEOFINT64
Definition ustring.h:984
rtl_ustr_ascii_compareIgnoreAsciiCase_WithLength
SAL_DLLPUBLIC sal_Int32 rtl_ustr_ascii_compareIgnoreAsciiCase_WithLength(const sal_Unicode *first, sal_Int32 firstLen, const char *second) SAL_THROW_EXTERN_C()
Compare two strings, ignoring the case of ASCII characters.
rtl_ustr_indexOfStr_WithLength
SAL_DLLPUBLIC sal_Int32 rtl_ustr_indexOfStr_WithLength(const sal_Unicode *str, sal_Int32 len, const sal_Unicode *subStr, sal_Int32 subLen) SAL_THROW_EXTERN_C()
Search for the first occurrence of a substring within a string.
rtl_uString_internConvert
SAL_DLLPUBLIC void rtl_uString_internConvert(rtl_uString **newStr, const char *str, sal_Int32 len, rtl_TextEncoding encoding, sal_uInt32 convertFlags, sal_uInt32 *pInfo) SAL_THROW_EXTERN_C()
Return a canonical representation for a string.
rtl_uString_acquire
SAL_DLLPUBLIC void rtl_uString_acquire(rtl_uString *str) SAL_THROW_EXTERN_C() SAL_HOT
Increment the reference count of a string.
rtl_ustr_toInt64
SAL_DLLPUBLIC sal_Int64 rtl_ustr_toInt64(const sal_Unicode *str, sal_Int16 radix) SAL_THROW_EXTERN_C()
Interpret a string as a long integer.
rtl_uString_newReplaceStrAt
SAL_DLLPUBLIC void rtl_uString_newReplaceStrAt(rtl_uString **newStr, rtl_uString *str, sal_Int32 idx, sal_Int32 count, rtl_uString *subStr) SAL_THROW_EXTERN_C()
Create a new string by replacing a substring of another string.
RTL_USTR_MAX_VALUEOFUINT64
#define RTL_USTR_MAX_VALUEOFUINT64
Definition ustring.h:1007
rtl_convertStringToUString
SAL_DLLPUBLIC sal_Bool rtl_convertStringToUString(rtl_uString **target, char const *source, sal_Int32 length, rtl_TextEncoding encoding, sal_uInt32 flags) SAL_THROW_EXTERN_C()
Converts a byte string to a Unicode string, signalling failure.
rtl_uString_newReplaceAllToAsciiL
SAL_DLLPUBLIC void rtl_uString_newReplaceAllToAsciiL(rtl_uString **newStr, rtl_uString *str, rtl_uString const *from, char const *to, sal_Int32 toLength) SAL_THROW_EXTERN_C()
Create a new string by replacing all occurrences of a given substring with another substring.
rtl_uString_iterateCodePoints
SAL_DLLPUBLIC sal_uInt32 rtl_uString_iterateCodePoints(rtl_uString const *string, sal_Int32 *indexUtf16, sal_Int32 incrementCodePoints)
Iterate through a string based on code points instead of UTF-16 code units.
rtl_uString_newToAsciiLowerCase
SAL_DLLPUBLIC void rtl_uString_newToAsciiLowerCase(rtl_uString **newStr, rtl_uString *str) SAL_THROW_EXTERN_C()
Create a new string by converting all ASCII uppercase letters to lowercase within another string.
rtl_uString_ensureCapacity
SAL_DLLPUBLIC void rtl_uString_ensureCapacity(rtl_uString **str, sal_Int32 size) SAL_THROW_EXTERN_C()
Ensure a string has enough space for a given number of characters.
rtl_uString_release
SAL_DLLPUBLIC void rtl_uString_release(rtl_uString *str) SAL_THROW_EXTERN_C() SAL_HOT
Decrement the reference count of a string.
rtl_ustr_getLength
SAL_DLLPUBLIC sal_Int32 rtl_ustr_getLength(const sal_Unicode *str) SAL_THROW_EXTERN_C()
Return the length of a string.
rtl_uString_newFromAscii
SAL_DLLPUBLIC void rtl_uString_newFromAscii(rtl_uString **newStr, const char *value) SAL_THROW_EXTERN_C()
Allocate a new string that contains a copy of a character array.
rtl_ustr_valueOfInt64
SAL_DLLPUBLIC sal_Int32 rtl_ustr_valueOfInt64(sal_Unicode *str, sal_Int64 l, sal_Int16 radix) SAL_THROW_EXTERN_C()
Create the string representation of a long integer.
rtl_ustr_lastIndexOfAscii_WithLength
SAL_DLLPUBLIC sal_Int32 rtl_ustr_lastIndexOfAscii_WithLength(sal_Unicode const *str, sal_Int32 len, char const *subStr, sal_Int32 subLen) SAL_THROW_EXTERN_C()
Search for the last occurrence of an ASCII substring within a string.
rtl_uString_newReplaceFirstAsciiL
SAL_DLLPUBLIC void rtl_uString_newReplaceFirstAsciiL(rtl_uString **newStr, rtl_uString *str, char const *from, sal_Int32 fromLength, rtl_uString const *to, sal_Int32 *index) SAL_THROW_EXTERN_C()
Create a new string by replacing the first occurrence of a given substring with another substring.
rtl_ustr_indexOfAscii_WithLength
SAL_DLLPUBLIC sal_Int32 rtl_ustr_indexOfAscii_WithLength(sal_Unicode const *str, sal_Int32 len, char const *subStr, sal_Int32 subLen) SAL_THROW_EXTERN_C()
Search for the first occurrence of an ASCII substring within a string.
rtl_uString_alloc
SAL_DLLPUBLIC rtl_uString * rtl_uString_alloc(sal_Int32 nLen) SAL_THROW_EXTERN_C()
Allocate a new string containing space for a given number of characters.
rtl_ustr_toUInt64
SAL_DLLPUBLIC sal_uInt64 rtl_ustr_toUInt64(const sal_Unicode *str, sal_Int16 radix) SAL_THROW_EXTERN_C()
Interpret a string as an unsigned long integer.
rtl_uString_newReplaceAllUtf16LAsciiL
SAL_DLLPUBLIC void rtl_uString_newReplaceAllUtf16LAsciiL(rtl_uString **newStr, rtl_uString *str, sal_Unicode const *from, sal_Int32 fromLength, char const *to, sal_Int32 toLength) SAL_THROW_EXTERN_C()
Create a new string by replacing all occurrences of a given substring with another substring.
rtl_ustr_shortenedCompareIgnoreAsciiCase_WithLength
SAL_DLLPUBLIC sal_Int32 rtl_ustr_shortenedCompareIgnoreAsciiCase_WithLength(const sal_Unicode *first, sal_Int32 firstLen, const sal_Unicode *second, sal_Int32 secondLen, sal_Int32 shortenedLen) SAL_THROW_EXTERN_C()
Compare two strings with a maximum count of characters, ignoring the case of ASCII characters.
rtl_uString_newTrim
SAL_DLLPUBLIC void rtl_uString_newTrim(rtl_uString **newStr, rtl_uString *str) SAL_THROW_EXTERN_C()
Create a new string by removing white space from both ends of another string.
rtl_ustr_lastIndexOfChar_WithLength
SAL_DLLPUBLIC sal_Int32 rtl_ustr_lastIndexOfChar_WithLength(const sal_Unicode *str, sal_Int32 len, sal_Unicode ch) SAL_THROW_EXTERN_C()
Search for the last occurrence of a character within a string.
rtl_uString_newReplaceFirstAsciiLAsciiL
SAL_DLLPUBLIC void rtl_uString_newReplaceFirstAsciiLAsciiL(rtl_uString **newStr, rtl_uString *str, char const *from, sal_Int32 fromLength, char const *to, sal_Int32 toLength, sal_Int32 *index) SAL_THROW_EXTERN_C()
Create a new string by replacing the first occurrence of a given substring with another substring.
rtl_ustr_toUInt32
SAL_DLLPUBLIC sal_uInt32 rtl_ustr_toUInt32(const sal_Unicode *str, sal_Int16 radix) SAL_THROW_EXTERN_C()
Interpret a string as an unsigned integer.
rtl_uString_intern
SAL_DLLPUBLIC void rtl_uString_intern(rtl_uString **newStr, rtl_uString *str) SAL_THROW_EXTERN_C()
Return a canonical representation for a string.
rtl_string2UString
SAL_DLLPUBLIC void rtl_string2UString(rtl_uString **newStr, const char *str, sal_Int32 len, rtl_TextEncoding encoding, sal_uInt32 convertFlags) SAL_THROW_EXTERN_C()
Create a new Unicode string by converting a byte string, using a specific text encoding.
rtl_uString_newFromStr
SAL_DLLPUBLIC void rtl_uString_newFromStr(rtl_uString **newStr, const sal_Unicode *value) SAL_THROW_EXTERN_C()
Allocate a new string that contains a copy of a character array.
rtl_ustr_asciil_reverseCompare_WithLength
SAL_DLLPUBLIC sal_Int32 rtl_ustr_asciil_reverseCompare_WithLength(const sal_Unicode *first, sal_Int32 firstLen, const char *second, sal_Int32 secondLen) SAL_THROW_EXTERN_C()
Compare two strings from back to front.
rtl_ustr_ascii_compare_WithLength
SAL_DLLPUBLIC sal_Int32 rtl_ustr_ascii_compare_WithLength(const sal_Unicode *first, sal_Int32 firstLen, const char *second) SAL_THROW_EXTERN_C()
Compare two strings.
RTL_USTR_MAX_VALUEOFBOOLEAN
#define RTL_USTR_MAX_VALUEOFBOOLEAN
Definition ustring.h:919
rtl_ustr_toInt32
SAL_DLLPUBLIC sal_Int32 rtl_ustr_toInt32(const sal_Unicode *str, sal_Int16 radix) SAL_THROW_EXTERN_C()
Interpret a string as an integer.
rtl_uString_newReplaceAllAsciiLAsciiL
SAL_DLLPUBLIC void rtl_uString_newReplaceAllAsciiLAsciiL(rtl_uString **newStr, rtl_uString *str, char const *from, sal_Int32 fromLength, char const *to, sal_Int32 toLength) SAL_THROW_EXTERN_C()
Create a new string by replacing all occurrences of a given substring with another substring.
rtl_ustr_valueOfUInt64
SAL_DLLPUBLIC sal_Int32 rtl_ustr_valueOfUInt64(sal_Unicode *str, sal_uInt64 l, sal_Int16 radix) SAL_THROW_EXTERN_C()
Create the string representation of an unsigned long integer.
rtl_uString_newFromCodePoints
SAL_DLLPUBLIC void rtl_uString_newFromCodePoints(rtl_uString **newString, sal_uInt32 const *codePoints, sal_Int32 codePointCount) SAL_THROW_EXTERN_C()
Allocate a new string from an array of Unicode code points.
rtl_ustr_compareIgnoreAsciiCase_WithLength
SAL_DLLPUBLIC sal_Int32 rtl_ustr_compareIgnoreAsciiCase_WithLength(const sal_Unicode *first, sal_Int32 firstLen, const sal_Unicode *second, sal_Int32 secondLen) SAL_THROW_EXTERN_C()
Compare two strings, ignoring the case of ASCII characters.
rtl_ustr_reverseCompare_WithLength
SAL_DLLPUBLIC sal_Int32 rtl_ustr_reverseCompare_WithLength(const sal_Unicode *first, sal_Int32 firstLen, const sal_Unicode *second, sal_Int32 secondLen) SAL_THROW_EXTERN_C()
Compare two strings from back to front.
rtl_ustr_shortenedCompare_WithLength
SAL_DLLPUBLIC sal_Int32 rtl_ustr_shortenedCompare_WithLength(const sal_Unicode *first, sal_Int32 firstLen, const sal_Unicode *second, sal_Int32 secondLen, sal_Int32 shortenedLen) SAL_THROW_EXTERN_C()
Compare two strings with a maximum count of characters.
rtl_ustr_valueOfInt32
SAL_DLLPUBLIC sal_Int32 rtl_ustr_valueOfInt32(sal_Unicode *str, sal_Int32 i, sal_Int16 radix) SAL_THROW_EXTERN_C()
Create the string representation of an integer.
rtl_ustr_toBoolean
SAL_DLLPUBLIC sal_Bool rtl_ustr_toBoolean(const sal_Unicode *str) SAL_THROW_EXTERN_C()
Interpret a string as a boolean.
rtl_uString_newReplace
SAL_DLLPUBLIC void rtl_uString_newReplace(rtl_uString **newStr, rtl_uString *str, sal_Unicode oldChar, sal_Unicode newChar) SAL_THROW_EXTERN_C()
Create a new string by replacing all occurrences of a single character within another string.
rtl_ustr_hashCode_WithLength
SAL_DLLPUBLIC sal_Int32 rtl_ustr_hashCode_WithLength(const sal_Unicode *str, sal_Int32 len) SAL_THROW_EXTERN_C()
Return a hash code for a string.
rtl_uString_newReplaceFirst
SAL_DLLPUBLIC void rtl_uString_newReplaceFirst(rtl_uString **newStr, rtl_uString *str, rtl_uString const *from, rtl_uString const *to, sal_Int32 *index) SAL_THROW_EXTERN_C()
Create a new string by replacing the first occurrence of a given substring with another substring.
rtl_uString_newReplaceFirstAsciiLUtf16L
SAL_DLLPUBLIC void rtl_uString_newReplaceFirstAsciiLUtf16L(rtl_uString **newStr, rtl_uString *str, char const *from, sal_Int32 fromLength, sal_Unicode const *to, sal_Int32 toLength, sal_Int32 *index) SAL_THROW_EXTERN_C()
Create a new string by replacing the first occurrence of a given substring with another substring.
rtl_uString_newToAsciiUpperCase
SAL_DLLPUBLIC void rtl_uString_newToAsciiUpperCase(rtl_uString **newStr, rtl_uString *str) SAL_THROW_EXTERN_C()
Create a new string by converting all ASCII lowercase letters to uppercase within another string.
rtl_ustr_lastIndexOfStr_WithLength
SAL_DLLPUBLIC sal_Int32 rtl_ustr_lastIndexOfStr_WithLength(const sal_Unicode *str, sal_Int32 len, const sal_Unicode *subStr, sal_Int32 subLen) SAL_THROW_EXTERN_C()
Search for the last occurrence of a substring within a string.
rtl_ustr_indexOfChar_WithLength
SAL_DLLPUBLIC sal_Int32 rtl_ustr_indexOfChar_WithLength(const sal_Unicode *str, sal_Int32 len, sal_Unicode ch) SAL_THROW_EXTERN_C()
Search for the first occurrence of a character within a string.
rtl_uString_newFromSubString
SAL_DLLPUBLIC void rtl_uString_newFromSubString(rtl_uString **newStr, const rtl_uString *from, sal_Int32 beginIndex, sal_Int32 count) SAL_THROW_EXTERN_C()
Allocate a new string that is a substring of this string.
rtl_uString_newConcatAsciiL
SAL_DLLPUBLIC void rtl_uString_newConcatAsciiL(rtl_uString **newString, rtl_uString *left, char const *right, sal_Int32 rightLength)
Create a new string that is the concatenation of two other strings.
RTL_USTR_MAX_VALUEOFINT32
#define RTL_USTR_MAX_VALUEOFINT32
Definition ustring.h:961
string.hxx
oslInterlockedCount
sal_Int32 oslInterlockedCount
Definition interlck.h:44
rtl
Definition bootstrap.hxx:34
rtl::operator<<
std::basic_ostream< charT, traits > & operator<<(std::basic_ostream< charT, traits > &stream, OString const &rString)
Support for rtl::OString in std::ostream (and thus in CPPUNIT_ASSERT or SAL_INFO macros,...
Definition string.hxx:2702
rtl::OStringToOUString
OUString OStringToOUString(const OString &rStr, rtl_TextEncoding encoding, sal_uInt32 convertFlags=OSTRING_TO_OUSTRING_CVTFLAGS)
Convert an OString to an OUString, using a specific text encoding.
Definition ustring.hxx:3862
rtl::OUStringToOString
OString OUStringToOString(const OUString &rUnicode, rtl_TextEncoding encoding, sal_uInt32 convertFlags=OUSTRING_TO_OSTRING_CVTFLAGS)
Convert an OUString to an OString, using a specific text encoding.
Definition ustring.hxx:3895
rtl::libreoffice_internal
Definition stringutils.hxx:119
rtl::OString
This String class provide base functionality for C++ like 8-Bit character array handling.
Definition string.hxx:193
rtl::OString::getStr
const char * getStr() const SAL_RETURNS_NONNULL
Returns a pointer to the characters of this string.
Definition string.hxx:690
rtl::OString::getLength
sal_Int32 getLength() const
Returns the length of this string.
Definition string.hxx:664
rtl::libreoffice_internal::Dummy
Definition stringutils.hxx:178
rtl::libreoffice_internal::CharPtrDetector
Definition stringutils.hxx:181
rtl::libreoffice_internal::ConstCharArrayDetector
Definition stringutils.hxx:233
rtl::OUStringBuffer
A string buffer implements a mutable sequence of characters.
Definition ustrbuf.hxx:73
rtl::OUString
This String class provides base functionality for C++ like Unicode character array handling.
Definition ustring.hxx:172
rtl::OUString::number
static OUString number(int i, sal_Int16 radix=10)
Returns the string representation of the integer argument.
Definition ustring.hxx:3491
rtl::OUString::intern
OUString intern() const
Return a canonical representation for a string.
Definition ustring.hxx:3256
rtl::OUString::indexOf
libreoffice_internal::ConstCharArrayDetector< T, sal_Int32 >::Type indexOf(T &literal, sal_Int32 fromIndex=0) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition ustring.hxx:2398
rtl::OUString::endsWith
bool endsWith(OUString const &str, OUString *rest=NULL) const
Check whether this string ends with a given substring.
Definition ustring.hxx:1816
rtl::OUString::endsWithIgnoreAsciiCaseAsciiL
bool endsWithIgnoreAsciiCaseAsciiL(char const *asciiStr, sal_Int32 asciiStrLength) const
Check whether this string ends with a given ASCII string, ignoring the case of ASCII letters.
Definition ustring.hxx:2104
rtl::OUString::toAsciiLowerCase
SAL_WARN_UNUSED_RESULT OUString toAsciiLowerCase() const
Converts from this string all ASCII uppercase characters (65-90) to ASCII lowercase characters (97-12...
Definition ustring.hxx:3033
rtl::OUString::replaceAll
SAL_WARN_UNUSED_RESULT libreoffice_internal::ConstCharArrayDetector< T, OUString >::Type replaceAll(T &from, OUString const &to) const
Returns a new string resulting from replacing all occurrences of a given substring with another subst...
Definition ustring.hxx:2942
rtl::OUString::getStr
const sal_Unicode * getStr() const SAL_RETURNS_NONNULL
Returns a pointer to the Unicode character buffer for this string.
Definition ustring.hxx:843
rtl::OUString::equalsIgnoreAsciiCase
bool equalsIgnoreAsciiCase(const OUString &str) const
Perform an ASCII lowercase comparison of two strings.
Definition ustring.hxx:1003
rtl::OUString::endsWithAsciiL
bool endsWithAsciiL(char const *asciiStr, sal_Int32 asciiStrLength) const
Check whether this string ends with a given ASCII string.
Definition ustring.hxx:1919
rtl::OUString::OUString
OUString(const OUString &str)
New string from OUString.
Definition ustring.hxx:195
rtl::OUString::iterateCodePoints
sal_uInt32 iterateCodePoints(sal_Int32 *indexUtf16, sal_Int32 incrementCodePoints=1) const
Iterate through this string based on code points instead of UTF-16 code units.
Definition ustring.hxx:3387
rtl::OUString::fromUtf8
static OUString fromUtf8(const OString &rSource)
Convert an OString to an OUString, assuming that the OString is UTF-8-encoded.
Definition ustring.hxx:3417
rtl::OUString::match
libreoffice_internal::ConstCharArrayDetector< T, bool >::Type match(T &literal, sal_Int32 fromIndex=0) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition ustring.hxx:1101
rtl::OUString::toInt32
sal_Int32 toInt32(sal_Int16 radix=10) const
Returns the int32 value from this string.
Definition ustring.hxx:3160
rtl::OUString::clear
void clear()
Clears the string, i.e, makes a zero-character string.
Definition ustring.hxx:808
rtl::OUString::equalsIgnoreAsciiCaseAsciiL
bool equalsIgnoreAsciiCaseAsciiL(const char *asciiStr, sal_Int32 asciiStrLength) const
Perform an ASCII lowercase comparison of two strings.
Definition ustring.hxx:1374
rtl::OUString::number
static OUString number(unsigned long long ll, sal_Int16 radix=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition ustring.hxx:3523
rtl::OUString::indexOfAsciiL
sal_Int32 indexOfAsciiL(char const *str, sal_Int32 len, sal_Int32 fromIndex=0) const
Returns the index within this string of the first occurrence of the specified ASCII substring,...
Definition ustring.hxx:2433
rtl::OUString::replaceAll
SAL_WARN_UNUSED_RESULT libreoffice_internal::ConstCharArrayDetector< T1, typenamelibreoffice_internal::ConstCharArrayDetector< T2, OUString >::Type >::Type replaceAll(T1 &from, T2 &to) const
Returns a new string resulting from replacing all occurrences of a given substring with another subst...
Definition ustring.hxx:3009
rtl::OUString::~OUString
~OUString()
Release the string data.
Definition ustring.hxx:534
rtl::OUString::compareTo
sal_Int32 compareTo(const OUString &str, sal_Int32 maxLength) const
Compares two strings with a maximum count of characters.
Definition ustring.hxx:908
rtl::OUString::lastIndexOfAsciiL
sal_Int32 lastIndexOfAsciiL(char const *str, sal_Int32 len) const
Returns the index within this string of the last occurrence of the specified ASCII substring.
Definition ustring.hxx:2542
rtl::OUString::indexOf
sal_Int32 indexOf(sal_Unicode ch, sal_Int32 fromIndex=0) const
Returns the index within this string of the first occurrence of the specified character,...
Definition ustring.hxx:2322
rtl::OUString::replaceAll
SAL_WARN_UNUSED_RESULT libreoffice_internal::ConstCharArrayDetector< T, OUString >::Type replaceAll(OUString const &from, T &to) const
Returns a new string resulting from replacing all occurrences of a given substring with another subst...
Definition ustring.hxx:2982
rtl::OUString::number
static OUString number(long long ll, sal_Int16 radix=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition ustring.hxx:3516
rtl::OUString::matchAsciiL
bool matchAsciiL(const char *asciiStr, sal_Int32 asciiStrLength, sal_Int32 fromIndex=0) const
Match against a substring appearing in this string.
Definition ustring.hxx:1402
rtl::OUString::replaceAll
SAL_WARN_UNUSED_RESULT OUString replaceAll(OUString const &from, OUString const &to, sal_Int32 fromIndex=0) const
Returns a new string resulting from replacing all occurrences of a given substring with another subst...
Definition ustring.hxx:2906
rtl::OUString::toFloat
float toFloat() const
Returns the float value from this string.
Definition ustring.hxx:3222
rtl::OUString::number
static OUString number(unsigned long i, sal_Int16 radix=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition ustring.hxx:3510
rtl::OUString::createFromAscii
static OUString createFromAscii(const char *value)
Returns an OUString copied without conversion from an ASCII character string.
Definition ustring.hxx:3699
rtl::OUString::replaceFirst
SAL_WARN_UNUSED_RESULT libreoffice_internal::ConstCharArrayDetector< T, OUString >::Type replaceFirst(T &from, OUString const &to, sal_Int32 *index=NULL) const
Returns a new string resulting from replacing the first occurrence of a given substring with another ...
Definition ustring.hxx:2781
rtl::OUString::replaceFirst
SAL_WARN_UNUSED_RESULT libreoffice_internal::ConstCharArrayDetector< T1, typenamelibreoffice_internal::ConstCharArrayDetector< T2, OUString >::Type >::Type replaceFirst(T1 &from, T2 &to, sal_Int32 *index=NULL) const
Returns a new string resulting from replacing the first occurrence of a given substring with another ...
Definition ustring.hxx:2865
rtl::OUString::replace
SAL_WARN_UNUSED_RESULT OUString replace(sal_Unicode oldChar, sal_Unicode newChar) const
Returns a new string resulting from replacing all occurrences of oldChar in this string with newChar.
Definition ustring.hxx:2699
rtl::OUString::hashCode
sal_Int32 hashCode() const
Returns a hashcode for this string.
Definition ustring.hxx:2304
rtl::OUString::reverseCompareTo
libreoffice_internal::ConstCharArrayDetector< T, sal_Int32 >::Type reverseCompareTo(T &literal) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition ustring.hxx:946
rtl::OUString::operator==
friend libreoffice_internal::ConstCharArrayDetector< T, bool >::Type operator==(T &literal, const OUString &rString)
Compare string to an ASCII string literal.
Definition ustring.hxx:2209
rtl::OUString::operator==
friend libreoffice_internal::ConstCharArrayDetector< T, bool >::Type operator==(const OUString &rString, T &literal)
Compare string to an ASCII string literal.
Definition ustring.hxx:2193
rtl::OUString::number
static OUString number(long i, sal_Int16 radix=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition ustring.hxx:3504
rtl::OUString::equalsIgnoreAsciiCase
libreoffice_internal::ConstCharArrayDetector< T, bool >::Type equalsIgnoreAsciiCase(T &literal) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition ustring.hxx:1048
rtl::OUString::toUInt64
sal_uInt64 toUInt64(sal_Int16 radix=10) const
Returns the uint64 value from this string.
Definition ustring.hxx:3209
rtl::OUString::matchIgnoreAsciiCaseAsciiL
bool matchIgnoreAsciiCaseAsciiL(const char *asciiStr, sal_Int32 asciiStrLength, sal_Int32 fromIndex=0) const
Match against a substring appearing in this string, ignoring the case of ASCII letters.
Definition ustring.hxx:1440
rtl::OUString::startsWithIgnoreAsciiCase
libreoffice_internal::ConstCharArrayDetector< T, bool >::Type startsWithIgnoreAsciiCase(T &literal, OUString *rest=NULL) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition ustring.hxx:1736
rtl::OUString::toUtf8
OString toUtf8() const
Convert this string to an OString, assuming that the string can be UTF-8-encoded successfully.
Definition ustring.hxx:3441
rtl::OUString::reverseCompareToAsciiL
sal_Int32 reverseCompareToAsciiL(const char *asciiStr, sal_Int32 asciiStrLength) const
Compares two strings in reverse order.
Definition ustring.hxx:1236
rtl::OUString::equalsAsciiL
bool equalsAsciiL(const char *asciiStr, sal_Int32 asciiStrLength) const
Perform a comparison of two strings.
Definition ustring.hxx:1279
rtl::OUString::number
static OUString number(unsigned int i, sal_Int16 radix=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition ustring.hxx:3498
rtl::OUString::convertToString
bool convertToString(OString *pTarget, rtl_TextEncoding nEncoding, sal_uInt32 nFlags) const
Converts to an OString, signalling failure.
Definition ustring.hxx:3329
rtl::OUString::startsWith
libreoffice_internal::ConstCharArrayDetector< T, bool >::Type startsWith(T &literal, OUString *rest=NULL) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition ustring.hxx:1598
rtl::OUString::OUString
OUString(rtl_uString *str)
New string from OUString data.
Definition ustring.hxx:247
rtl::OUString::OUString
OUString(const sal_Unicode *value, sal_Int32 length)
New string from a Unicode character buffer array.
Definition ustring.hxx:333
rtl::OUString::endsWithIgnoreAsciiCase
bool endsWithIgnoreAsciiCase(OUString const &str, OUString *rest=NULL) const
Check whether this string ends with a given string, ignoring the case of ASCII letters.
Definition ustring.hxx:2008
rtl::OUString::compareTo
sal_Int32 compareTo(const OUString &str) const
Compares two strings.
Definition ustring.hxx:879
rtl::OUString::operator!=
friend libreoffice_internal::ConstCharArrayDetector< T, bool >::Type operator!=(const OUString &rString, T &literal)
Compare string to an ASCII string literal.
Definition ustring.hxx:2225
rtl::OUString::operator=
libreoffice_internal::ConstCharArrayDetector< T, OUString & >::Type operator=(T &literal)
Assign a new string from an 8-Bit string literal that is expected to contain only characters in the A...
Definition ustring.hxx:619
rtl::OUString::startsWith
bool startsWith(OUString const &str, OUString *rest=NULL) const
Check whether this string starts with a given substring.
Definition ustring.hxx:1528
rtl::OUString::lastIndexOf
sal_Int32 lastIndexOf(sal_Unicode ch) const
Returns the index within this string of the last occurrence of the specified character,...
Definition ustring.hxx:2338
rtl::OUString::compareToIgnoreAsciiCaseAscii
sal_Int32 compareToIgnoreAsciiCaseAscii(const char *asciiStr) const
Compares two ASCII strings ignoring case.
Definition ustring.hxx:1338
rtl::OUString::replaceFirst
SAL_WARN_UNUSED_RESULT libreoffice_internal::ConstCharArrayDetector< T, OUString >::Type replaceFirst(OUString const &from, T &to, sal_Int32 *index=NULL) const
Returns a new string resulting from replacing the first occurrence of a given substring with another ...
Definition ustring.hxx:2830
rtl::OUString::OUString
OUString(sal_Unicode value)
New string from a single Unicode character.
Definition ustring.hxx:276
rtl::OUString::replaceFirst
SAL_WARN_UNUSED_RESULT OUString replaceFirst(OUString const &from, OUString const &to, sal_Int32 *index=NULL) const
Returns a new string resulting from replacing the first occurrence of a given substring with another ...
Definition ustring.hxx:2736
rtl::OUString::toInt64
sal_Int64 toInt64(sal_Int16 radix=10) const
Returns the int64 value from this string.
Definition ustring.hxx:3192
rtl::OUString::toUInt32
sal_uInt32 toUInt32(sal_Int16 radix=10) const
Returns the uint32 value from this string.
Definition ustring.hxx:3177
rtl::OUString::startsWithIgnoreAsciiCase
bool startsWithIgnoreAsciiCase(OUString const &str, OUString *rest=NULL) const
Check whether this string starts with a given string, ignoring the case of ASCII letters.
Definition ustring.hxx:1660
rtl::OUString::lastIndexOf
sal_Int32 lastIndexOf(const OUString &str, sal_Int32 fromIndex) const
Returns the index within this string of the last occurrence of the specified substring,...
Definition ustring.hxx:2500
rtl::OUString::unacquired
static OUString const & unacquired(rtl_uString *const *ppHandle)
Provides an OUString const & passing a storage pointer of an rtl_uString * handle.
Definition ustring.hxx:560
rtl::OUString::toDouble
double toDouble() const
Returns the double value from this string.
Definition ustring.hxx:3235
rtl::OUString::equalsAscii
bool equalsAscii(const char *asciiStr) const
Perform a comparison of two strings.
Definition ustring.hxx:1257
rtl::OUString::matchIgnoreAsciiCase
libreoffice_internal::ConstCharArrayDetector< T, bool >::Type matchIgnoreAsciiCase(T &literal, sal_Int32 fromIndex=0) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition ustring.hxx:1158
rtl::OUString::getToken
OUString getToken(sal_Int32 token, sal_Unicode cTok, sal_Int32 &index) const
Returns a token in the string.
Definition ustring.hxx:3101
rtl::OUString::getLength
sal_Int32 getLength() const
Returns the length of this string.
Definition ustring.hxx:821
rtl::OUString::equalsIgnoreAsciiCaseAscii
bool equalsIgnoreAsciiCaseAscii(const char *asciiStr) const
Perform an ASCII lowercase comparison of two strings.
Definition ustring.hxx:1306
rtl::OUString::OUString
OUString()
New string containing no characters.
Definition ustring.hxx:181
rtl::OUString::OUString
OUString(const sal_Unicode *value)
New string from a Unicode character buffer array.
Definition ustring.hxx:317
rtl::OUString::OUString
OUString(const char *value, sal_Int32 length, rtl_TextEncoding encoding, sal_uInt32 convertFlags=OSTRING_TO_OUSTRING_CVTFLAGS)
New string from an 8-Bit character buffer array.
Definition ustring.hxx:453
rtl::OUString::operator=
OUString & operator=(const OUString &str)
Assign a new string.
Definition ustring.hxx:584
rtl::OUString::number
static OUString number(float f)
Returns the string representation of the float argument.
Definition ustring.hxx:3539
rtl::OUString::valueOf
static OUString valueOf(sal_Bool b)
Returns the string representation of the sal_Bool argument.
Definition ustring.hxx:3591
rtl::OUString::isEmpty
bool isEmpty() const
Checks if a string is empty.
Definition ustring.hxx:831
rtl::OUString::compareToIgnoreAsciiCase
sal_Int32 compareToIgnoreAsciiCase(const OUString &str) const
Perform an ASCII lowercase comparison of two strings.
Definition ustring.hxx:1035
rtl::OUString::OUString
OUString(sal_uInt32 const *codePoints, sal_Int32 codePointCount)
Create a new string from an array of Unicode code points.
Definition ustring.hxx:480
rtl::OUString::endsWith
libreoffice_internal::ConstCharArrayDetector< T, bool >::Type endsWith(T &literal, OUString *rest=NULL) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition ustring.hxx:1885
rtl::OUString::operator+=
OUString & operator+=(const OUString &str)
Append a string to this string.
Definition ustring.hxx:692
rtl::OUString::toChar
sal_Unicode toChar() const
Returns the first character from this string.
Definition ustring.hxx:3145
rtl::OUString::getToken
OUString getToken(sal_Int32 count, sal_Unicode separator) const
Returns a token from the string.
Definition ustring.hxx:3121
rtl::OUString::boolean
static OUString boolean(bool b)
Returns the string representation of the boolean argument.
Definition ustring.hxx:3607
rtl::OUString::lastIndexOf
libreoffice_internal::ConstCharArrayDetector< T, sal_Int32 >::Type lastIndexOf(T &literal) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition ustring.hxx:2513
rtl::OUString::copy
SAL_WARN_UNUSED_RESULT OUString copy(sal_Int32 beginIndex, sal_Int32 count) const
Returns a new string that is a substring of this string.
Definition ustring.hxx:2575
rtl::OUString::endsWithIgnoreAsciiCase
libreoffice_internal::ConstCharArrayDetector< T, bool >::Type endsWithIgnoreAsciiCase(T &literal, OUString *rest=NULL) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition ustring.hxx:2069
rtl::OUString::OUString
OUString(rtl_uString *str, __sal_NoAcquire)
New OUString from OUString data without acquiring it.
Definition ustring.hxx:268
rtl::OUString::lastIndexOf
sal_Int32 lastIndexOf(sal_Unicode ch, sal_Int32 fromIndex) const
Returns the index within this string of the last occurrence of the specified character,...
Definition ustring.hxx:2355
rtl::OUString::trim
SAL_WARN_UNUSED_RESULT OUString trim() const
Returns a new string resulting from removing white space from both ends of the string.
Definition ustring.hxx:3070
rtl::OUString::toAsciiUpperCase
SAL_WARN_UNUSED_RESULT OUString toAsciiUpperCase() const
Converts from this string all ASCII lowercase characters (97-122) to ASCII uppercase characters (65-9...
Definition ustring.hxx:3050
rtl::OUString::concat
SAL_WARN_UNUSED_RESULT OUString concat(const OUString &str) const
Concatenates the specified string to the end of this string.
Definition ustring.hxx:2631
rtl::OUString::replaceAt
SAL_WARN_UNUSED_RESULT OUString replaceAt(sal_Int32 index, sal_Int32 count, const OUString &newStr) const
Returns a new string resulting from replacing n = count characters from position index in this string...
Definition ustring.hxx:2659
rtl::OUString::match
bool match(const OUString &str, sal_Int32 fromIndex=0) const
Match against a substring appearing in this string.
Definition ustring.hxx:1087
rtl::OUString::matchIgnoreAsciiCase
bool matchIgnoreAsciiCase(const OUString &str, sal_Int32 fromIndex=0) const
Match against a substring appearing in this string, ignoring the case of ASCII letters.
Definition ustring.hxx:1143
rtl::OUString::compareToAscii
sal_Int32 compareToAscii(const char *asciiStr) const
Compares two strings.
Definition ustring.hxx:1183
rtl::OUString::OUString
OUString(T &literal, typename libreoffice_internal::ConstCharArrayDetector< T, libreoffice_internal::Dummy >::Type=libreoffice_internal::Dummy())
New string from an 8-Bit string literal that is expected to contain only characters in the ASCII set ...
Definition ustring.hxx:355
rtl::OUString::reverseCompareTo
sal_Int32 reverseCompareTo(const OUString &str) const
Compares two strings in reverse order.
Definition ustring.hxx:933
rtl::OUString::number
static OUString number(double d)
Returns the string representation of the double argument.
Definition ustring.hxx:3561
rtl::OUString::operator+
friend OUString operator+(const OUString &rStr1, const OUString &rStr2)
Definition ustring.hxx:2640
rtl::OUString::copy
SAL_WARN_UNUSED_RESULT OUString copy(sal_Int32 beginIndex) const
Returns a new string that is a substring of this string.
Definition ustring.hxx:2558
rtl::OUString::operator!=
friend libreoffice_internal::ConstCharArrayDetector< T, bool >::Type operator!=(T &literal, const OUString &rString)
Compare string to an ASCII string literal.
Definition ustring.hxx:2241
rtl::OUString::equals
bool equals(const OUString &str) const
Perform a comparison of two strings.
Definition ustring.hxx:967
rtl::OUString::lastIndexOf
sal_Int32 lastIndexOf(const OUString &str) const
Returns the index within this string of the last occurrence of the specified substring,...
Definition ustring.hxx:2471
rtl::OUString::toBoolean
bool toBoolean() const
Returns the Boolean value from this string.
Definition ustring.hxx:3134
rtl::OUString::indexOf
sal_Int32 indexOf(const OUString &str, sal_Int32 fromIndex=0) const
Returns the index within this string of the first occurrence of the specified substring,...
Definition ustring.hxx:2383
rtl::OUString::intern
static OUString intern(const char *value, sal_Int32 length, rtl_TextEncoding encoding, sal_uInt32 convertFlags=OSTRING_TO_OUSTRING_CVTFLAGS, sal_uInt32 *pInfo=NULL)
Return a canonical representation for a converted string.
Definition ustring.hxx:3291
rtl::OUStringHash
A helper to use OUStrings with hash maps.
Definition ustring.hxx:3821
rtl::OUStringHash::operator()
size_t operator()(const OUString &rString) const
Compute a hash code for a string.
Definition ustring.hxx:3831