20 #ifndef INCLUDED_RTL_USTRING_HXX
21 #define INCLUDED_RTL_USTRING_HXX
33 #if defined LIBO_INTERNAL_ONLY
34 #include <string_view>
35 #include <type_traits>
43 #ifdef LIBO_INTERNAL_ONLY
44 #include "config_global.h"
45 #include "rtl/stringconcat.hxx"
48 #ifdef RTL_STRING_UNITTEST
49 extern bool rtl_string_unittest_invalid_conversion;
57 #ifdef RTL_STRING_UNITTEST
58 #define rtl rtlunittest
66 #ifdef RTL_STRING_UNITTEST
70 #if defined LIBO_INTERNAL_ONLY
80 static_assert(N != 0);
81 static_assert(N - 1 <= std::numeric_limits<sal_Int32>::max(),
"literal too long");
84 #if HAVE_CPP_CONSTEVAL
89 OUStringLiteral(char16_t
const (&literal)[N]) {
91 assert(literal[N - 1] ==
'\0');
93 for (std::size_t i = 0; i != N; ++i) {
94 buffer[i] = literal[i];
98 constexpr sal_Int32 getLength()
const {
return length; }
100 constexpr
sal_Unicode const * getStr() const SAL_RETURNS_NONNULL {
return buffer; }
102 constexpr
operator std::u16string_view()
const {
return {buffer, sal_uInt32(length)}; }
105 static constexpr
void assertLayout() {
108 static_assert(offsetof(OUStringLiteral, refCount) == offsetof(rtl_uString, refCount));
109 static_assert(std::is_same_v<decltype(refCount), decltype(rtl_uString::refCount)>);
110 static_assert(offsetof(OUStringLiteral, length) == offsetof(rtl_uString, length));
111 static_assert(std::is_same_v<decltype(length), decltype(rtl_uString::length)>);
112 static_assert(offsetof(OUStringLiteral, buffer) == offsetof(rtl_uString, buffer));
115 std::remove_extent_t<decltype(buffer)>,
116 std::remove_extent_t<decltype(rtl_uString::buffer)>>);
121 sal_Int32 length = N - 1;
125 #if defined RTL_STRING_UNITTEST
126 namespace libreoffice_internal {
127 template<std::
size_t N>
struct ExceptConstCharArrayDetector<OUStringLiteral<N>> {};
128 template<std::
size_t N>
struct ExceptCharArrayDetector<OUStringLiteral<N>> {};
187 #if defined LIBO_INTERNAL_ONLY
235 #if defined LIBO_INTERNAL_ONLY && !defined RTL_STRING_UNITTEST_CONCAT
246 #if defined LIBO_INTERNAL_ONLY
248 template<
typename T>
explicit OUString(
250 typename libreoffice_internal::CharPtrDetector<T, libreoffice_internal::Dummy>::TypeUtf16
251 = libreoffice_internal::Dummy()):
255 template<
typename T>
explicit OUString(
258 libreoffice_internal::NonConstCharArrayDetector<T, libreoffice_internal::Dummy>::TypeUtf16
259 = libreoffice_internal::Dummy()):
307 template<
typename T >
322 #ifdef RTL_STRING_UNITTEST
323 rtl_string_unittest_const_literal =
true;
327 #if defined LIBO_INTERNAL_ONLY
343 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
345 libreoffice_internal::ConstCharArrayDetector<T>::length);
350 #if defined LIBO_INTERNAL_ONLY && defined RTL_STRING_UNITTEST
356 template<
typename T >
357 OUString( T&,
typename libreoffice_internal::ExceptConstCharArrayDetector< T >::Type = libreoffice_internal::Dummy() )
361 rtl_string_unittest_invalid_conversion =
true;
367 template<
typename T >
368 OUString(
const T&,
typename libreoffice_internal::ExceptCharArrayDetector< T >::Type = libreoffice_internal::Dummy() )
372 rtl_string_unittest_invalid_conversion =
true;
377 #ifdef LIBO_INTERNAL_ONLY
384 template<std::
size_t N> OUString(OUStringLiteral<N>
const & literal):
385 pData(const_cast<rtl_uString *>(reinterpret_cast<rtl_uString const *>(&literal))) {}
386 template<std::
size_t N> OUString(OUStringLiteral<N> &&) =
delete;
411 throw std::bad_alloc();
432 sal_uInt32
const * codePoints, sal_Int32 codePointCount):
437 throw std::bad_alloc();
441 #ifdef LIBO_INTERNAL_ONLY
446 template< typename T1, typename T2 >
447 OUString( OUStringConcat< T1, T2 >&& c )
449 const sal_Int32 l = c.length();
464 template<
typename T >
465 OUString( OUStringNumber< T >&& n )
466 : OUString( n.buf, n.length )
470 #if defined LIBO_INTERNAL_ONLY
471 OUString(std::u16string_view sv) {
472 if (sv.size() > sal_uInt32(std::numeric_limits<sal_Int32>::max())) {
473 throw std::bad_alloc();
500 {
return *
reinterpret_cast< OUString const *
>( ppHandle ); }
513 #if defined LIBO_INTERNAL_ONLY
542 template<
typename T >
559 #if defined LIBO_INTERNAL_ONLY
564 operator =(T & literal) {
570 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
572 libreoffice_internal::ConstCharArrayDetector<T>::length);
578 template<std::
size_t N> OUString & operator =(OUStringLiteral<N>
const & literal) {
579 if (literal.getLength() == 0) {
588 OUString & operator =(OUStringNumber<T> && n) {
594 OUString & operator =(std::u16string_view sv) {
604 #if defined LIBO_INTERNAL_ONLY
613 inline OUString & operator+=(
const OUStringBuffer & str ) &;
624 #if defined LIBO_INTERNAL_ONLY
628 return internalAppend(str.pData);
630 #if defined LIBO_INTERNAL_ONLY
631 void operator+=(
OUString const &) && =
delete;
642 operator +=(T & literal)
643 #if defined LIBO_INTERNAL_ONLY
655 #if defined LIBO_INTERNAL_ONLY
658 operator +=(T &) && =
delete;
661 #if defined LIBO_INTERNAL_ONLY
666 operator +=(T & literal) & {
675 libreoffice_internal::ConstCharArrayDetector<T, OUString &>::TypeUtf16
676 operator +=(T &) && =
delete;
679 template<std::
size_t N> OUString & operator +=(OUStringLiteral<N>
const & literal) & {
683 template<std::
size_t N>
void operator +=(OUStringLiteral<N>
const &) && =
delete;
685 OUString & operator +=(std::u16string_view sv) & {
686 if (sv.size() > sal_uInt32(std::numeric_limits<sal_Int32>::max())) {
687 throw std::bad_alloc();
692 void operator +=(std::u16string_view) && =
delete;
695 #ifdef LIBO_INTERNAL_ONLY
700 template< typename T1, typename T2 >
701 OUString& operator+=( OUStringConcat< T1, T2 >&& c ) & {
702 sal_Int32 l = c.length();
707 sal_Unicode* end = c.addData( pData->buffer + pData->length );
712 template<
typename T1,
typename T2>
void operator +=(
713 OUStringConcat<T1, T2> &&) && =
delete;
719 template<
typename T >
720 OUString& operator+=( OUStringNumber< T >&& n ) & {
721 sal_Int32 l = n.length;
726 sal_Unicode* end = addDataHelper( pData->buffer + pData->length, n.buf, n.length );
731 template<
typename T>
void operator +=(
732 OUStringNumber<T> &&) && =
delete;
764 return pData->length == 0;
787 assert(index >= 0 &&
static_cast<sal_uInt32
>(index) <
static_cast<sal_uInt32
>(getLength()));
788 return getStr()[index];
806 str.pData->buffer, str.pData->length );
827 str.pData->buffer, str.pData->length, maxLength );
842 #if defined LIBO_INTERNAL_ONLY
843 sal_Int32 reverseCompareTo(std::u16string_view sv)
const {
845 pData->buffer, pData->length, sv.data(), sv.size());
851 str.pData->buffer, str.pData->length );
860 template<
typename T >
866 pData->buffer, pData->length,
884 if ( pData->length != str.pData->length )
886 if ( pData == str.pData )
889 str.pData->buffer, str.pData->length ) == 0;
906 #if defined LIBO_INTERNAL_ONLY
907 bool equalsIgnoreAsciiCase(std::u16string_view sv)
const {
910 pData->buffer, pData->length, sv.data(), sv.size())
916 if ( pData->length != str.pData->length )
918 if ( pData == str.pData )
921 str.pData->buffer, str.pData->length ) == 0;
940 #if defined LIBO_INTERNAL_ONLY
941 sal_Int32 compareToIgnoreAsciiCase(std::u16string_view sv)
const {
943 pData->buffer, pData->length, sv.data(), sv.size());
949 str.pData->buffer, str.pData->length );
958 template<
typename T >
967 pData->buffer, pData->length,
988 #if defined LIBO_INTERNAL_ONLY
989 bool match(std::u16string_view sv, sal_Int32 fromIndex = 0)
const {
992 pData->buffer + fromIndex, pData->length - fromIndex, sv.data(), sv.size(),
1000 str.pData->buffer, str.pData->length, str.pData->length ) == 0;
1009 template<
typename T >
1016 pData->buffer+fromIndex, pData->length-fromIndex,
1041 #if defined LIBO_INTERNAL_ONLY
1042 bool matchIgnoreAsciiCase(std::u16string_view sv, sal_Int32 fromIndex = 0)
const {
1045 pData->buffer + fromIndex, pData->length - fromIndex, sv.data(), sv.size(),
1053 str.pData->buffer, str.pData->length,
1054 str.pData->length ) == 0;
1063 template<
typename T >
1070 pData->buffer+fromIndex, pData->length-fromIndex,
1121 "replace s1.compareToAscii(s2, strlen(s2)) == 0 with s1.startsWith(s2)")
1122 sal_Int32 compareToAscii( const
char * asciiStr, sal_Int32 maxLength )
const
1125 asciiStr, maxLength );
1150 asciiStr, asciiStrLength );
1193 if ( pData->length != asciiStrLength )
1197 pData->buffer, asciiStr, asciiStrLength );
1268 if ( pData->length != asciiStrLength )
1295 bool matchAsciiL(
const char* asciiStr, sal_Int32 asciiStrLength, sal_Int32 fromIndex = 0 )
const
1298 asciiStr, asciiStrLength ) == 0;
1305 #if SAL_TYPES_SIZEOFLONG == 8
1336 asciiStr, asciiStrLength ) == 0;
1343 #if SAL_TYPES_SIZEOFLONG == 8
1362 #if defined LIBO_INTERNAL_ONLY
1363 bool startsWith(std::u16string_view sv,
OUString * rest =
nullptr)
const {
1364 auto const b = match(sv);
1365 if (b && rest !=
nullptr) {
1366 *rest = copy(sv.size());
1372 bool b = match(str);
1373 if (b && rest != NULL) {
1385 template<
typename T >
1387 T & literal,
OUString * rest = NULL)
const
1393 <= sal_uInt32(pData->length))
1399 if (b && rest != NULL) {
1426 #if defined LIBO_INTERNAL_ONLY
1427 bool startsWithIgnoreAsciiCase(std::u16string_view sv,
OUString * rest =
nullptr)
const {
1428 auto const b = matchIgnoreAsciiCase(sv);
1429 if (b && rest !=
nullptr) {
1430 *rest = copy(sv.size());
1438 bool b = matchIgnoreAsciiCase(str);
1439 if (b && rest != NULL) {
1451 template<
typename T >
1465 if (b && rest != NULL) {
1486 #if defined LIBO_INTERNAL_ONLY
1487 bool endsWith(std::u16string_view sv,
OUString * rest =
nullptr)
const {
1488 auto const b = sv.size() <= sal_uInt32(pData->length)
1489 && match(sv, pData->length - sv.size());
1490 if (b && rest !=
nullptr) {
1491 *rest = copy(0, (pData->length - sv.size()));
1498 && match(str, getLength() - str.
getLength());
1499 if (b && rest != NULL) {
1500 *rest = copy(0, getLength() - str.
getLength());
1511 template<
typename T >
1519 <= sal_uInt32(pData->length))
1521 (pData->buffer + pData->length
1526 if (b && rest != NULL) {
1549 return asciiStrLength <= pData->length
1551 pData->buffer + pData->length - asciiStrLength, asciiStr,
1575 #if defined LIBO_INTERNAL_ONLY
1576 bool endsWithIgnoreAsciiCase(std::u16string_view sv,
OUString * rest =
nullptr)
const {
1577 auto const b = sv.size() <= sal_uInt32(pData->length)
1578 && matchIgnoreAsciiCase(sv, pData->length - sv.size());
1579 if (b && rest !=
nullptr) {
1580 *rest = copy(0, pData->length - sv.size());
1588 && matchIgnoreAsciiCase(str, getLength() - str.
getLength());
1589 if (b && rest != NULL) {
1590 *rest = copy(0, getLength() - str.
getLength());
1601 template<
typename T >
1609 <= sal_uInt32(pData->length))
1611 (pData->buffer + pData->length
1618 if (b && rest != NULL) {
1638 char const * asciiStr, sal_Int32 asciiStrLength)
const
1640 return asciiStrLength <= pData->length
1642 pData->buffer + pData->length - asciiStrLength,
1643 asciiStrLength, asciiStr, asciiStrLength)
1648 {
return rStr1.
equals(rStr2); }
1654 {
return rStr1.
compareTo( rStr2 ) < 0; }
1656 {
return rStr1.
compareTo( rStr2 ) > 0; }
1658 {
return rStr1.
compareTo( rStr2 ) <= 0; }
1660 {
return rStr1.
compareTo( rStr2 ) >= 0; }
1662 #if defined LIBO_INTERNAL_ONLY
1670 template<
typename T>
1671 friend typename libreoffice_internal::NonConstCharArrayDetector<T, bool>::TypeUtf16
1677 template<
typename T>
friend typename libreoffice_internal::CharPtrDetector<T, bool>::TypeUtf16
1683 template<
typename T>
1684 friend typename libreoffice_internal::NonConstCharArrayDetector<T, bool>::TypeUtf16
1690 template<
typename T>
friend typename libreoffice_internal::CharPtrDetector<T, bool>::TypeUtf16
1691 operator !=(OUString
const & s1, T
const & s2) {
return !(s1 == s2); }
1693 template<
typename T>
1694 friend typename libreoffice_internal::NonConstCharArrayDetector<T, bool>::TypeUtf16
1695 operator !=(OUString
const & s1, T & s2) {
return !(s1 == s2); }
1697 template<
typename T>
friend typename libreoffice_internal::CharPtrDetector<T, bool>::TypeUtf16
1698 operator !=(T
const & s1, OUString
const & s2) {
return !(s1 == s2); }
1700 template<
typename T>
1701 friend typename libreoffice_internal::NonConstCharArrayDetector<T, bool>::TypeUtf16
1702 operator !=(T & s1, OUString
const & s2) {
return !(s1 == s2); }
1707 {
return rStr1.
compareTo( pStr2 ) == 0; }
1725 template<
typename T >
1741 template<
typename T >
1757 template<
typename T >
1773 template<
typename T >
1783 #if defined LIBO_INTERNAL_ONLY
1789 string.pData->buffer,
string.pData->length,
1796 template<
typename T>
friend typename libreoffice_internal::ConstCharArrayDetector<T, bool>::TypeUtf16
1797 operator ==(T & literal, OUString
const &
string) {
1800 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
1802 libreoffice_internal::ConstCharArrayDetector<T>::length,
1803 string.pData->buffer,
string.pData->length)
1807 template<
typename T>
friend typename libreoffice_internal::ConstCharArrayDetector<T, bool>::TypeUtf16
1808 operator !=(OUString
const &
string, T & literal) {
1811 string.pData->buffer,
string.pData->length,
1812 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
1814 libreoffice_internal::ConstCharArrayDetector<T>::length)
1818 template<
typename T>
friend typename libreoffice_internal::ConstCharArrayDetector<T, bool>::TypeUtf16
1819 operator !=(T & literal, OUString
const &
string) {
1822 libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
1824 libreoffice_internal::ConstCharArrayDetector<T>::length,
1825 string.pData->buffer,
string.pData->length)
1830 #if defined LIBO_INTERNAL_ONLY
1838 template<std::
size_t N>
1839 friend bool operator ==(OUString
const & lhs, OUStringLiteral<N>
const & rhs) {
1842 lhs.pData->buffer, lhs.pData->length, rhs.getStr(), rhs.getLength())
1846 template<std::
size_t N>
1847 friend bool operator !=(OUString
const & lhs, OUStringLiteral<N>
const & rhs) {
1850 lhs.pData->buffer, lhs.pData->length, rhs.getStr(), rhs.getLength())
1854 template<std::
size_t N>
1855 friend bool operator <(OUString
const & lhs, OUStringLiteral<N>
const & rhs) {
1858 lhs.pData->buffer, lhs.pData->length, rhs.getStr(), rhs.getLength()))
1862 template<std::
size_t N>
1863 friend bool operator <=(OUString
const & lhs, OUStringLiteral<N>
const & rhs) {
1866 lhs.pData->buffer, lhs.pData->length, rhs.getStr(), rhs.getLength()))
1870 template<std::
size_t N>
1871 friend bool operator >(OUString
const & lhs, OUStringLiteral<N>
const & rhs) {
1874 lhs.pData->buffer, lhs.pData->length, rhs.getStr(), rhs.getLength()))
1878 template<std::
size_t N>
1879 friend bool operator >=(OUString
const & lhs, OUStringLiteral<N>
const & rhs) {
1882 lhs.pData->buffer, lhs.pData->length, rhs.getStr(), rhs.getLength()))
1886 template<std::
size_t N>
1887 friend bool operator ==(OUStringLiteral<N>
const & lhs, OUString
const & rhs) {
1890 lhs.getStr(), lhs.getLength(), rhs.pData->buffer, rhs.pData->length)
1894 template<std::
size_t N>
1895 friend bool operator !=(OUStringLiteral<N>
const & lhs, OUString
const & rhs) {
1898 lhs.getStr(), lhs.getLength(), rhs.pData->buffer, rhs.pData->length)
1902 template<std::
size_t N>
1903 friend bool operator <(OUStringLiteral<N>
const & lhs, OUString
const & rhs) {
1906 lhs.getStr(), lhs.getLength(), rhs.pData->buffer, rhs.pData->length))
1910 template<std::
size_t N>
1911 friend bool operator <=(OUStringLiteral<N>
const & lhs, OUString
const & rhs) {
1914 lhs.getStr(), lhs.getLength(), rhs.pData->buffer, rhs.pData->length))
1918 template<std::
size_t N>
1919 friend bool operator >(OUStringLiteral<N>
const & lhs, OUString
const & rhs) {
1922 lhs.getStr(), lhs.getLength(), rhs.pData->buffer, rhs.pData->length))
1926 template<std::
size_t N>
1927 friend bool operator >=(OUStringLiteral<N>
const & lhs, OUString
const & rhs) {
1930 lhs.getStr(), lhs.getLength(), rhs.pData->buffer, rhs.pData->length))
1937 #if defined LIBO_INTERNAL_ONLY
1938 friend bool operator ==(OUString
const & lhs, std::u16string_view rhs) {
1941 lhs.pData->buffer, lhs.pData->length, rhs.data(), rhs.size())
1945 friend bool operator !=(OUString
const & lhs, std::u16string_view rhs) {
1948 lhs.pData->buffer, lhs.pData->length, rhs.data(), rhs.size())
1952 friend bool operator <(OUString
const & lhs, std::u16string_view rhs) {
1955 lhs.pData->buffer, lhs.pData->length, rhs.data(), rhs.size()))
1959 friend bool operator <=(OUString
const & lhs, std::u16string_view rhs) {
1962 lhs.pData->buffer, lhs.pData->length, rhs.data(), rhs.size()))
1966 friend bool operator >(OUString
const & lhs, std::u16string_view rhs) {
1969 lhs.pData->buffer, lhs.pData->length, rhs.data(), rhs.size()))
1973 friend bool operator >=(OUString
const & lhs, std::u16string_view rhs) {
1976 lhs.pData->buffer, lhs.pData->length, rhs.data(), rhs.size()))
1980 friend bool operator ==(std::u16string_view lhs, OUString
const & rhs) {
1983 lhs.data(), lhs.size(), rhs.pData->buffer, rhs.pData->length)
1987 friend bool operator !=(std::u16string_view lhs, OUString
const & rhs) {
1990 lhs.data(), lhs.size(), rhs.pData->buffer, rhs.pData->length)
1994 friend bool operator <(std::u16string_view lhs, OUString
const & rhs) {
1997 lhs.data(), lhs.size(), rhs.pData->buffer, rhs.pData->length))
2001 friend bool operator <=(std::u16string_view lhs, OUString
const & rhs) {
2004 lhs.data(), lhs.size(), rhs.pData->buffer, rhs.pData->length))
2008 friend bool operator >(std::u16string_view lhs, OUString
const & rhs) {
2011 lhs.data(), lhs.size(), rhs.pData->buffer, rhs.pData->length))
2015 friend bool operator >=(std::u16string_view lhs, OUString
const & rhs) {
2018 lhs.data(), lhs.size(), rhs.pData->buffer, rhs.pData->length))
2051 return (ret < 0 ? ret : ret+fromIndex);
2100 #if defined LIBO_INTERNAL_ONLY
2101 sal_Int32 indexOf(std::u16string_view sv, sal_Int32 fromIndex = 0)
const {
2103 pData->buffer + fromIndex, pData->length - fromIndex, sv.data(), sv.size());
2104 return n < 0 ? n : n + fromIndex;
2110 str.pData->buffer, str.pData->length );
2111 return (ret < 0 ? ret : ret+fromIndex);
2120 template<
typename T >
2126 pData->buffer + fromIndex, pData->length - fromIndex,
2129 return n < 0 ? n : n + fromIndex;
2156 char const * str, sal_Int32 len, sal_Int32 fromIndex = 0)
const
2159 pData->buffer + fromIndex, pData->length - fromIndex, str, len);
2160 return ret < 0 ? ret : ret + fromIndex;
2167 #if SAL_TYPES_SIZEOFLONG == 8
2186 #if defined LIBO_INTERNAL_ONLY
2187 sal_Int32 lastIndexOf(std::u16string_view sv)
const {
2189 pData->buffer, pData->length, sv.data(), sv.size());
2195 str.pData->buffer, str.pData->length );
2216 #if defined LIBO_INTERNAL_ONLY
2217 sal_Int32 lastIndexOf(std::u16string_view sv, sal_Int32 fromIndex)
const {
2224 str.pData->buffer, str.pData->length );
2233 template<
typename T >
2239 pData->buffer, pData->length,
2266 pData->buffer, pData->length, str, len);
2281 return copy(beginIndex, getLength() - beginIndex);
2298 rtl_uString *pNew = NULL;
2303 #if defined LIBO_INTERNAL_ONLY
2316 assert(beginIndex >= 0);
2317 assert(beginIndex <= getLength());
2318 return subView(beginIndex, getLength() - beginIndex);
2335 assert(beginIndex >= 0);
2337 assert(beginIndex <= getLength());
2338 assert(count <= getLength() - beginIndex);
2339 return std::u16string_view(*this).substr(beginIndex, count);
2343 #ifndef LIBO_INTERNAL_ONLY
2352 SAL_WARN_UNUSED_RESULT OUString concat( const OUString & str ) const
2354 rtl_uString* pNew = NULL;
2360 #ifndef LIBO_INTERNAL_ONLY
2363 return rStr1.
concat( rStr2 );
2382 rtl_uString* pNew = NULL;
2402 rtl_uString* pNew = NULL;
2425 #if defined LIBO_INTERNAL_ONLY
2426 [[nodiscard]]
OUString replaceFirst(
2427 std::u16string_view from, std::u16string_view to, sal_Int32 * index =
nullptr)
const
2429 rtl_uString * s =
nullptr;
2432 &s, pData, from.data(), from.size(), to.data(), to.size(),
2433 index ==
nullptr ? &i : index);
2438 OUString const & from,
OUString const & to, sal_Int32 * index = NULL)
const
2440 rtl_uString * s = NULL;
2443 &s, pData, from.pData, to.pData, index == NULL ? &i : index);
2466 #if defined LIBO_INTERNAL_ONLY
2467 template<
typename T> [[nodiscard]]
2469 T & from, std::u16string_view to, sal_Int32 * index =
nullptr)
const
2472 rtl_uString * s =
nullptr;
2477 index ==
nullptr ? &i : index);
2481 template<
typename T >
2483 sal_Int32 * index = NULL)
const
2486 rtl_uString * s = NULL;
2492 index == NULL ? &i : index);
2515 #if defined LIBO_INTERNAL_ONLY
2516 template<
typename T> [[nodiscard]]
2518 std::u16string_view from, T & to, sal_Int32 * index =
nullptr)
const
2521 rtl_uString * s =
nullptr;
2524 &s, pData, from.data(), from.size(),
2530 template<
typename T >
2532 sal_Int32 * index = NULL)
const
2535 rtl_uString * s = NULL;
2538 &s, pData, from.pData,
2541 index == NULL ? &i : index);
2564 template<
typename T1,
typename T2 >
2570 rtl_uString * s = NULL;
2578 index == NULL ? &i : index);
2597 #if defined LIBO_INTERNAL_ONLY
2599 std::u16string_view from, std::u16string_view to, sal_Int32 fromIndex = 0)
const
2601 rtl_uString * s =
nullptr;
2602 rtl_uString_newReplaceAllFromIndexUtf16LUtf16L(
2603 &s, pData, from.data(), from.size(), to.data(), to.size(), fromIndex);
2610 rtl_uString * s = NULL;
2629 #if defined LIBO_INTERNAL_ONLY
2630 template<
typename T> [[nodiscard]]
2632 T & from, std::u16string_view to)
const
2635 rtl_uString * s =
nullptr;
2642 template<
typename T >
2646 rtl_uString * s = NULL;
2668 #if defined LIBO_INTERNAL_ONLY
2669 template<
typename T> [[nodiscard]]
2671 std::u16string_view from, T & to)
const
2674 rtl_uString * s =
nullptr;
2676 &s, pData, from.data(), from.size(),
2682 template<
typename T >
2686 rtl_uString * s = NULL;
2688 &s, pData, from.pData,
2708 template<
typename T1,
typename T2 >
2714 rtl_uString * s = NULL;
2736 rtl_uString* pNew = NULL;
2753 rtl_uString* pNew = NULL;
2773 rtl_uString* pNew = NULL;
2804 rtl_uString * pNew = NULL;
2824 return getToken(count, separator, n);
2848 return pData->buffer[0];
2959 rtl_uString * pNew = NULL;
2962 throw std::bad_alloc();
2995 sal_uInt32 *pInfo = NULL )
2997 rtl_uString * pNew = NULL;
2999 convertFlags, pInfo );
3001 throw std::bad_alloc();
3031 sal_uInt32 nFlags)
const
3034 pData->length, nEncoding, nFlags);
3089 sal_Int32 * indexUtf16, sal_Int32 incrementCodePoints = 1)
const
3092 pData, indexUtf16, incrementCodePoints);
3140 #ifdef LIBO_INTERNAL_ONLY
3142 static OUStringNumber< int > number(
int i, sal_Int16 radix = 10 )
3144 return OUStringNumber< int >( i, radix );
3146 static OUStringNumber< long long > number(
long long ll, sal_Int16 radix = 10 )
3148 return OUStringNumber< long long >( ll, radix );
3150 static OUStringNumber< unsigned long long > number(
unsigned long long ll, sal_Int16 radix = 10 )
3152 return OUStringNumber< unsigned long long >( ll, radix );
3154 static OUStringNumber< unsigned long long > number(
unsigned int i, sal_Int16 radix = 10 )
3156 return number(
static_cast< unsigned long long >( i ), radix );
3158 static OUStringNumber< long long > number(
long i, sal_Int16 radix = 10)
3160 return number(
static_cast< long long >( i ), radix );
3162 static OUStringNumber< unsigned long long > number(
unsigned long i, sal_Int16 radix = 10 )
3164 return number(
static_cast< unsigned long long >( i ), radix );
3166 static OUStringNumber< float > number(
float f )
3168 return OUStringNumber< float >( f );
3170 static OUStringNumber< double > number(
double d )
3172 return OUStringNumber< double >( d );
3194 return number(
static_cast< unsigned long long >( i ), radix );
3200 return number(
static_cast< long long >( i ), radix );
3206 return number(
static_cast< unsigned long long >( i ), radix );
3311 return number( i, radix );
3326 return number( ll, radix );
3374 rtl_uString* pNew = NULL;
3379 #if defined LIBO_INTERNAL_ONLY
3380 static OUString createFromAscii(std::string_view value) {
3381 rtl_uString * p =
nullptr;
3387 #if defined LIBO_INTERNAL_ONLY
3388 operator std::u16string_view()
const {
return {getStr(), sal_uInt32(getLength())}; }
3391 #if defined LIBO_INTERNAL_ONLY
3402 template<
typename T> [[nodiscard]]
static
3403 typename std::enable_if_t<
3404 ToStringHelper<T>::allowOUStringConcat, OUStringConcat<OUStringConcatMarker, T>>
3405 Concat(T
const & value) {
return OUStringConcat<OUStringConcatMarker, T>({}, value); }
3410 template<
typename T, std::
size_t N> [[nodiscard]]
static
3411 typename std::enable_if_t<
3412 ToStringHelper<T[N]>::allowOUStringConcat, OUStringConcat<OUStringConcatMarker, T[N]>>
3413 Concat(T (& value)[N]) {
return OUStringConcat<OUStringConcatMarker, T[N]>({}, value); }
3417 OUString & internalAppend( rtl_uString* pOtherData )
3419 rtl_uString* pNewData = NULL;
3421 if (pNewData == NULL) {
3422 throw std::bad_alloc();
3431 #if defined LIBO_INTERNAL_ONLY
3437 void operator ==(OUString
const &, std::nullptr_t) =
delete;
3438 void operator ==(std::nullptr_t, OUString
const &) =
delete;
3439 void operator !=(OUString
const &, std::nullptr_t) =
delete;
3440 void operator !=(std::nullptr_t, OUString
const &) =
delete;
3443 #if defined LIBO_INTERNAL_ONLY
3450 struct ToStringHelper< OUString >
3452 static std::size_t length(
const OUString& s ) {
return s.getLength(); }
3453 static sal_Unicode* addData(
sal_Unicode* buffer,
const OUString& s ) {
return addDataHelper( buffer, s.getStr(), s.getLength()); }
3454 static const bool allowOStringConcat =
false;
3455 static const bool allowOUStringConcat =
true;
3461 template<std::
size_t N>
3462 struct ToStringHelper< OUStringLiteral<N> >
3464 static std::size_t length(
const OUStringLiteral<N>& str ) {
return str.getLength(); }
3465 static sal_Unicode* addData(
sal_Unicode* buffer,
const OUStringLiteral<N>& str ) {
return addDataHelper( buffer, str.getStr(), str.getLength() ); }
3466 static const bool allowOStringConcat =
false;
3467 static const bool allowOUStringConcat =
true;
3473 template<
typename charT,
typename traits,
typename T1,
typename T2 >
3474 inline std::basic_ostream<charT, traits> &
operator <<(
3475 std::basic_ostream<charT, traits> & stream, OUStringConcat< T1, T2 >&& concat)
3477 return stream << OUString( std::move(concat) );
3500 {
return static_cast<size_t>(rString.
hashCode()); }
3563 template<
typename charT,
typename traits >
3564 inline std::basic_ostream<charT, traits> &
operator <<(
3565 std::basic_ostream<charT, traits> & stream, OUString
const & rString)
3575 #ifdef RTL_STRING_UNITTEST
3578 typedef rtlunittest::OUString OUString;
3585 #if defined LIBO_INTERNAL_ONLY && !defined RTL_STRING_UNITTEST
3586 using ::rtl::OUString;
3587 using ::rtl::OUStringHash;
3590 using ::rtl::OUStringLiteral;
3591 using ::rtl::OUStringChar;
3600 #if defined LIBO_INTERNAL_ONLY
3607 {
return std::size_t(s.
hashCode()); }
#define SAL_DEPRECATED(message)
Use as follows: SAL_DEPRECATED("Don't use, it's evil.") void doit(int nPara);.
Definition: types.h:445
__sal_NoAcquire
Definition: types.h:349
@ SAL_NO_ACQUIRE
definition of a no acquire enum for ctors
Definition: types.h:352
unsigned char sal_Bool
Definition: types.h:34
sal_uInt16 sal_Unicode
Definition: types.h:119
#define SAL_WARN_UNUSED_RESULT
Use this as markup for functions and methods whose return value must be checked.
Definition: types.h:280
#define SAL_WARN_UNUSED
Annotate classes where a compiler should warn if an instance is unused.
Definition: types.h:558
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.
#define OUSTRING_TO_OSTRING_CVTFLAGS
Definition: string.h:1350
#define RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR
Definition: textcvt.h:147
#define RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR
Definition: textcvt.h:71
#define RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR
Definition: textcvt.h:68
#define RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR
Definition: textcvt.h:64
#define RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR
Definition: textcvt.h:141
#define RTL_TEXTENCODING_UTF8
Definition: textenc.h:113
sal_uInt16 rtl_TextEncoding
The various supported text encodings.
Definition: textenc.h:33
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.
SAL_DLLPUBLIC void rtl_uString_assign(rtl_uString **str, rtl_uString *rightValue) SAL_THROW_EXTERN_C()
Assign a new value to a string.
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.
SAL_DLLPUBLIC float rtl_ustr_toFloat(const sal_Unicode *str) SAL_THROW_EXTERN_C()
Interpret a string as a float.
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.
SAL_DLLPUBLIC void rtl_uString_new(rtl_uString **newStr) SAL_THROW_EXTERN_C()
Allocate a new string containing no characters.
#define OSTRING_TO_OUSTRING_CVTFLAGS
Definition: ustring.h:2180
#define RTL_USTR_MAX_VALUEOFFLOAT
Definition: ustring.h:1022
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.
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.
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.
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.
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.
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.
#define RTL_USTR_MAX_VALUEOFDOUBLE
Definition: ustring.h:1041
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.
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.
SAL_DLLPUBLIC void rtl_uString_newFromLiteral(rtl_uString **newStr, const char *value, sal_Int32 len, sal_Int32 allocExtra) SAL_THROW_EXTERN_C()
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.
SAL_DLLPUBLIC sal_Int32 rtl_ustr_valueOfBoolean(sal_Unicode *str, sal_Bool b) SAL_THROW_EXTERN_C()
Create the string representation of a boolean.
SAL_DLLPUBLIC double rtl_ustr_toDouble(const sal_Unicode *str) SAL_THROW_EXTERN_C()
Interpret a string as a double.
SAL_DLLPUBLIC sal_Int32 rtl_ustr_valueOfFloat(sal_Unicode *str, float f) SAL_THROW_EXTERN_C()
Create the string representation of a float.
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.
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.
SAL_DLLPUBLIC sal_Int32 rtl_ustr_valueOfDouble(sal_Unicode *str, double d) SAL_THROW_EXTERN_C()
Create the string representation of a double.
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.
#define RTL_USTR_MAX_VALUEOFINT64
Definition: ustring.h:980
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.
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.
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.
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.
SAL_DLLPUBLIC void rtl_uString_acquire(rtl_uString *str) SAL_THROW_EXTERN_C() SAL_HOT
Increment the reference count of a string.
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.
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.
#define RTL_USTR_MAX_VALUEOFUINT64
Definition: ustring.h:1003
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.
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.
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.
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.
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.
SAL_DLLPUBLIC void rtl_uString_release(rtl_uString *str) SAL_THROW_EXTERN_C() SAL_HOT
Decrement the reference count of a string.
SAL_DLLPUBLIC sal_Int32 rtl_ustr_getLength(const sal_Unicode *str) SAL_THROW_EXTERN_C()
Return the length of a string.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
SAL_DLLPUBLIC void rtl_uString_intern(rtl_uString **newStr, rtl_uString *str) SAL_THROW_EXTERN_C()
Return a canonical representation for a string.
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.
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.
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.
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.
#define RTL_USTR_MAX_VALUEOFBOOLEAN
Definition: ustring.h:915
SAL_DLLPUBLIC sal_Int32 rtl_ustr_toInt32(const sal_Unicode *str, sal_Int16 radix) SAL_THROW_EXTERN_C()
Interpret a string as an integer.
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.
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.
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.
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.
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.
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.
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.
SAL_DLLPUBLIC sal_Bool rtl_ustr_toBoolean(const sal_Unicode *str) SAL_THROW_EXTERN_C()
Interpret a string as a boolean.
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.
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.
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.
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.
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.
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.
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.
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.
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.
#define RTL_USTR_MAX_VALUEOFINT32
Definition: ustring.h:957
sal_Int32 oslInterlockedCount
Definition: interlck.h:40
bool operator<(const TTimeValue &rTimeA, const TTimeValue &rTimeB)
Definition: timer.hxx:90
bool operator>(const TTimeValue &rTimeA, const TTimeValue &rTimeB)
Definition: timer.hxx:100
bool operator==(const TTimeValue &rTimeA, const TTimeValue &rTimeB)
Definition: timer.hxx:110
Definition: bootstrap.hxx:30
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:3522
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:3546
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:2095
bool operator!=(const Any &rAny, const C &value)
Template inequality operator: compares set value of left side any to right side value.
Definition: Any.hxx:664
This String class provide base functionality for C++ like 8-Bit character array handling.
Definition: string.hxx:171
const char * getStr() const SAL_RETURNS_NONNULL
Returns a pointer to the characters of this string.
Definition: string.hxx:551
sal_Int32 getLength() const
Returns the length of this string.
Definition: string.hxx:525
Definition: stringutils.hxx:131
Definition: stringutils.hxx:134
Definition: stringutils.hxx:186
This String class provides base functionality for C++ like Unicode character array handling.
Definition: ustring.hxx:161
static OUString number(int i, sal_Int16 radix=10)
Returns the string representation of the integer argument.
Definition: ustring.hxx:3185
OUString intern() const
Return a canonical representation for a string.
Definition: ustring.hxx:2957
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:2121
SAL_WARN_UNUSED_RESULT libreoffice_internal::ConstCharArrayDetector< T1, typename libreoffice_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:2566
bool endsWith(OUString const &str, OUString *rest=NULL) const
Check whether this string ends with a given substring.
Definition: ustring.hxx:1496
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:1637
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:2734
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:2643
bool equalsIgnoreAsciiCase(const OUString &str) const
Perform an ASCII lowercase comparison of two strings.
Definition: ustring.hxx:914
bool endsWithAsciiL(char const *asciiStr, sal_Int32 asciiStrLength) const
Check whether this string ends with a given ASCII string.
Definition: ustring.hxx:1546
OUString(const OUString &str)
New string from OUString.
Definition: ustring.hxx:181
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:3088
static OUString fromUtf8(const OString &rSource)
Convert an OString to an OUString, assuming that the OString is UTF-8-encoded.
Definition: ustring.hxx:3104
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:1010
sal_Int32 toInt32(sal_Int16 radix=10) const
Returns the int32 value from this string.
Definition: ustring.hxx:2861
void clear()
Clears the string, i.e, makes a zero-character string.
Definition: ustring.hxx:739
bool equalsIgnoreAsciiCaseAsciiL(const char *asciiStr, sal_Int32 asciiStrLength) const
Perform an ASCII lowercase comparison of two strings.
Definition: ustring.hxx:1266
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:3217
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:2155
~OUString()
Release the string data.
Definition: ustring.hxx:483
sal_Int32 compareTo(const OUString &str, sal_Int32 maxLength) const
Compares two strings with a maximum count of characters.
Definition: ustring.hxx:824
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:2263
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:2048
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:2683
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:3210
bool matchAsciiL(const char *asciiStr, sal_Int32 asciiStrLength, sal_Int32 fromIndex=0) const
Match against a substring appearing in this string.
Definition: ustring.hxx:1295
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:2607
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:543
float toFloat() const
Returns the float value from this string.
Definition: ustring.hxx:2923
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:3204
SAL_WARN_UNUSED_RESULT libreoffice_internal::ConstCharArrayDetector< T1, typename libreoffice_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:2710
static OUString createFromAscii(const char *value)
Returns an OUString copied without conversion from an ASCII character string.
Definition: ustring.hxx:3372
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:2482
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:2400
sal_Int32 hashCode() const
Returns a hashcode for this string.
Definition: ustring.hxx:2030
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:861
friend libreoffice_internal::ConstCharArrayDetector< T, bool >::Type operator==(T &literal, const OUString &rString)
Compare string to an ASCII string literal.
Definition: ustring.hxx:1742
friend libreoffice_internal::ConstCharArrayDetector< T, bool >::Type operator==(const OUString &rString, T &literal)
Compare string to an ASCII string literal.
Definition: ustring.hxx:1726
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:3198
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:959
const sal_Unicode * getStr() const SAL_RETURNS_NONNULL
Returns a pointer to the Unicode character buffer for this string.
Definition: ustring.hxx:774
sal_uInt64 toUInt64(sal_Int16 radix=10) const
Returns the uint64 value from this string.
Definition: ustring.hxx:2910
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:1333
OUString & operator+=(const OUString &str)
Append a string to this string.
Definition: ustring.hxx:623
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:1453
OString toUtf8() const
Convert this string to an OString, assuming that the string can be UTF-8-encoded successfully.
Definition: ustring.hxx:3127
sal_Int32 reverseCompareToAsciiL(const char *asciiStr, sal_Int32 asciiStrLength) const
Compares two strings in reverse order.
Definition: ustring.hxx:1147
bool equalsAsciiL(const char *asciiStr, sal_Int32 asciiStrLength) const
Perform a comparison of two strings.
Definition: ustring.hxx:1191
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:3192
bool convertToString(OString *pTarget, rtl_TextEncoding nEncoding, sal_uInt32 nFlags) const
Converts to an OString, signalling failure.
Definition: ustring.hxx:3030
OUString & operator=(const OUString &str)
Assign a new string.
Definition: ustring.hxx:507
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:1386
OUString(rtl_uString *str)
New string from OUString data.
Definition: ustring.hxx:207
OUString(const sal_Unicode *value, sal_Int32 length)
New string from a Unicode character buffer array.
Definition: ustring.hxx:286
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:1585
sal_Int32 compareTo(const OUString &str) const
Compares two strings.
Definition: ustring.hxx:803
friend libreoffice_internal::ConstCharArrayDetector< T, bool >::Type operator!=(const OUString &rString, T &literal)
Compare string to an ASCII string literal.
Definition: ustring.hxx:1758
bool startsWith(OUString const &str, OUString *rest=NULL) const
Check whether this string starts with a given substring.
Definition: ustring.hxx:1371
sal_Int32 lastIndexOf(sal_Unicode ch) const
Returns the index within this string of the last occurrence of the specified character,...
Definition: ustring.hxx:2063
sal_Int32 compareToIgnoreAsciiCaseAscii(const char *asciiStr) const
Compares two ASCII strings ignoring case.
Definition: ustring.hxx:1241
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:2531
OUString(sal_Unicode value)
New string from a single Unicode character.
Definition: ustring.hxx:229
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:2437
sal_Int64 toInt64(sal_Int16 radix=10) const
Returns the int64 value from this string.
Definition: ustring.hxx:2893
sal_uInt32 toUInt32(sal_Int16 radix=10) const
Returns the uint32 value from this string.
Definition: ustring.hxx:2878
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:1435
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:2221
double toDouble() const
Returns the double value from this string.
Definition: ustring.hxx:2936
bool equalsAscii(const char *asciiStr) const
Perform a comparison of two strings.
Definition: ustring.hxx:1168
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:1064
OUString getToken(sal_Int32 token, sal_Unicode cTok, sal_Int32 &index) const
Returns a token in the string.
Definition: ustring.hxx:2802
sal_Int32 getLength() const
Returns the length of this string.
Definition: ustring.hxx:752
bool equalsIgnoreAsciiCaseAscii(const char *asciiStr) const
Perform an ASCII lowercase comparison of two strings.
Definition: ustring.hxx:1218
OUString()
New string containing no characters.
Definition: ustring.hxx:170
static OUString const & unacquired(rtl_uString *const *ppHandle)
Provides an OUString const & passing a storage pointer of an rtl_uString * handle.
Definition: ustring.hxx:499
OUString(const sal_Unicode *value)
New string from a Unicode character buffer array.
Definition: ustring.hxx:270
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:404
static OUString number(float f)
Returns the string representation of the float argument.
Definition: ustring.hxx:3232
bool isEmpty() const
Checks if a string is empty.
Definition: ustring.hxx:762
sal_Int32 compareToIgnoreAsciiCase(const OUString &str) const
Perform an ASCII lowercase comparison of two strings.
Definition: ustring.hxx:946
OUString(sal_uInt32 const *codePoints, sal_Int32 codePointCount)
Create a new string from an array of Unicode code points.
Definition: ustring.hxx:431
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:1513
sal_Unicode toChar() const
Returns the first character from this string.
Definition: ustring.hxx:2846
OUString getToken(sal_Int32 count, sal_Unicode separator) const
Returns a token from the string.
Definition: ustring.hxx:2822
static OUString boolean(bool b)
Returns the string representation of the boolean argument.
Definition: ustring.hxx:3281
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:2234
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:2296
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:1603
OUString(rtl_uString *str, __sal_NoAcquire)
New OUString from OUString data without acquiring it.
Definition: ustring.hxx:221
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:2080
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:2771
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:2751
SAL_WARN_UNUSED_RESULT OUString concat(const OUString &str) const
Concatenates the specified string to the end of this string.
Definition: ustring.hxx:2352
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:2380
bool match(const OUString &str, sal_Int32 fromIndex=0) const
Match against a substring appearing in this string.
Definition: ustring.hxx:997
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:1050
sal_Int32 compareToAscii(const char *asciiStr) const
Compares two strings.
Definition: ustring.hxx:1093
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:308
sal_Int32 reverseCompareTo(const OUString &str) const
Compares two strings in reverse order.
Definition: ustring.hxx:848
static OUString number(double d)
Returns the string representation of the double argument.
Definition: ustring.hxx:3247
friend OUString operator+(const OUString &rStr1, const OUString &rStr2)
Definition: ustring.hxx:2361
SAL_WARN_UNUSED_RESULT OUString copy(sal_Int32 beginIndex) const
Returns a new string that is a substring of this string.
Definition: ustring.hxx:2279
friend libreoffice_internal::ConstCharArrayDetector< T, bool >::Type operator!=(T &literal, const OUString &rString)
Compare string to an ASCII string literal.
Definition: ustring.hxx:1774
bool equals(const OUString &str) const
Perform a comparison of two strings.
Definition: ustring.hxx:882
sal_Int32 lastIndexOf(const OUString &str) const
Returns the index within this string of the last occurrence of the specified substring,...
Definition: ustring.hxx:2192
bool toBoolean() const
Returns the Boolean value from this string.
Definition: ustring.hxx:2835
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:2107
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:2992
A helper to use OUStrings with hash maps.
Definition: ustring.hxx:3489
size_t operator()(const OUString &rString) const
Compute a hash code for a string.
Definition: ustring.hxx:3499