LibreOffice LibreOffice 26.2 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
56 extern 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
68 namespace rtl
69{
70
71 class OUStringBuffer;
72
73#ifdef RTL_STRING_UNITTEST
74#undef rtl
75#endif
76
77#if defined LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
79
86 template<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
90 public:
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
108 private:
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
126 public:
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
136 namespace libreoffice_internal {
137 template<std::size_t N> struct ExceptConstCharArrayDetector<OUStringLiteral<N>> {};
138 template<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{
173 public:
175 rtl_uString * pData;
177
181#if defined LIBO_INTERNAL_ONLY && !(defined _MSC_VER && _MSC_VER <= 1929 && defined _MANAGED)
182 constexpr
183#endif
184 OUString()
185 {
186#if defined LIBO_INTERNAL_ONLY && !(defined _MSC_VER && _MSC_VER <= 1929 && defined _MANAGED)
187 pData = const_cast<rtl_uString *>(&empty.str);
188#else
189 pData = NULL;
190 rtl_uString_new( &pData );
191#endif
192 }
193
198#if defined LIBO_INTERNAL_ONLY && !(defined _MSC_VER && _MSC_VER <= 1929 && defined _MANAGED)
199 constexpr
200#endif
201 OUString( const OUString & str )
202 {
203 pData = str.pData;
204#if defined LIBO_INTERNAL_ONLY && !(defined _MSC_VER && _MSC_VER <= 1929 && defined _MANAGED)
205 if (std::is_constant_evaluated()) {
206 //TODO: We would want to
207 //
208 // assert(SAL_STRING_IS_STATIC(pData));
209 //
210 // here, but that wouldn't work because read of member `str` of OUStringLiteral's
211 // anonymous union with active member `more` is not allowed in a constant expression.
212 } else
213#endif
214 rtl_uString_acquire( pData );
215 }
216
217#if defined LIBO_INTERNAL_ONLY
218#if !defined(__COVERITY__) // suppress COPY_INSTEAD_OF_MOVE suggestions
225#if !(defined _MSC_VER && _MSC_VER <= 1929 && defined _MANAGED)
226 constexpr
227#endif
228 OUString( OUString && str ) noexcept
229 {
230 pData = str.pData;
231#if !(defined _MSC_VER && _MSC_VER <= 1929 && defined _MANAGED)
232 if (std::is_constant_evaluated()) {
233 //TODO: We would want to
234 //
235 // assert(SAL_STRING_IS_STATIC(pData));
236 //
237 // here, but that wouldn't work because read of member `str` of OUStringLiteral's
238 // anonymous union with active member `more` is not allowed in a constant expression.
239 return;
240 }
241#endif
242 str.pData = nullptr;
243 rtl_uString_new( &str.pData );
244 }
245#endif
246#endif
247
253 OUString( rtl_uString * str )
254 {
255 pData = str;
256 rtl_uString_acquire( pData );
257 }
258
259#if defined LIBO_INTERNAL_ONLY
261 // Catch inadvertent conversions to the above ctor:
262 OUString(std::nullptr_t) = delete;
264#endif
265
274 OUString( rtl_uString * str, __sal_NoAcquire )
275 { pData = str; }
276
282 explicit OUString( sal_Unicode value )
283 : pData (NULL)
284 {
285 rtl_uString_newFromStr_WithLength( &pData, &value, 1 );
286 }
287
288#if defined LIBO_INTERNAL_ONLY && !defined RTL_STRING_UNITTEST_CONCAT
290 // Catch inadvertent conversions to the above ctor (but still allow
291 // construction from char literals):
292 OUString(int) = delete;
293 explicit OUString(char c):
294 OUString(sal_Unicode(static_cast<unsigned char>(c)))
295 {}
297#endif
298
299#if defined LIBO_INTERNAL_ONLY
300
301 template<typename T> explicit OUString(
302 T const & value,
303 typename libreoffice_internal::CharPtrDetector<T, libreoffice_internal::Dummy>::TypeUtf16
304 = libreoffice_internal::Dummy()):
305 pData(nullptr)
306 { rtl_uString_newFromStr(&pData, value); }
307
308 template<typename T> explicit OUString(
309 T & value,
310 typename
311 libreoffice_internal::NonConstCharArrayDetector<T, libreoffice_internal::Dummy>::TypeUtf16
312 = libreoffice_internal::Dummy()):
313 pData(nullptr)
314 { rtl_uString_newFromStr(&pData, value); }
315
316#else
317
323 OUString( const sal_Unicode * value )
324 {
325 pData = NULL;
326 rtl_uString_newFromStr( &pData, value );
327 }
328
329#endif
330
339 OUString( const sal_Unicode * value, sal_Int32 length )
340 {
341 pData = NULL;
342 rtl_uString_newFromStr_WithLength( &pData, value, length );
343 }
344
360 template< typename T >
361 OUString( T& literal, typename libreoffice_internal::ConstCharArrayDetector< T, libreoffice_internal::Dummy >::Type = libreoffice_internal::Dummy() )
362 {
363 assert(
364 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
365 pData = NULL;
366 if SAL_CONSTEXPR (libreoffice_internal::ConstCharArrayDetector<T>::length == 0) {
367 rtl_uString_new(&pData);
368 } else {
369 rtl_uString_newFromLiteral(
370 &pData,
371 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
372 literal),
373 libreoffice_internal::ConstCharArrayDetector<T>::length, 0);
374 }
375#ifdef RTL_STRING_UNITTEST
376 rtl_string_unittest_const_literal = true;
377#endif
378 }
379
380#if defined LIBO_INTERNAL_ONLY
381 // Rather use a u""_ustr literal (but don't remove this entirely, to avoid implicit support for
382 // it via std::u16string_view from kicking in):
383 template<typename T> OUString(
384 T &,
385 typename libreoffice_internal::ConstCharArrayDetector<
386 T, libreoffice_internal::Dummy>::TypeUtf16
387 = libreoffice_internal::Dummy()) = delete;
388
389 OUString(OUStringChar c): pData(nullptr) { rtl_uString_newFromStr_WithLength(&pData, &c.c, 1); }
390#endif
391
392#if defined LIBO_INTERNAL_ONLY && defined RTL_STRING_UNITTEST
394
398 template< typename T >
399 OUString( T&, typename libreoffice_internal::ExceptConstCharArrayDetector< T >::Type = libreoffice_internal::Dummy() )
400 {
401 pData = NULL;
402 rtl_uString_newFromLiteral( &pData, "!!br0ken!!", 10, 0 ); // set to garbage
403 rtl_string_unittest_invalid_conversion = true;
404 }
409 template< typename T >
410 OUString( const T&, typename libreoffice_internal::ExceptCharArrayDetector< T >::Type = libreoffice_internal::Dummy() )
411 {
412 pData = NULL;
413 rtl_uString_newFromLiteral( &pData, "!!br0ken!!", 10, 0 ); // set to garbage
414 rtl_string_unittest_invalid_conversion = true;
415 }
417#endif
418
419#ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
421
426 template<std::size_t N> constexpr OUString(OUStringLiteral<N> const & literal):
427 pData(const_cast<rtl_uString *>(&literal.str)) {}
428 template<std::size_t N> OUString(OUStringLiteral<N> &&) = delete;
430#endif
431
432#if defined LIBO_INTERNAL_ONLY && !(defined _MSC_VER && _MSC_VER <= 1929 && defined _MANAGED)
433 // For operator ""_tstr:
434 template<OStringLiteral L> OUString(detail::OStringHolder<L> const & holder) {
435 pData = nullptr;
436 if (holder.literal.getLength() == 0) {
437 rtl_uString_new(&pData);
438 } else {
439 rtl_uString_newFromLiteral(
440 &pData, holder.literal.getStr(), holder.literal.getLength(), 0);
441 }
442 }
443#endif
444
459 OUString( const char * value, sal_Int32 length,
460 rtl_TextEncoding encoding,
461 sal_uInt32 convertFlags = OSTRING_TO_OUSTRING_CVTFLAGS )
462 {
463 pData = NULL;
464 rtl_string2UString( &pData, value, length, encoding, convertFlags );
465 if (pData == NULL) {
466 throw std::bad_alloc();
467 }
468 }
469
486 explicit OUString(
487 sal_uInt32 const * codePoints, sal_Int32 codePointCount):
488 pData(NULL)
489 {
490 rtl_uString_newFromCodePoints(&pData, codePoints, codePointCount);
491 if (pData == NULL) {
492 throw std::bad_alloc();
493 }
494 }
495
496#ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
501 template< typename T1, typename T2 >
502 OUString( OUStringConcat< T1, T2 >&& c )
503 {
504 const sal_Int32 l = c.length();
505 pData = rtl_uString_alloc( l );
506 if (l != 0)
507 {
508 sal_Unicode* end = c.addData( pData->buffer );
509 pData->length = l;
510 *end = '\0';
511 }
512 }
513
518 template< std::size_t N >
519 OUString( OUStringNumber< N >&& n )
520 : OUString( n.buf, n.length )
521 {}
522#endif
523
524#if defined LIBO_INTERNAL_ONLY
525 explicit OUString(std::u16string_view sv) {
526 if (sv.size() > sal_uInt32(std::numeric_limits<sal_Int32>::max())) {
527 throw std::bad_alloc();
528 }
529 pData = nullptr;
530 rtl_uString_newFromStr_WithLength(&pData, sv.data(), sv.size());
531 }
532#endif
533
537#if defined LIBO_INTERNAL_ONLY && !(defined _MSC_VER && _MSC_VER <= 1929 && defined _MANAGED)
538 constexpr
539#endif
540 ~OUString()
541 {
542#if defined LIBO_INTERNAL_ONLY && !(defined _MSC_VER && _MSC_VER <= 1929 && defined _MANAGED)
543 if (std::is_constant_evaluated()) {
544 //TODO: We would want to
545 //
546 // assert(SAL_STRING_IS_STATIC(pData));
547 //
548 // here, but that wouldn't work because read of member `str` of OUStringLiteral's
549 // anonymous union with active member `more` is not allowed in a constant expression.
550 } else
551#endif
552 rtl_uString_release( pData );
553 }
554
566 static OUString const & unacquired( rtl_uString * const * ppHandle )
567 { return * reinterpret_cast< OUString const * >( ppHandle ); }
568
569#if defined LIBO_INTERNAL_ONLY
582 static OUString const& unacquired(const OUStringBuffer& str);
583#endif
584
590 OUString & operator=( const OUString & str )
591 {
592 rtl_uString_assign( &pData, str.pData );
593 return *this;
594 }
595
596#if defined LIBO_INTERNAL_ONLY
597#if !defined(__COVERITY__) // suppress COPY_INSTEAD_OF_MOVE suggestions
604 OUString & operator=( OUString && str ) noexcept
605 {
606 std::swap(pData, str.pData);
607 return *this;
608 }
609#endif
610#endif
611
624 template< typename T >
625 typename libreoffice_internal::ConstCharArrayDetector< T, OUString& >::Type operator=( T& literal )
626 {
627 assert(
628 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
629 if SAL_CONSTEXPR (libreoffice_internal::ConstCharArrayDetector<T>::length == 0) {
630 rtl_uString_new(&pData);
631 } else {
632 rtl_uString_newFromLiteral(
633 &pData,
634 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
635 literal),
636 libreoffice_internal::ConstCharArrayDetector<T>::length, 0);
637 }
638 return *this;
639 }
640
641#if defined LIBO_INTERNAL_ONLY
642 // Rather assign from a u""_ustr literal (but don't remove this entirely, to avoid implicit
643 // support for it via std::u16string_view from kicking in):
644 template<typename T>
645 typename
646 libreoffice_internal::ConstCharArrayDetector<T, OUString &>::TypeUtf16
647 operator =(T &) = delete;
648
649 OUString & operator =(OUStringChar c) {
650 rtl_uString_newFromStr_WithLength(&pData, &c.c, 1);
651 return *this;
652 }
653
655 template<std::size_t N> OUString & operator =(OUStringLiteral<N> const & literal) {
656 rtl_uString_release(pData);
657 pData = const_cast<rtl_uString *>(&literal.str);
658 return *this;
659 }
660 template<std::size_t N> OUString & operator =(OUStringLiteral<N> &&) = delete;
661
662 template <std::size_t N>
663 OUString & operator =(OUStringNumber<N> && n) {
664 // n.length should never be zero, so no need to add an optimization for that case
665 rtl_uString_newFromStr_WithLength(&pData, n.buf, n.length);
666 return *this;
667 }
668
669 OUString & operator =(std::u16string_view sv) {
670 if (sv.empty()) {
671 rtl_uString_new(&pData);
672 } else {
673 rtl_uString_newFromStr_WithLength(&pData, sv.data(), sv.size());
674 }
675 return *this;
676 }
677#endif
678
679#if defined LIBO_INTERNAL_ONLY
688 inline OUString & operator+=( const OUStringBuffer & str ) &;
689#endif
690
698 OUString & operator+=( const OUString & str )
699#if defined LIBO_INTERNAL_ONLY
700 &
701#endif
702 {
703 return internalAppend(str.pData);
704 }
705#if defined LIBO_INTERNAL_ONLY
706 void operator+=(OUString const &) && = delete;
707#endif
708
715 template<typename T>
716 typename libreoffice_internal::ConstCharArrayDetector<T, OUString &>::Type
717 operator +=(T & literal)
718#if defined LIBO_INTERNAL_ONLY
719 &
720#endif
721 {
722 assert(
723 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
724 rtl_uString_newConcatAsciiL(
725 &pData, pData,
726 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal),
727 libreoffice_internal::ConstCharArrayDetector<T>::length);
728 return *this;
729 }
730#if defined LIBO_INTERNAL_ONLY
731 template<typename T>
732 typename libreoffice_internal::ConstCharArrayDetector<T, OUString &>::Type
733 operator +=(T &) && = delete;
734#endif
735
736#if defined LIBO_INTERNAL_ONLY
738 template<typename T>
739 typename
740 libreoffice_internal::ConstCharArrayDetector<T, OUString &>::TypeUtf16
741 operator +=(T & literal) & {
742 rtl_uString_newConcatUtf16L(
743 &pData, pData,
744 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal),
745 libreoffice_internal::ConstCharArrayDetector<T>::length);
746 return *this;
747 }
748 template<typename T>
749 typename
750 libreoffice_internal::ConstCharArrayDetector<T, OUString &>::TypeUtf16
751 operator +=(T &) && = delete;
752
754 template<std::size_t N> OUString & operator +=(OUStringLiteral<N> const & literal) & {
755 rtl_uString_newConcatUtf16L(&pData, pData, literal.getStr(), literal.getLength());
756 return *this;
757 }
758 template<std::size_t N> void operator +=(OUStringLiteral<N> const &) && = delete;
759
760 OUString & operator +=(std::u16string_view sv) & {
761 if (sv.size() > sal_uInt32(std::numeric_limits<sal_Int32>::max())) {
762 throw std::bad_alloc();
763 }
764 rtl_uString_newConcatUtf16L(&pData, pData, sv.data(), sv.size());
765 return *this;
766 }
767 void operator +=(std::u16string_view) && = delete;
768#endif
769
770#ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
775 template< typename T1, typename T2 >
776 OUString& operator+=( OUStringConcat< T1, T2 >&& c ) & {
777 sal_Int32 l = c.length();
778 if( l == 0 )
779 return *this;
780 l += pData->length;
781 rtl_uString_ensureCapacity( &pData, l );
782 sal_Unicode* end = c.addData( pData->buffer + pData->length );
783 *end = '\0';
784 pData->length = l;
785 return *this;
786 }
787 template<typename T1, typename T2> void operator +=(
788 OUStringConcat<T1, T2> &&) && = delete;
789
794 template< std::size_t N >
795 OUString& operator+=( OUStringNumber< N >&& n ) & {
796 sal_Int32 l = n.length;
797 if( l == 0 )
798 return *this;
799 l += pData->length;
800 rtl_uString_ensureCapacity( &pData, l );
801 sal_Unicode* end = addDataHelper( pData->buffer + pData->length, n.buf, n.length );
802 *end = '\0';
803 pData->length = l;
804 return *this;
805 }
806 template<std::size_t N> void operator +=(
807 OUStringNumber<N> &&) && = delete;
808#endif
809
814 void clear()
815 {
816 rtl_uString_new( &pData );
817 }
818
827 sal_Int32 getLength() const { return pData->length; }
828
837 bool isEmpty() const
838 {
839 return pData->length == 0;
840 }
841
849 const sal_Unicode * getStr() const SAL_RETURNS_NONNULL { return pData->buffer; }
850
860 sal_Unicode operator [](sal_Int32 index) const {
861 // silence spurious -Werror=strict-overflow warnings from GCC 4.8.2
862 assert(index >= 0 && static_cast<sal_uInt32>(index) < static_cast<sal_uInt32>(getLength()));
863 return getStr()[index];
864 }
865
878#if defined LIBO_INTERNAL_ONLY
879 sal_Int32 compareTo( std::u16string_view str ) const
880 {
881 return rtl_ustr_compare_WithLength( pData->buffer, pData->length,
882 str.data(), str.length() );
883 }
884#else
885 sal_Int32 compareTo( const OUString & str ) const
886 {
887 return rtl_ustr_compare_WithLength( pData->buffer, pData->length,
888 str.pData->buffer, str.pData->length );
889 }
890#endif
891
907#if defined LIBO_INTERNAL_ONLY
908 sal_Int32 compareTo( std::u16string_view str, sal_Int32 maxLength ) const
909 {
910 return rtl_ustr_shortenedCompare_WithLength( pData->buffer, pData->length,
911 str.data(), str.length(), maxLength );
912 }
913#else
914 sal_Int32 compareTo( const OUString & str, sal_Int32 maxLength ) const
915 {
916 return rtl_ustr_shortenedCompare_WithLength( pData->buffer, pData->length,
917 str.pData->buffer, str.pData->length, maxLength );
918 }
919#endif
920
933#if defined LIBO_INTERNAL_ONLY
934 sal_Int32 reverseCompareTo(std::u16string_view sv) const {
935 return rtl_ustr_reverseCompare_WithLength(
936 pData->buffer, pData->length, sv.data(), sv.size());
937 }
938#else
939 sal_Int32 reverseCompareTo( const OUString & str ) const
940 {
941 return rtl_ustr_reverseCompare_WithLength( pData->buffer, pData->length,
942 str.pData->buffer, str.pData->length );
943 }
944#endif
945
951 template< typename T >
952 typename libreoffice_internal::ConstCharArrayDetector< T, sal_Int32 >::Type reverseCompareTo( T& literal ) const
953 {
954 assert(
955 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
956 return rtl_ustr_asciil_reverseCompare_WithLength(
957 pData->buffer, pData->length,
958 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal),
959 libreoffice_internal::ConstCharArrayDetector<T>::length);
960 }
961
973 bool equals( const OUString & str ) const
974 {
975 if ( pData->length != str.pData->length )
976 return false;
977 if ( pData == str.pData )
978 return true;
979 return rtl_ustr_reverseCompare_WithLength( pData->buffer, pData->length,
980 str.pData->buffer, str.pData->length ) == 0;
981 }
982
997#if defined LIBO_INTERNAL_ONLY
998 bool equalsIgnoreAsciiCase(std::u16string_view sv) const {
999 if ( sal_uInt32(pData->length) != sv.size() )
1000 return false;
1001 if ( pData->buffer == sv.data() )
1002 return true;
1003 return
1004 rtl_ustr_compareIgnoreAsciiCase_WithLength(
1005 pData->buffer, pData->length, sv.data(), sv.size())
1006 == 0;
1007 }
1008#else
1009 bool equalsIgnoreAsciiCase( const OUString & str ) const
1010 {
1011 if ( pData->length != str.pData->length )
1012 return false;
1013 if ( pData == str.pData )
1014 return true;
1015 return rtl_ustr_compareIgnoreAsciiCase_WithLength( pData->buffer, pData->length,
1016 str.pData->buffer, str.pData->length ) == 0;
1017 }
1018#endif
1019
1035#if defined LIBO_INTERNAL_ONLY
1036 sal_Int32 compareToIgnoreAsciiCase(std::u16string_view sv) const {
1037 return rtl_ustr_compareIgnoreAsciiCase_WithLength(
1038 pData->buffer, pData->length, sv.data(), sv.size());
1039 }
1040#else
1041 sal_Int32 compareToIgnoreAsciiCase( const OUString & str ) const
1042 {
1043 return rtl_ustr_compareIgnoreAsciiCase_WithLength( pData->buffer, pData->length,
1044 str.pData->buffer, str.pData->length );
1045 }
1046#endif
1047
1053 template< typename T >
1054 typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type equalsIgnoreAsciiCase( T& literal ) const
1055 {
1056 assert(
1057 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
1058 return
1059 (pData->length
1060 == libreoffice_internal::ConstCharArrayDetector<T>::length)
1061 && (rtl_ustr_ascii_compareIgnoreAsciiCase_WithLength(
1062 pData->buffer, pData->length,
1063 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
1064 literal))
1065 == 0);
1066 }
1067
1083#if defined LIBO_INTERNAL_ONLY
1084 bool match(std::u16string_view sv, sal_Int32 fromIndex = 0) const {
1085 assert(fromIndex >= 0);
1086 return
1087 rtl_ustr_shortenedCompare_WithLength(
1088 pData->buffer + fromIndex, pData->length - fromIndex, sv.data(), sv.size(),
1089 sv.size())
1090 == 0;
1091 }
1092#else
1093 bool match( const OUString & str, sal_Int32 fromIndex = 0 ) const
1094 {
1095 assert(fromIndex >= 0);
1096 return rtl_ustr_shortenedCompare_WithLength( pData->buffer+fromIndex, pData->length-fromIndex,
1097 str.pData->buffer, str.pData->length, str.pData->length ) == 0;
1098 }
1099#endif
1100
1106 template< typename T >
1107 typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type match( T& literal, sal_Int32 fromIndex = 0 ) const
1108 {
1109 assert(
1110 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
1111 assert(fromIndex >= 0);
1112 return
1113 rtl_ustr_ascii_shortenedCompare_WithLength(
1114 pData->buffer+fromIndex, pData->length-fromIndex,
1115 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
1116 literal),
1117 libreoffice_internal::ConstCharArrayDetector<T>::length)
1118 == 0;
1119 }
1120
1139#if defined LIBO_INTERNAL_ONLY
1140 bool matchIgnoreAsciiCase(std::u16string_view sv, sal_Int32 fromIndex = 0) const {
1141 assert(fromIndex >= 0);
1142 return
1143 rtl_ustr_shortenedCompareIgnoreAsciiCase_WithLength(
1144 pData->buffer + fromIndex, pData->length - fromIndex, sv.data(), sv.size(),
1145 sv.size())
1146 == 0;
1147 }
1148#else
1149 bool matchIgnoreAsciiCase( const OUString & str, sal_Int32 fromIndex = 0 ) const
1150 {
1151 assert(fromIndex >= 0);
1152 return rtl_ustr_shortenedCompareIgnoreAsciiCase_WithLength( pData->buffer+fromIndex, pData->length-fromIndex,
1153 str.pData->buffer, str.pData->length,
1154 str.pData->length ) == 0;
1155 }
1156#endif
1157
1163 template< typename T >
1164 typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type matchIgnoreAsciiCase( T& literal, sal_Int32 fromIndex = 0 ) const
1165 {
1166 assert(
1167 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
1168 return matchIgnoreAsciiCaseAsciiL(
1169 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal),
1170 libreoffice_internal::ConstCharArrayDetector<T>::length, fromIndex);
1171 }
1172
1189 sal_Int32 compareToAscii( const char* asciiStr ) const
1190 {
1191 return rtl_ustr_ascii_compare_WithLength( pData->buffer, pData->length, asciiStr );
1192 }
1193
1216 SAL_DEPRECATED(
1217 "replace s1.compareToAscii(s2, strlen(s2)) == 0 with s1.startsWith(s2)")
1218 sal_Int32 compareToAscii( const char * asciiStr, sal_Int32 maxLength ) const
1219 {
1220 return rtl_ustr_ascii_shortenedCompare_WithLength( pData->buffer, pData->length,
1221 asciiStr, maxLength );
1222 }
1223
1242 sal_Int32 reverseCompareToAsciiL( const char * asciiStr, sal_Int32 asciiStrLength ) const
1243 {
1244 return rtl_ustr_asciil_reverseCompare_WithLength( pData->buffer, pData->length,
1245 asciiStr, asciiStrLength );
1246 }
1247
1263 bool equalsAscii( const char* asciiStr ) const
1264 {
1265 return rtl_ustr_ascii_compare_WithLength( pData->buffer, pData->length,
1266 asciiStr ) == 0;
1267 }
1268
1285 bool equalsAsciiL( const char* asciiStr, sal_Int32 asciiStrLength ) const
1286 {
1287 if ( pData->length != asciiStrLength )
1288 return false;
1289
1290 return rtl_ustr_asciil_reverseEquals_WithLength(
1291 pData->buffer, asciiStr, asciiStrLength );
1292 }
1293
1312 bool equalsIgnoreAsciiCaseAscii( const char * asciiStr ) const
1313 {
1314 return rtl_ustr_ascii_compareIgnoreAsciiCase_WithLength( pData->buffer, pData->length, asciiStr ) == 0;
1315 }
1316
1317#if defined LIBO_INTERNAL_ONLY
1318 bool equalsIgnoreAsciiCaseAscii( std::string_view asciiStr ) const
1319 {
1320 return o3tl::make_unsigned(pData->length) == asciiStr.length()
1321 && rtl_ustr_ascii_compareIgnoreAsciiCase_WithLengths(
1322 pData->buffer, pData->length, asciiStr.data(), asciiStr.length()) == 0;
1323 }
1324#endif
1325
1344 sal_Int32 compareToIgnoreAsciiCaseAscii( const char * asciiStr ) const
1345 {
1346 return rtl_ustr_ascii_compareIgnoreAsciiCase_WithLength( pData->buffer, pData->length, asciiStr );
1347 }
1348
1349#if defined LIBO_INTERNAL_ONLY
1350 sal_Int32 compareToIgnoreAsciiCaseAscii( std::string_view asciiStr ) const
1351 {
1352 sal_Int32 nMax = std::min<size_t>(asciiStr.length(), std::numeric_limits<sal_Int32>::max());
1353 sal_Int32 result = rtl_ustr_ascii_compareIgnoreAsciiCase_WithLengths(
1354 pData->buffer, pData->length, asciiStr.data(), nMax);
1355 if (result == 0 && o3tl::make_unsigned(pData->length) < asciiStr.length())
1356 result = -1;
1357 return result;
1358 }
1359#endif
1360
1380 bool equalsIgnoreAsciiCaseAsciiL( const char * asciiStr, sal_Int32 asciiStrLength ) const
1381 {
1382 if ( pData->length != asciiStrLength )
1383 return false;
1384
1385 return rtl_ustr_ascii_compareIgnoreAsciiCase_WithLength( pData->buffer, pData->length, asciiStr ) == 0;
1386 }
1387
1408 bool matchAsciiL( const char* asciiStr, sal_Int32 asciiStrLength, sal_Int32 fromIndex = 0 ) const
1409 {
1410 assert(fromIndex >= 0);
1411 return rtl_ustr_ascii_shortenedCompare_WithLength( pData->buffer+fromIndex, pData->length-fromIndex,
1412 asciiStr, asciiStrLength ) == 0;
1413 }
1414
1415 // This overload is left undefined, to detect calls of matchAsciiL that
1416 // erroneously use RTL_CONSTASCII_USTRINGPARAM instead of
1417 // RTL_CONSTASCII_STRINGPARAM (but would lead to ambiguities on 32 bit
1418 // platforms):
1419#if SAL_TYPES_SIZEOFLONG == 8
1420 void matchAsciiL(char const *, sal_Int32, rtl_TextEncoding) const;
1421#endif
1422
1446 bool matchIgnoreAsciiCaseAsciiL( const char* asciiStr, sal_Int32 asciiStrLength, sal_Int32 fromIndex = 0 ) const
1447 {
1448 assert(fromIndex >= 0);
1449 return rtl_ustr_ascii_shortenedCompareIgnoreAsciiCase_WithLength( pData->buffer+fromIndex, pData->length-fromIndex,
1450 asciiStr, asciiStrLength ) == 0;
1451 }
1452
1453 // This overload is left undefined, to detect calls of
1454 // matchIgnoreAsciiCaseAsciiL that erroneously use
1455 // RTL_CONSTASCII_USTRINGPARAM instead of RTL_CONSTASCII_STRINGPARAM (but
1456 // would lead to ambiguities on 32 bit platforms):
1457#if SAL_TYPES_SIZEOFLONG == 8
1458 void matchIgnoreAsciiCaseAsciiL(char const *, sal_Int32, rtl_TextEncoding)
1459 const;
1460#endif
1461
1462#if defined LIBO_INTERNAL_ONLY
1473 bool startsWith(std::u16string_view sv) const {
1474 return match(sv);
1475 }
1490 bool startsWith(std::u16string_view sv, OUString * rest) const {
1491 assert(rest);
1492 auto const b = startsWith(sv);
1493 if (b) {
1494 *rest = copy(sv.size());
1495 }
1496 return b;
1497 }
1511 bool startsWith(std::u16string_view sv, std::u16string_view * rest) const {
1512 assert(rest);
1513 auto const b = startsWith(sv);
1514 if (b) {
1515 *rest = subView(sv.size());
1516 }
1517 return b;
1518 }
1519#else
1534 bool startsWith(OUString const & str, OUString * rest = NULL) const {
1535 bool b = match(str);
1536 if (b && rest != NULL) {
1537 *rest = copy(str.getLength());
1538 }
1539 return b;
1540 }
1541#endif
1542
1543#if defined LIBO_INTERNAL_ONLY
1548 template< typename T >
1549 typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type startsWith(
1550 T & literal) const
1551 {
1552 assert(
1553 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
1554 bool b
1555 = (libreoffice_internal::ConstCharArrayDetector<T>::length
1556 <= sal_uInt32(pData->length))
1557 && rtl_ustr_asciil_reverseEquals_WithLength(
1558 pData->buffer,
1559 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
1560 literal),
1561 libreoffice_internal::ConstCharArrayDetector<T>::length);
1562 return b;
1563 }
1569 template< typename T >
1570 typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type startsWith(
1571 T & literal, OUString * rest) const
1572 {
1573 assert(rest);
1574 bool b = startsWith(literal);
1575 if (b) {
1576 *rest = copy(
1577 libreoffice_internal::ConstCharArrayDetector<T>::length);
1578 }
1579 return b;
1580 }
1585 template< typename T >
1586 typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type startsWith(
1587 T & literal, std::u16string_view * rest) const
1588 {
1589 assert(rest);
1590 bool b = startsWith(literal);
1591 if (b) {
1592 *rest = subView(
1593 libreoffice_internal::ConstCharArrayDetector<T>::length);
1594 }
1595 return b;
1596 }
1597#else
1603 template< typename T >
1604 typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type startsWith(
1605 T & literal, OUString * rest = NULL) const
1606 {
1607 assert(
1608 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
1609 bool b
1610 = (libreoffice_internal::ConstCharArrayDetector<T>::length
1611 <= sal_uInt32(pData->length))
1612 && rtl_ustr_asciil_reverseEquals_WithLength(
1613 pData->buffer,
1614 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
1615 literal),
1616 libreoffice_internal::ConstCharArrayDetector<T>::length);
1617 if (b && rest != NULL) {
1618 *rest = copy(
1619 libreoffice_internal::ConstCharArrayDetector<T>::length);
1620 }
1621 return b;
1622 }
1623#endif
1624
1645#if defined LIBO_INTERNAL_ONLY
1646 bool startsWithIgnoreAsciiCase(std::u16string_view sv) const {
1647 return matchIgnoreAsciiCase(sv);
1648 }
1649 bool startsWithIgnoreAsciiCase(std::u16string_view sv, OUString * rest) const {
1650 assert(rest);
1651 auto const b = startsWithIgnoreAsciiCase(sv);
1652 if (b) {
1653 *rest = copy(sv.size());
1654 }
1655 return b;
1656 }
1657 bool startsWithIgnoreAsciiCase(std::u16string_view sv, std::u16string_view * rest) const {
1658 assert(rest);
1659 auto const b = startsWithIgnoreAsciiCase(sv);
1660 if (b) {
1661 *rest = subView(sv.size());
1662 }
1663 return b;
1664 }
1665#else
1666 bool startsWithIgnoreAsciiCase(OUString const & str, OUString * rest = NULL)
1667 const
1668 {
1669 bool b = matchIgnoreAsciiCase(str);
1670 if (b && rest != NULL) {
1671 *rest = copy(str.getLength());
1672 }
1673 return b;
1674 }
1675#endif
1676
1677#if defined LIBO_INTERNAL_ONLY
1683 template< typename T >
1684 typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type
1685 startsWithIgnoreAsciiCase(T & literal) const
1686 {
1687 assert(
1688 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
1689 bool b
1690 = (libreoffice_internal::ConstCharArrayDetector<T>::length
1691 <= sal_uInt32(pData->length))
1692 && (rtl_ustr_ascii_compareIgnoreAsciiCase_WithLengths(
1693 pData->buffer,
1694 libreoffice_internal::ConstCharArrayDetector<T>::length,
1695 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
1696 literal),
1697 libreoffice_internal::ConstCharArrayDetector<T>::length)
1698 == 0);
1699 return b;
1700 }
1706 template< typename T >
1707 typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type
1708 startsWithIgnoreAsciiCase(T & literal, OUString * rest) const
1709 {
1710 assert(rest);
1711 bool b = startsWithIgnoreAsciiCase(literal);
1712 if (b) {
1713 *rest = copy(
1714 libreoffice_internal::ConstCharArrayDetector<T>::length);
1715 }
1716 return b;
1717 }
1722 template< typename T >
1723 typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type
1724 startsWithIgnoreAsciiCase(T & literal, std::u16string_view * rest) const
1725 {
1726 assert(rest);
1727 bool b = startsWithIgnoreAsciiCase(literal);
1728 if (b) {
1729 *rest = subView(
1730 libreoffice_internal::ConstCharArrayDetector<T>::length);
1731 }
1732 return b;
1733 }
1734#else
1740 template< typename T >
1741 typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type
1742 startsWithIgnoreAsciiCase(T & literal, OUString * rest = NULL) const
1743 {
1744 assert(
1745 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
1746 bool b
1747 = (libreoffice_internal::ConstCharArrayDetector<T>::length
1748 <= sal_uInt32(pData->length))
1749 && (rtl_ustr_ascii_compareIgnoreAsciiCase_WithLengths(
1750 pData->buffer,
1751 libreoffice_internal::ConstCharArrayDetector<T>::length,
1752 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
1753 literal),
1754 libreoffice_internal::ConstCharArrayDetector<T>::length)
1755 == 0);
1756 if (b && rest != NULL) {
1757 *rest = copy(
1758 libreoffice_internal::ConstCharArrayDetector<T>::length);
1759 }
1760 return b;
1761 }
1762#endif
1763
1764#if defined LIBO_INTERNAL_ONLY
1775 bool endsWith(std::u16string_view sv) const {
1776 return sv.size() <= sal_uInt32(pData->length)
1777 && match(sv, pData->length - sv.size());
1778 }
1779 bool endsWith(std::u16string_view sv, OUString * rest) const {
1780 auto const b = endsWith(sv);
1781 if (b && rest != nullptr) {
1782 *rest = copy(0, (pData->length - sv.size()));
1783 }
1784 return b;
1785 }
1799 bool endsWith(std::u16string_view sv, std::u16string_view * rest) const {
1800 assert(rest);
1801 auto const b = endsWith(sv);
1802 if (b) {
1803 *rest = subView(0, (pData->length - sv.size()));
1804 }
1805 return b;
1806 }
1807#else
1822 bool endsWith(OUString const & str, OUString * rest = NULL) const {
1823 bool b = str.getLength() <= getLength()
1824 && match(str, getLength() - str.getLength());
1825 if (b && rest != NULL) {
1826 *rest = copy(0, getLength() - str.getLength());
1827 }
1828 return b;
1829 }
1830#endif
1831
1832#if defined LIBO_INTERNAL_ONLY
1838 template< typename T >
1839 typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type
1840 endsWith(T & literal) const
1841 {
1842 assert(
1843 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
1844 bool b
1845 = (libreoffice_internal::ConstCharArrayDetector<T>::length
1846 <= sal_uInt32(pData->length))
1847 && rtl_ustr_asciil_reverseEquals_WithLength(
1848 (pData->buffer + pData->length
1849 - libreoffice_internal::ConstCharArrayDetector<T>::length),
1850 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
1851 literal),
1852 libreoffice_internal::ConstCharArrayDetector<T>::length);
1853 return b;
1854 }
1855 template< typename T >
1856 typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type
1857 endsWith(T & literal, OUString * rest) const
1858 {
1859 assert(rest);
1860 bool b = endsWith(literal);
1861 if (b) {
1862 *rest = copy(
1863 0,
1864 (getLength()
1865 - libreoffice_internal::ConstCharArrayDetector<T>::length));
1866 }
1867 return b;
1868 }
1869 template< typename T >
1870 typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type
1871 endsWith(T & literal, std::u16string_view * rest) const
1872 {
1873 assert(rest);
1874 bool b = endsWith(literal);
1875 if (b) {
1876 *rest = subView(
1877 0,
1878 (getLength()
1879 - libreoffice_internal::ConstCharArrayDetector<T>::length));
1880 }
1881 return b;
1882 }
1883#else
1889 template< typename T >
1890 typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type
1891 endsWith(T & literal, OUString * rest = NULL) const
1892 {
1893 assert(
1894 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
1895 bool b
1896 = (libreoffice_internal::ConstCharArrayDetector<T>::length
1897 <= sal_uInt32(pData->length))
1898 && rtl_ustr_asciil_reverseEquals_WithLength(
1899 (pData->buffer + pData->length
1900 - libreoffice_internal::ConstCharArrayDetector<T>::length),
1901 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
1902 literal),
1903 libreoffice_internal::ConstCharArrayDetector<T>::length);
1904 if (b && rest != NULL) {
1905 *rest = copy(
1906 0,
1907 (getLength()
1908 - libreoffice_internal::ConstCharArrayDetector<T>::length));
1909 }
1910 return b;
1911 }
1912#endif
1913
1925 bool endsWithAsciiL(char const * asciiStr, sal_Int32 asciiStrLength)
1926 const
1927 {
1928 return asciiStrLength <= pData->length
1929 && rtl_ustr_asciil_reverseEquals_WithLength(
1930 pData->buffer + pData->length - asciiStrLength, asciiStr,
1931 asciiStrLength);
1932 }
1933
1934#if defined LIBO_INTERNAL_ONLY
1955 bool endsWithIgnoreAsciiCase(std::u16string_view sv) const {
1956 return sv.size() <= sal_uInt32(pData->length)
1957 && matchIgnoreAsciiCase(sv, pData->length - sv.size());
1958 }
1959 bool endsWithIgnoreAsciiCase(std::u16string_view sv, OUString * rest) const {
1960 auto const b = endsWithIgnoreAsciiCase(sv);
1961 if (b && rest != nullptr) {
1962 *rest = copy(0, pData->length - sv.size());
1963 }
1964 return b;
1965 }
1985 bool endsWithIgnoreAsciiCase(std::u16string_view sv, std::u16string_view * rest) const {
1986 assert(rest);
1987 auto const b = endsWithIgnoreAsciiCase(sv);
1988 if (b) {
1989 *rest = subView(0, pData->length - sv.size());
1990 }
1991 return b;
1992 }
1993#else
2014 bool endsWithIgnoreAsciiCase(OUString const & str, OUString * rest = NULL) const
2015 {
2016 bool b = str.getLength() <= getLength()
2017 && matchIgnoreAsciiCase(str, getLength() - str.getLength());
2018 if (b && rest != NULL) {
2019 *rest = copy(0, getLength() - str.getLength());
2020 }
2021 return b;
2022 }
2023#endif
2024
2025#if defined LIBO_INTERNAL_ONLY
2030 template< typename T >
2031 typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type
2032 endsWithIgnoreAsciiCase(T & literal) const
2033 {
2034 assert(
2035 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
2036 bool b
2037 = (libreoffice_internal::ConstCharArrayDetector<T>::length
2038 <= sal_uInt32(pData->length))
2039 && (rtl_ustr_ascii_compareIgnoreAsciiCase_WithLengths(
2040 (pData->buffer + pData->length
2041 - libreoffice_internal::ConstCharArrayDetector<T>::length),
2042 libreoffice_internal::ConstCharArrayDetector<T>::length,
2043 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
2044 literal),
2045 libreoffice_internal::ConstCharArrayDetector<T>::length)
2046 == 0);
2047 return b;
2048 }
2053 template< typename T >
2054 typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type
2055 endsWithIgnoreAsciiCase(T & literal, std::u16string_view * rest) const
2056 {
2057 assert(rest);
2058 bool b = endsWithIgnoreAsciiCase(literal);
2059 if (b) {
2060 *rest = subView(
2061 0,
2062 (getLength()
2063 - libreoffice_internal::ConstCharArrayDetector<T>::length));
2064 }
2065 return b;
2066 }
2067#else
2073 template< typename T >
2074 typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type
2075 endsWithIgnoreAsciiCase(T & literal, OUString * rest = NULL) const
2076 {
2077 assert(
2078 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
2079 bool b
2080 = (libreoffice_internal::ConstCharArrayDetector<T>::length
2081 <= sal_uInt32(pData->length))
2082 && (rtl_ustr_ascii_compareIgnoreAsciiCase_WithLengths(
2083 (pData->buffer + pData->length
2084 - libreoffice_internal::ConstCharArrayDetector<T>::length),
2085 libreoffice_internal::ConstCharArrayDetector<T>::length,
2086 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
2087 literal),
2088 libreoffice_internal::ConstCharArrayDetector<T>::length)
2089 == 0);
2090 if (b && rest != NULL) {
2091 *rest = copy(
2092 0,
2093 (getLength()
2094 - libreoffice_internal::ConstCharArrayDetector<T>::length));
2095 }
2096 return b;
2097 }
2098#endif
2099
2110 bool endsWithIgnoreAsciiCaseAsciiL(
2111 char const * asciiStr, sal_Int32 asciiStrLength) const
2112 {
2113 return asciiStrLength <= pData->length
2114 && (rtl_ustr_ascii_compareIgnoreAsciiCase_WithLengths(
2115 pData->buffer + pData->length - asciiStrLength,
2116 asciiStrLength, asciiStr, asciiStrLength)
2117 == 0);
2118 }
2119
2120 friend bool operator == ( const OUString& rStr1, const OUString& rStr2 )
2121 { return rStr1.equals(rStr2); }
2122
2123 friend bool operator != ( const OUString& rStr1, const OUString& rStr2 )
2124 { return !(operator == ( rStr1, rStr2 )); }
2125
2126 friend bool operator < ( const OUString& rStr1, const OUString& rStr2 )
2127 { return rStr1.compareTo( rStr2 ) < 0; }
2128 friend bool operator > ( const OUString& rStr1, const OUString& rStr2 )
2129 { return rStr1.compareTo( rStr2 ) > 0; }
2130 friend bool operator <= ( const OUString& rStr1, const OUString& rStr2 )
2131 { return rStr1.compareTo( rStr2 ) <= 0; }
2132 friend bool operator >= ( const OUString& rStr1, const OUString& rStr2 )
2133 { return rStr1.compareTo( rStr2 ) >= 0; }
2134
2135#if defined LIBO_INTERNAL_ONLY
2136
2137 template<typename T> friend typename libreoffice_internal::CharPtrDetector<T, bool>::TypeUtf16
2138 operator ==(OUString const & s1, T const & s2) {
2139 return rtl_ustr_compare_WithLength(s1.getStr(), s1.getLength(), s2, rtl_ustr_getLength(s2))
2140 == 0;
2141 }
2142
2143 template<typename T>
2144 friend typename libreoffice_internal::NonConstCharArrayDetector<T, bool>::TypeUtf16
2145 operator ==(OUString const & s1, T & s2) {
2146 return rtl_ustr_compare_WithLength(s1.getStr(), s1.getLength(), s2, rtl_ustr_getLength(s2))
2147 == 0;
2148 }
2149
2150 template<typename T> friend typename libreoffice_internal::CharPtrDetector<T, bool>::TypeUtf16
2151 operator ==(T const & s1, OUString const & s2) {
2152 return rtl_ustr_compare_WithLength(s1, rtl_ustr_getLength(s1), s2.getStr(), s2.getLength())
2153 == 0;
2154 }
2155
2156 template<typename T>
2157 friend typename libreoffice_internal::NonConstCharArrayDetector<T, bool>::TypeUtf16
2158 operator ==(T & s1, OUString const & s2) {
2159 return rtl_ustr_compare_WithLength(s1, rtl_ustr_getLength(s1), s2.getStr(), s2.getLength())
2160 == 0;
2161 }
2162
2163 template<typename T> friend typename libreoffice_internal::CharPtrDetector<T, bool>::TypeUtf16
2164 operator !=(OUString const & s1, T const & s2) { return !(s1 == s2); }
2165
2166 template<typename T>
2167 friend typename libreoffice_internal::NonConstCharArrayDetector<T, bool>::TypeUtf16
2168 operator !=(OUString const & s1, T & s2) { return !(s1 == s2); }
2169
2170 template<typename T> friend typename libreoffice_internal::CharPtrDetector<T, bool>::TypeUtf16
2171 operator !=(T const & s1, OUString const & s2) { return !(s1 == s2); }
2172
2173 template<typename T>
2174 friend typename libreoffice_internal::NonConstCharArrayDetector<T, bool>::TypeUtf16
2175 operator !=(T & s1, OUString const & s2) { return !(s1 == s2); }
2176
2177#else
2178
2179 friend bool operator == ( const OUString& rStr1, const sal_Unicode * pStr2 )
2180 { return rStr1.compareTo( pStr2 ) == 0; }
2181 friend bool operator == ( const sal_Unicode * pStr1, const OUString& rStr2 )
2182 { return OUString( pStr1 ).compareTo( rStr2 ) == 0; }
2183
2184 friend bool operator != ( const OUString& rStr1, const sal_Unicode * pStr2 )
2185 { return !(operator == ( rStr1, pStr2 )); }
2186 friend bool operator != ( const sal_Unicode * pStr1, const OUString& rStr2 )
2187 { return !(operator == ( pStr1, rStr2 )); }
2188
2189#endif
2190
2198 template< typename T >
2199 friend typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type operator==( const OUString& rString, T& literal )
2200 {
2201 assert(
2202 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
2203 return rString.equalsAsciiL(
2204 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal),
2205 libreoffice_internal::ConstCharArrayDetector<T>::length);
2206 }
2207
2214 template< typename T >
2215 friend typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type operator==( T& literal, const OUString& rString )
2216 {
2217 assert(
2218 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
2219 return rString.equalsAsciiL(
2220 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal),
2221 libreoffice_internal::ConstCharArrayDetector<T>::length);
2222 }
2223
2230 template< typename T >
2231 friend typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type operator!=( const OUString& rString, T& literal )
2232 {
2233 assert(
2234 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
2235 return !rString.equalsAsciiL(
2236 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal),
2237 libreoffice_internal::ConstCharArrayDetector<T>::length);
2238 }
2239
2246 template< typename T >
2247 friend typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type operator!=( T& literal, const OUString& rString )
2248 {
2249 assert(
2250 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
2251 return !rString.equalsAsciiL(
2252 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal),
2253 libreoffice_internal::ConstCharArrayDetector<T>::length);
2254 }
2255
2256#if defined LIBO_INTERNAL_ONLY
2258 template<typename T> friend typename libreoffice_internal::ConstCharArrayDetector<T, bool>::TypeUtf16
2259 operator ==(OUString const & string, T & literal) {
2260 return
2261 rtl_ustr_reverseCompare_WithLength(
2262 string.pData->buffer, string.pData->length,
2263 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
2264 literal),
2265 libreoffice_internal::ConstCharArrayDetector<T>::length)
2266 == 0;
2267 }
2269 template<typename T> friend typename libreoffice_internal::ConstCharArrayDetector<T, bool>::TypeUtf16
2270 operator ==(T & literal, OUString const & string) {
2271 return
2272 rtl_ustr_reverseCompare_WithLength(
2273 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
2274 literal),
2275 libreoffice_internal::ConstCharArrayDetector<T>::length,
2276 string.pData->buffer, string.pData->length)
2277 == 0;
2278 }
2280 template<typename T> friend typename libreoffice_internal::ConstCharArrayDetector<T, bool>::TypeUtf16
2281 operator !=(OUString const & string, T & literal) {
2282 return
2283 rtl_ustr_reverseCompare_WithLength(
2284 string.pData->buffer, string.pData->length,
2285 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
2286 literal),
2287 libreoffice_internal::ConstCharArrayDetector<T>::length)
2288 != 0;
2289 }
2291 template<typename T> friend typename libreoffice_internal::ConstCharArrayDetector<T, bool>::TypeUtf16
2292 operator !=(T & literal, OUString const & string) {
2293 return
2294 rtl_ustr_reverseCompare_WithLength(
2295 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
2296 literal),
2297 libreoffice_internal::ConstCharArrayDetector<T>::length,
2298 string.pData->buffer, string.pData->length)
2299 != 0;
2300 }
2301#endif
2302
2310 sal_Int32 hashCode() const
2311 {
2312 return rtl_ustr_hashCode_WithLength( pData->buffer, pData->length );
2313 }
2314
2328 sal_Int32 indexOf( sal_Unicode ch, sal_Int32 fromIndex = 0 ) const
2329 {
2330 assert(fromIndex >= 0);
2331 sal_Int32 ret = rtl_ustr_indexOfChar_WithLength( pData->buffer+fromIndex, pData->length-fromIndex, ch );
2332 return (ret < 0 ? ret : ret+fromIndex);
2333 }
2334
2344 sal_Int32 lastIndexOf( sal_Unicode ch ) const
2345 {
2346 return rtl_ustr_lastIndexOfChar_WithLength( pData->buffer, pData->length, ch );
2347 }
2348
2361 sal_Int32 lastIndexOf( sal_Unicode ch, sal_Int32 fromIndex ) const
2362 {
2363 return rtl_ustr_lastIndexOfChar_WithLength( pData->buffer, fromIndex, ch );
2364 }
2365
2381#if defined LIBO_INTERNAL_ONLY
2382 sal_Int32 indexOf(std::u16string_view sv, sal_Int32 fromIndex = 0) const {
2383 assert(fromIndex >= 0);
2384 auto const n = rtl_ustr_indexOfStr_WithLength(
2385 pData->buffer + fromIndex, pData->length - fromIndex, sv.data(), sv.size());
2386 return n < 0 ? n : n + fromIndex;
2387 }
2388#else
2389 sal_Int32 indexOf( const OUString & str, sal_Int32 fromIndex = 0 ) const
2390 {
2391 assert(fromIndex >= 0);
2392 sal_Int32 ret = rtl_ustr_indexOfStr_WithLength( pData->buffer+fromIndex, pData->length-fromIndex,
2393 str.pData->buffer, str.pData->length );
2394 return (ret < 0 ? ret : ret+fromIndex);
2395 }
2396#endif
2397
2403 template< typename T >
2404 typename libreoffice_internal::ConstCharArrayDetector< T, sal_Int32 >::Type indexOf( T& literal, sal_Int32 fromIndex = 0 ) const
2405 {
2406 assert(
2407 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
2408 assert(fromIndex >= 0);
2409 sal_Int32 n = rtl_ustr_indexOfAscii_WithLength(
2410 pData->buffer + fromIndex, pData->length - fromIndex,
2411 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal),
2412 libreoffice_internal::ConstCharArrayDetector<T>::length);
2413 return n < 0 ? n : n + fromIndex;
2414 }
2415
2439 sal_Int32 indexOfAsciiL(
2440 char const * str, sal_Int32 len, sal_Int32 fromIndex = 0) const
2441 {
2442 assert(fromIndex >= 0);
2443 sal_Int32 ret = rtl_ustr_indexOfAscii_WithLength(
2444 pData->buffer + fromIndex, pData->length - fromIndex, str, len);
2445 return ret < 0 ? ret : ret + fromIndex;
2446 }
2447
2448 // This overload is left undefined, to detect calls of indexOfAsciiL that
2449 // erroneously use RTL_CONSTASCII_USTRINGPARAM instead of
2450 // RTL_CONSTASCII_STRINGPARAM (but would lead to ambiguities on 32 bit
2451 // platforms):
2452#if SAL_TYPES_SIZEOFLONG == 8
2453 void indexOfAsciiL(char const *, sal_Int32 len, rtl_TextEncoding) const;
2454#endif
2455
2471#if defined LIBO_INTERNAL_ONLY
2472 sal_Int32 lastIndexOf(std::u16string_view sv) const {
2473 return rtl_ustr_lastIndexOfStr_WithLength(
2474 pData->buffer, pData->length, sv.data(), sv.size());
2475 }
2476#else
2477 sal_Int32 lastIndexOf( const OUString & str ) const
2478 {
2479 return rtl_ustr_lastIndexOfStr_WithLength( pData->buffer, pData->length,
2480 str.pData->buffer, str.pData->length );
2481 }
2482#endif
2483
2501#if defined LIBO_INTERNAL_ONLY
2502 sal_Int32 lastIndexOf(std::u16string_view sv, sal_Int32 fromIndex) const {
2503 return rtl_ustr_lastIndexOfStr_WithLength(pData->buffer, fromIndex, sv.data(), sv.size());
2504 }
2505#else
2506 sal_Int32 lastIndexOf( const OUString & str, sal_Int32 fromIndex ) const
2507 {
2508 return rtl_ustr_lastIndexOfStr_WithLength( pData->buffer, fromIndex,
2509 str.pData->buffer, str.pData->length );
2510 }
2511#endif
2512
2518 template< typename T >
2519 typename libreoffice_internal::ConstCharArrayDetector< T, sal_Int32 >::Type lastIndexOf( T& literal ) const
2520 {
2521 assert(
2522 libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
2523 return rtl_ustr_lastIndexOfAscii_WithLength(
2524 pData->buffer, pData->length,
2525 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal),
2526 libreoffice_internal::ConstCharArrayDetector<T>::length);
2527 }
2528
2548 sal_Int32 lastIndexOfAsciiL(char const * str, sal_Int32 len) const
2549 {
2550 return rtl_ustr_lastIndexOfAscii_WithLength(
2551 pData->buffer, pData->length, str, len);
2552 }
2553
2564 SAL_WARN_UNUSED_RESULT OUString copy( sal_Int32 beginIndex ) const
2565 {
2566 return copy(beginIndex, getLength() - beginIndex);
2567 }
2568
2581 SAL_WARN_UNUSED_RESULT OUString copy( sal_Int32 beginIndex, sal_Int32 count ) const
2582 {
2583 rtl_uString *pNew = NULL;
2584 rtl_uString_newFromSubString( &pNew, pData, beginIndex, count );
2585 return OUString( pNew, SAL_NO_ACQUIRE );
2586 }
2587
2588#if defined LIBO_INTERNAL_ONLY
2599 SAL_WARN_UNUSED_RESULT std::u16string_view subView( sal_Int32 beginIndex ) const
2600 {
2601 assert(beginIndex >= 0);
2602 assert(beginIndex <= getLength());
2603 return subView(beginIndex, getLength() - beginIndex);
2604 }
2605
2618 SAL_WARN_UNUSED_RESULT std::u16string_view subView( sal_Int32 beginIndex, sal_Int32 count ) const
2619 {
2620 assert(beginIndex >= 0);
2621 assert(count >= 0);
2622 assert(beginIndex <= getLength());
2623 assert(count <= getLength() - beginIndex);
2624 return std::u16string_view(*this).substr(beginIndex, count);
2625 }
2626#endif
2627
2628#ifndef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
2637 SAL_WARN_UNUSED_RESULT OUString concat( const OUString & str ) const
2638 {
2639 rtl_uString* pNew = NULL;
2640 rtl_uString_newConcat( &pNew, pData, str.pData );
2641 return OUString( pNew, SAL_NO_ACQUIRE );
2642 }
2643#endif
2644
2645#ifndef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
2646 friend OUString operator+( const OUString& rStr1, const OUString& rStr2 )
2647 {
2648 return rStr1.concat( rStr2 );
2649 }
2650#endif
2651
2665 SAL_WARN_UNUSED_RESULT OUString replaceAt( sal_Int32 index, sal_Int32 count, const OUString& newStr ) const
2666 {
2667 rtl_uString* pNew = NULL;
2668 rtl_uString_newReplaceStrAt( &pNew, pData, index, count, newStr.pData );
2669 return OUString( pNew, SAL_NO_ACQUIRE );
2670 }
2671
2672#ifdef LIBO_INTERNAL_ONLY
2673 SAL_WARN_UNUSED_RESULT OUString replaceAt( sal_Int32 index, sal_Int32 count, std::u16string_view newStr ) const
2674 {
2675 rtl_uString* pNew = NULL;
2676 rtl_uString_newReplaceStrAtUtf16L( &pNew, pData, index, count, newStr.data(), newStr.size() );
2677 return OUString( pNew, SAL_NO_ACQUIRE );
2678 }
2679 // Disambiguation
2680 template <std::size_t N>
2681 SAL_WARN_UNUSED_RESULT OUString replaceAt( sal_Int32 index, sal_Int32 count, const sal_Unicode (&newStr)[N] ) const
2682 {
2683 return replaceAt(index, count, std::u16string_view(newStr, N - 1));
2684 }
2685 template <class T, std::enable_if_t<std::is_convertible_v<T, std::u16string_view>, int> = 0>
2686 SAL_WARN_UNUSED_RESULT OUString replaceAt( sal_Int32 index, sal_Int32 count, const T& newStr ) const
2687 {
2688 return replaceAt(index, count, std::u16string_view(newStr));
2689 }
2690#endif
2691
2705 SAL_WARN_UNUSED_RESULT OUString replace( sal_Unicode oldChar, sal_Unicode newChar ) const
2706 {
2707 rtl_uString* pNew = NULL;
2708 rtl_uString_newReplace( &pNew, pData, oldChar, newChar );
2709 return OUString( pNew, SAL_NO_ACQUIRE );
2710 }
2711
2730#if defined LIBO_INTERNAL_ONLY
2731 [[nodiscard]] OUString replaceFirst(
2732 std::u16string_view from, std::u16string_view to, sal_Int32 * index = nullptr) const
2733 {
2734 rtl_uString * s = nullptr;
2735 sal_Int32 i = 0;
2736 rtl_uString_newReplaceFirstUtf16LUtf16L(
2737 &s, pData, from.data(), from.size(), to.data(), to.size(),
2738 index == nullptr ? &i : index);
2739 return OUString(s, SAL_NO_ACQUIRE);
2740 }
2741#else
2742 SAL_WARN_UNUSED_RESULT OUString replaceFirst(
2743 OUString const & from, OUString const & to, sal_Int32 * index = NULL) const
2744 {
2745 rtl_uString * s = NULL;
2746 sal_Int32 i = 0;
2747 rtl_uString_newReplaceFirst(
2748 &s, pData, from.pData, to.pData, index == NULL ? &i : index);
2749 return OUString(s, SAL_NO_ACQUIRE);
2750 }
2751#endif
2752
2771#if defined LIBO_INTERNAL_ONLY
2772 template<typename T> [[nodiscard]]
2773 typename libreoffice_internal::ConstCharArrayDetector<T, OUString >::Type replaceFirst(
2774 T & from, std::u16string_view to, sal_Int32 * index = nullptr) const
2775 {
2776 assert(libreoffice_internal::ConstCharArrayDetector<T>::isValid(from));
2777 rtl_uString * s = nullptr;
2778 sal_Int32 i = 0;
2779 rtl_uString_newReplaceFirstAsciiLUtf16L(
2780 &s, pData, libreoffice_internal::ConstCharArrayDetector<T>::toPointer(from),
2781 libreoffice_internal::ConstCharArrayDetector<T>::length, to.data(), to.size(),
2782 index == nullptr ? &i : index);
2783 return OUString(s, SAL_NO_ACQUIRE);
2784 }
2785#else
2786 template< typename T >
2787 SAL_WARN_UNUSED_RESULT typename libreoffice_internal::ConstCharArrayDetector< T, OUString >::Type replaceFirst( T& from, OUString const & to,
2788 sal_Int32 * index = NULL) const
2789 {
2790 assert(libreoffice_internal::ConstCharArrayDetector<T>::isValid(from));
2791 rtl_uString * s = NULL;
2792 sal_Int32 i = 0;
2793 rtl_uString_newReplaceFirstAsciiL(
2794 &s, pData,
2795 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(from),
2796 libreoffice_internal::ConstCharArrayDetector<T>::length, to.pData,
2797 index == NULL ? &i : index);
2798 return OUString(s, SAL_NO_ACQUIRE);
2799 }
2800#endif
2801
2820#if defined LIBO_INTERNAL_ONLY
2821 template<typename T> [[nodiscard]]
2822 typename libreoffice_internal::ConstCharArrayDetector<T, OUString >::Type replaceFirst(
2823 std::u16string_view from, T & to, sal_Int32 * index = nullptr) const
2824 {
2825 assert(libreoffice_internal::ConstCharArrayDetector<T>::isValid(to));
2826 rtl_uString * s = nullptr;
2827 sal_Int32 i = 0;
2828 rtl_uString_newReplaceFirstUtf16LAsciiL(
2829 &s, pData, from.data(), from.size(),
2830 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(to),
2831 libreoffice_internal::ConstCharArrayDetector<T>::length, index == nullptr ? &i : index);
2832 return OUString(s, SAL_NO_ACQUIRE);
2833 }
2834#else
2835 template< typename T >
2836 SAL_WARN_UNUSED_RESULT typename libreoffice_internal::ConstCharArrayDetector< T, OUString >::Type replaceFirst( OUString const & from, T& to,
2837 sal_Int32 * index = NULL) const
2838 {
2839 assert(libreoffice_internal::ConstCharArrayDetector<T>::isValid(to));
2840 rtl_uString * s = NULL;
2841 sal_Int32 i = 0;
2842 rtl_uString_newReplaceFirstToAsciiL(
2843 &s, pData, from.pData,
2844 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(to),
2845 libreoffice_internal::ConstCharArrayDetector<T>::length,
2846 index == NULL ? &i : index);
2847 return OUString(s, SAL_NO_ACQUIRE);
2848 }
2849#endif
2850
2869 template< typename T1, typename T2 >
2870 SAL_WARN_UNUSED_RESULT typename libreoffice_internal::ConstCharArrayDetector< T1, typename libreoffice_internal::ConstCharArrayDetector< T2, OUString >::Type >::Type
2871 replaceFirst( T1& from, T2& to, sal_Int32 * index = NULL) const
2872 {
2873 assert(libreoffice_internal::ConstCharArrayDetector<T1>::isValid(from));
2874 assert(libreoffice_internal::ConstCharArrayDetector<T2>::isValid(to));
2875 rtl_uString * s = NULL;
2876 sal_Int32 i = 0;
2877 rtl_uString_newReplaceFirstAsciiLAsciiL(
2878 &s, pData,
2879 libreoffice_internal::ConstCharArrayDetector<T1>::toPointer(from),
2880 libreoffice_internal::ConstCharArrayDetector<T1>::length,
2881 libreoffice_internal::ConstCharArrayDetector<T2>::toPointer(to),
2882 libreoffice_internal::ConstCharArrayDetector<T2>::length,
2883 index == NULL ? &i : index);
2884 return OUString(s, SAL_NO_ACQUIRE);
2885 }
2886
2902#if defined LIBO_INTERNAL_ONLY
2903 [[nodiscard]] OUString replaceAll(
2904 std::u16string_view from, std::u16string_view to, sal_Int32 fromIndex = 0) const
2905 {
2906 rtl_uString * s = nullptr;
2907 rtl_uString_newReplaceAllFromIndexUtf16LUtf16L(
2908 &s, pData, from.data(), from.size(), to.data(), to.size(), fromIndex);
2909 return OUString(s, SAL_NO_ACQUIRE);
2910 }
2911#else
2912 SAL_WARN_UNUSED_RESULT OUString replaceAll(
2913 OUString const & from, OUString const & to, sal_Int32 fromIndex = 0) const
2914 {
2915 rtl_uString * s = NULL;
2916 rtl_uString_newReplaceAllFromIndex(&s, pData, from.pData, to.pData, fromIndex);
2917 return OUString(s, SAL_NO_ACQUIRE);
2918 }
2919#endif
2920
2934#if defined LIBO_INTERNAL_ONLY
2935 template<typename T> [[nodiscard]]
2936 typename libreoffice_internal::ConstCharArrayDetector<T, OUString >::Type replaceAll(
2937 T & from, std::u16string_view to) const
2938 {
2939 assert(libreoffice_internal::ConstCharArrayDetector<T>::isValid(from));
2940 rtl_uString * s = nullptr;
2941 rtl_uString_newReplaceAllAsciiLUtf16L(
2942 &s, pData, libreoffice_internal::ConstCharArrayDetector<T>::toPointer(from),
2943 libreoffice_internal::ConstCharArrayDetector<T>::length, to.data(), to.size());
2944 return OUString(s, SAL_NO_ACQUIRE);
2945 }
2946#else
2947 template< typename T >
2948 SAL_WARN_UNUSED_RESULT typename libreoffice_internal::ConstCharArrayDetector< T, OUString >::Type replaceAll( T& from, OUString const & to) const
2949 {
2950 assert(libreoffice_internal::ConstCharArrayDetector<T>::isValid(from));
2951 rtl_uString * s = NULL;
2952 rtl_uString_newReplaceAllAsciiL(
2953 &s, pData,
2954 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(from),
2955 libreoffice_internal::ConstCharArrayDetector<T>::length, to.pData);
2956 return OUString(s, SAL_NO_ACQUIRE);
2957 }
2958#endif
2959
2973#if defined LIBO_INTERNAL_ONLY
2974 template<typename T> [[nodiscard]]
2975 typename libreoffice_internal::ConstCharArrayDetector<T, OUString >::Type replaceAll(
2976 std::u16string_view from, T & to) const
2977 {
2978 assert(libreoffice_internal::ConstCharArrayDetector<T>::isValid(to));
2979 rtl_uString * s = nullptr;
2980 rtl_uString_newReplaceAllUtf16LAsciiL(
2981 &s, pData, from.data(), from.size(),
2982 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(to),
2983 libreoffice_internal::ConstCharArrayDetector<T>::length);
2984 return OUString(s, SAL_NO_ACQUIRE);
2985 }
2986#else
2987 template< typename T >
2988 SAL_WARN_UNUSED_RESULT typename libreoffice_internal::ConstCharArrayDetector< T, OUString >::Type replaceAll( OUString const & from, T& to) const
2989 {
2990 assert(libreoffice_internal::ConstCharArrayDetector<T>::isValid(to));
2991 rtl_uString * s = NULL;
2992 rtl_uString_newReplaceAllToAsciiL(
2993 &s, pData, from.pData,
2994 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(to),
2995 libreoffice_internal::ConstCharArrayDetector<T>::length);
2996 return OUString(s, SAL_NO_ACQUIRE);
2997 }
2998#endif
2999
3013 template< typename T1, typename T2 >
3014 SAL_WARN_UNUSED_RESULT typename libreoffice_internal::ConstCharArrayDetector< T1, typename libreoffice_internal::ConstCharArrayDetector< T2, OUString >::Type >::Type
3015 replaceAll( T1& from, T2& to ) const
3016 {
3017 assert(libreoffice_internal::ConstCharArrayDetector<T1>::isValid(from));
3018 assert(libreoffice_internal::ConstCharArrayDetector<T2>::isValid(to));
3019 rtl_uString * s = NULL;
3020 rtl_uString_newReplaceAllAsciiLAsciiL(
3021 &s, pData,
3022 libreoffice_internal::ConstCharArrayDetector<T1>::toPointer(from),
3023 libreoffice_internal::ConstCharArrayDetector<T1>::length,
3024 libreoffice_internal::ConstCharArrayDetector<T2>::toPointer(to),
3025 libreoffice_internal::ConstCharArrayDetector<T2>::length);
3026 return OUString(s, SAL_NO_ACQUIRE);
3027 }
3028
3039 SAL_WARN_UNUSED_RESULT OUString toAsciiLowerCase() const
3040 {
3041 rtl_uString* pNew = NULL;
3042 rtl_uString_newToAsciiLowerCase( &pNew, pData );
3043 return OUString( pNew, SAL_NO_ACQUIRE );
3044 }
3045
3056 SAL_WARN_UNUSED_RESULT OUString toAsciiUpperCase() const
3057 {
3058 rtl_uString* pNew = NULL;
3059 rtl_uString_newToAsciiUpperCase( &pNew, pData );
3060 return OUString( pNew, SAL_NO_ACQUIRE );
3061 }
3062
3076 SAL_WARN_UNUSED_RESULT OUString trim() const
3077 {
3078 rtl_uString* pNew = NULL;
3079 rtl_uString_newTrim( &pNew, pData );
3080 return OUString( pNew, SAL_NO_ACQUIRE );
3081 }
3082
3107 OUString getToken( sal_Int32 token, sal_Unicode cTok, sal_Int32& index ) const
3108 {
3109 rtl_uString * pNew = NULL;
3110 index = rtl_uString_getToken( &pNew, pData, token, cTok, index );
3111 return OUString( pNew, SAL_NO_ACQUIRE );
3112 }
3113
3127 OUString getToken(sal_Int32 count, sal_Unicode separator) const {
3128 sal_Int32 n = 0;
3129 return getToken(count, separator, n);
3130 }
3131
3140 bool toBoolean() const
3141 {
3142 return rtl_ustr_toBoolean( pData->buffer );
3143 }
3144
3151 sal_Unicode toChar() const
3152 {
3153 return pData->buffer[0];
3154 }
3155
3166 sal_Int32 toInt32( sal_Int16 radix = 10 ) const
3167 {
3168 return rtl_ustr_toInt32( pData->buffer, radix );
3169 }
3170
3183 sal_uInt32 toUInt32( sal_Int16 radix = 10 ) const
3184 {
3185 return rtl_ustr_toUInt32( pData->buffer, radix );
3186 }
3187
3198 sal_Int64 toInt64( sal_Int16 radix = 10 ) const
3199 {
3200 return rtl_ustr_toInt64( pData->buffer, radix );
3201 }
3202
3215 sal_uInt64 toUInt64( sal_Int16 radix = 10 ) const
3216 {
3217 return rtl_ustr_toUInt64( pData->buffer, radix );
3218 }
3219
3228 float toFloat() const
3229 {
3230 return rtl_ustr_toFloat( pData->buffer );
3231 }
3232
3241 double toDouble() const
3242 {
3243 return rtl_ustr_toDouble( pData->buffer );
3244 }
3245
3246
3262 OUString intern() const
3263 {
3264 rtl_uString * pNew = NULL;
3265 rtl_uString_intern( &pNew, pData );
3266 if (pNew == NULL) {
3267 throw std::bad_alloc();
3268 }
3269 return OUString( pNew, SAL_NO_ACQUIRE );
3270 }
3271
3297 static OUString intern( const char * value, sal_Int32 length,
3298 rtl_TextEncoding encoding,
3299 sal_uInt32 convertFlags = OSTRING_TO_OUSTRING_CVTFLAGS,
3300 sal_uInt32 *pInfo = NULL )
3301 {
3302 rtl_uString * pNew = NULL;
3303 rtl_uString_internConvert( &pNew, value, length, encoding,
3304 convertFlags, pInfo );
3305 if (pNew == NULL) {
3306 throw std::bad_alloc();
3307 }
3308 return OUString( pNew, SAL_NO_ACQUIRE );
3309 }
3310
3335 bool convertToString(OString * pTarget, rtl_TextEncoding nEncoding,
3336 sal_uInt32 nFlags) const
3337 {
3338 return rtl_convertUStringToString(&pTarget->pData, pData->buffer,
3339 pData->length, nEncoding, nFlags);
3340 }
3341
3393 sal_uInt32 iterateCodePoints(
3394 sal_Int32 * indexUtf16, sal_Int32 incrementCodePoints = 1) const
3395 {
3396 return rtl_uString_iterateCodePoints(
3397 pData, indexUtf16, incrementCodePoints);
3398 }
3399
3409#if defined LIBO_INTERNAL_ONLY
3410 static OUString fromUtf8(std::string_view rSource)
3411 {
3412 OUString aTarget;
3413 bool bSuccess = rtl_convertStringToUString(&aTarget.pData,
3414 rSource.data(),
3415 rSource.length(),
3416 RTL_TEXTENCODING_UTF8,
3417 RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR|RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR|RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR);
3418 (void) bSuccess;
3419 assert(bSuccess);
3420 return aTarget;
3421 }
3422#else
3423 static OUString fromUtf8(const OString& rSource)
3424 {
3425 OUString aTarget;
3426 bool bSuccess = rtl_convertStringToUString(&aTarget.pData,
3427 rSource.getStr(),
3428 rSource.getLength(),
3429 RTL_TEXTENCODING_UTF8,
3430 RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR|RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR|RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR);
3431 (void) bSuccess;
3432 assert(bSuccess);
3433 return aTarget;
3434 }
3435#endif
3436
3447 OString toUtf8() const
3448 {
3449 OString aTarget;
3450 bool bSuccess = rtl_convertUStringToString(&aTarget.pData,
3451 getStr(),
3452 getLength(),
3453 RTL_TEXTENCODING_UTF8,
3454 RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR|RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR);
3455 (void) bSuccess;
3456 assert(bSuccess);
3457 return aTarget;
3458 }
3459
3460#ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
3461
3462 static auto number( int i, sal_Int16 radix = 10 )
3463 {
3464 return OUStringNumber<RTL_USTR_MAX_VALUEOFINT32>(rtl_ustr_valueOfInt32, i, radix);
3465 }
3466 static auto number( long long ll, sal_Int16 radix = 10 )
3467 {
3468 return OUStringNumber<RTL_USTR_MAX_VALUEOFINT64>(rtl_ustr_valueOfInt64, ll, radix);
3469 }
3470 static auto number( unsigned long long ll, sal_Int16 radix = 10 )
3471 {
3472 return OUStringNumber<RTL_USTR_MAX_VALUEOFUINT64>(rtl_ustr_valueOfUInt64, ll, radix);
3473 }
3474 static auto number( unsigned int i, sal_Int16 radix = 10 )
3475 {
3476 return number( static_cast< unsigned long long >( i ), radix );
3477 }
3478 static auto number( long i, sal_Int16 radix = 10)
3479 {
3480 return number( static_cast< long long >( i ), radix );
3481 }
3482 static auto number( unsigned long i, sal_Int16 radix = 10 )
3483 {
3484 return number( static_cast< unsigned long long >( i ), radix );
3485 }
3486#else
3497 static OUString number( int i, sal_Int16 radix = 10 )
3498 {
3499 sal_Unicode aBuf[RTL_USTR_MAX_VALUEOFINT32];
3500 return OUString(aBuf, rtl_ustr_valueOfInt32(aBuf, i, radix));
3501 }
3502
3504 static OUString number( unsigned int i, sal_Int16 radix = 10 )
3505 {
3506 return number( static_cast< unsigned long long >( i ), radix );
3507 }
3508
3510 static OUString number( long i, sal_Int16 radix = 10)
3511 {
3512 return number( static_cast< long long >( i ), radix );
3513 }
3514
3516 static OUString number( unsigned long i, sal_Int16 radix = 10 )
3517 {
3518 return number( static_cast< unsigned long long >( i ), radix );
3519 }
3520
3522 static OUString number( long long ll, sal_Int16 radix = 10 )
3523 {
3524 sal_Unicode aBuf[RTL_USTR_MAX_VALUEOFINT64];
3525 return OUString(aBuf, rtl_ustr_valueOfInt64(aBuf, ll, radix));
3526 }
3527
3529 static OUString number( unsigned long long ll, sal_Int16 radix = 10 )
3530 {
3531 sal_Unicode aBuf[RTL_USTR_MAX_VALUEOFUINT64];
3532 return OUString(aBuf, rtl_ustr_valueOfUInt64(aBuf, ll, radix));
3533 }
3534#endif
3535
3545 static OUString number( float f )
3546 {
3547 rtl_uString* pNew = NULL;
3548 // Same as rtl::str::valueOfFP, used for rtl_ustr_valueOfFloat
3549 rtl_math_doubleToUString(&pNew, NULL, 0, f, rtl_math_StringFormat_G,
3550 RTL_USTR_MAX_VALUEOFFLOAT - SAL_N_ELEMENTS("-x.E-xxx") + 1, '.',
3551 NULL, 0, true);
3552 if (pNew == NULL)
3553 throw std::bad_alloc();
3554
3555 return OUString(pNew, SAL_NO_ACQUIRE);
3556 }
3557
3567 static OUString number( double d )
3568 {
3569 rtl_uString* pNew = NULL;
3570 // Same as rtl::str::valueOfFP, used for rtl_ustr_valueOfDouble
3571 rtl_math_doubleToUString(&pNew, NULL, 0, d, rtl_math_StringFormat_G,
3572 RTL_USTR_MAX_VALUEOFDOUBLE - SAL_N_ELEMENTS("-x.E-xxx") + 1, '.',
3573 NULL, 0, true);
3574 if (pNew == NULL)
3575 throw std::bad_alloc();
3576
3577 return OUString(pNew, SAL_NO_ACQUIRE);
3578 }
3579
3580#ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
3581 static auto boolean(bool b)
3582 {
3583 return OUStringNumber<RTL_USTR_MAX_VALUEOFBOOLEAN>(rtl_ustr_valueOfBoolean, b);
3584 }
3585#else
3597 SAL_DEPRECATED("use boolean()") static OUString valueOf( sal_Bool b )
3598 {
3599 return boolean(b);
3600 }
3601
3613 static OUString boolean( bool b )
3614 {
3615 sal_Unicode aBuf[RTL_USTR_MAX_VALUEOFBOOLEAN];
3616 return OUString(aBuf, rtl_ustr_valueOfBoolean(aBuf, b));
3617 }
3618#endif
3619
3627 SAL_DEPRECATED("convert to OUString or use directly") static OUString valueOf( sal_Unicode c )
3628 {
3629 return OUString( &c, 1 );
3630 }
3631
3642 SAL_DEPRECATED("use number()") static OUString valueOf( sal_Int32 i, sal_Int16 radix = 10 )
3643 {
3644 return number( i, radix );
3645 }
3646
3657 SAL_DEPRECATED("use number()") static OUString valueOf( sal_Int64 ll, sal_Int16 radix = 10 )
3658 {
3659 return number( ll, radix );
3660 }
3661
3671 SAL_DEPRECATED("use number()") static OUString valueOf( float f )
3672 {
3673 return number(f);
3674 }
3675
3685 SAL_DEPRECATED("use number()") static OUString valueOf( double d )
3686 {
3687 return number(d);
3688 }
3689
3705 static OUString createFromAscii( const char * value )
3706 {
3707 rtl_uString* pNew = NULL;
3708 rtl_uString_newFromAscii( &pNew, value );
3709 return OUString( pNew, SAL_NO_ACQUIRE );
3710 }
3711
3712#if defined LIBO_INTERNAL_ONLY
3713 static OUString createFromAscii(std::string_view value) {
3714 rtl_uString * p = nullptr;
3715 rtl_uString_newFromLiteral(&p, value.data(), value.size(), 0); //TODO: check for overflow
3716 return OUString(p, SAL_NO_ACQUIRE);
3717 }
3718 #endif
3719
3720#if defined LIBO_INTERNAL_ONLY
3721 operator std::u16string_view() const { return {getStr(), sal_uInt32(getLength())}; }
3722#endif
3723
3724#if defined LIBO_INTERNAL_ONLY
3725 // A wrapper for the first expression in an
3726 //
3727 // OUString::Concat(e1) + e2 + ...
3728 //
3729 // concatenation chain, when neither of the first two e1, e2 is one of our rtl string-related
3730 // classes (so something like
3731 //
3732 // OUString s = "a" + (b ? std::u16string_view(u"c") : std::u16string_view(u"dd"));
3733 //
3734 // would not compile):
3735 template<typename T> [[nodiscard]] static
3736 OUStringConcat<OUStringConcatMarker, T>
3737 Concat(T const & value) { return OUStringConcat<OUStringConcatMarker, T>(value); }
3738
3739 // This overload is needed so that an argument of type 'char const[N]' ends up as
3740 // 'OUStringConcat<rtl::OUStringConcatMarker, char const[N]>' rather than as
3741 // 'OUStringConcat<rtl::OUStringConcatMarker, char[N]>':
3742 template<typename T, std::size_t N> [[nodiscard]] static
3743 OUStringConcat<OUStringConcatMarker, T[N]>
3744 Concat(T (& value)[N]) { return OUStringConcat<OUStringConcatMarker, T[N]>(value); }
3745#endif
3746
3747 private:
3748 OUString & internalAppend( rtl_uString* pOtherData )
3749 {
3750 rtl_uString* pNewData = NULL;
3751 rtl_uString_newConcat( &pNewData, pData, pOtherData );
3752 if (pNewData == NULL) {
3753 throw std::bad_alloc();
3754 }
3755 rtl_uString_assign(&pData, pNewData);
3756 rtl_uString_release(pNewData);
3757 return *this;
3758 }
3759
3760#if defined LIBO_INTERNAL_ONLY && !(defined _MSC_VER && _MSC_VER <= 1929 && defined _MANAGED)
3761 static constexpr auto empty = OUStringLiteral(u""); // [-loplugin:ostr]
3762#endif
3763};
3764
3765#if defined LIBO_INTERNAL_ONLY
3766// Prevent the operator ==/!= overloads with 'sal_Unicode const *' parameter from
3767// being selected for nonsensical code like
3768//
3769// if (ouIdAttr == nullptr)
3770//
3771 void operator ==(OUString const &, std::nullptr_t) = delete;
3772 void operator ==(std::nullptr_t, OUString const &) = delete;
3773 void operator !=(OUString const &, std::nullptr_t) = delete;
3774 void operator !=(std::nullptr_t, OUString const &) = delete;
3775#endif
3776
3777#if defined LIBO_INTERNAL_ONLY && !defined RTL_STRING_UNITTEST
3778 inline bool operator ==(OUString const & lhs, StringConcatenation<char16_t> const & rhs)
3779{ return lhs == std::u16string_view(rhs); }
3780 inline bool operator !=(OUString const & lhs, StringConcatenation<char16_t> const & rhs)
3781{ return lhs != std::u16string_view(rhs); }
3782 inline bool operator ==(StringConcatenation<char16_t> const & lhs, OUString const & rhs)
3783{ return std::u16string_view(lhs) == rhs; }
3784 inline bool operator !=(StringConcatenation<char16_t> const & lhs, OUString const & rhs)
3785{ return std::u16string_view(lhs) != rhs; }
3786#endif
3787
3788#if defined LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
3790
3794 template<>
3795 struct ToStringHelper< OUString >
3796{
3797 static std::size_t length( const OUString& s ) { return s.getLength(); }
3798 sal_Unicode* operator() ( sal_Unicode* buffer, const OUString& s ) const { return addDataHelper( buffer, s.getStr(), s.getLength()); }
3799};
3800
3804 template<std::size_t N>
3805 struct ToStringHelper< OUStringLiteral<N> >
3806{
3807 static std::size_t length( const OUStringLiteral<N>& str ) { return str.getLength(); }
3808 sal_Unicode* operator()( sal_Unicode* buffer, const OUStringLiteral<N>& str ) const { return addDataHelper( buffer, str.getStr(), str.getLength() ); }
3809};
3810
3814 template< typename charT, typename traits, typename T1, typename T2 >
3815 inline std::basic_ostream<charT, traits> & operator <<(
3816 std::basic_ostream<charT, traits> & stream, OUStringConcat< T1, T2 >&& concat)
3817{
3818 return stream << OUString( std::move(concat) );
3819}
3820
3822#endif
3823
3829 struct OUStringHash
3830{
3840 size_t operator()(const OUString& rString) const
3841 { return static_cast<size_t>(rString.hashCode()); }
3842};
3843
3844/* ======================================================================= */
3845
3863#if defined LIBO_INTERNAL_ONLY
3864 inline OUString OStringToOUString( std::string_view rStr,
3865 rtl_TextEncoding encoding,
3866 sal_uInt32 convertFlags = OSTRING_TO_OUSTRING_CVTFLAGS )
3867{
3868 return OUString( rStr.data(), rStr.length(), encoding, convertFlags );
3869}
3870#else
3871 inline OUString OStringToOUString( const OString & rStr,
3872 rtl_TextEncoding encoding,
3873 sal_uInt32 convertFlags = OSTRING_TO_OUSTRING_CVTFLAGS )
3874{
3875 return OUString( rStr.getStr(), rStr.getLength(), encoding, convertFlags );
3876}
3877#endif
3878
3896#if defined LIBO_INTERNAL_ONLY
3897 inline OString OUStringToOString( std::u16string_view rUnicode,
3898 rtl_TextEncoding encoding,
3899 sal_uInt32 convertFlags = OUSTRING_TO_OSTRING_CVTFLAGS )
3900{
3901 return OString( rUnicode.data(), rUnicode.length(), encoding, convertFlags );
3902}
3903#else
3904 inline OString OUStringToOString( const OUString & rUnicode,
3905 rtl_TextEncoding encoding,
3906 sal_uInt32 convertFlags = OUSTRING_TO_OSTRING_CVTFLAGS )
3907{
3908 return OString( rUnicode.getStr(), rUnicode.getLength(), encoding, convertFlags );
3909}
3910#endif
3911
3912/* ======================================================================= */
3913
3922 template< typename charT, typename traits >
3923 inline std::basic_ostream<charT, traits> & operator <<(
3924 std::basic_ostream<charT, traits> & stream, OUString const & rString)
3925{
3926 return stream <<
3927 OUStringToOString(rString, RTL_TEXTENCODING_UTF8);
3928 // best effort; potentially loses data due to conversion failures
3929 // (stray surrogate halves) and embedded null characters
3930}
3931
3932} // namespace
3933
3934#ifdef RTL_STRING_UNITTEST
3935 namespace rtl
3936{
3937 typedef rtlunittest::OUString OUString;
3938}
3939#endif
3940
3941// In internal code, allow to use classes like OUString without having to
3942// explicitly refer to the rtl namespace, which is kind of superfluous given
3943// that OUString itself is namespaced by its OU prefix:
3944#if defined LIBO_INTERNAL_ONLY && !defined RTL_STRING_UNITTEST
3945 using ::rtl::OUString;
3946 using ::rtl::OUStringHash;
3947 using ::rtl::OStringToOUString;
3948 using ::rtl::OUStringToOString;
3949 using ::rtl::OUStringLiteral;
3950 using ::rtl::OUStringChar;
3951 using ::rtl::Concat2View;
3952 using RepeatedUChar = ::rtl::RepeatedChar_t<sal_Unicode>;
3953#endif
3954
3955#if defined LIBO_INTERNAL_ONLY && !(defined _MSC_VER && _MSC_VER <= 1929 && defined _MANAGED)
3956
3957 template<
3958#if defined RTL_STRING_UNITTEST
3959 rtlunittest::
3960#endif
3961 OUStringLiteral L>
3962 constexpr
3963#if defined RTL_STRING_UNITTEST
3964 rtlunittest::
3965#endif
3966 OUString
3967 operator ""_ustr() { return L; }
3968
3969#endif
3970
3972
3977#if defined LIBO_INTERNAL_ONLY
3978 namespace std {
3979
3980 template<>
3981 struct hash<::rtl::OUString>
3982{
3983 std::size_t operator()(::rtl::OUString const & s) const
3984 {
3985 if constexpr (sizeof(std::size_t) == 8)
3986 {
3987 // return a hash that uses the full 64-bit range instead of a 32-bit value
3988 size_t n = s.getLength();
3989 for (sal_Int32 i = 0, len = s.getLength(); i < len; ++i)
3990 n = 37 * n + s[i];
3991 return n;
3992 }
3993 else
3994 return std::size_t(s.hashCode());
3995 }
3996};
3997
3998}
3999
4000#if !(defined _MSC_VER && _MSC_VER <= 1929 && defined _MANAGED)
4007 static inline constexpr ::rtl::OUString EMPTY_OUSTRING = u""_ustr;
4008#endif
4009
4010#endif
4012
4013#endif /* _RTL_USTRING_HXX */
4014
4015/* 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
string.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
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
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
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
stringutils.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:2714
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:3871
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:3904
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:697
rtl::OString::getLength
sal_Int32 getLength() const
Returns the length of this string.
Definition string.hxx:671
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:3497
rtl::OUString::intern
OUString intern() const
Return a canonical representation for a string.
Definition ustring.hxx:3262
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:2404
rtl::OUString::endsWith
bool endsWith(OUString const &str, OUString *rest=NULL) const
Check whether this string ends with a given substring.
Definition ustring.hxx:1822
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:2110
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:3039
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:2948
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:849
rtl::OUString::equalsIgnoreAsciiCase
bool equalsIgnoreAsciiCase(const OUString &str) const
Perform an ASCII lowercase comparison of two strings.
Definition ustring.hxx:1009
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:1925
rtl::OUString::OUString
OUString(const OUString &str)
New string from OUString.
Definition ustring.hxx:201
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:3393
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:3423
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:1107
rtl::OUString::toInt32
sal_Int32 toInt32(sal_Int16 radix=10) const
Returns the int32 value from this string.
Definition ustring.hxx:3166
rtl::OUString::clear
void clear()
Clears the string, i.e, makes a zero-character string.
Definition ustring.hxx:814
rtl::OUString::equalsIgnoreAsciiCaseAsciiL
bool equalsIgnoreAsciiCaseAsciiL(const char *asciiStr, sal_Int32 asciiStrLength) const
Perform an ASCII lowercase comparison of two strings.
Definition ustring.hxx:1380
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:3529
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:2439
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:3015
rtl::OUString::~OUString
~OUString()
Release the string data.
Definition ustring.hxx:540
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:914
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:2548
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:2328
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:2988
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:3522
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:1408
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:2912
rtl::OUString::toFloat
float toFloat() const
Returns the float value from this string.
Definition ustring.hxx:3228
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:3516
rtl::OUString::createFromAscii
static OUString createFromAscii(const char *value)
Returns an OUString copied without conversion from an ASCII character string.
Definition ustring.hxx:3705
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:2787
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:2871
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:2705
rtl::OUString::hashCode
sal_Int32 hashCode() const
Returns a hashcode for this string.
Definition ustring.hxx:2310
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:952
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:2215
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:2199
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:3510
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:1054
rtl::OUString::toUInt64
sal_uInt64 toUInt64(sal_Int16 radix=10) const
Returns the uint64 value from this string.
Definition ustring.hxx:3215
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:1446
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:1742
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:3447
rtl::OUString::reverseCompareToAsciiL
sal_Int32 reverseCompareToAsciiL(const char *asciiStr, sal_Int32 asciiStrLength) const
Compares two strings in reverse order.
Definition ustring.hxx:1242
rtl::OUString::equalsAsciiL
bool equalsAsciiL(const char *asciiStr, sal_Int32 asciiStrLength) const
Perform a comparison of two strings.
Definition ustring.hxx:1285
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:3504
rtl::OUString::convertToString
bool convertToString(OString *pTarget, rtl_TextEncoding nEncoding, sal_uInt32 nFlags) const
Converts to an OString, signalling failure.
Definition ustring.hxx:3335
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:1604
rtl::OUString::OUString
OUString(rtl_uString *str)
New string from OUString data.
Definition ustring.hxx:253
rtl::OUString::OUString
OUString(const sal_Unicode *value, sal_Int32 length)
New string from a Unicode character buffer array.
Definition ustring.hxx:339
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:2014
rtl::OUString::compareTo
sal_Int32 compareTo(const OUString &str) const
Compares two strings.
Definition ustring.hxx:885
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:2231
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:625
rtl::OUString::startsWith
bool startsWith(OUString const &str, OUString *rest=NULL) const
Check whether this string starts with a given substring.
Definition ustring.hxx:1534
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:2344
rtl::OUString::compareToIgnoreAsciiCaseAscii
sal_Int32 compareToIgnoreAsciiCaseAscii(const char *asciiStr) const
Compares two ASCII strings ignoring case.
Definition ustring.hxx:1344
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:2836
rtl::OUString::OUString
OUString(sal_Unicode value)
New string from a single Unicode character.
Definition ustring.hxx:282
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:2742
rtl::OUString::toInt64
sal_Int64 toInt64(sal_Int16 radix=10) const
Returns the int64 value from this string.
Definition ustring.hxx:3198
rtl::OUString::toUInt32
sal_uInt32 toUInt32(sal_Int16 radix=10) const
Returns the uint32 value from this string.
Definition ustring.hxx:3183
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:1666
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:2506
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:566
rtl::OUString::toDouble
double toDouble() const
Returns the double value from this string.
Definition ustring.hxx:3241
rtl::OUString::equalsAscii
bool equalsAscii(const char *asciiStr) const
Perform a comparison of two strings.
Definition ustring.hxx:1263
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:1164
rtl::OUString::getToken
OUString getToken(sal_Int32 token, sal_Unicode cTok, sal_Int32 &index) const
Returns a token in the string.
Definition ustring.hxx:3107
rtl::OUString::getLength
sal_Int32 getLength() const
Returns the length of this string.
Definition ustring.hxx:827
rtl::OUString::equalsIgnoreAsciiCaseAscii
bool equalsIgnoreAsciiCaseAscii(const char *asciiStr) const
Perform an ASCII lowercase comparison of two strings.
Definition ustring.hxx:1312
rtl::OUString::OUString
OUString()
New string containing no characters.
Definition ustring.hxx:184
rtl::OUString::OUString
OUString(const sal_Unicode *value)
New string from a Unicode character buffer array.
Definition ustring.hxx:323
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:459
rtl::OUString::operator=
OUString & operator=(const OUString &str)
Assign a new string.
Definition ustring.hxx:590
rtl::OUString::number
static OUString number(float f)
Returns the string representation of the float argument.
Definition ustring.hxx:3545
rtl::OUString::valueOf
static OUString valueOf(sal_Bool b)
Returns the string representation of the sal_Bool argument.
Definition ustring.hxx:3597
rtl::OUString::isEmpty
bool isEmpty() const
Checks if a string is empty.
Definition ustring.hxx:837
rtl::OUString::compareToIgnoreAsciiCase
sal_Int32 compareToIgnoreAsciiCase(const OUString &str) const
Perform an ASCII lowercase comparison of two strings.
Definition ustring.hxx:1041
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:486
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:1891
rtl::OUString::operator+=
OUString & operator+=(const OUString &str)
Append a string to this string.
Definition ustring.hxx:698
rtl::OUString::toChar
sal_Unicode toChar() const
Returns the first character from this string.
Definition ustring.hxx:3151
rtl::OUString::getToken
OUString getToken(sal_Int32 count, sal_Unicode separator) const
Returns a token from the string.
Definition ustring.hxx:3127
rtl::OUString::boolean
static OUString boolean(bool b)
Returns the string representation of the boolean argument.
Definition ustring.hxx:3613
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:2519
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:2581
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:2075
rtl::OUString::OUString
OUString(rtl_uString *str, __sal_NoAcquire)
New OUString from OUString data without acquiring it.
Definition ustring.hxx:274
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:2361
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:3076
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:3056
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:2637
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:2665
rtl::OUString::match
bool match(const OUString &str, sal_Int32 fromIndex=0) const
Match against a substring appearing in this string.
Definition ustring.hxx:1093
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:1149
rtl::OUString::compareToAscii
sal_Int32 compareToAscii(const char *asciiStr) const
Compares two strings.
Definition ustring.hxx:1189
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:361
rtl::OUString::reverseCompareTo
sal_Int32 reverseCompareTo(const OUString &str) const
Compares two strings in reverse order.
Definition ustring.hxx:939
rtl::OUString::number
static OUString number(double d)
Returns the string representation of the double argument.
Definition ustring.hxx:3567
rtl::OUString::operator+
friend OUString operator+(const OUString &rStr1, const OUString &rStr2)
Definition ustring.hxx:2646
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:2564
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:2247
rtl::OUString::equals
bool equals(const OUString &str) const
Perform a comparison of two strings.
Definition ustring.hxx:973
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:2477
rtl::OUString::toBoolean
bool toBoolean() const
Returns the Boolean value from this string.
Definition ustring.hxx:3140
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:2389
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:3297
rtl::OUStringHash
A helper to use OUStrings with hash maps.
Definition ustring.hxx:3830
rtl::OUStringHash::operator()
size_t operator()(const OUString &rString) const
Compute a hash code for a string.
Definition ustring.hxx:3840