20 #ifndef INCLUDED_RTL_STRING_HXX
21 #define INCLUDED_RTL_STRING_HXX
35 #ifdef RTL_FAST_STRING
46 #ifdef RTL_STRING_UNITTEST
47 #define rtl rtlunittest
54 #ifdef RTL_STRING_UNITTEST
57 #define RTL_STRING_CONST_FUNCTION rtl_string_unittest_const_literal_function = true;
59 #define RTL_STRING_CONST_FUNCTION
158 template<
typename T >
165 template<
typename T >
182 template<
typename T >
191 #ifdef RTL_STRING_UNITTEST
192 rtl_string_unittest_const_literal =
true;
231 throw std::bad_alloc();
235 #ifdef RTL_FAST_STRING
240 template<
typename T1,
typename T2 >
241 OString(
const OStringConcat< T1, T2 >& c )
243 const sal_Int32 l = c.length();
247 char* end = c.addData( pData->buffer );
248 pData->length = end - pData->buffer;
278 template<
typename T >
281 RTL_STRING_CONST_FUNCTION
301 #ifdef RTL_FAST_STRING
306 template<
typename T1,
typename T2 >
307 OString& operator+=(
const OStringConcat< T1, T2 >& c )
309 const int l = c.length();
313 char* end = c.addData( pData->buffer + pData->length );
315 pData->length = end - pData->buffer;
339 return pData->length == 0;
366 assert(index >= 0 && static_cast<sal_uInt32>(index) < static_cast<sal_uInt32>(getLength()));
367 return getStr()[index];
385 str.pData->buffer, str.pData->length );
404 rObj.pData->buffer, rObj.pData->length, maxLength );
422 str.pData->buffer, str.pData->length );
438 if ( pData->length != str.pData->length )
440 if ( pData == str.pData )
443 str.pData->buffer, str.pData->length ) == 0;
463 if ( pData->length != length )
467 value, length ) == 0;
486 if ( pData->length != str.pData->length )
488 if ( pData == str.pData )
491 str.pData->buffer, str.pData->length ) == 0;
515 template<
typename T >
521 template<
typename T >
532 template<
typename T >
535 RTL_STRING_CONST_FUNCTION
564 if ( pData->length != asciiStrLength )
568 asciiStr, asciiStrLength ) == 0;
589 str.pData->buffer, str.pData->length, str.pData->length ) == 0;
597 template<
typename T >
600 RTL_STRING_CONST_FUNCTION
603 pData->buffer + fromIndex, pData->length - fromIndex,
624 char const * str, sal_Int32 strLength, sal_Int32 fromIndex = 0)
628 pData->buffer + fromIndex, pData->length - fromIndex,
629 str, strLength, strLength) == 0;
636 #if SAL_TYPES_SIZEOFLONG == 8
661 str.pData->buffer, str.pData->length,
662 str.pData->length ) == 0;
670 template<
typename T >
673 RTL_STRING_CONST_FUNCTION
694 bool b = match(str, 0);
695 if (b && rest != 0) {
706 template<
typename T >
708 T & literal,
OString * rest = 0)
const
710 RTL_STRING_CONST_FUNCTION
711 bool b = match(literal, 0);
712 if (b && rest != 0) {
734 && match(str, getLength() - str.
getLength());
735 if (b && rest != 0) {
736 *rest = copy(0, getLength() - str.
getLength());
746 template<
typename T >
748 T & literal,
OString * rest = 0)
const
750 RTL_STRING_CONST_FUNCTION
754 if (b && rest != 0) {
776 bool endsWithL(
char const * str, sal_Int32 strLength)
const {
777 return strLength <= getLength()
778 && matchL(str, strLength, getLength() - strLength);
782 {
return rStr1.equals(rStr2); }
786 {
return rStr1.compareTo( rStr2 ) < 0; }
788 {
return rStr1.compareTo( rStr2 ) > 0; }
790 {
return rStr1.compareTo( rStr2 ) <= 0; }
792 {
return rStr1.compareTo( rStr2 ) >= 0; }
794 template<
typename T >
797 return rStr1.compareTo( value ) == 0;
800 template<
typename T >
803 return rStr1.compareTo( value ) == 0;
806 template<
typename T >
809 return rStr2.compareTo( value ) == 0;
812 template<
typename T >
815 return rStr2.compareTo( value ) == 0;
823 template<
typename T >
826 RTL_STRING_CONST_FUNCTION
838 template<
typename T >
841 RTL_STRING_CONST_FUNCTION
848 template<
typename T >
854 template<
typename T >
860 template<
typename T >
866 template<
typename T >
877 template<
typename T >
880 return !( rStr == literal );
888 template<
typename T >
891 return !( literal == rStr );
922 return (ret < 0 ? ret : ret+fromIndex);
974 str.pData->buffer, str.pData->length );
975 return (ret < 0 ? ret : ret+fromIndex);
983 template<
typename T >
986 RTL_STRING_CONST_FUNCTION
990 return n < 0 ? n : n + fromIndex;
1011 sal_Int32
indexOfL(
char const * str, sal_Int32 len, sal_Int32 fromIndex = 0)
1015 pData->buffer + fromIndex, pData->length - fromIndex, str, len);
1016 return n < 0 ? n : n + fromIndex;
1023 #if SAL_TYPES_SIZEOFLONG == 8
1045 str.pData->buffer, str.pData->length );
1068 str.pData->buffer, str.pData->length );
1083 rtl_String *pNew = 0;
1102 rtl_String *pNew = 0;
1117 rtl_String* pNew = 0;
1122 #ifndef RTL_FAST_STRING
1125 return str1.concat( str2 );
1144 rtl_String* pNew = 0;
1164 rtl_String* pNew = 0;
1188 OString const & from,
OString const & to, sal_Int32 * index = 0)
const
1193 &s, pData, from.pData->buffer, from.pData->length,
1194 to.pData->buffer, to.pData->length, index == 0 ? &i : index);
1214 &s, pData, from.pData->buffer, from.pData->length,
1215 to.pData->buffer, to.pData->length);
1231 rtl_String* pNew = 0;
1248 rtl_String* pNew = 0;
1266 rtl_String* pNew = 0;
1297 rtl_String * pNew = 0;
1317 return getToken(count, separator, n);
1341 return pData->buffer[0];
1446 return number( static_cast< long long >( i ), radix );
1452 return number( static_cast< unsigned long long >( i ), radix );
1458 return number( static_cast< long long >( i ), radix );
1464 return number( static_cast< unsigned long long >( i ), radix );
1471 rtl_String* pNewData = 0;
1480 rtl_String* pNewData = 0;
1497 rtl_String* pNewData = 0;
1514 rtl_String* pNewData = 0;
1549 rtl_String* pNewData = 0;
1578 return number( i, radix );
1593 return number( ll, radix );
1628 #ifdef RTL_FAST_STRING
1640 OStringLiteral(
const char (&str)[ N ] ) : size( N - 1 ), data( str ) { assert( strlen( str ) == N - 1 ); }
1649 struct ToStringHelper< OString >
1651 static int length(
const OString& s ) {
return s.getLength(); }
1652 static char* addData(
char* buffer,
const OString& s ) {
return addDataHelper( buffer, s.getStr(), s.getLength()); }
1653 static const bool allowOStringConcat =
true;
1654 static const bool allowOUStringConcat =
false;
1661 struct ToStringHelper< OStringLiteral >
1663 static int length(
const OStringLiteral& str ) {
return str.size; }
1664 static char* addData(
char* buffer,
const OStringLiteral& str ) {
return addDataHelper( buffer, str.data, str.size ); }
1665 static const bool allowOStringConcat =
true;
1666 static const bool allowOUStringConcat =
false;
1672 template<
typename charT,
typename traits,
typename T1,
typename T2 >
1673 inline std::basic_ostream<charT, traits> &
operator <<(
1674 std::basic_ostream<charT, traits> & stream,
const OStringConcat< T1, T2 >& concat)
1676 return stream << OString( concat );
1681 typedef OString OStringLiteral;
1703 {
return (
size_t)rString.
hashCode(); }
1728 template<
typename charT,
typename traits > std::basic_ostream<charT, traits> &
1730 std::basic_ostream<charT, traits> & stream,
OString const &
string)
1732 return stream <<
string.getStr();
1738 #ifdef RTL_STRING_UNITTEST
1741 typedef rtlunittest::OString OString;
1743 #undef RTL_STRING_CONST_FUNCTION
1747 using ::rtl::OString;
1748 using ::rtl::OStringHash;
1749 using ::rtl::OStringLiteral;
1752 #endif // INCLUDED_RTL_STRING_HXX
sal_uInt64 toUInt64(sal_Int16 radix=10) const
Returns the uint64 value from this string.
Definition: string.hxx:1403
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:951
sal_Bool operator<(const TTimeValue &rTimeA, const TTimeValue &rTimeB)
Definition: timer.hxx:98
OString(rtl_String *str, __sal_NoAcquire)
New string from OString data without acquiring it.
Definition: string.hxx:134
internal::NonConstCharArrayDetector< T, bool >::Type equalsIgnoreAsciiCase(T &asciiStr) const
Definition: string.hxx:522
bool isEmpty() const
Checks if a string is empty.
Definition: string.hxx:337
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_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 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.
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.
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.
~OString()
Release the string data.
Definition: string.hxx:257
sal_Int32 reverseCompareTo(const OString &str) const
Compares two strings in reverse order.
Definition: string.hxx:419
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...
OString & operator=(const OString &str)
Assign a new string.
Definition: string.hxx:267
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_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:565
friend internal::CharPtrDetector< T, bool >::Type operator!=(const T &value, const OString &rStr2)
Definition: string.hxx:861
friend internal::CharPtrDetector< T, bool >::Type operator!=(const OString &rStr1, const T &value)
Definition: string.hxx:849
#define RTL_STR_MAX_VALUEOFINT64
Definition: string.h:650
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.
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.
#define sal_True
Definition: types.h:48
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.
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:889
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.
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:1246
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:934
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 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:1142
sal_Bool match(const OString &str, sal_Int32 fromIndex=0) const
Match against a substring appearing in this string.
Definition: string.hxx:586
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.
OString(const sal_Char *value, sal_Int32 length)
New string from a character buffer array.
Definition: string.hxx:204
Definition: stringutils.hxx:87
double toDouble() const
Returns the double value from this string.
Definition: string.hxx:1429
bool matchL(char const *str, sal_Int32 strLength, sal_Int32 fromIndex=0) const
Match against a substring appearing in this string.
Definition: string.hxx:623
sal_Bool toBoolean() const
Returns the Boolean value from this string.
Definition: string.hxx:1328
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.
friend internal::CharPtrDetector< T, bool >::Type operator==(const T &value, const OString &rStr2)
Definition: string.hxx:807
static OString number(float f)
Returns the string representation of the float argument.
Definition: string.hxx:1494
bool endsWith(OString const &str, OString *rest=0) const
Check whether this string ends with a given substring.
Definition: string.hxx:732
friend internal::NonConstCharArrayDetector< T, bool >::Type operator==(T &value, const OString &rStr2)
Definition: string.hxx:813
Definition: stringutils.hxx:67
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:984
sal_Bool operator==(const TTimeValue &rTimeA, const TTimeValue &rTimeB)
Definition: timer.hxx:118
OString getToken(sal_Int32 count, char separator) const
Returns a token from the string.
Definition: string.hxx:1315
size_t operator()(const char *p) const
Definition: string.hxx:1716
OString & operator+=(const OString &str)
Append a string to this string.
Definition: string.hxx:295
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:971
sal_Bool operator>(const TTimeValue &rTimeA, const TTimeValue &rTimeB)
Definition: timer.hxx:108
sal_Int32 hashCode() const
Returns a hashcode for this string.
Definition: string.hxx:901
sal_uInt16 sal_Unicode
Definition: types.h:136
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:1162
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...
OString()
New string containing no characters.
Definition: string.hxx:99
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_toInt32(const sal_Char *str, sal_Int16 radix) SAL_THROW_EXTERN_C()
Interpret a string as an integer.
OString(const T &value, typename internal::CharPtrDetector< T, internal::Dummy >::Type=internal::Dummy())
New string from a character buffer array.
Definition: string.hxx:159
SAL_DLLPUBLIC void rtl_string_acquire(rtl_String *str) SAL_THROW_EXTERN_C()
Increment the reference count of a string.
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:1011
sal_Char toChar() const
Returns the first character from this string.
Definition: string.hxx:1339
#define RTL_STR_MAX_VALUEOFUINT64
Definition: string.h:673
bool operator()(const char *p1, const char *p2) const
Definition: string.hxx:1709
OString(sal_Char value)
New string from a single character.
Definition: string.hxx:144
bool endsWithL(char const *str, sal_Int32 strLength) const
Check whether this string ends with a given substring.
Definition: string.hxx:776
SAL_DLLPUBLIC double rtl_str_toDouble(const sal_Char *str) SAL_THROW_EXTERN_C()
Interpret a string as a double.
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:1450
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:1042
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_compareIgnoreAsciiCase(const sal_Char *first, const sal_Char *second) SAL_THROW_EXTERN_C()
Compare two strings, ignoring the case of ASCII characters.
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:658
SAL_DLLPUBLIC sal_Int32 rtl_str_valueOfDouble(sal_Char *str, double d) SAL_THROW_EXTERN_C()
Create the string representation of a double.
#define SAL_WARN_UNUSED
Annotate classes where a compiler should warn if an instance is unused.
Definition: types.h:591
#define SAL_DEPRECATED(message)
Use as follows: SAL_DEPRECATED("Dont use, its evil.") void doit(int nPara);.
Definition: types.h:479
OString(T &literal, typename internal::ConstCharArrayDetector< T, internal::Dummy >::Type=internal::Dummy())
New string from a string literal.
Definition: string.hxx:183
bool startsWith(OString const &str, OString *rest=0) const
Check whether this string starts with a given substring.
Definition: string.hxx:693
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:1477
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:279
SAL_DLLPUBLIC sal_Int32 rtl_str_compare(const sal_Char *first, const sal_Char *second) SAL_THROW_EXTERN_C()
Compare two strings.
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:1065
internal::ConstCharArrayDetector< T, bool >::Type endsWith(T &literal, OString *rest=0) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: string.hxx:747
sal_uInt32 toUInt32(sal_Int16 radix=10) const
Returns the uint32 value from this string.
Definition: string.hxx:1371
sal_Int32 toInt32(sal_Int16 radix=10) const
Returns the int32 value from this string.
Definition: string.hxx:1354
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.
SAL_DLLPUBLIC sal_Int32 rtl_str_hashCode(const sal_Char *str) SAL_THROW_EXTERN_C()
Return a hash code for a string.
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:1211
friend internal::NonConstCharArrayDetector< T, bool >::Type operator==(const OString &rStr1, T &value)
Definition: string.hxx:801
internal::ConstCharArrayDetector< T, bool >::Type startsWith(T &literal, OString *rest=0) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: string.hxx:707
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:1462
internal::CharPtrDetector< T, bool >::Type equalsIgnoreAsciiCase(const T &asciiStr) const
Perform a ASCII lowercase comparison of two strings.
Definition: string.hxx:516
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:1264
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:1456
OString getToken(sal_Int32 token, sal_Char cTok, sal_Int32 &index) const
Returns a token in the string.
Definition: string.hxx:1295
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.
SAL_DLLPUBLIC void rtl_string_newFromLiteral(rtl_String **newStr, const sal_Char *value, sal_Int32 len, sal_Int32 allocExtra) SAL_THROW_EXTERN_C()
friend OString operator+(const OString &str1, const OString &str2)
Definition: string.hxx:1123
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.
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:533
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.
A helper to use OStrings with hash maps.
Definition: string.hxx:1691
SAL_DLLPUBLIC float rtl_str_toFloat(const sal_Char *str) SAL_THROW_EXTERN_C()
Interpret a string as a float.
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:1468
SAL_DLLPUBLIC void rtl_string_release(rtl_String *str) SAL_THROW_EXTERN_C()
Decrement the reference count of a string.
#define RTL_STR_MAX_VALUEOFDOUBLE
Definition: string.h:711
definition of a no acquire enum for ctors
Definition: types.h:376
This String class provide base functionality for C++ like 8-Bit character array handling.
Definition: string.hxx:89
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.
static OString number(int i, sal_Int16 radix=10)
Returns the string representation of the integer argument.
Definition: string.hxx:1444
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:878
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.
Definition: stringutils.hxx:110
SAL_DLLPUBLIC sal_uInt32 rtl_str_toUInt32(const sal_Char *str, sal_Int16 radix) SAL_THROW_EXTERN_C()
Interpret a string as an unsigned integer.
unsigned char sal_Bool
Definition: types.h:46
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_Int64 toInt64(sal_Int16 radix=10) const
Returns the int64 value from this string.
Definition: string.hxx:1386
OString(const OString &str)
New string from OString.
Definition: string.hxx:110
__sal_NoAcquire
Definition: types.h:372
Hashing functor for classic c-strings (i.e., null-terminated char* strings).
Definition: string.hxx:1714
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 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 OString &rStr1, const T &value)
Definition: string.hxx:795
sal_Bool equalsIgnoreAsciiCaseL(const sal_Char *asciiStr, sal_Int32 asciiStrLength) const
Perform a ASCII lowercase comparison of two strings.
Definition: string.hxx:562
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
friend internal::NonConstCharArrayDetector< T, bool >::Type operator!=(T &value, const OString &rStr2)
Definition: string.hxx:867
#define RTL_STR_MAX_VALUEOFBOOLEAN
Definition: string.h:585
Definition: stringutils.hxx:69
SAL_DLLPUBLIC sal_Int32 rtl_str_valueOfFloat(sal_Char *str, float f) SAL_THROW_EXTERN_C()
Create the string representation of a float.
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.
sal_Bool equals(const OString &str) const
Perform a comparison of two strings.
Definition: string.hxx:436
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.
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:1187
sal_Bool equalsL(const sal_Char *value, sal_Int32 length) const
Perform a comparison of two strings.
Definition: string.hxx:461
#define sal_False
Definition: types.h:47
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:1100
#define SAL_WARN_UNUSED_RESULT
Use this as markup for functions and methods whose return value must be checked.
Definition: types.h:305
sal_Int32 getLength() const
Returns the length of this string.
Definition: string.hxx:327
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:919
char sal_Char
Definition: types.h:124
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:224
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:598
OString(T &value, typename internal::NonConstCharArrayDetector< T, internal::Dummy >::Type=internal::Dummy())
Definition: string.hxx:166
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_Int32 compareTo(const OString &rObj, sal_Int32 maxLength) const
Compares two strings with an maximum count of characters.
Definition: string.hxx:401
SAL_WARN_UNUSED_RESULT OString copy(sal_Int32 beginIndex) const
Returns a new string that is a substring of this string.
Definition: string.hxx:1081
OString(rtl_String *str)
New string from OString data.
Definition: string.hxx:121
sal_Int32 compareTo(const OString &str) const
Compares two strings.
Definition: string.hxx:382
friend internal::NonConstCharArrayDetector< T, bool >::Type operator!=(const OString &rStr1, T &value)
Definition: string.hxx:855
const sal_Char * getStr() const
Returns a pointer to the characters of this string.
Definition: string.hxx:353
sal_uInt16 rtl_TextEncoding
The various supported text encodings.
Definition: textenc.h:39
sal_Bool equalsIgnoreAsciiCase(const OString &str) const
Perform a ASCII lowercase comparison of two strings.
Definition: string.hxx:484
static OString number(double d)
Returns the string representation of the double argument.
Definition: string.hxx:1511
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:839
size_t operator()(const OString &rString) const
Compute a hash code for a string.
Definition: string.hxx:1702
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...
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:671
SAL_DLLPUBLIC sal_Bool rtl_str_toBoolean(const sal_Char *str) SAL_THROW_EXTERN_C()
Interpret a string as a boolean.
static OString boolean(bool b)
Returns the string representation of the boolean argument.
Definition: string.hxx:1546
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.
#define OUSTRING_TO_OSTRING_CVTFLAGS
Definition: string.h:1324
Equality functor for classic c-strings (i.e., null-terminated char* strings).
Definition: string.hxx:1707
SAL_DLLPUBLIC void rtl_string_new(rtl_String **newStr) SAL_THROW_EXTERN_C()
Allocate a new string containing no characters.
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:1229
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:824
#define SAL_THROW(exc)
Definition of function throw clause macros.
Definition: types.h:358
SAL_WARN_UNUSED_RESULT OString concat(const OString &str) const
Concatenates the specified string to the end of this string.
Definition: string.hxx:1115
#define RTL_STR_MAX_VALUEOFFLOAT
Definition: string.h:692
float toFloat() const
Returns the float value from this string.
Definition: string.hxx:1416