20 #ifndef _RTL_STRING_HXX_
21 #define _RTL_STRING_HXX_
34 #ifdef RTL_FAST_STRING
40 #if !defined EXCEPTIONS_OFF
49 #ifdef RTL_STRING_UNITTEST
50 #define rtl rtlunittest
56 #ifdef RTL_STRING_UNITTEST
59 #define RTL_STRING_CONST_FUNCTION rtl_string_unittest_const_literal_function = true;
61 #define RTL_STRING_CONST_FUNCTION
168 template<
typename T >
175 template<
typename T >
192 template<
typename T >
201 #ifdef RTL_STRING_UNITTEST
202 rtl_string_unittest_const_literal =
true;
241 #if defined EXCEPTIONS_OFF
244 throw std::bad_alloc();
249 #ifdef RTL_FAST_STRING
254 template<
typename T1,
typename T2 >
255 OString(
const OStringConcat< T1, T2 >& c )
257 const sal_Int32 l = c.length();
261 char* end = c.addData( pData->buffer );
262 pData->length = end - pData->buffer;
292 template<
typename T >
315 #ifdef RTL_FAST_STRING
320 template<
typename T1,
typename T2 >
321 OString& operator+=(
const OStringConcat< T1, T2 >& c )
323 const int l = c.length();
327 char* end = c.addData( pData->buffer + pData->length );
329 pData->length = end - pData->buffer;
353 return pData->length == 0;
379 assert(index >= 0 && index <= getLength());
384 return getStr()[index];
402 str.pData->buffer, str.pData->length );
421 rObj.pData->buffer, rObj.pData->length, maxLength );
439 str.pData->buffer, str.pData->length );
455 if ( pData->length != str.pData->length )
457 if ( pData == str.pData )
460 str.pData->buffer, str.pData->length ) == 0;
480 if ( pData->length != length )
484 value, length ) == 0;
503 if ( pData->length != str.pData->length )
505 if ( pData == str.pData )
508 str.pData->buffer, str.pData->length ) == 0;
532 template<
typename T >
538 template<
typename T >
549 template<
typename T >
581 if ( pData->length != asciiStrLength )
585 asciiStr, asciiStrLength ) == 0;
606 str.pData->buffer, str.pData->length, str.pData->length ) == 0;
614 template<
typename T >
620 pData->buffer + fromIndex, pData->length - fromIndex,
641 char const * str, sal_Int32 strLength, sal_Int32 fromIndex = 0)
645 pData->buffer + fromIndex, pData->length - fromIndex,
646 str, strLength, strLength) == 0;
653 #if SAL_TYPES_SIZEOFLONG == 8
678 str.pData->buffer, str.pData->length,
679 str.pData->length ) == 0;
687 template<
typename T >
707 return match(str, 0);
715 template<
typename T >
719 return match(literal, 0);
734 && match(str, getLength() - str.
getLength());
742 template<
typename T >
764 bool endsWithL(
char const * str, sal_Int32 strLength)
const {
765 return strLength <= getLength()
766 && matchL(str, strLength, getLength() - strLength);
770 {
return rStr1.equals(rStr2); }
774 {
return rStr1.compareTo( rStr2 ) < 0; }
776 {
return rStr1.compareTo( rStr2 ) > 0; }
778 {
return rStr1.compareTo( rStr2 ) <= 0; }
780 {
return rStr1.compareTo( rStr2 ) >= 0; }
782 template<
typename T >
785 return rStr1.compareTo( value ) == 0;
788 template<
typename T >
791 return rStr1.compareTo( value ) == 0;
794 template<
typename T >
797 return rStr2.compareTo( value ) == 0;
800 template<
typename T >
803 return rStr2.compareTo( value ) == 0;
811 template<
typename T >
826 template<
typename T >
836 template<
typename T >
842 template<
typename T >
848 template<
typename T >
854 template<
typename T >
865 template<
typename T >
868 return !( rStr == literal );
876 template<
typename T >
879 return !( literal == rStr );
910 return (ret < 0 ? ret : ret+fromIndex);
962 str.pData->buffer, str.pData->length );
963 return (ret < 0 ? ret : ret+fromIndex);
971 template<
typename T >
978 return n < 0 ? n : n + fromIndex;
999 sal_Int32
indexOfL(
char const * str, sal_Int32 len, sal_Int32 fromIndex = 0)
1003 pData->buffer + fromIndex, pData->length - fromIndex, str, len);
1004 return n < 0 ? n : n + fromIndex;
1011 #if SAL_TYPES_SIZEOFLONG == 8
1033 str.pData->buffer, str.pData->length );
1056 str.pData->buffer, str.pData->length );
1071 rtl_String *pNew = 0;
1073 return OString( pNew, (DO_NOT_ACQUIRE*)0 );
1090 rtl_String *pNew = 0;
1092 return OString( pNew, (DO_NOT_ACQUIRE*)0 );
1105 rtl_String* pNew = 0;
1107 return OString( pNew, (DO_NOT_ACQUIRE*)0 );
1110 #ifndef RTL_FAST_STRING
1113 return str1.concat( str2 );
1132 rtl_String* pNew = 0;
1134 return OString( pNew, (DO_NOT_ACQUIRE*)0 );
1152 rtl_String* pNew = 0;
1154 return OString( pNew, (DO_NOT_ACQUIRE*)0 );
1176 OString const & from,
OString const & to, sal_Int32 * index = 0)
const
1181 &s, pData, from.pData->buffer, from.pData->length,
1182 to.pData->buffer, to.pData->length, index == 0 ? &i : index);
1202 &s, pData, from.pData->buffer, from.pData->length,
1203 to.pData->buffer, to.pData->length);
1219 rtl_String* pNew = 0;
1221 return OString( pNew, (DO_NOT_ACQUIRE*)0 );
1236 rtl_String* pNew = 0;
1238 return OString( pNew, (DO_NOT_ACQUIRE*)0 );
1254 rtl_String* pNew = 0;
1256 return OString( pNew, (DO_NOT_ACQUIRE*)0 );
1285 rtl_String * pNew = 0;
1287 return OString( pNew, (DO_NOT_ACQUIRE *)0 );
1305 return getToken(count, separator, n);
1329 return pData->buffer[0];
1415 return number( static_cast< long long >( i ), radix );
1421 return number( static_cast< unsigned long long >( i ), radix );
1427 return number( static_cast< long long >( i ), radix );
1433 return number( static_cast< unsigned long long >( i ), radix );
1440 rtl_String* pNewData = 0;
1442 return OString( pNewData, (DO_NOT_ACQUIRE*)0 );
1449 rtl_String* pNewData = 0;
1451 return OString( pNewData, (DO_NOT_ACQUIRE*)0 );
1466 rtl_String* pNewData = 0;
1468 return OString( pNewData, (DO_NOT_ACQUIRE*)0 );
1483 rtl_String* pNewData = 0;
1485 return OString( pNewData, (DO_NOT_ACQUIRE*)0 );
1518 rtl_String* pNewData = 0;
1520 return OString( pNewData, (DO_NOT_ACQUIRE*)0 );
1547 return number( i, radix );
1562 return number( ll, radix );
1597 #ifdef RTL_FAST_STRING
1609 OStringLiteral(
const char (&str)[ N ] ) : size( N - 1 ), data( str ) { assert( strlen( str ) == N - 1 ); }
1618 struct ToStringHelper< OString >
1620 static int length(
const OString& s ) {
return s.getLength(); }
1621 static char* addData(
char* buffer,
const OString& s ) {
return addDataHelper( buffer, s.getStr(), s.getLength()); }
1622 static const bool allowOStringConcat =
true;
1623 static const bool allowOUStringConcat =
false;
1632 static int length(
const OStringLiteral& str ) {
return str.size; }
1633 static char* addData(
char* buffer,
const OStringLiteral& str ) {
return addDataHelper( buffer, str.data, str.size ); }
1634 static const bool allowOStringConcat =
true;
1635 static const bool allowOUStringConcat =
false;
1641 template<
typename charT,
typename traits,
typename T1,
typename T2 >
1642 inline std::basic_ostream<charT, traits> &
operator <<(
1643 std::basic_ostream<charT, traits> & stream,
const OStringConcat< T1, T2 >& concat)
1645 return stream << OString( concat );
1670 {
return (
size_t)rString.
hashCode(); }
1695 template<
typename charT,
typename traits > std::basic_ostream<charT, traits> &
1697 std::basic_ostream<charT, traits> & stream,
OString const &
string)
1699 return stream <<
string.getStr();
1705 #ifdef RTL_STRING_UNITTEST
1708 typedef rtlunittest::OString OString;
1710 #undef RTL_STRING_CONST_FUNCTION
1714 using ::rtl::OString;
1715 using ::rtl::OStringHash;
SAL_DLLPUBLIC void rtl_string_newTrim(rtl_String **newStr, rtl_String *str) SAL_THROW_EXTERN_C()
Create a new string by removing white space from both ends of another string.
friend internal::NonConstCharArrayDetector< T, bool >::Type operator!=(T &value, const OString &rStr2)
Definition: string.hxx:855
static OString number(float f)
Returns the string representation of the float argument.
Definition: string.hxx:1463
#define RTL_STR_MAX_VALUEOFINT64
Definition: string.h:650
OString & operator+=(const OString &str)
Append a string to this string.
Definition: string.hxx:309
SAL_DLLPUBLIC sal_Int32 rtl_str_valueOfFloat(sal_Char *str, float f) SAL_THROW_EXTERN_C()
Create the string representation of a float.
#define SAL_UNUSED_PARAMETER
Annotate unused but required C++ function parameters.
Definition: types.h:540
SAL_DLLPUBLIC void rtl_string_newFromLiteral(rtl_String **newStr, const sal_Char *value, sal_Int32 len, sal_Int32 allocExtra) SAL_THROW_EXTERN_C()
SAL_DLLPUBLIC void rtl_string_acquire(rtl_String *str) SAL_THROW_EXTERN_C()
Increment the reference count of a string.
sal_uInt16 rtl_TextEncoding
The various supported text encodings.
Definition: textenc.h:39
sal_uInt16 sal_Unicode
Definition: types.h:134
sal_Char toChar() const
Returns the first character from this string.
Definition: string.hxx:1327
#define OUSTRING_TO_OSTRING_CVTFLAGS
Definition: string.h:1303
friend internal::ConstCharArrayDetector< T, bool >::Type operator==(T &literal, const OString &rStr)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: string.hxx:827
SAL_DLLPUBLIC sal_Int64 rtl_str_toInt64(const sal_Char *str, sal_Int16 radix) SAL_THROW_EXTERN_C()
Interpret a string as a long integer.
sal_Bool toBoolean() const
Returns the Boolean value from this string.
Definition: string.hxx:1316
SAL_DLLPUBLIC sal_Int32 rtl_str_hashCode(const sal_Char *str) SAL_THROW_EXTERN_C()
Return a hash code for a string.
OString(T &value, typename internal::NonConstCharArrayDetector< T, internal::Dummy >::Type=internal::Dummy())
Definition: string.hxx:176
sal_Bool matchIgnoreAsciiCase(const OString &str, sal_Int32 fromIndex=0) const
Match against a substring appearing in this string, ignoring the case of ASCII letters.
Definition: string.hxx:675
SAL_WARN_UNUSED_RESULT OString toAsciiLowerCase() const
Converts from this string all ASCII uppercase characters (65-90) to ASCII lowercase characters (97-12...
Definition: string.hxx:1217
sal_Bool operator<(const TTimeValue &rTimeA, const TTimeValue &rTimeB)
Definition: timer.hxx:98
friend internal::ConstCharArrayDetector< T, bool >::Type operator!=(T &literal, const OString &rStr)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: string.hxx:877
SAL_DLLPUBLIC void rtl_string_newReplace(rtl_String **newStr, rtl_String *str, sal_Char oldChar, sal_Char newChar) SAL_THROW_EXTERN_C()
Create a new string by replacing all occurrences of a single character within another string...
SAL_DLLPUBLIC float rtl_str_toFloat(const sal_Char *str) SAL_THROW_EXTERN_C()
Interpret a string as a float.
float toFloat() const
Returns the float value from this string.
Definition: string.hxx:1385
const sal_Char * getStr() const
Returns a pointer to the characters of this string.
Definition: string.hxx:367
sal_Int64 toInt64(sal_Int16 radix=10) const
Returns the int64 value from this string.
Definition: string.hxx:1355
OString(const OString &str)
New string from OString.
Definition: string.hxx:120
SAL_DLLPUBLIC void rtl_string_new(rtl_String **newStr) SAL_THROW_EXTERN_C()
Allocate a new string containing no characters.
sal_uInt64 toUInt64(sal_Int16 radix=10) const
Returns the uint64 value from this string.
Definition: string.hxx:1372
friend internal::NonConstCharArrayDetector< T, bool >::Type operator==(const OString &rStr1, T &value)
Definition: string.hxx:789
SAL_DLLPUBLIC sal_Int32 rtl_str_compareIgnoreAsciiCase(const sal_Char *first, const sal_Char *second) SAL_THROW_EXTERN_C()
Compare two strings, ignoring the case of ASCII characters.
static OString 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: string.hxx:1446
SAL_DLLPUBLIC sal_Int32 rtl_str_lastIndexOfChar_WithLength(const sal_Char *str, sal_Int32 len, sal_Char ch) SAL_THROW_EXTERN_C()
Search for the last occurrence of a character within a string.
friend internal::CharPtrDetector< T, bool >::Type operator==(const OString &rStr1, const T &value)
Definition: string.hxx:783
sal_Bool equalsIgnoreAsciiCaseL(const sal_Char *asciiStr, sal_Int32 asciiStrLength) const
Perform a ASCII lowercase comparison of two strings.
Definition: string.hxx:579
SAL_DLLPUBLIC void rtl_string_ensureCapacity(rtl_String **str, sal_Int32 size) SAL_THROW_EXTERN_C()
Ensure a string has enough space for a given number of characters.
bool matchL(char const *str, sal_Int32 strLength, sal_Int32 fromIndex=0) const
Match against a substring appearing in this string.
Definition: string.hxx:640
SAL_WARN_UNUSED_RESULT OString trim() const
Returns a new string resulting from removing white space from both ends of the string.
Definition: string.hxx:1252
definition of a no acquire enum for ctors
Definition: types.h:374
bool operator()(const char *p1, const char *p2) const
Definition: string.hxx:1676
A helper to use OStrings with hash maps.
Definition: string.hxx:1658
SAL_WARN_UNUSED_RESULT OString concat(const OString &str) const
Concatenates the specified string to the end of this string.
Definition: string.hxx:1103
SAL_DLLPUBLIC void rtl_string_newToAsciiLowerCase(rtl_String **newStr, rtl_String *str) SAL_THROW_EXTERN_C()
Create a new string by converting all ASCII uppercase letters to lowercase within another string...
SAL_DLLPUBLIC rtl_String * rtl_string_alloc(sal_Int32 nLen) SAL_THROW_EXTERN_C()
Allocate a new string containing space for a given number of characters.
Definition: stringutils.hxx:110
#define RTL_STR_MAX_VALUEOFBOOLEAN
Definition: string.h:585
sal_Int32 lastIndexOf(sal_Char ch, sal_Int32 fromIndex) const
Returns the index within this string of the last occurrence of the specified character, searching backward starting before the specified index.
Definition: string.hxx:939
SAL_DLLPUBLIC sal_Int32 rtl_str_valueOfDouble(sal_Char *str, double d) SAL_THROW_EXTERN_C()
Create the string representation of a double.
SAL_DLLPUBLIC sal_uInt64 rtl_str_toUInt64(const sal_Char *str, sal_Int16 radix) SAL_THROW_EXTERN_C()
Interpret a string as an unsigned long integer.
sal_Int32 hashCode() const
Returns a hashcode for this string.
Definition: string.hxx:889
static OString 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: string.hxx:1419
internal::CharPtrDetector< T, bool >::Type equalsIgnoreAsciiCase(const T &asciiStr) const
Perform a ASCII lowercase comparison of two strings.
Definition: string.hxx:533
sal_Int32 getLength() const
Returns the length of this string.
Definition: string.hxx:341
OString(const sal_Unicode *value, sal_Int32 length, rtl_TextEncoding encoding, sal_uInt32 convertFlags=OUSTRING_TO_OSTRING_CVTFLAGS)
New string from a Unicode character buffer array.
Definition: string.hxx:234
static OString number(long i, sal_Int16 radix=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: string.hxx:1425
SAL_DLLPUBLIC void rtl_string_newReplaceStrAt(rtl_String **newStr, rtl_String *str, sal_Int32 idx, sal_Int32 count, rtl_String *subStr) SAL_THROW_EXTERN_C()
Create a new string by replacing a substring of another string.
bool endsWith(OString const &str) const
Check whether this string ends with a given substring.
Definition: string.hxx:732
OString getToken(sal_Int32 token, sal_Char cTok, sal_Int32 &index) const
Returns a token in the string.
Definition: string.hxx:1283
OString(rtl_String *str)
New string from OString data.
Definition: string.hxx:131
OString(const T &value, typename internal::CharPtrDetector< T, internal::Dummy >::Type=internal::Dummy())
New string from a character buffer array.
Definition: string.hxx:169
Hashing functor for classic c-strings (i.e.
Definition: string.hxx:1681
friend internal::NonConstCharArrayDetector< T, bool >::Type operator!=(const OString &rStr1, T &value)
Definition: string.hxx:843
SAL_DLLPUBLIC void rtl_string_newFromStr_WithLength(rtl_String **newStr, const sal_Char *value, sal_Int32 len) SAL_THROW_EXTERN_C()
Allocate a new string that contains a copy of a character array.
SAL_DLLPUBLIC sal_Int32 rtl_str_indexOfStr_WithLength(const sal_Char *str, sal_Int32 len, const sal_Char *subStr, sal_Int32 subLen) SAL_THROW_EXTERN_C()
Search for the first occurrence of a substring within a string.
SAL_DLLPUBLIC void rtl_string_newFromSubString(rtl_String **newStr, const rtl_String *from, sal_Int32 beginIndex, sal_Int32 count) SAL_THROW_EXTERN_C()
Allocate a new string that is a substring of this string.
SAL_DLLPUBLIC sal_Int32 rtl_str_compare(const sal_Char *first, const sal_Char *second) SAL_THROW_EXTERN_C()
Compare two strings.
SAL_DLLPUBLIC sal_Int32 rtl_str_lastIndexOfStr_WithLength(const sal_Char *str, sal_Int32 len, const sal_Char *subStr, sal_Int32 subLen) SAL_THROW_EXTERN_C()
Search for the last occurrence of a substring within a string.
sal_Bool equalsIgnoreAsciiCase(const OString &str) const
Perform a ASCII lowercase comparison of two strings.
Definition: string.hxx:501
friend internal::CharPtrDetector< T, bool >::Type operator!=(const OString &rStr1, const T &value)
Definition: string.hxx:837
Definition: stringutils.hxx:69
OString(const sal_Char *value, sal_Int32 length)
New string from a character buffer array.
Definition: string.hxx:214
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: string.hxx:688
double toDouble() const
Returns the double value from this string.
Definition: string.hxx:1398
#define RTL_STR_MAX_VALUEOFFLOAT
Definition: string.h:692
SAL_DLLPUBLIC sal_Int32 rtl_str_reverseCompare_WithLength(const sal_Char *first, sal_Int32 firstLen, const sal_Char *second, sal_Int32 secondLen) SAL_THROW_EXTERN_C()
Compare two strings from back to front.
static OString boolean(bool b)
Returns the string representation of the boolean argument.
Definition: string.hxx:1515
sal_Bool operator==(const TTimeValue &rTimeA, const TTimeValue &rTimeB)
Definition: timer.hxx:118
sal_Int32 lastIndexOf(const OString &str, sal_Int32 fromIndex) const
Returns the index within this string of the last occurrence of the specified substring, searching backward starting before the specified index.
Definition: string.hxx:1053
bool startsWith(OString const &str) const
Check whether this string starts with a given substring.
Definition: string.hxx:706
sal_Bool operator>(const TTimeValue &rTimeA, const TTimeValue &rTimeB)
Definition: timer.hxx:108
SAL_DLLPUBLIC void rtl_string_release(rtl_String *str) SAL_THROW_EXTERN_C()
Decrement the reference count of a string.
SAL_WARN_UNUSED_RESULT OString replaceFirst(OString const &from, OString const &to, sal_Int32 *index=0) const
Returns a new string resulting from replacing the first occurrence of a given substring with another ...
Definition: string.hxx:1175
SAL_DLLPUBLIC void rtl_string_newFromStr(rtl_String **newStr, const sal_Char *value) SAL_THROW_EXTERN_C()
Allocate a new string that contains a copy of a character array.
SAL_DLLPUBLIC sal_Bool rtl_str_toBoolean(const sal_Char *str) SAL_THROW_EXTERN_C()
Interpret a string as a boolean.
char sal_Char
Definition: types.h:122
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: string.hxx:972
sal_Bool equalsL(const sal_Char *value, sal_Int32 length) const
Perform a comparison of two strings.
Definition: string.hxx:478
OString(T &literal, typename internal::ConstCharArrayDetector< T, internal::Dummy >::Type=internal::Dummy())
New string from a string literal.
Definition: string.hxx:193
SAL_DLLPUBLIC sal_Int32 rtl_str_indexOfChar_WithLength(const sal_Char *str, sal_Int32 len, sal_Char ch) SAL_THROW_EXTERN_C()
Search for the first occurrence of a character within a string.
sal_Bool match(const OString &str, sal_Int32 fromIndex=0) const
Match against a substring appearing in this string.
Definition: string.hxx:603
bool isEmpty() const
Checks if a string is empty.
Definition: string.hxx:351
static OString 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: string.hxx:1431
unsigned char sal_Bool
Definition: types.h:37
~OString()
Release the string data.
Definition: string.hxx:271
OString()
New string containing no characters.
Definition: string.hxx:109
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: string.hxx:615
#define sal_False
Definition: types.h:38
sal_Int32 reverseCompareTo(const OString &str) const
Compares two strings in reverse order.
Definition: string.hxx:436
OString & operator=(const OString &str)
Assign a new string.
Definition: string.hxx:281
SAL_DLLPUBLIC sal_Int32 rtl_string_getToken(rtl_String **newStr, rtl_String *str, sal_Int32 token, sal_Char cTok, sal_Int32 idx) SAL_THROW_EXTERN_C()
Create a new string by extracting a single token from another string.
friend internal::CharPtrDetector< T, bool >::Type operator==(const T &value, const OString &rStr2)
Definition: string.hxx:795
friend internal::NonConstCharArrayDetector< T, bool >::Type operator==(T &value, const OString &rStr2)
Definition: string.hxx:801
sal_Bool equals(const OString &str) const
Perform a comparison of two strings.
Definition: string.hxx:453
sal_Int32 indexOfL(char const *str, sal_Int32 len, sal_Int32 fromIndex=0) const
Returns the index within this string of the first occurrence of the specified substring, starting at the specified index.
Definition: string.hxx:999
SAL_DLLPUBLIC double rtl_str_toDouble(const sal_Char *str) SAL_THROW_EXTERN_C()
Interpret a string as a double.
SAL_DLLPUBLIC void rtl_string_newConcat(rtl_String **newStr, rtl_String *left, rtl_String *right) SAL_THROW_EXTERN_C()
Create a new string that is the concatenation of two other strings.
SAL_DLLPUBLIC sal_Int32 rtl_str_valueOfInt64(sal_Char *str, sal_Int64 l, sal_Int16 radix) SAL_THROW_EXTERN_C()
Create the string representation of a long integer.
size_t operator()(const char *p) const
Definition: string.hxx:1683
SAL_DLLPUBLIC sal_Int32 rtl_str_compareIgnoreAsciiCase_WithLength(const sal_Char *first, sal_Int32 firstLen, const sal_Char *second, sal_Int32 secondLen) SAL_THROW_EXTERN_C()
Compare two strings, ignoring the case of ASCII characters.
#define SAL_WARN_UNUSED
Annotate classes where a compiler should warn if an instance is unused.
Definition: types.h:561
sal_Int32 indexOf(sal_Char ch, sal_Int32 fromIndex=0) const
Returns the index within this string of the first occurrence of the specified character, starting the search at the specified index.
Definition: string.hxx:907
__sal_NoAcquire
Definition: types.h:370
friend internal::ConstCharArrayDetector< T, bool >::Type operator==(const OString &rStr, T &literal)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: string.hxx:812
friend OString operator+(const OString &str1, const OString &str2)
Definition: string.hxx:1111
SAL_DLLPUBLIC void rtl_string_newToAsciiUpperCase(rtl_String **newStr, rtl_String *str) SAL_THROW_EXTERN_C()
Create a new string by converting all ASCII lowercase letters to uppercase within another string...
#define SAL_WARN_UNUSED_RESULT
Use this as markup for functions and methods whose return value must be checked.
Definition: types.h:303
SAL_WARN_UNUSED_RESULT OString toAsciiUpperCase() const
Converts from this string all ASCII lowercase characters (97-122) to ASCII uppercase characters (65-9...
Definition: string.hxx:1234
SAL_WARN_UNUSED_RESULT OString replaceAt(sal_Int32 index, sal_Int32 count, const OString &newStr) const
Returns a new string resulting from replacing n = count characters from position index in this string...
Definition: string.hxx:1130
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: string.hxx:550
OString(rtl_String *str, __sal_NoAcquire)
New string from OString data without acquiring it.
Definition: string.hxx:144
internal::NonConstCharArrayDetector< T, bool >::Type equalsIgnoreAsciiCase(T &asciiStr) const
Definition: string.hxx:539
SAL_DLLPUBLIC sal_Int32 rtl_str_shortenedCompare_WithLength(const sal_Char *first, sal_Int32 firstLen, const sal_Char *second, sal_Int32 secondLen, sal_Int32 shortenedLen) SAL_THROW_EXTERN_C()
Compare two strings with a maximum count of characters.
#define SAL_DEPRECATED_INTERNAL(message)
This macro is used to tag interfaces that are deprecated for both internal and external API users...
Definition: types.h:492
size_t operator()(const OString &rString) const
Compute a hash code for a string.
Definition: string.hxx:1669
sal_Int32 lastIndexOf(const OString &str) const
Returns the index within this string of the last occurrence of the specified substring, searching backward starting at the end.
Definition: string.hxx:1030
friend internal::ConstCharArrayDetector< T, bool >::Type operator!=(const OString &rStr, T &literal)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: string.hxx:866
Equality functor for classic c-strings (i.e.
Definition: string.hxx:1674
friend internal::CharPtrDetector< T, bool >::Type operator!=(const T &value, const OString &rStr2)
Definition: string.hxx:849
#define RTL_STRING_CONST_FUNCTION
Definition: string.hxx:61
SAL_DLLPUBLIC sal_Int32 rtl_str_compare_WithLength(const sal_Char *first, sal_Int32 firstLen, const sal_Char *second, sal_Int32 secondLen) SAL_THROW_EXTERN_C()
Compare two strings.
SAL_DLLPUBLIC sal_Int32 rtl_str_shortenedCompareIgnoreAsciiCase_WithLength(const sal_Char *first, sal_Int32 firstLen, const sal_Char *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_string_newReplaceAll(rtl_String **newStr, rtl_String *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 void rtl_uString2String(rtl_String **newStr, const sal_Unicode *str, sal_Int32 len, rtl_TextEncoding encoding, sal_uInt32 convertFlags) SAL_THROW_EXTERN_C()
Create a new byte string by converting a Unicode string, using a specific text encoding.
SAL_DLLPUBLIC sal_Int32 rtl_str_valueOfBoolean(sal_Char *str, sal_Bool b) SAL_THROW_EXTERN_C()
Create the string representation of a boolean.
SAL_DLLPUBLIC sal_Int32 rtl_str_hashCode_WithLength(const sal_Char *str, sal_Int32 len) SAL_THROW_EXTERN_C()
Return a hash code for a string.
sal_Int32 indexOf(const OString &str, sal_Int32 fromIndex=0) const
Returns the index within this string of the first occurrence of the specified substring, starting at the specified index.
Definition: string.hxx:959
SAL_WARN_UNUSED_RESULT OString replace(sal_Char oldChar, sal_Char newChar) const
Returns a new string resulting from replacing all occurrences of oldChar in this string with newChar...
Definition: string.hxx:1150
OString OStringLiteral
Definition: string.hxx:1649
sal_Int32 compareTo(const OString &rObj, sal_Int32 maxLength) const
Compares two strings with an maximum count of characters.
Definition: string.hxx:418
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:1696
sal_Bool operator!=(const Any &rAny, const C &value)
Template unequality operator: compares set value of left side any to right side value.
Definition: Any.hxx:558
sal_Int32 compareTo(const OString &str) const
Compares two strings.
Definition: string.hxx:399
sal_Int32 toInt32(sal_Int16 radix=10) const
Returns the int32 value from this string.
Definition: string.hxx:1341
OString(sal_Char value)
New string from a single character.
Definition: string.hxx:154
#define RTL_STR_MAX_VALUEOFDOUBLE
Definition: string.h:711
SAL_DLLPUBLIC sal_Int32 rtl_str_valueOfUInt64(sal_Char *str, sal_uInt64 l, sal_Int16 radix) SAL_THROW_EXTERN_C()
Create the string representation of an unsigned long integer.
This String class provide base functionality for C++ like 8-Bit character array handling.
Definition: string.hxx:90
static OString number(double d)
Returns the string representation of the double argument.
Definition: string.hxx:1480
bool endsWithL(char const *str, sal_Int32 strLength) const
Check whether this string ends with a given substring.
Definition: string.hxx:764
SAL_DLLPUBLIC void rtl_string_newReplaceFirst(rtl_String **newStr, rtl_String *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_WARN_UNUSED_RESULT OString replaceAll(OString const &from, OString const &to) const
Returns a new string resulting from replacing all occurrences of a given substring with another subst...
Definition: string.hxx:1199
Definition: stringutils.hxx:67
internal::ConstCharArrayDetector< T, bool >::Type endsWith(T &literal) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: string.hxx:743
SAL_WARN_UNUSED_RESULT OString copy(sal_Int32 beginIndex, sal_Int32 count) const
Returns a new string that is a substring of this string.
Definition: string.hxx:1088
internal::ConstCharArrayDetector< T, bool >::Type startsWith(T &literal) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: string.hxx:716
#define SAL_THROW(exc)
Definition of function throw clause macros.
Definition: types.h:356
#define RTL_STR_MAX_VALUEOFUINT64
Definition: string.h:673
static OString number(int i, sal_Int16 radix=10)
Returns the string representation of the integer argument.
Definition: string.hxx:1413
SAL_DLLPUBLIC void rtl_string_assign(rtl_String **str, rtl_String *rightValue) SAL_THROW_EXTERN_C()
Assign a new value to a string.
SAL_WARN_UNUSED_RESULT OString copy(sal_Int32 beginIndex) const
Returns a new string that is a substring of this string.
Definition: string.hxx:1069
OString getToken(sal_Int32 count, char separator) const
Returns a token from the string.
Definition: string.hxx:1303
sal_Int32 lastIndexOf(sal_Char ch) const
Returns the index within this string of the last occurrence of the specified character, searching backward starting at the end.
Definition: string.hxx:922
SAL_DLLPUBLIC sal_Int32 rtl_str_toInt32(const sal_Char *str, sal_Int16 radix) SAL_THROW_EXTERN_C()
Interpret a string as an integer.
#define sal_True
Definition: types.h:39
static OString 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: string.hxx:1437
internal::ConstCharArrayDetector< T, OString & >::Type operator=(T &literal)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: string.hxx:293
Definition: stringutils.hxx:87