20 #ifndef INCLUDED_RTL_STRING_HXX 21 #define INCLUDED_RTL_STRING_HXX 35 #ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING" 36 #include <config_global.h> 42 #ifdef RTL_STRING_UNITTEST 43 extern bool rtl_string_unittest_const_literal;
44 extern bool rtl_string_unittest_const_literal_function;
52 #ifdef RTL_STRING_UNITTEST 53 #define rtl rtlunittest 60 #ifdef RTL_STRING_UNITTEST 63 #define RTL_STRING_CONST_FUNCTION rtl_string_unittest_const_literal_function = true; 65 #define RTL_STRING_CONST_FUNCTION 122 #ifndef _MSC_VER // TODO? 123 #if defined LIBO_INTERNAL_ONLY 181 template<
typename T >
188 template<
typename T >
205 template<
typename T >
220 #ifdef RTL_STRING_UNITTEST 221 rtl_string_unittest_const_literal =
true;
260 throw std::bad_alloc();
264 #ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING" 269 template<
typename T1,
typename T2 >
270 OString(
const OStringConcat< T1, T2 >& c )
272 const sal_Int32 l = c.length();
276 char* end = c.addData( pData->buffer );
283 #ifdef LIBO_INTERNAL_ONLY 284 OString(std::nullptr_t) =
delete;
306 #ifndef _MSC_VER // TODO? 307 #if defined LIBO_INTERNAL_ONLY 330 template<
typename T >
333 RTL_STRING_CONST_FUNCTION
354 #if defined LIBO_INTERNAL_ONLY && HAVE_CXX11_REF_QUALIFIER 361 #if defined LIBO_INTERNAL_ONLY && HAVE_CXX11_REF_QUALIFIER 362 void operator+=(
OString const &) && =
delete;
365 #ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING" 370 template<
typename T1,
typename T2 >
371 OString& operator+=(
const OStringConcat< T1, T2 >& c )
372 #if HAVE_CXX11_REF_QUALIFIER 376 sal_Int32 l = c.length();
381 char* end = c.addData( pData->buffer + pData->length );
386 #if HAVE_CXX11_REF_QUALIFIER 387 template<
typename T1,
typename T2>
void operator +=(
388 OStringConcat<T1, T2>
const &) && =
delete;
421 return pData->length == 0;
448 assert(index >= 0 && static_cast<sal_uInt32>(index) < static_cast<sal_uInt32>(getLength()));
449 return getStr()[index];
467 str.pData->buffer, str.pData->length );
486 rObj.pData->buffer, rObj.pData->length, maxLength );
504 str.pData->buffer, str.pData->length );
520 if ( pData->length != str.pData->length )
522 if ( pData == str.pData )
525 str.pData->buffer, str.pData->length ) == 0;
545 if ( pData->length != length )
549 value, length ) == 0;
568 if ( pData->length != str.pData->length )
570 if ( pData == str.pData )
573 str.pData->buffer, str.pData->length ) == 0;
597 template<
typename T >
603 template<
typename T >
614 template<
typename T >
617 RTL_STRING_CONST_FUNCTION
624 pData->buffer, pData->length,
652 if ( pData->length != asciiStrLength )
656 asciiStr, asciiStrLength ) == 0;
677 str.pData->buffer, str.pData->length, str.pData->length ) == 0;
685 template<
typename T >
688 RTL_STRING_CONST_FUNCTION
693 pData->buffer + fromIndex, pData->length - fromIndex,
718 char const * str, sal_Int32 strLength, sal_Int32 fromIndex = 0)
722 pData->buffer + fromIndex, pData->length - fromIndex,
723 str, strLength, strLength) == 0;
730 #if SAL_TYPES_SIZEOFLONG == 8 755 str.pData->buffer, str.pData->length,
756 str.pData->length ) == 0;
764 template<
typename T >
767 RTL_STRING_CONST_FUNCTION
772 pData->buffer+fromIndex, pData->length-fromIndex,
796 if (b && rest != NULL) {
807 template<
typename T >
809 T & literal,
OString * rest = NULL)
const 811 RTL_STRING_CONST_FUNCTION
812 bool b = match(literal, 0);
813 if (b && rest != NULL) {
842 bool b = matchIgnoreAsciiCase(str);
843 if (b && rest != NULL) {
854 template<
typename T >
858 RTL_STRING_CONST_FUNCTION
861 bool b = matchIgnoreAsciiCase(literal);
862 if (b && rest != NULL) {
885 && match(str, getLength() - str.
getLength());
886 if (b && rest != NULL) {
887 *rest = copy(0, getLength() - str.
getLength());
897 template<
typename T >
899 T & literal,
OString * rest = NULL)
const 901 RTL_STRING_CONST_FUNCTION
906 <= sal_uInt32(getLength()))
912 if (b && rest != NULL) {
934 bool endsWithL(
char const * str, sal_Int32 strLength)
const {
935 return strLength <= getLength()
936 && matchL(str, strLength, getLength() - strLength);
940 {
return rStr1.
equals(rStr2); }
948 {
return rStr1.
compareTo( rStr2 ) <= 0; }
950 {
return rStr1.
compareTo( rStr2 ) >= 0; }
952 template<
typename T >
958 template<
typename T >
964 template<
typename T >
970 template<
typename T >
981 template<
typename T >
984 RTL_STRING_CONST_FUNCTION
991 rStr.pData->buffer, rStr.pData->length,
1003 template<
typename T >
1006 RTL_STRING_CONST_FUNCTION
1013 rStr.pData->buffer, rStr.pData->length,
1020 template<
typename T >
1026 template<
typename T >
1032 template<
typename T >
1038 template<
typename T >
1049 template<
typename T >
1052 return !( rStr == literal );
1060 template<
typename T >
1063 return !( literal == rStr );
1094 return (ret < 0 ? ret : ret+fromIndex);
1146 str.pData->buffer, str.pData->length );
1147 return (ret < 0 ? ret : ret+fromIndex);
1155 template<
typename T >
1158 RTL_STRING_CONST_FUNCTION
1162 pData->buffer + fromIndex, pData->length - fromIndex,
1165 return n < 0 ? n : n + fromIndex;
1186 sal_Int32
indexOfL(
char const * str, sal_Int32 len, sal_Int32 fromIndex = 0)
1190 pData->buffer + fromIndex, pData->length - fromIndex, str, len);
1191 return n < 0 ? n : n + fromIndex;
1198 #if SAL_TYPES_SIZEOFLONG == 8 1220 str.pData->buffer, str.pData->length );
1243 str.pData->buffer, str.pData->length );
1258 rtl_String *pNew = NULL;
1277 rtl_String *pNew = NULL;
1292 rtl_String* pNew = NULL;
1297 #ifndef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING" 1300 return str1.
concat( str2 );
1319 rtl_String* pNew = NULL;
1339 rtl_String* pNew = NULL;
1363 OString const & from,
OString const & to, sal_Int32 * index = NULL)
const 1365 rtl_String * s = NULL;
1368 &s, pData, from.pData->buffer, from.pData->length,
1369 to.pData->buffer, to.pData->length, index == NULL ? &i : index);
1387 rtl_String * s = NULL;
1389 &s, pData, from.pData->buffer, from.pData->length,
1390 to.pData->buffer, to.pData->length);
1406 rtl_String* pNew = NULL;
1423 rtl_String* pNew = NULL;
1441 rtl_String* pNew = NULL;
1472 rtl_String * pNew = NULL;
1492 return getToken(count, separator, n);
1516 return pData->buffer[0];
1621 return number( static_cast< long long >( i ), radix );
1627 return number( static_cast< unsigned long long >( i ), radix );
1633 return number( static_cast< long long >( i ), radix );
1639 return number( static_cast< unsigned long long >( i ), radix );
1646 rtl_String* pNewData = NULL;
1655 rtl_String* pNewData = NULL;
1672 rtl_String* pNewData = NULL;
1689 rtl_String* pNewData = NULL;
1724 rtl_String* pNewData = NULL;
1753 return number( i, radix );
1768 return number( ll, radix );
1803 #ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING" 1815 explicit OStringLiteral(
const char (&str)[ N ] ) : size( N - 1 ), data( str ) { assert( strlen( str ) == N - 1 ); }
1824 struct ToStringHelper< OString >
1826 static int length(
const OString& s ) {
return s.
getLength(); }
1827 static char* addData(
char* buffer,
const OString& s ) {
return addDataHelper( buffer, s.
getStr(), s.
getLength()); }
1828 static const bool allowOStringConcat =
true;
1829 static const bool allowOUStringConcat =
false;
1836 struct ToStringHelper< OStringLiteral >
1838 static int length(
const OStringLiteral& str ) {
return str.size; }
1839 static char* addData(
char* buffer,
const OStringLiteral& str ) {
return addDataHelper( buffer, str.data, str.size ); }
1840 static const bool allowOStringConcat =
true;
1841 static const bool allowOUStringConcat =
false;
1847 template<
typename charT,
typename traits,
typename T1,
typename T2 >
1848 inline std::basic_ostream<charT, traits> &
operator <<(
1849 std::basic_ostream<charT, traits> & stream,
const OStringConcat< T1, T2 >& concat)
1851 return stream << OString( concat );
1873 {
return (
size_t)rString.
hashCode(); }
1898 template<
typename charT,
typename traits > std::basic_ostream<charT, traits> &
1900 std::basic_ostream<charT, traits> & stream, OString
const & rString)
1902 return stream << rString.
getStr();
1908 #ifdef RTL_STRING_UNITTEST 1911 typedef rtlunittest::OString
OString;
1913 #undef RTL_STRING_CONST_FUNCTION 1916 #if defined LIBO_INTERNAL_ONLY && !defined RTL_STRING_UNITTEST 1917 using ::rtl::OString;
1918 using ::rtl::OStringHash;
1919 using ::rtl::OStringLiteral;
1922 #endif // INCLUDED_RTL_STRING_HXX bool equalsIgnoreAsciiCaseL(const sal_Char *asciiStr, sal_Int32 asciiStrLength) const
Perform a ASCII lowercase comparison of two strings.
Definition: string.hxx:650
#define OUSTRING_TO_OSTRING_CVTFLAGS
Definition: string.h:1324
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:1106
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.
libreoffice_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:331
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:1421
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_WARN_UNUSED_RESULT OString copy(sal_Int32 beginIndex) const
Returns a new string that is a substring of this string.
Definition: string.hxx:1256
SAL_DLLPUBLIC sal_Int32 rtl_str_hashCode(const sal_Char *str) SAL_THROW_EXTERN_C()
Return a hash code for a string.
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:1643
libreoffice_internal::ConstCharArrayDetector< T, bool >::Type match(T &literal, sal_Int32 fromIndex=0) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: string.hxx:686
libreoffice_internal::NonConstCharArrayDetector< T, bool >::Type equalsIgnoreAsciiCase(T &asciiStr) const
Definition: string.hxx:604
sal_uInt16 rtl_TextEncoding
The various supported text encodings.
Definition: textenc.h:39
Definition: stringutils.hxx:135
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:1631
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_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:1217
static OString boolean(bool b)
Returns the string representation of the boolean argument.
Definition: string.hxx:1721
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:1637
#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.
OString(const T &value, typename libreoffice_internal::CharPtrDetector< T, libreoffice_internal::Dummy >::Type=libreoffice_internal::Dummy())
New string from a character buffer array.
Definition: string.hxx:182
#define RTL_STR_MAX_VALUEOFUINT64
Definition: string.h:673
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:1091
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 libreoffice_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:1050
Definition: stringutils.hxx:158
#define RTL_STR_MAX_VALUEOFINT64
Definition: string.h:650
sal_Int32 compareTo(const OString &rObj, sal_Int32 maxLength) const
Compares two strings with an maximum count of characters.
Definition: string.hxx:483
~OString()
Release the string data.
Definition: string.hxx:290
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 void rtl_string_newFromLiteral(rtl_String **newStr, const sal_Char *value, sal_Int32 len, sal_Int32 allocExtra) SAL_THROW_EXTERN_C()
size_t operator()(const OString &rString) const
Compute a hash code for a string.
Definition: string.hxx:1872
SAL_DLLPUBLIC sal_Int32 rtl_str_compare(const sal_Char *first, const sal_Char *second) SAL_THROW_EXTERN_C()
Compare two strings.
sal_Int32 toInt32(sal_Int16 radix=10) const
Returns the int32 value from this string.
Definition: string.hxx:1529
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:1404
friend libreoffice_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:982
bool match(const OString &str, sal_Int32 fromIndex=0) const
Match against a substring appearing in this string.
Definition: string.hxx:674
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.
OString getToken(sal_Int32 count, char separator) const
Returns a token from the string.
Definition: string.hxx:1490
OString(T &literal, typename libreoffice_internal::ConstCharArrayDetector< T, libreoffice_internal::Dummy >::Type=libreoffice_internal::Dummy())
New string from a string literal.
Definition: string.hxx:206
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:1275
bool startsWithIgnoreAsciiCase(OString const &str, OString *rest=NULL) const
Check whether this string starts with a given string, ignoring the case of ASCII letters.
Definition: string.hxx:839
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:1625
static OString number(float f)
Returns the string representation of the float argument.
Definition: string.hxx:1669
const sal_Char * getStr() const
Returns a pointer to the characters of this string.
Definition: string.hxx:435
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 float rtl_str_toFloat(const sal_Char *str) SAL_THROW_EXTERN_C()
Interpret a string as a float.
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_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...
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:1186
SAL_DLLPUBLIC void rtl_string_new(rtl_String **newStr) SAL_THROW_EXTERN_C()
Allocate a new string containing no characters.
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:1143
#define SAL_DEPRECATED(message)
Use as follows: SAL_DEPRECATED("Don't use, it's evil.") void doit(int nPara);.
Definition: types.h:483
#define SAL_WARN_UNUSED
Annotate classes where a compiler should warn if an instance is unused.
Definition: types.h:598
OString(rtl_String *str)
New string from OString data.
Definition: string.hxx:144
void clear()
Clears the string, i.e, makes a zero-character string.
Definition: string.hxx:396
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.
libreoffice_internal::ConstCharArrayDetector< T, sal_Int32 >::Type indexOf(T &literal, sal_Int32 fromIndex=0) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: string.hxx:1156
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.
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_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_hashCode_WithLength(const sal_Char *str, sal_Int32 len) SAL_THROW_EXTERN_C()
Return a hash code for a string.
float toFloat() const
Returns the float value from this string.
Definition: string.hxx:1591
OString & operator=(const OString &str)
Assign a new string.
Definition: string.hxx:300
OString(sal_Char value)
New string from a single character.
Definition: string.hxx:167
friend libreoffice_internal::CharPtrDetector< T, bool >::Type operator!=(const OString &rStr1, const T &value)
Definition: string.hxx:1021
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_Int32 reverseCompareTo(const OString &str) const
Compares two strings in reverse order.
Definition: string.hxx:501
sal_Char toChar() const
Returns the first character from this string.
Definition: string.hxx:1514
libreoffice_internal::ConstCharArrayDetector< T, bool >::Type endsWith(T &literal, OString *rest=NULL) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: string.hxx:898
sal_uInt32 toUInt32(sal_Int16 radix=10) const
Returns the uint32 value from this string.
Definition: string.hxx:1546
friend libreoffice_internal::NonConstCharArrayDetector< T, bool >::Type operator!=(T &value, const OString &rStr2)
Definition: string.hxx:1039
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_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 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.
This String class provide base functionality for C++ like 8-Bit character array handling.
Definition: string.hxx:95
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
bool operator<(const TTimeValue &rTimeA, const TTimeValue &rTimeB)
Definition: timer.hxx:96
sal_uInt16 sal_Unicode
Definition: types.h:142
libreoffice_internal::ConstCharArrayDetector< T, bool >::Type startsWithIgnoreAsciiCase(T &literal, OString *rest=NULL) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: string.hxx:856
libreoffice_internal::ConstCharArrayDetector< T, bool >::Type startsWith(T &literal, OString *rest=NULL) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: string.hxx:808
unsigned char sal_Bool
Definition: types.h:39
#define RTL_STR_MAX_VALUEOFBOOLEAN
Definition: string.h:585
__sal_NoAcquire
Definition: types.h:366
friend libreoffice_internal::NonConstCharArrayDetector< T, bool >::Type operator==(const OString &rStr1, T &value)
Definition: string.hxx:959
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:1317
libreoffice_internal::ConstCharArrayDetector< T, bool >::Type equalsIgnoreAsciiCase(T &literal) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: string.hxx:615
friend OString operator+(const OString &str1, const OString &str2)
Definition: string.hxx:1298
bool equalsIgnoreAsciiCase(const OString &str) const
Perform a ASCII lowercase comparison of two strings.
Definition: string.hxx:566
bool toBoolean() const
Returns the Boolean value from this string.
Definition: string.hxx:1503
bool endsWith(OString const &str, OString *rest=NULL) const
Check whether this string ends with a given substring.
Definition: string.hxx:883
Definition: stringutils.hxx:117
sal_Int64 toInt64(sal_Int16 radix=10) const
Returns the int64 value from this string.
Definition: string.hxx:1561
friend libreoffice_internal::CharPtrDetector< T, bool >::Type operator==(const T &value, const OString &rStr2)
Definition: string.hxx:965
friend libreoffice_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:1004
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_WARN_UNUSED_RESULT OString concat(const OString &str) const
Concatenates the specified string to the end of this string.
Definition: string.hxx:1290
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...
libreoffice_internal::ConstCharArrayDetector< T, bool >::Type matchIgnoreAsciiCase(T &literal, sal_Int32 fromIndex=0) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: string.hxx:765
bool operator()(const char *p1, const char *p2) const
Definition: string.hxx:1879
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_WARN_UNUSED_RESULT OString trim() const
Returns a new string resulting from removing white space from both ends of the string.
Definition: string.hxx:1439
friend libreoffice_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:1061
size_t operator()(const char *p) const
Definition: string.hxx:1886
bool matchL(char const *str, sal_Int32 strLength, sal_Int32 fromIndex=0) const
Match against a substring appearing in this string.
Definition: string.hxx:717
friend libreoffice_internal::CharPtrDetector< T, bool >::Type operator!=(const T &value, const OString &rStr2)
Definition: string.hxx:1033
sal_Int32 hashCode() const
Returns a hashcode for this string.
Definition: string.hxx:1073
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.
friend libreoffice_internal::NonConstCharArrayDetector< T, bool >::Type operator==(T &value, const OString &rStr2)
Definition: string.hxx:971
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:752
bool operator==(const TTimeValue &rTimeA, const TTimeValue &rTimeB)
Definition: timer.hxx:116
SAL_DLLPUBLIC sal_Int32 rtl_str_valueOfBoolean(sal_Char *str, sal_Bool b) SAL_THROW_EXTERN_C()
Create the string representation of a boolean.
OString(const OString &str)
New string from OString.
Definition: string.hxx:116
OString()
New string containing no characters.
Definition: string.hxx:105
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...
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:633
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.
definition of a no acquire enum for ctors
Definition: types.h:370
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_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 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:1337
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:253
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:1123
Equality functor for classic c-strings (i.e., null-terminated char* strings).
Definition: string.hxx:1877
SAL_DLLPUBLIC sal_Bool rtl_str_toBoolean(const sal_Char *str) SAL_THROW_EXTERN_C()
Interpret a string as a boolean.
OString & operator+=(const OString &str)
Append a string to this string.
Definition: string.hxx:353
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.
OString(T &value, typename libreoffice_internal::NonConstCharArrayDetector< T, libreoffice_internal::Dummy >::Type=libreoffice_internal::Dummy())
Definition: string.hxx:189
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.
std::basic_ostream< charT, traits > & operator<<(std::basic_ostream< charT, traits > &stream, OString const &rString)
Support for rtl::OString in std::ostream (and thus in CPPUNIT_ASSERT or SAL_INFO macros, for example).
Definition: string.hxx:1899
#define SAL_WARN_UNUSED_RESULT
Use this as markup for functions and methods whose return value must be checked.
Definition: types.h:307
char sal_Char
A legacy synonym for char.
Definition: types.h:121
libreoffice_internal::CharPtrDetector< T, bool >::Type equalsIgnoreAsciiCase(const T &asciiStr) const
Perform a ASCII lowercase comparison of two strings.
Definition: string.hxx:598
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...
bool operator>(const TTimeValue &rTimeA, const TTimeValue &rTimeB)
Definition: timer.hxx:106
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.
friend libreoffice_internal::NonConstCharArrayDetector< T, bool >::Type operator!=(const OString &rStr1, T &value)
Definition: string.hxx:1027
static OString number(double d)
Returns the string representation of the double argument.
Definition: string.hxx:1686
SAL_DLLPUBLIC void rtl_string_acquire(rtl_String *str) SAL_THROW_EXTERN_C()
Increment the reference count of a string.
Definition: stringutils.hxx:115
bool equals(const OString &str) const
Perform a comparison of two strings.
Definition: string.hxx:518
SAL_DLLPUBLIC sal_Int32 rtl_str_valueOfFloat(sal_Char *str, float f) SAL_THROW_EXTERN_C()
Create the string representation of a float.
A helper to use OStrings with hash maps.
Definition: string.hxx:1861
OString getToken(sal_Int32 token, sal_Char cTok, sal_Int32 &index) const
Returns a token in the string.
Definition: string.hxx:1470
SAL_DLLPUBLIC sal_Int32 rtl_str_valueOfDouble(sal_Char *str, double d) SAL_THROW_EXTERN_C()
Create the string representation of a double.
sal_Int32 getLength() const
Returns the length of this string.
Definition: string.hxx:409
Definition: bootstrap.hxx:29
static OString number(int i, sal_Int16 radix=10)
Returns the string representation of the integer argument.
Definition: string.hxx:1619
bool endsWithL(char const *str, sal_Int32 strLength) const
Check whether this string ends with a given substring.
Definition: string.hxx:934
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:1386
sal_uInt64 toUInt64(sal_Int16 radix=10) const
Returns the uint64 value from this string.
Definition: string.hxx:1578
friend libreoffice_internal::CharPtrDetector< T, bool >::Type operator==(const OString &rStr1, const T &value)
Definition: string.hxx:953
bool isEmpty() const
Checks if a string is empty.
Definition: string.hxx:419
SAL_DLLPUBLIC sal_Int32 rtl_str_toInt32(const sal_Char *str, sal_Int16 radix) SAL_THROW_EXTERN_C()
Interpret a string as an integer.
sal_Int32 compareTo(const OString &str) const
Compares two strings.
Definition: string.hxx:464
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:1240
double toDouble() const
Returns the double value from this string.
Definition: string.hxx:1604
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.
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:1652
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...
Hashing functor for classic c-strings (i.e., null-terminated char* strings).
Definition: string.hxx:1884
SAL_WARN_UNUSED_RESULT OString replaceFirst(OString const &from, OString const &to, sal_Int32 *index=NULL) const
Returns a new string resulting from replacing the first occurrence of a given substring with another ...
Definition: string.hxx:1362
bool startsWith(OString const &str, OString *rest=NULL) const
Check whether this string starts with a given substring.
Definition: string.hxx:794
OString(const sal_Char *value, sal_Int32 length)
New string from a character buffer array.
Definition: string.hxx:233
bool equalsL(const sal_Char *value, sal_Int32 length) const
Perform a comparison of two strings.
Definition: string.hxx:543
OString(rtl_String *str, __sal_NoAcquire)
New string from OString data without acquiring it.
Definition: string.hxx:157