LibreOffice
LibreOffice 6.2 SDK C/C++ API Reference
|
Go to the documentation of this file.
20 #ifndef INCLUDED_RTL_STRING_HXX
21 #define INCLUDED_RTL_STRING_HXX
35 #ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
39 #ifdef RTL_STRING_UNITTEST
40 extern bool rtl_string_unittest_const_literal;
41 extern bool rtl_string_unittest_const_literal_function;
49 #ifdef RTL_STRING_UNITTEST
50 #define rtl rtlunittest
57 #ifdef RTL_STRING_UNITTEST
60 #define RTL_STRING_CONST_FUNCTION rtl_string_unittest_const_literal_function = true;
62 #define RTL_STRING_CONST_FUNCTION
119 #ifndef _MSC_VER // TODO?
120 #if defined LIBO_INTERNAL_ONLY
178 template<
typename T >
185 template<
typename T >
202 template<
typename T >
217 #ifdef RTL_STRING_UNITTEST
218 rtl_string_unittest_const_literal =
true;
257 throw std::bad_alloc();
261 #ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
266 template<
typename T1,
typename T2 >
267 OString( OStringConcat< T1, T2 >&& c )
269 const sal_Int32 l = c.length();
273 char* end = c.addData( pData->buffer );
280 #ifdef LIBO_INTERNAL_ONLY
281 OString(std::nullptr_t) =
delete;
303 #ifndef _MSC_VER // TODO?
304 #if defined LIBO_INTERNAL_ONLY
327 template<
typename T >
330 RTL_STRING_CONST_FUNCTION
351 #if defined LIBO_INTERNAL_ONLY
358 #if defined LIBO_INTERNAL_ONLY
359 void operator+=(
OString const &) && =
delete;
362 #ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
367 template<
typename T1,
typename T2 >
368 OString& operator+=( OStringConcat< T1, T2 >&& c ) & {
369 sal_Int32 l = c.length();
374 char* end = c.addData( pData->buffer + pData->length );
379 template<
typename T1,
typename T2>
void operator +=(
380 OStringConcat<T1, T2> &&) && =
delete;
412 return pData->length == 0;
439 assert(index >= 0 &&
static_cast<sal_uInt32
>(index) <
static_cast<sal_uInt32
>(getLength()));
440 return getStr()[index];
458 str.pData->buffer, str.pData->length );
477 rObj.pData->buffer, rObj.pData->length, maxLength );
495 str.pData->buffer, str.pData->length );
511 if ( pData->length != str.pData->length )
513 if ( pData == str.pData )
516 str.pData->buffer, str.pData->length ) == 0;
536 if ( pData->length != length )
540 value, length ) == 0;
559 if ( pData->length != str.pData->length )
561 if ( pData == str.pData )
564 str.pData->buffer, str.pData->length ) == 0;
588 template<
typename T >
594 template<
typename T >
605 template<
typename T >
608 RTL_STRING_CONST_FUNCTION
615 pData->buffer, pData->length,
643 if ( pData->length != asciiStrLength )
647 asciiStr, asciiStrLength ) == 0;
668 str.pData->buffer, str.pData->length, str.pData->length ) == 0;
676 template<
typename T >
679 RTL_STRING_CONST_FUNCTION
684 pData->buffer + fromIndex, pData->length - fromIndex,
709 char const * str, sal_Int32 strLength, sal_Int32 fromIndex = 0)
713 pData->buffer + fromIndex, pData->length - fromIndex,
714 str, strLength, strLength) == 0;
721 #if SAL_TYPES_SIZEOFLONG == 8
746 str.pData->buffer, str.pData->length,
747 str.pData->length ) == 0;
755 template<
typename T >
758 RTL_STRING_CONST_FUNCTION
763 pData->buffer+fromIndex, pData->length-fromIndex,
787 if (b && rest != NULL) {
798 template<
typename T >
800 T & literal,
OString * rest = NULL)
const
802 RTL_STRING_CONST_FUNCTION
803 bool b = match(literal, 0);
804 if (b && rest != NULL) {
833 bool b = matchIgnoreAsciiCase(str);
834 if (b && rest != NULL) {
845 template<
typename T >
849 RTL_STRING_CONST_FUNCTION
852 bool b = matchIgnoreAsciiCase(literal);
853 if (b && rest != NULL) {
876 && match(str, getLength() - str.
getLength());
877 if (b && rest != NULL) {
878 *rest = copy(0, getLength() - str.
getLength());
888 template<
typename T >
890 T & literal,
OString * rest = NULL)
const
892 RTL_STRING_CONST_FUNCTION
897 <= sal_uInt32(getLength()))
903 if (b && rest != NULL) {
925 bool endsWithL(
char const * str, sal_Int32 strLength)
const {
926 return strLength <= getLength()
927 && matchL(str, strLength, getLength() - strLength);
931 {
return rStr1.
equals(rStr2); }
939 {
return rStr1.
compareTo( rStr2 ) <= 0; }
941 {
return rStr1.
compareTo( rStr2 ) >= 0; }
943 template<
typename T >
949 template<
typename T >
955 template<
typename T >
961 template<
typename T >
972 template<
typename T >
975 RTL_STRING_CONST_FUNCTION
982 rStr.pData->buffer, rStr.pData->length,
994 template<
typename T >
997 RTL_STRING_CONST_FUNCTION
1004 rStr.pData->buffer, rStr.pData->length,
1011 template<
typename T >
1017 template<
typename T >
1023 template<
typename T >
1029 template<
typename T >
1040 template<
typename T >
1043 return !( rStr == literal );
1051 template<
typename T >
1054 return !( literal == rStr );
1085 return (ret < 0 ? ret : ret+fromIndex);
1137 str.pData->buffer, str.pData->length );
1138 return (ret < 0 ? ret : ret+fromIndex);
1146 template<
typename T >
1149 RTL_STRING_CONST_FUNCTION
1153 pData->buffer + fromIndex, pData->length - fromIndex,
1156 return n < 0 ? n : n + fromIndex;
1177 sal_Int32
indexOfL(
char const * str, sal_Int32 len, sal_Int32 fromIndex = 0)
1181 pData->buffer + fromIndex, pData->length - fromIndex, str, len);
1182 return n < 0 ? n : n + fromIndex;
1189 #if SAL_TYPES_SIZEOFLONG == 8
1211 str.pData->buffer, str.pData->length );
1234 str.pData->buffer, str.pData->length );
1249 rtl_String *pNew = NULL;
1268 rtl_String *pNew = NULL;
1283 rtl_String* pNew = NULL;
1288 #ifndef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
1291 return str1.
concat( str2 );
1310 rtl_String* pNew = NULL;
1330 rtl_String* pNew = NULL;
1354 OString const & from,
OString const & to, sal_Int32 * index = NULL)
const
1356 rtl_String * s = NULL;
1359 &s, pData, from.pData->buffer, from.pData->length,
1360 to.pData->buffer, to.pData->length, index == NULL ? &i : index);
1378 rtl_String * s = NULL;
1380 &s, pData, from.pData->buffer, from.pData->length,
1381 to.pData->buffer, to.pData->length);
1397 rtl_String* pNew = NULL;
1414 rtl_String* pNew = NULL;
1432 rtl_String* pNew = NULL;
1463 rtl_String * pNew = NULL;
1483 return getToken(count, separator, n);
1507 return pData->buffer[0];
1612 return number(
static_cast< long long >( i ), radix );
1618 return number(
static_cast< unsigned long long >( i ), radix );
1624 return number(
static_cast< long long >( i ), radix );
1630 return number(
static_cast< unsigned long long >( i ), radix );
1637 rtl_String* pNewData = NULL;
1646 rtl_String* pNewData = NULL;
1663 rtl_String* pNewData = NULL;
1680 rtl_String* pNewData = NULL;
1715 rtl_String* pNewData = NULL;
1744 return number( i, radix );
1759 return number( ll, radix );
1794 #ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
1806 explicit OStringLiteral(
const char (&str)[ N ] ) : size( N - 1 ), data( str ) { assert( strlen( str ) == N - 1 ); }
1807 #if defined __cpp_char8_t
1809 explicit OStringLiteral(
const char8_t (&str)[ N ] ) : size( N - 1 ), data( reinterpret_cast<char const *>(str) ) { assert( strlen( data ) == N - 1 ); }
1819 struct ToStringHelper< OString >
1821 static int length(
const OString& s ) {
return s.getLength(); }
1822 static char* addData(
char* buffer,
const OString& s ) {
return addDataHelper( buffer, s.getStr(), s.getLength()); }
1823 static const bool allowOStringConcat =
true;
1824 static const bool allowOUStringConcat =
false;
1831 struct ToStringHelper< OStringLiteral >
1833 static int length(
const OStringLiteral& str ) {
return str.size; }
1834 static char* addData(
char* buffer,
const OStringLiteral& str ) {
return addDataHelper( buffer, str.data, str.size ); }
1835 static const bool allowOStringConcat =
true;
1836 static const bool allowOUStringConcat =
false;
1842 template<
typename charT,
typename traits,
typename T1,
typename T2 >
1843 inline std::basic_ostream<charT, traits> &
operator <<(
1844 std::basic_ostream<charT, traits> & stream, OStringConcat< T1, T2 >&& concat)
1846 return stream << OString( std::move(concat) );
1868 {
return static_cast<size_t>(rString.
hashCode()); }
1893 template<
typename charT,
typename traits > std::basic_ostream<charT, traits> &
1895 std::basic_ostream<charT, traits> & stream,
OString const & rString)
1897 return stream << rString.
getStr();
1903 #ifdef RTL_STRING_UNITTEST
1906 typedef rtlunittest::OString OString;
1908 #undef RTL_STRING_CONST_FUNCTION
1911 #if defined LIBO_INTERNAL_ONLY && !defined RTL_STRING_UNITTEST
1912 using ::rtl::OString;
1913 using ::rtl::OStringHash;
1914 using ::rtl::OStringLiteral;
1923 #if defined LIBO_INTERNAL_ONLY
1930 {
return std::size_t(s.
hashCode()); }
1938 #endif // INCLUDED_RTL_STRING_HXX
sal_Int32 reverseCompareTo(const OString &str) const
Compares two strings in reverse order.
Definition: string.hxx:492
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_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.
bool equalsL(const sal_Char *value, sal_Int32 length) const
Perform a comparison of two strings.
Definition: string.hxx:534
char sal_Char
A legacy synonym for char.
Definition: types.h:120
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:1634
OString getToken(sal_Int32 token, sal_Char cTok, sal_Int32 &index) const
Returns a token in the string.
Definition: string.hxx:1461
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.
Definition: stringutils.hxx:138
libreoffice_internal::NonConstCharArrayDetector< T, bool >::Type equalsIgnoreAsciiCase(T &asciiStr) const
Definition: string.hxx:595
sal_uInt64 toUInt64(sal_Int16 radix=10) const
Returns the uint64 value from this string.
Definition: string.hxx:1569
static OString number(float f)
Returns the string representation of the float argument.
Definition: string.hxx:1660
OString()
New string containing no characters.
Definition: string.hxx:102
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_Int32 lastIndexOf(const OString &str, sal_Int32 fromIndex) const
Returns the index within this string of the last occurrence of the specified substring,...
Definition: string.hxx:1231
friend libreoffice_internal::NonConstCharArrayDetector< T, bool >::Type operator==(const OString &rStr1, T &value)
Definition: string.hxx:950
OString(T &literal, typename libreoffice_internal::ConstCharArrayDetector< T, libreoffice_internal::Dummy >::Type=libreoffice_internal::Dummy())
New string from a string literal.
Definition: string.hxx:203
std::basic_ostream< charT, traits > & operator<<(std::basic_ostream< charT, traits > &stream, OString const &rString)
Support for rtl::OString in std::ostream (and thus in CPPUNIT_ASSERT or SAL_INFO macros,...
Definition: string.hxx:1894
sal_Int32 lastIndexOf(sal_Char ch, sal_Int32 fromIndex) const
Returns the index within this string of the last occurrence of the specified character,...
Definition: string.hxx:1114
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:1616
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(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:250
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:645
bool endsWith(OString const &str, OString *rest=NULL) const
Check whether this string ends with a given substring.
Definition: string.hxx:874
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_uInt16 rtl_TextEncoding
The various supported text encodings.
Definition: textenc.h:33
@ SAL_NO_ACQUIRE
definition of a no acquire enum for ctors
Definition: types.h:374
OString & operator+=(const OString &str)
Append a string to this string.
Definition: string.hxx:350
#define RTL_STR_MAX_VALUEOFDOUBLE
Definition: string.h:711
SAL_DLLPUBLIC void rtl_string_acquire(rtl_String *str) SAL_THROW_EXTERN_C()
Increment the reference count of a string.
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.
OString(rtl_String *str)
New string from OString data.
Definition: string.hxx:141
libreoffice_internal::CharPtrDetector< T, bool >::Type equalsIgnoreAsciiCase(const T &asciiStr) const
Perform a ASCII lowercase comparison of two strings.
Definition: string.hxx:589
#define RTL_STR_MAX_VALUEOFFLOAT
Definition: string.h:692
sal_Int32 toInt32(sal_Int16 radix=10) const
Returns the int32 value from this string.
Definition: string.hxx:1520
SAL_DLLPUBLIC void rtl_string_assign(rtl_String **str, rtl_String *rightValue) SAL_THROW_EXTERN_C()
Assign a new value to a string.
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.
friend libreoffice_internal::NonConstCharArrayDetector< T, bool >::Type operator!=(T &value, const OString &rStr2)
Definition: string.hxx:1030
#define RTL_STR_MAX_VALUEOFUINT64
Definition: string.h:673
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:1643
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 libreoffice_internal::NonConstCharArrayDetector< T, bool >::Type operator!=(const OString &rStr1, T &value)
Definition: string.hxx:1018
OString(sal_Char value)
New string from a single character.
Definition: string.hxx:164
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:1052
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.
size_t operator()(const OString &rString) const
Compute a hash code for a string.
Definition: string.hxx:1867
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.
bool equalsIgnoreAsciiCaseL(const sal_Char *asciiStr, sal_Int32 asciiStrLength) const
Perform a ASCII lowercase comparison of two strings.
Definition: string.hxx:641
SAL_DLLPUBLIC void rtl_string_new(rtl_String **newStr) SAL_THROW_EXTERN_C()
Allocate a new string containing no characters.
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:847
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.
#define SAL_WARN_UNUSED
Annotate classes where a compiler should warn if an instance is unused.
Definition: types.h:590
OString getToken(sal_Int32 count, char separator) const
Returns a token from the string.
Definition: string.hxx:1481
sal_Int32 getLength() const
Returns the length of this string.
Definition: string.hxx:400
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:1308
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:1328
friend libreoffice_internal::CharPtrDetector< T, bool >::Type operator==(const T &value, const OString &rStr2)
Definition: string.hxx:956
#define OUSTRING_TO_OSTRING_CVTFLAGS
Definition: string.h:1325
Definition: stringutils.hxx:161
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.
void clear()
Clears the string, i.e, makes a zero-character string.
Definition: string.hxx:387
bool isEmpty() const
Checks if a string is empty.
Definition: string.hxx:410
sal_Int32 compareTo(const OString &str) const
Compares two strings.
Definition: string.hxx:455
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:1622
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:995
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.
bool equalsIgnoreAsciiCase(const OString &str) const
Perform a ASCII lowercase comparison of two strings.
Definition: string.hxx:557
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:1628
SAL_DLLPUBLIC sal_Int32 rtl_str_valueOfBoolean(sal_Char *str, sal_Bool b) SAL_THROW_EXTERN_C()
Create the string representation of a boolean.
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:606
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_Int32 indexOf(const OString &str, sal_Int32 fromIndex=0) const
Returns the index within this string of the first occurrence of the specified substring,...
Definition: string.hxx:1134
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.
unsigned char sal_Bool
Definition: types.h:38
bool startsWith(OString const &str, OString *rest=NULL) const
Check whether this string starts with a given substring.
Definition: string.hxx:785
sal_Char toChar() const
Returns the first character from this string.
Definition: string.hxx:1505
sal_Int64 toInt64(sal_Int16 radix=10) const
Returns the int64 value from this string.
Definition: string.hxx:1552
#define RTL_STR_MAX_VALUEOFBOOLEAN
Definition: string.h:585
bool operator()(const char *p1, const char *p2) const
Definition: string.hxx:1874
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:1430
float toFloat() const
Returns the float value from this string.
Definition: string.hxx:1582
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 compareTo(const OString &rObj, sal_Int32 maxLength) const
Compares two strings with an maximum count of characters.
Definition: string.hxx:474
Hashing functor for classic c-strings (i.e., null-terminated char* strings).
Definition: string.hxx:1879
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:1412
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.
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:756
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:973
#define RTL_STR_MAX_VALUEOFINT64
Definition: string.h:650
friend OString operator+(const OString &str1, const OString &str2)
Definition: string.hxx:1289
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.
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:743
bool matchL(char const *str, sal_Int32 strLength, sal_Int32 fromIndex=0) const
Match against a substring appearing in this string.
Definition: string.hxx:708
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.
static OString number(int i, sal_Int16 radix=10)
Returns the string representation of the integer argument.
Definition: string.hxx:1610
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_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.
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:799
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 concat(const OString &str) const
Concatenates the specified string to the end of this string.
Definition: string.hxx:1281
SAL_DLLPUBLIC sal_Int32 rtl_str_hashCode(const sal_Char *str) SAL_THROW_EXTERN_C()
Return a hash code for a string.
static OString boolean(bool b)
Returns the string representation of the boolean argument.
Definition: string.hxx:1712
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:1377
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_compareIgnoreAsciiCase(const sal_Char *first, const sal_Char *second) SAL_THROW_EXTERN_C()
Compare two strings, ignoring the case of ASCII characters.
SAL_DLLPUBLIC sal_Int32 rtl_str_valueOfDouble(sal_Char *str, double d) SAL_THROW_EXTERN_C()
Create the string representation of a double.
sal_uInt32 toUInt32(sal_Int16 radix=10) const
Returns the uint32 value from this string.
Definition: string.hxx:1537
__sal_NoAcquire
Definition: types.h:370
sal_Int32 lastIndexOf(sal_Char ch) const
Returns the index within this string of the last occurrence of the specified character,...
Definition: string.hxx:1097
SAL_DLLPUBLIC sal_Bool rtl_str_toBoolean(const sal_Char *str) SAL_THROW_EXTERN_C()
Interpret a string as a boolean.
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.
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:889
bool equals(const OString &str) const
Perform a comparison of two strings.
Definition: string.hxx:509
SAL_WARN_UNUSED_RESULT OString copy(sal_Int32 beginIndex) const
Returns a new string that is a substring of this string.
Definition: string.hxx:1247
#define SAL_DEPRECATED(message)
Use as follows: SAL_DEPRECATED("Don't use, it's evil.") void doit(int nPara);.
Definition: types.h:477
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:1395
OString(rtl_String *str, __sal_NoAcquire)
New string from OString data without acquiring it.
Definition: string.hxx:154
bool operator<(const TTimeValue &rTimeA, const TTimeValue &rTimeB)
Definition: timer.hxx:90
friend libreoffice_internal::CharPtrDetector< T, bool >::Type operator!=(const T &value, const OString &rStr2)
Definition: string.hxx:1024
bool endsWithL(char const *str, sal_Int32 strLength) const
Check whether this string ends with a given substring.
Definition: string.hxx:925
sal_Int32 hashCode() const
Returns a hashcode for this string.
Definition: string.hxx:1064
#define SAL_WARN_UNUSED_RESULT
Use this as markup for functions and methods whose return value must be checked.
Definition: types.h:302
static OString number(double d)
Returns the string representation of the double argument.
Definition: string.hxx:1677
Definition: stringutils.hxx:120
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,...
Definition: string.hxx:1082
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.
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.
Definition: bootstrap.hxx:29
SAL_DLLPUBLIC sal_Int32 rtl_str_valueOfFloat(sal_Char *str, float f) SAL_THROW_EXTERN_C()
Create the string representation of a float.
bool operator>(const TTimeValue &rTimeA, const TTimeValue &rTimeB)
Definition: timer.hxx:100
Equality functor for classic c-strings (i.e., null-terminated char* strings).
Definition: string.hxx:1872
friend libreoffice_internal::CharPtrDetector< T, bool >::Type operator!=(const OString &rStr1, const T &value)
Definition: string.hxx:1012
double toDouble() const
Returns the double value from this string.
Definition: string.hxx:1595
sal_uInt16 sal_Unicode
Definition: types.h:141
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:1353
SAL_DLLPUBLIC sal_Int32 rtl_str_compare(const sal_Char *first, const sal_Char *second) SAL_THROW_EXTERN_C()
Compare two strings.
~OString()
Release the string data.
Definition: string.hxx:287
OString(const sal_Char *value, sal_Int32 length)
New string from a character buffer array.
Definition: string.hxx:230
This String class provide base functionality for C++ like 8-Bit character array handling.
Definition: string.hxx:92
SAL_DLLPUBLIC float rtl_str_toFloat(const sal_Char *str) SAL_THROW_EXTERN_C()
Interpret a string as a float.
OString(T &value, typename libreoffice_internal::NonConstCharArrayDetector< T, libreoffice_internal::Dummy >::Type=libreoffice_internal::Dummy())
Definition: string.hxx:186
Definition: stringutils.hxx:118
const sal_Char * getStr() const SAL_RETURNS_NONNULL
Returns a pointer to the characters of this string.
Definition: string.hxx:426
bool operator==(const TTimeValue &rTimeA, const TTimeValue &rTimeB)
Definition: timer.hxx:110
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:1266
size_t operator()(const char *p) const
Definition: string.hxx:1881
A helper to use OStrings with hash maps.
Definition: string.hxx:1856
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:830
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:677
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_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_newFromLiteral(rtl_String **newStr, const sal_Char *value, sal_Int32 len, sal_Int32 allocExtra) SAL_THROW_EXTERN_C()
friend libreoffice_internal::NonConstCharArrayDetector< T, bool >::Type operator==(T &value, const OString &rStr2)
Definition: string.hxx:962
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.
OString(const OString &str)
New string from OString.
Definition: string.hxx:113
bool match(const OString &str, sal_Int32 fromIndex=0) const
Match against a substring appearing in this string.
Definition: string.hxx:665
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:1147
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,...
Definition: string.hxx:1177
SAL_DLLPUBLIC void rtl_string_release(rtl_String *str) SAL_THROW_EXTERN_C()
Decrement the reference count of a string.
bool toBoolean() const
Returns the Boolean value from this string.
Definition: string.hxx:1494
OString & operator=(const OString &str)
Assign a new string.
Definition: string.hxx:297
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:1041
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_Int32 lastIndexOf(const OString &str) const
Returns the index within this string of the last occurrence of the specified substring,...
Definition: string.hxx:1208
friend libreoffice_internal::CharPtrDetector< T, bool >::Type operator==(const OString &rStr1, const T &value)
Definition: string.hxx:944
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:179
SAL_DLLPUBLIC double rtl_str_toDouble(const sal_Char *str) SAL_THROW_EXTERN_C()
Interpret a string as a double.
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:328