20 #ifndef INCLUDED_RTL_USTRING_HXX
21 #define INCLUDED_RTL_USTRING_HXX
37 #ifdef RTL_FAST_STRING
46 #ifdef RTL_STRING_UNITTEST
47 #define rtl rtlunittest
53 #ifdef RTL_STRING_UNITTEST
182 template<
typename T >
191 #ifdef RTL_STRING_UNITTEST
192 rtl_string_unittest_const_literal =
true;
196 #ifdef RTL_STRING_UNITTEST
201 template<
typename T >
206 rtl_string_unittest_invalid_conversion =
true;
212 template<
typename T >
213 OUString(
const T&,
typename internal::ExceptCharArrayDetector< T >::Type = internal::Dummy() )
217 rtl_string_unittest_invalid_conversion =
true;
242 throw std::bad_alloc();
263 sal_uInt32
const * codePoints, sal_Int32 codePointCount):
268 throw std::bad_alloc();
272 #ifdef RTL_FAST_STRING
277 template<
typename T1,
typename T2 >
278 OUString(
const OUStringConcat< T1, T2 >& c )
280 const sal_Int32 l = c.length();
285 pData->length = end - pData->buffer;
312 {
return *
reinterpret_cast< OUString const *
>( ppHandle ); }
337 template<
typename T >
359 #ifdef RTL_FAST_STRING
364 template<
typename T1,
typename T2 >
365 OUString& operator+=(
const OUStringConcat< T1, T2 >& c )
367 const int l = c.length();
371 sal_Unicode* end = c.addData( pData->buffer + pData->length );
373 pData->length = end - pData->buffer;
398 return pData->length == 0;
421 assert(index >= 0 && static_cast<sal_uInt32>(index) < static_cast<sal_uInt32>(getLength()));
422 return getStr()[index];
440 str.pData->buffer, str.pData->length );
461 str.pData->buffer, str.pData->length, maxLength );
479 str.pData->buffer, str.pData->length );
487 template<
typename T >
508 if ( pData->length != str.pData->length )
510 if ( pData == str.pData )
513 str.pData->buffer, str.pData->length ) == 0;
532 if ( pData->length != str.pData->length )
534 if ( pData == str.pData )
537 str.pData->buffer, str.pData->length ) == 0;
558 str.pData->buffer, str.pData->length );
567 template<
typename T >
595 str.pData->buffer, str.pData->length, str.pData->length ) == 0;
603 template<
typename T >
632 str.pData->buffer, str.pData->length,
633 str.pData->length ) == 0;
641 template<
typename T >
693 "replace s1.compareToAscii(s2, strlen(s2)) == 0 with s1.startsWith(s2)")
697 asciiStr, maxLength );
722 asciiStr, asciiStrLength );
765 if ( pData->length != asciiStrLength )
769 pData->buffer, asciiStr, asciiStrLength );
840 if ( pData->length != asciiStrLength )
870 asciiStr, asciiStrLength ) == 0;
877 #if SAL_TYPES_SIZEOFLONG == 8
908 asciiStr, asciiStrLength ) == 0;
915 #if SAL_TYPES_SIZEOFLONG == 8
935 bool b = match(str, 0);
936 if (b && rest != 0) {
947 template<
typename T >
949 T & literal,
OUString * rest = 0)
const
955 if (b && rest != 0) {
984 bool b = matchIgnoreAsciiCase(str, 0);
985 if (b && rest != 0) {
996 template<
typename T >
1006 if (b && rest != 0) {
1028 && match(str, getLength() - str.
getLength());
1029 if (b && rest != 0) {
1030 *rest = copy(0, getLength() - str.
getLength());
1040 template<
typename T >
1049 if (b && rest != 0) {
1072 return asciiStrLength <= pData->length
1074 pData->buffer + pData->length - asciiStrLength, asciiStr,
1101 && matchIgnoreAsciiCase(str, getLength() - str.
getLength());
1102 if (b && rest != 0) {
1103 *rest = copy(0, getLength() - str.
getLength());
1113 template<
typename T >
1124 if (b && rest != 0) {
1144 char const * asciiStr, sal_Int32 asciiStrLength)
const
1146 return asciiStrLength <= pData->length
1148 pData->buffer + pData->length - asciiStrLength,
1149 asciiStrLength, asciiStr, asciiStrLength)
1154 {
return rStr1.equals(rStr2); }
1156 {
return rStr1.compareTo( pStr2 ) == 0; }
1168 {
return rStr1.compareTo( rStr2 ) < 0; }
1170 {
return rStr1.compareTo( rStr2 ) > 0; }
1172 {
return rStr1.compareTo( rStr2 ) <= 0; }
1174 {
return rStr1.compareTo( rStr2 ) >= 0; }
1183 template<
typename T >
1196 template<
typename T >
1209 template<
typename T >
1222 template<
typename T >
1257 return (ret < 0 ? ret : ret+fromIndex);
1309 str.pData->buffer, str.pData->length );
1310 return (ret < 0 ? ret : ret+fromIndex);
1318 template<
typename T >
1323 pData->buffer + fromIndex, pData->length - fromIndex, literal,
1325 return ret < 0 ? ret : ret + fromIndex;
1352 char const * str, sal_Int32 len, sal_Int32 fromIndex = 0) const
1356 pData->buffer + fromIndex, pData->length - fromIndex, str, len);
1357 return ret < 0 ? ret : ret + fromIndex;
1364 #if SAL_TYPES_SIZEOFLONG == 8
1386 str.pData->buffer, str.pData->length );
1409 str.pData->buffer, str.pData->length );
1417 template<
typename T >
1448 pData->buffer, pData->length, str, len);
1463 rtl_uString *pNew = 0;
1482 rtl_uString *pNew = 0;
1497 rtl_uString* pNew = 0;
1502 #ifndef RTL_FAST_STRING
1505 return rStr1.concat( rStr2 );
1524 rtl_uString* pNew = 0;
1544 rtl_uString* pNew = 0;
1570 rtl_uString * s = 0;
1573 &s, pData, from.pData, to.pData, index == 0 ? &i : index);
1595 template<
typename T >
1597 sal_Int32 * index = 0)
const
1599 rtl_uString * s = 0;
1625 template<
typename T1,
typename T2 >
1629 rtl_uString * s = 0;
1657 rtl_uString * s = 0;
1675 template<
typename T >
1678 rtl_uString * s = 0;
1697 template<
typename T1,
typename T2 >
1701 rtl_uString * s = 0;
1722 rtl_uString* pNew = 0;
1739 rtl_uString* pNew = 0;
1757 rtl_uString* pNew = 0;
1788 rtl_uString * pNew = 0;
1808 return getToken(count, separator, n);
1832 return pData->buffer[0];
1943 rtl_uString * pNew = 0;
1946 throw std::bad_alloc();
1979 sal_uInt32 *pInfo = NULL )
1981 rtl_uString * pNew = 0;
1983 convertFlags, pInfo );
1985 throw std::bad_alloc();
2015 sal_uInt32 nFlags)
const
2018 pData->length, nEncoding, nFlags);
2073 sal_Int32 * indexUtf16, sal_Int32 incrementCodePoints = 1)
const
2076 pData, indexUtf16, incrementCodePoints);
2092 rtl_uString* pNewData = 0;
2100 return number( static_cast< unsigned long long >( i ), radix );
2106 return number( static_cast< long long >( i ), radix );
2112 return number( static_cast< unsigned long long >( i ), radix );
2119 rtl_uString* pNewData = 0;
2128 rtl_uString* pNewData = 0;
2145 rtl_uString* pNewData = 0;
2162 rtl_uString* pNewData = 0;
2197 rtl_uString* pNewData = 0;
2226 return number( i, radix );
2241 return number( ll, radix );
2289 rtl_uString* pNew = 0;
2297 #ifdef RTL_FAST_STRING
2309 OUStringLiteral(
const char (&str)[ N ] ) : size( N - 1 ), data( str ) { assert( strlen( str ) == N - 1 ); }
2318 struct ToStringHelper< OUString >
2320 static int length(
const OUString& s ) {
return s.getLength(); }
2321 static sal_Unicode* addData(
sal_Unicode* buffer,
const OUString& s ) {
return addDataHelper( buffer, s.getStr(), s.getLength()); }
2322 static const bool allowOStringConcat =
false;
2323 static const bool allowOUStringConcat =
true;
2330 struct ToStringHelper< OUStringLiteral >
2332 static int length(
const OUStringLiteral& str ) {
return str.size; }
2333 static sal_Unicode* addData(
sal_Unicode* buffer,
const OUStringLiteral& str ) {
return addDataLiteral( buffer, str.data, str.size ); }
2334 static const bool allowOStringConcat =
false;
2335 static const bool allowOUStringConcat =
true;
2341 template<
typename charT,
typename traits,
typename T1,
typename T2 >
2342 inline std::basic_ostream<charT, traits> &
operator <<(
2343 std::basic_ostream<charT, traits> & stream,
const OUStringConcat< T1, T2 >& concat)
2345 return stream << OUString( concat );
2350 typedef OUString OUStringLiteral;
2371 {
return (
size_t)rString.
hashCode(); }
2434 template<
typename charT,
typename traits >
2436 std::basic_ostream<charT, traits> & stream,
OUString const &
string)
2446 #ifdef RTL_STRING_UNITTEST
2449 typedef rtlunittest::OUString OUString;
2458 using ::rtl::OUString;
2459 using ::rtl::OUStringHash;
2462 using ::rtl::OUStringLiteral;
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 void rtl_uString_release(rtl_uString *str) SAL_THROW_EXTERN_C()
Decrement the reference count of a string.
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_Int32 compareTo(const OUString &str, sal_Int32 maxLength) const SAL_THROW(())
Compares two strings with a maximum count of characters.
Definition: ustring.hxx:458
SAL_DLLPUBLIC void rtl_uString_intern(rtl_uString **newStr, rtl_uString *str) SAL_THROW_EXTERN_C()
Return a canonical representation for a string.
internal::ConstCharArrayDetector< T, bool >::Type match(T &literal, sal_Int32 fromIndex=0) const SAL_THROW(())
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: ustring.hxx:604
#define SAL_DEPRECATED(message)
Use as follows: SAL_DEPRECATED("Dont use, its evil.") void doit(int nPara);.
Definition: types.h:491
bool operator!=(const Any &rAny, const C &value) SAL_THROW(())
Template unequality operator: compares set value of left side any to right side value.
Definition: Any.hxx:582
sal_uInt64 toUInt64(sal_Int16 radix=10) const SAL_THROW(())
Returns the uint64 value from this string.
Definition: ustring.hxx:1894
SAL_DLLPUBLIC void rtl_uString_new(rtl_uString **newStr) SAL_THROW_EXTERN_C()
Allocate a new string containing no characters.
float toFloat() const SAL_THROW(())
Returns the float value from this string.
Definition: ustring.hxx:1907
OUString(const sal_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:235
OUString(const OUString &str) SAL_THROW(())
New string from OUString.
Definition: ustring.hxx:103
size_t operator()(const OUString &rString) const
Compute a hash code for a string.
Definition: ustring.hxx:2370
SAL_DLLPUBLIC sal_Bool rtl_ustr_asciil_reverseEquals_WithLength(const sal_Unicode *first, const sal_Char *second, sal_Int32 len) SAL_THROW_EXTERN_C()
Compare two strings from back to front for equality.
OUString(const sal_Unicode *value, sal_Int32 length) SAL_THROW(())
New string from a Unicode character buffer array.
Definition: ustring.hxx:161
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 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.
friend internal::ConstCharArrayDetector< T, bool >::Type operator!=(T &literal, const OUString &string)
Compare string to an ASCII string literal.
Definition: ustring.hxx:1223
const sal_Char * getStr() const SAL_THROW(())
Returns a pointer to the characters of this string.
Definition: string.hxx:353
sal_Int32 indexOf(const OUString &str, sal_Int32 fromIndex=0) const SAL_THROW(())
Returns the index within this string of the first occurrence of the specified substring, starting at the specified index.
Definition: ustring.hxx:1306
sal_Int32 lastIndexOf(const OUString &str) const SAL_THROW(())
Returns the index within this string of the last occurrence of the specified substring, searching backward starting at the end.
Definition: ustring.hxx:1383
SAL_DLLPUBLIC sal_Int32 rtl_ustr_ascii_compare_WithLength(const sal_Unicode *first, sal_Int32 firstLen, const sal_Char *second) SAL_THROW_EXTERN_C()
Compare two strings.
unsigned char sal_Bool
Definition: types.h:46
bool operator<(const TTimeValue &rTimeA, const TTimeValue &rTimeB)
Definition: timer.hxx:98
SAL_DLLPUBLIC sal_Int32 rtl_ustr_valueOfBoolean(sal_Unicode *str, sal_Bool b) SAL_THROW_EXTERN_C()
Create the string representation of a boolean.
friend OUString operator+(const OUString &rStr1, const OUString &rStr2) SAL_THROW(())
Definition: ustring.hxx:1503
SAL_DLLPUBLIC sal_Int32 rtl_ustr_ascii_shortenedCompareIgnoreAsciiCase_WithLength(const sal_Unicode *first, sal_Int32 firstLen, const sal_Char *second, sal_Int32 shortenedLen) SAL_THROW_EXTERN_C()
Compare two strings with a maximum count of characters, ignoring the case of ASCII characters...
Definition: bootstrap.hxx:24
static OUString number(int i, sal_Int16 radix=10)
Returns the string representation of the integer argument.
Definition: ustring.hxx:2089
Definition: stringutils.hxx:67
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.
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.
internal::ConstCharArrayDetector< T, bool >::Type endsWithIgnoreAsciiCase(T &literal, OUString *rest=0) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: ustring.hxx:1115
definition of a no acquire enum for ctors
Definition: types.h:388
#define RTL_USTR_MAX_VALUEOFINT32
Definition: ustring.h:957
OUString(sal_uInt32 const *codePoints, sal_Int32 codePointCount)
Create a new string from an array of Unicode code points.
Definition: ustring.hxx:262
bool startsWith(OUString const &str, OUString *rest=0) const
Check whether this string starts with a given substring.
Definition: ustring.hxx:934
bool endsWithAsciiL(char const *asciiStr, sal_Int32 asciiStrLength) const
Check whether this string ends with a given ASCII string.
Definition: ustring.hxx:1069
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 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_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 double rtl_ustr_toDouble(const sal_Unicode *str) SAL_THROW_EXTERN_C()
Interpret a string as a double.
#define OSTRING_TO_OUSTRING_CVTFLAGS
Definition: ustring.h:1817
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:2104
SAL_WARN_UNUSED_RESULT OUString trim() const SAL_THROW(())
Returns a new string resulting from removing white space from both ends of the string.
Definition: ustring.hxx:1755
SAL_DLLPUBLIC float rtl_ustr_toFloat(const sal_Unicode *str) SAL_THROW_EXTERN_C()
Interpret a string as a float.
sal_Int32 reverseCompareToAsciiL(const sal_Char *asciiStr, sal_Int32 asciiStrLength) const SAL_THROW(())
Compares two strings in reverse order.
Definition: ustring.hxx:719
OUString & operator+=(const OUString &str) SAL_THROW(())
Append a string to this string.
Definition: ustring.hxx:353
OUString() SAL_THROW(())
New string containing no characters.
Definition: ustring.hxx:92
sal_Int32 hashCode() const SAL_THROW(())
Returns a hashcode for this string.
Definition: ustring.hxx:1236
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:338
friend internal::ConstCharArrayDetector< T, bool >::Type operator!=(const OUString &string, T &literal)
Compare string to an ASCII string literal.
Definition: ustring.hxx:1210
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.
A helper to use OUStrings with hash maps.
Definition: ustring.hxx:2359
static OUString createFromAscii(const sal_Char *value) SAL_THROW(())
Returns a OUString copied without conversion from an ASCII character string.
Definition: ustring.hxx:2287
SAL_WARN_UNUSED_RESULT 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:1676
const sal_Unicode * getStr() const SAL_THROW(())
Returns a pointer to the Unicode character buffer for this string.
Definition: ustring.hxx:408
OUString(rtl_uString *str) SAL_THROW(())
New string from OUString data.
Definition: ustring.hxx:114
__sal_NoAcquire
Definition: types.h:384
double toDouble() const SAL_THROW(())
Returns the double value from this string.
Definition: ustring.hxx:1920
SAL_DLLPUBLIC void rtl_uString_assign(rtl_uString **str, rtl_uString *rightValue) SAL_THROW_EXTERN_C()
Assign a new value to a string.
bool endsWithIgnoreAsciiCase(OUString const &str, OUString *rest=0) const
Check whether this string ends with a given string, ignoring the case of ASCII letters.
Definition: ustring.hxx:1098
OUString(sal_Unicode value) SAL_THROW(())
New string from a single Unicode character.
Definition: ustring.hxx:136
bool toBoolean() const SAL_THROW(())
Returns the Boolean value from this string.
Definition: ustring.hxx:1819
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...
internal::ConstCharArrayDetector< T, bool >::Type startsWithIgnoreAsciiCase(T &literal, OUString *rest=0) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: ustring.hxx:998
bool match(const OUString &str, sal_Int32 fromIndex=0) const SAL_THROW(())
Match against a substring appearing in this string.
Definition: ustring.hxx:592
sal_Int32 lastIndexOf(sal_Unicode ch, sal_Int32 fromIndex) const SAL_THROW(())
Returns the index within this string of the last occurrence of the specified character, searching backward starting before the specified index.
Definition: ustring.hxx:1286
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.
friend internal::ConstCharArrayDetector< T, bool >::Type operator==(const OUString &string, T &literal)
Compare string to an ASCII string literal.
Definition: ustring.hxx:1184
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.
bool startsWithIgnoreAsciiCase(OUString const &str, OUString *rest=0) const
Check whether this string starts with a given string, ignoring the case of ASCII letters.
Definition: ustring.hxx:981
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_WARN_UNUSED_RESULT OUString copy(sal_Int32 beginIndex) const SAL_THROW(())
Returns a new string that is a substring of this string.
Definition: ustring.hxx:1461
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:2072
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.
static OUString const & unacquired(rtl_uString *const *ppHandle)
Provides an OUString const & passing a storage pointer of an rtl_uString * handle.
Definition: ustring.hxx:311
SAL_WARN_UNUSED_RESULT OUString toAsciiUpperCase() const SAL_THROW(())
Converts from this string all ASCII lowercase characters (97-122) to ASCII uppercase characters (65-9...
Definition: ustring.hxx:1737
sal_Int64 toInt64(sal_Int16 radix=10) const SAL_THROW(())
Returns the int64 value from this string.
Definition: ustring.hxx:1877
#define SAL_WARN_UNUSED_RESULT
Use this as markup for functions and methods whose return value must be checked.
Definition: types.h:307
SAL_WARN_UNUSED_RESULT OUString copy(sal_Int32 beginIndex, sal_Int32 count) const SAL_THROW(())
Returns a new string that is a substring of this string.
Definition: ustring.hxx:1480
char sal_Char
A legacy synonym for char.
Definition: types.h:128
SAL_WARN_UNUSED_RESULT internal::ConstCharArrayDetector< T, OUString >::Type replaceFirst(T &from, OUString const &to, sal_Int32 *index=0) const
Returns a new string resulting from replacing the first occurrence of a given substring with another ...
Definition: ustring.hxx:1596
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:2393
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 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 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.
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 void rtl_string2UString(rtl_uString **newStr, const sal_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.
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:2417
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:2098
static OUString intern(const sal_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:1976
bool equalsIgnoreAsciiCaseAscii(const sal_Char *asciiStr) const SAL_THROW(())
Perform a ASCII lowercase comparison of two strings.
Definition: ustring.hxx:790
OUString & operator=(const OUString &str) SAL_THROW(())
Assign a new string.
Definition: ustring.hxx:319
SAL_DLLPUBLIC sal_Bool rtl_ustr_toBoolean(const sal_Unicode *str) SAL_THROW_EXTERN_C()
Interpret a string as a boolean.
sal_Int32 lastIndexOf(sal_Unicode ch) const SAL_THROW(())
Returns the index within this string of the last occurrence of the specified character, searching backward starting at the end.
Definition: ustring.hxx:1269
bool operator==(const TTimeValue &rTimeA, const TTimeValue &rTimeB)
Definition: timer.hxx:118
sal_Int32 toInt32(sal_Int16 radix=10) const SAL_THROW(())
Returns the int32 value from this string.
Definition: ustring.hxx:1845
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...
bool matchIgnoreAsciiCaseAsciiL(const sal_Char *asciiStr, sal_Int32 asciiStrLength, sal_Int32 fromIndex=0) const SAL_THROW(())
Match against a substring appearing in this string, ignoring the case of ASCII letters.
Definition: ustring.hxx:905
sal_Int32 getLength() const SAL_THROW(())
Returns the length of this string.
Definition: string.hxx:327
OUString getToken(sal_Int32 count, sal_Unicode separator) const
Returns a token from the string.
Definition: ustring.hxx:1806
#define RTL_STR_MAX_VALUEOFUINT64
Definition: string.h:673
#define RTL_TEXTENCODING_UTF8
Definition: textenc.h:121
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.
internal::ConstCharArrayDetector< T, bool >::Type matchIgnoreAsciiCase(T &literal, sal_Int32 fromIndex=0) const SAL_THROW(())
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: ustring.hxx:642
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_WARN_UNUSED_RESULT OUString concat(const OUString &str) const SAL_THROW(())
Concatenates the specified string to the end of this string.
Definition: ustring.hxx:1495
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:2110
This String class provide base functionality for C++ like 8-Bit character array handling.
Definition: string.hxx:89
OUString(T &literal, typename internal::ConstCharArrayDetector< T, internal::Dummy >::Type=internal::Dummy())
New string from an 8-Bit string literal that is expected to contain only characters in the ASCII set ...
Definition: ustring.hxx:183
Definition: stringutils.hxx:110
sal_Int32 compareTo(const OUString &str) const SAL_THROW(())
Compares two strings.
Definition: ustring.hxx:437
internal::ConstCharArrayDetector< T, bool >::Type startsWith(T &literal, OUString *rest=0) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: ustring.hxx:948
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.
#define SAL_THROW(x)
Exception specification documentation.
Definition: types.h:361
SAL_DLLPUBLIC void rtl_uString_newFromAscii(rtl_uString **newStr, const sal_Char *value) SAL_THROW_EXTERN_C()
Allocate a new string that contains a copy of a character array.
sal_Int32 lastIndexOf(const OUString &str, sal_Int32 fromIndex) const SAL_THROW(())
Returns the index within this string of the last occurrence of the specified substring, searching backward starting before the specified index.
Definition: ustring.hxx:1406
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 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_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.
~OUString() SAL_THROW(())
Release the string data.
Definition: ustring.hxx:295
internal::ConstCharArrayDetector< T, sal_Int32 >::Type lastIndexOf(T &literal) const SAL_THROW(())
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: ustring.hxx:1418
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 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 void rtl_uString_acquire(rtl_uString *str) SAL_THROW_EXTERN_C()
Increment the reference count of a string.
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:1351
bool operator>(const TTimeValue &rTimeA, const TTimeValue &rTimeB)
Definition: timer.hxx:108
bool endsWith(OUString const &str, OUString *rest=0) const
Check whether this string ends with a given substring.
Definition: ustring.hxx:1026
SAL_DLLPUBLIC sal_Int32 rtl_ustr_asciil_reverseCompare_WithLength(const sal_Unicode *first, sal_Int32 firstLen, const sal_Char *second, sal_Int32 secondLen) SAL_THROW_EXTERN_C()
Compare two strings from back to front.
sal_uInt16 rtl_TextEncoding
The various supported text encodings.
Definition: textenc.h:39
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_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_Int32 indexOf(sal_Unicode ch, sal_Int32 fromIndex=0) const SAL_THROW(())
Returns the index within this string of the first occurrence of the specified character, starting the search at the specified index.
Definition: ustring.hxx:1254
bool matchAsciiL(const sal_Char *asciiStr, sal_Int32 asciiStrLength, sal_Int32 fromIndex=0) const SAL_THROW(())
Match against a substring appearing in this string.
Definition: ustring.hxx:867
OUString(rtl_uString *str, __sal_NoAcquire) SAL_THROW(())
New OUString from OUString data without acquiring it.
Definition: ustring.hxx:128
internal::ConstCharArrayDetector< T, sal_Int32 >::Type reverseCompareTo(T &literal) const SAL_THROW(())
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: ustring.hxx:488
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_uInt32 toUInt32(sal_Int16 radix=10) const SAL_THROW(())
Returns the uint32 value from this string.
Definition: ustring.hxx:1862
sal_Unicode toChar() const SAL_THROW(())
Returns the first character from this string.
Definition: ustring.hxx:1830
bool equalsAscii(const sal_Char *asciiStr) const SAL_THROW(())
Perform a comparison of two strings.
Definition: ustring.hxx:740
bool equalsIgnoreAsciiCase(const OUString &str) const SAL_THROW(())
Perform a ASCII lowercase comparison of two strings.
Definition: ustring.hxx:530
OUString getToken(sal_Int32 token, sal_Unicode cTok, sal_Int32 &index) const SAL_THROW(())
Returns a token in the string.
Definition: ustring.hxx:1786
bool isEmpty() const SAL_THROW(())
Checks if a string is empty.
Definition: ustring.hxx:396
internal::ConstCharArrayDetector< T, bool >::Type endsWith(T &literal, OUString *rest=0) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: ustring.hxx:1042
bool matchIgnoreAsciiCase(const OUString &str, sal_Int32 fromIndex=0) const SAL_THROW(())
Match against a substring appearing in this string, ignoring the case of ASCII letters.
Definition: ustring.hxx:629
SAL_WARN_UNUSED_RESULT internal::ConstCharArrayDetector< T1, typename 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:1699
#define RTL_USTR_MAX_VALUEOFDOUBLE
Definition: ustring.h:1041
bool equals(const OUString &str) const SAL_THROW(())
Perform a comparison of two strings.
Definition: ustring.hxx:506
bool equalsIgnoreAsciiCaseAsciiL(const sal_Char *asciiStr, sal_Int32 asciiStrLength) const SAL_THROW(())
Perform an ASCII lowercase comparison of two strings.
Definition: ustring.hxx:838
friend internal::ConstCharArrayDetector< T, bool >::Type operator==(T &literal, const OUString &string)
Compare string to an ASCII string literal.
Definition: ustring.hxx:1197
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 sal_Int32 rtl_ustr_hashCode_WithLength(const sal_Unicode *str, sal_Int32 len) SAL_THROW_EXTERN_C()
Return a hash code for a string.
#define RTL_USTR_MAX_VALUEOFFLOAT
Definition: ustring.h:1022
SAL_DLLPUBLIC sal_Int32 rtl_ustr_ascii_compareIgnoreAsciiCase_WithLength(const sal_Unicode *first, sal_Int32 firstLen, const sal_Char *second) SAL_THROW_EXTERN_C()
Compare two strings, ignoring the case of ASCII characters.
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...
bool convertToString(OString *pTarget, rtl_TextEncoding nEncoding, sal_uInt32 nFlags) const
Converts to an OString, signalling failure.
Definition: ustring.hxx:2014
std::basic_ostream< charT, traits > & operator<<(std::basic_ostream< charT, traits > &stream, OString const &string)
Support for rtl::OString in std::ostream (and thus in CPPUNIT_ASSERT or SAL_INFO macros, for example).
Definition: string.hxx:1729
internal::ConstCharArrayDetector< T, bool >::Type equalsIgnoreAsciiCase(T &literal) const SAL_THROW(())
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: ustring.hxx:568
#define OUSTRING_TO_OSTRING_CVTFLAGS
Definition: string.h:1324
sal_Int32 compareToIgnoreAsciiCase(const OUString &str) const SAL_THROW(())
Perform a ASCII lowercase comparison of two strings.
Definition: ustring.hxx:555
sal_Int32 reverseCompareTo(const OUString &str) const SAL_THROW(())
Compares two strings in reverse order.
Definition: ustring.hxx:476
SAL_WARN_UNUSED_RESULT OUString replaceFirst(OUString const &from, OUString const &to, sal_Int32 *index=0) const
Returns a new string resulting from replacing the first occurrence of a given substring with another ...
Definition: ustring.hxx:1567
static OUString number(double d)
Returns the string representation of the double argument.
Definition: ustring.hxx:2159
SAL_WARN_UNUSED_RESULT OUString replaceAt(sal_Int32 index, sal_Int32 count, const OUString &newStr) const SAL_THROW(())
Returns a new string resulting from replacing n = count characters from position index in this string...
Definition: ustring.hxx:1522
sal_Int32 getLength() const SAL_THROW(())
Returns the length of this string.
Definition: ustring.hxx:386
#define RTL_USTR_MAX_VALUEOFBOOLEAN
Definition: ustring.h:915
#define SAL_WARN_UNUSED
Annotate classes where a compiler should warn if an instance is unused.
Definition: types.h:603
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 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.
static OUString number(float f)
Returns the string representation of the float argument.
Definition: ustring.hxx:2142
SAL_DLLPUBLIC sal_Int32 rtl_ustr_ascii_shortenedCompare_WithLength(const sal_Unicode *first, sal_Int32 firstLen, const sal_Char *second, sal_Int32 shortenedLen) SAL_THROW_EXTERN_C()
Compare two strings with a maximum count of characters.
SAL_WARN_UNUSED_RESULT OUString replace(sal_Unicode oldChar, sal_Unicode newChar) const SAL_THROW(())
Returns a new string resulting from replacing all occurrences of oldChar in this string with newChar...
Definition: ustring.hxx:1542
OUString intern() const
Return a canonical representation for a string.
Definition: ustring.hxx:1941
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:2125
SAL_DLLPUBLIC sal_Int32 rtl_ustr_valueOfDouble(sal_Unicode *str, double d) SAL_THROW_EXTERN_C()
Create the string representation of a double.
sal_Int32 compareToAscii(const sal_Char *asciiStr) const SAL_THROW(())
Compares two strings.
Definition: ustring.hxx:665
This String class provides base functionality for C++ like Unicode character array handling...
Definition: ustring.hxx:82
SAL_DLLPUBLIC void rtl_uString_newFromLiteral(rtl_uString **newStr, const sal_Char *value, sal_Int32 len, sal_Int32 allocExtra) SAL_THROW_EXTERN_C()
sal_uInt16 sal_Unicode
Definition: types.h:150
SAL_DLLPUBLIC void rtl_uString_internConvert(rtl_uString **newStr, const sal_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 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.
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:2116
static OUString boolean(bool b) SAL_THROW(())
Returns the string representation of the boolean argument.
Definition: ustring.hxx:2194
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.
bool equalsAsciiL(const sal_Char *asciiStr, sal_Int32 asciiStrLength) const SAL_THROW(())
Perform a comparison of two strings.
Definition: ustring.hxx:763
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_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:1444
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_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.
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:1143
#define RTL_STR_MAX_VALUEOFINT64
Definition: string.h:650
sal_Int32 compareToIgnoreAsciiCaseAscii(const sal_Char *asciiStr) const SAL_THROW(())
Compares two ASCII strings ignoring case.
Definition: ustring.hxx:813
OUString(const sal_Unicode *value) SAL_THROW(())
New string from a Unicode character buffer array.
Definition: ustring.hxx:147
SAL_WARN_UNUSED_RESULT OUString toAsciiLowerCase() const SAL_THROW(())
Converts from this string all ASCII uppercase characters (65-90) to ASCII lowercase characters (97-12...
Definition: ustring.hxx:1720
SAL_WARN_UNUSED_RESULT internal::ConstCharArrayDetector< T1, typename internal::ConstCharArrayDetector< T2, OUString >::Type >::Type replaceFirst(T1 &from, T2 &to, sal_Int32 *index=0) const
Returns a new string resulting from replacing the first occurrence of a given substring with another ...
Definition: ustring.hxx:1627
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_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:1654
internal::ConstCharArrayDetector< T, sal_Int32 >::Type indexOf(T &literal, sal_Int32 fromIndex=0) const SAL_THROW(())
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: ustring.hxx:1319