LibreOffice
LibreOffice 6.4 SDK C/C++ API Reference
|
Go to the documentation of this file.
20 #ifndef INCLUDED_RTL_STRING_HXX
21 #define INCLUDED_RTL_STRING_HXX
32 #if defined LIBO_INTERNAL_ONLY
33 #include <string_view>
40 #ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
41 #include "rtl/stringconcat.hxx"
44 #ifdef RTL_STRING_UNITTEST
45 extern bool rtl_string_unittest_const_literal;
46 extern bool rtl_string_unittest_const_literal_function;
54 #ifdef RTL_STRING_UNITTEST
55 #define rtl rtlunittest
62 #ifdef RTL_STRING_UNITTEST
65 #define RTL_STRING_CONST_FUNCTION rtl_string_unittest_const_literal_function = true;
67 #define RTL_STRING_CONST_FUNCTION
124 #ifndef _MSC_VER // TODO?
125 #if defined LIBO_INTERNAL_ONLY
183 template<
typename T >
190 template<
typename T >
207 template<
typename T >
222 #ifdef RTL_STRING_UNITTEST
223 rtl_string_unittest_const_literal =
true;
262 throw std::bad_alloc();
266 #ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
271 template<
typename T1,
typename T2 >
272 OString( OStringConcat< T1, T2 >&& c )
274 const sal_Int32 l = c.length();
278 char* end = c.addData( pData->buffer );
288 template<
typename T >
289 OString( OStringNumber< T >&& n )
290 : OString( n.buf, n.length )
294 #ifdef LIBO_INTERNAL_ONLY
295 OString(std::nullptr_t) =
delete;
317 #ifndef _MSC_VER // TODO?
318 #if defined LIBO_INTERNAL_ONLY
341 template<
typename T >
344 RTL_STRING_CONST_FUNCTION
365 #if defined LIBO_INTERNAL_ONLY
372 #if defined LIBO_INTERNAL_ONLY
373 void operator+=(
OString const &) && =
delete;
376 #ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
381 template<
typename T1,
typename T2 >
382 OString& operator+=( OStringConcat< T1, T2 >&& c ) & {
383 sal_Int32 l = c.length();
388 char* end = c.addData( pData->buffer + pData->length );
393 template<
typename T1,
typename T2>
void operator +=(
394 OStringConcat<T1, T2> &&) && =
delete;
400 template<
typename T >
401 OString& operator+=( OStringNumber< T >&& n ) & {
402 sal_Int32 l = n.length;
407 char* end = addDataHelper( pData->buffer + pData->length, n.buf, n.length );
412 template<
typename T>
void operator +=(
413 OStringNumber<T> &&) && =
delete;
445 return pData->length == 0;
472 assert(index >= 0 &&
static_cast<sal_uInt32
>(index) <
static_cast<sal_uInt32
>(getLength()));
473 return getStr()[index];
491 str.pData->buffer, str.pData->length );
510 rObj.pData->buffer, rObj.pData->length, maxLength );
528 str.pData->buffer, str.pData->length );
544 if ( pData->length != str.pData->length )
546 if ( pData == str.pData )
549 str.pData->buffer, str.pData->length ) == 0;
569 if ( pData->length != length )
573 value, length ) == 0;
592 if ( pData->length != str.pData->length )
594 if ( pData == str.pData )
597 str.pData->buffer, str.pData->length ) == 0;
621 template<
typename T >
627 template<
typename T >
638 template<
typename T >
641 RTL_STRING_CONST_FUNCTION
648 pData->buffer, pData->length,
676 if ( pData->length != asciiStrLength )
680 asciiStr, asciiStrLength ) == 0;
701 str.pData->buffer, str.pData->length, str.pData->length ) == 0;
709 template<
typename T >
712 RTL_STRING_CONST_FUNCTION
717 pData->buffer + fromIndex, pData->length - fromIndex,
742 char const * str, sal_Int32 strLength, sal_Int32 fromIndex = 0)
746 pData->buffer + fromIndex, pData->length - fromIndex,
747 str, strLength, strLength) == 0;
754 #if SAL_TYPES_SIZEOFLONG == 8
779 str.pData->buffer, str.pData->length,
780 str.pData->length ) == 0;
788 template<
typename T >
791 RTL_STRING_CONST_FUNCTION
796 pData->buffer+fromIndex, pData->length-fromIndex,
820 if (b && rest != NULL) {
831 template<
typename T >
833 T & literal,
OString * rest = NULL)
const
835 RTL_STRING_CONST_FUNCTION
836 bool b = match(literal, 0);
837 if (b && rest != NULL) {
866 bool b = matchIgnoreAsciiCase(str);
867 if (b && rest != NULL) {
878 template<
typename T >
882 RTL_STRING_CONST_FUNCTION
885 bool b = matchIgnoreAsciiCase(literal);
886 if (b && rest != NULL) {
909 && match(str, getLength() - str.
getLength());
910 if (b && rest != NULL) {
911 *rest = copy(0, getLength() - str.
getLength());
921 template<
typename T >
923 T & literal,
OString * rest = NULL)
const
925 RTL_STRING_CONST_FUNCTION
930 <= sal_uInt32(getLength()))
936 if (b && rest != NULL) {
958 bool endsWithL(
char const * str, sal_Int32 strLength)
const {
959 return strLength <= getLength()
960 && matchL(str, strLength, getLength() - strLength);
964 {
return rStr1.
equals(rStr2); }
972 {
return rStr1.
compareTo( rStr2 ) <= 0; }
974 {
return rStr1.
compareTo( rStr2 ) >= 0; }
976 template<
typename T >
982 template<
typename T >
988 template<
typename T >
994 template<
typename T >
1005 template<
typename T >
1008 RTL_STRING_CONST_FUNCTION
1015 rStr.pData->buffer, rStr.pData->length,
1027 template<
typename T >
1030 RTL_STRING_CONST_FUNCTION
1037 rStr.pData->buffer, rStr.pData->length,
1044 template<
typename T >
1050 template<
typename T >
1056 template<
typename T >
1062 template<
typename T >
1073 template<
typename T >
1076 return !( rStr == literal );
1084 template<
typename T >
1087 return !( literal == rStr );
1118 return (ret < 0 ? ret : ret+fromIndex);
1170 str.pData->buffer, str.pData->length );
1171 return (ret < 0 ? ret : ret+fromIndex);
1179 template<
typename T >
1182 RTL_STRING_CONST_FUNCTION
1186 pData->buffer + fromIndex, pData->length - fromIndex,
1189 return n < 0 ? n : n + fromIndex;
1210 sal_Int32
indexOfL(
char const * str, sal_Int32 len, sal_Int32 fromIndex = 0)
1214 pData->buffer + fromIndex, pData->length - fromIndex, str, len);
1215 return n < 0 ? n : n + fromIndex;
1222 #if SAL_TYPES_SIZEOFLONG == 8
1244 str.pData->buffer, str.pData->length );
1267 str.pData->buffer, str.pData->length );
1282 return copy(beginIndex, getLength() - beginIndex);
1299 rtl_String *pNew = NULL;
1314 rtl_String* pNew = NULL;
1319 #ifndef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
1322 return str1.
concat( str2 );
1341 rtl_String* pNew = NULL;
1361 rtl_String* pNew = NULL;
1385 OString const & from,
OString const & to, sal_Int32 * index = NULL)
const
1387 rtl_String * s = NULL;
1390 &s, pData, from.pData->buffer, from.pData->length,
1391 to.pData->buffer, to.pData->length, index == NULL ? &i : index);
1409 rtl_String * s = NULL;
1411 &s, pData, from.pData->buffer, from.pData->length,
1412 to.pData->buffer, to.pData->length);
1428 rtl_String* pNew = NULL;
1445 rtl_String* pNew = NULL;
1463 rtl_String* pNew = NULL;
1494 rtl_String * pNew = NULL;
1514 return getToken(count, separator, n);
1538 return pData->buffer[0];
1631 #ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
1633 static OStringNumber< int > number(
int i, sal_Int16 radix = 10 )
1635 return OStringNumber< int >( i, radix );
1637 static OStringNumber< long long > number(
long long ll, sal_Int16 radix = 10 )
1639 return OStringNumber< long long >( ll, radix );
1641 static OStringNumber< unsigned long long > number(
unsigned long long ll, sal_Int16 radix = 10 )
1643 return OStringNumber< unsigned long long >( ll, radix );
1645 static OStringNumber< unsigned long long > number(
unsigned int i, sal_Int16 radix = 10 )
1647 return number(
static_cast< unsigned long long >( i ), radix );
1649 static OStringNumber< long long > number(
long i, sal_Int16 radix = 10)
1651 return number(
static_cast< long long >( i ), radix );
1653 static OStringNumber< unsigned long long > number(
unsigned long i, sal_Int16 radix = 10 )
1655 return number(
static_cast< unsigned long long >( i ), radix );
1657 static OStringNumber< float > number(
float f )
1659 return OStringNumber< float >( f );
1661 static OStringNumber< double > number(
double d )
1663 return OStringNumber< double >( d );
1685 return number(
static_cast< unsigned long long >( i ), radix );
1691 return number(
static_cast< long long >( i ), radix );
1697 return number(
static_cast< unsigned long long >( i ), radix );
1802 return number( i, radix );
1817 return number( ll, radix );
1848 #if defined LIBO_INTERNAL_ONLY
1849 operator std::string_view()
const {
return {getStr(), sal_uInt32(getLength())}; }
1855 #ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
1867 explicit OStringLiteral(
const char (&str)[ N ] ) : size( N - 1 ), data( str ) { assert( strlen( str ) == N - 1 ); }
1868 #if defined __cpp_char8_t
1870 explicit OStringLiteral(
const char8_t (&str)[ N ] ) : size( N - 1 ), data( reinterpret_cast<char const *>(str) ) { assert( strlen( data ) == N - 1 ); }
1880 struct ToStringHelper< OString >
1882 static std::size_t length(
const OString& s ) {
return s.getLength(); }
1883 static char* addData(
char* buffer,
const OString& s ) {
return addDataHelper( buffer, s.getStr(), s.getLength()); }
1884 static const bool allowOStringConcat =
true;
1885 static const bool allowOUStringConcat =
false;
1892 struct ToStringHelper< OStringLiteral >
1894 static std::size_t length(
const OStringLiteral& str ) {
return str.size; }
1895 static char* addData(
char* buffer,
const OStringLiteral& str ) {
return addDataHelper( buffer, str.data, str.size ); }
1896 static const bool allowOStringConcat =
true;
1897 static const bool allowOUStringConcat =
false;
1903 template<
typename charT,
typename traits,
typename T1,
typename T2 >
1904 inline std::basic_ostream<charT, traits> &
operator <<(
1905 std::basic_ostream<charT, traits> & stream, OStringConcat< T1, T2 >&& concat)
1907 return stream << OString( std::move(concat) );
1929 {
return static_cast<size_t>(rString.
hashCode()); }
1954 template<
typename charT,
typename traits > std::basic_ostream<charT, traits> &
1956 std::basic_ostream<charT, traits> & stream, OString
const & rString)
1958 return stream << rString.getStr();
1964 #ifdef RTL_STRING_UNITTEST
1967 typedef rtlunittest::OString OString;
1969 #undef RTL_STRING_CONST_FUNCTION
1972 #if defined LIBO_INTERNAL_ONLY && !defined RTL_STRING_UNITTEST
1973 using ::rtl::OString;
1974 using ::rtl::OStringChar;
1975 using ::rtl::OStringHash;
1976 using ::rtl::OStringLiteral;
1985 #if defined LIBO_INTERNAL_ONLY
1992 {
return std::size_t(s.
hashCode()); }
2000 #endif // INCLUDED_RTL_STRING_HXX
OString & operator+=(const OString &str)
Append a string to this string.
Definition: string.hxx:364
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.
char sal_Char
A legacy synonym for char.
Definition: types.h:120
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.
bool operator>(const TTimeValue &rTimeA, const TTimeValue &rTimeB)
Definition: timer.hxx:100
friend libreoffice_internal::NonConstCharArrayDetector< T, bool >::Type operator==(const OString &rStr1, T &value)
Definition: string.hxx:983
OString(T &literal, typename libreoffice_internal::ConstCharArrayDetector< T, libreoffice_internal::Dummy >::Type=libreoffice_internal::Dummy())
New string from a string literal.
Definition: string.hxx:208
friend OString operator+(const OString &str1, const OString &str2)
Definition: string.hxx:1320
Definition: stringutils.hxx:133
Equality functor for classic c-strings (i.e., null-terminated char* strings).
Definition: string.hxx:1934
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:255
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.
bool endsWith(OString const &str, OString *rest=NULL) const
Check whether this string ends with a given substring.
Definition: string.hxx:907
size_t operator()(const char *p) const
Definition: string.hxx:1942
sal_uInt16 rtl_TextEncoding
The various supported text encodings.
Definition: textenc.h:33
static OString number(double d)
Returns the string representation of the double argument.
Definition: string.hxx:1738
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:1028
sal_Int32 lastIndexOf(const OString &str) const
Returns the index within this string of the last occurrence of the specified substring,...
Definition: string.hxx:1241
friend libreoffice_internal::CharPtrDetector< T, bool >::Type operator==(const OString &rStr1, const T &value)
Definition: string.hxx:977
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_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.
OString(rtl_String *str)
New string from OString data.
Definition: string.hxx:146
sal_Int32 reverseCompareTo(const OString &str) const
Compares two strings in reverse order.
Definition: string.hxx:525
@ SAL_NO_ACQUIRE
definition of a no acquire enum for ctors
Definition: types.h:374
#define RTL_STR_MAX_VALUEOFDOUBLE
Definition: string.h:711
This String class provide base functionality for C++ like 8-Bit character array handling.
Definition: string.hxx:98
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.
bool toBoolean() const
Returns the Boolean value from this string.
Definition: string.hxx:1525
bool operator<(const TTimeValue &rTimeA, const TTimeValue &rTimeB)
Definition: timer.hxx:90
friend libreoffice_internal::NonConstCharArrayDetector< T, bool >::Type operator!=(const OString &rStr1, T &value)
Definition: string.hxx:1051
OString(sal_Char value)
New string from a single character.
Definition: string.hxx:169
#define RTL_STR_MAX_VALUEOFFLOAT
Definition: string.h:692
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.
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:922
#define RTL_STR_MAX_VALUEOFUINT64
Definition: string.h:673
OString()
New string containing no characters.
Definition: string.hxx:107
SAL_DLLPUBLIC sal_Int32 rtl_str_indexOfChar_WithLength(const sal_Char *str, sal_Int32 len, sal_Char ch) SAL_THROW_EXTERN_C()
Search for the first occurrence of a character within a string.
SAL_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 sal_Int32 rtl_str_hashCode_WithLength(const sal_Char *str, sal_Int32 len) SAL_THROW_EXTERN_C()
Return a hash code for a string.
SAL_DLLPUBLIC void rtl_string_new(rtl_String **newStr) SAL_THROW_EXTERN_C()
Allocate a new string containing no characters.
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:1701
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:863
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.
bool endsWithL(char const *str, sal_Int32 strLength) const
Check whether this string ends with a given substring.
Definition: string.hxx:958
#define SAL_WARN_UNUSED
Annotate classes where a compiler should warn if an instance is unused.
Definition: types.h:578
libreoffice_internal::NonConstCharArrayDetector< T, bool >::Type equalsIgnoreAsciiCase(T &asciiStr) const
Definition: string.hxx:628
SAL_DLLPUBLIC sal_Int32 rtl_str_valueOfInt32(sal_Char *str, sal_Int32 i, sal_Int16 radix) SAL_THROW_EXTERN_C()
Create the string representation of an integer.
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:1085
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:832
friend libreoffice_internal::NonConstCharArrayDetector< T, bool >::Type operator==(T &value, const OString &rStr2)
Definition: string.hxx:995
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:639
#define OUSTRING_TO_OSTRING_CVTFLAGS
Definition: string.h:1350
bool match(const OString &str, sal_Int32 fromIndex=0) const
Match against a substring appearing in this string.
Definition: string.hxx:698
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::CharPtrDetector< T, bool >::Type operator!=(const OString &rStr1, const T &value)
Definition: string.hxx:1045
OString getToken(sal_Int32 count, char separator) const
Returns a token from the string.
Definition: string.hxx:1512
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_valueOfBoolean(sal_Char *str, sal_Bool b) SAL_THROW_EXTERN_C()
Create the string representation of a boolean.
sal_Int64 toInt64(sal_Int16 radix=10) const
Returns the int64 value from this string.
Definition: string.hxx:1583
sal_uInt32 toUInt32(sal_Int16 radix=10) const
Returns the uint32 value from this string.
Definition: string.hxx:1568
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:1359
bool operator!=(const Any &rAny, const C &value)
Template inequality operator: compares set value of left side any to right side value.
Definition: Any.hxx:664
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_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.
~OString()
Release the string data.
Definition: string.hxx:301
unsigned char sal_Bool
Definition: types.h:38
size_t operator()(const OString &rString) const
Compute a hash code for a string.
Definition: string.hxx:1928
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:1695
bool equals(const OString &str) const
Perform a comparison of two strings.
Definition: string.hxx:542
SAL_WARN_UNUSED_RESULT OString concat(const OString &str) const
Concatenates the specified string to the end of this string.
Definition: string.hxx:1312
#define RTL_STR_MAX_VALUEOFBOOLEAN
Definition: string.h:585
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:184
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:1426
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 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.
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:1708
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:1297
bool equalsL(const sal_Char *value, sal_Int32 length) const
Perform a comparison of two strings.
Definition: string.hxx:567
#define RTL_STR_MAX_VALUEOFINT64
Definition: string.h:650
SAL_DLLPUBLIC void rtl_string_newFromStr_WithLength(rtl_String **newStr, const sal_Char *value, sal_Int32 len) SAL_THROW_EXTERN_C()
Allocate a new string that contains a copy of a character array.
sal_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:1115
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 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.
static OString boolean(bool b)
Returns the string representation of the boolean argument.
Definition: string.hxx:1772
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_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:1147
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:1339
Definition: bootstrap.hxx:30
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:1683
SAL_DLLPUBLIC sal_Int32 rtl_str_hashCode(const sal_Char *str) SAL_THROW_EXTERN_C()
Return a hash code for a string.
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:1074
void clear()
Clears the string, i.e, makes a zero-character string.
Definition: string.hxx:420
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:1461
float toFloat() const
Returns the float value from this string.
Definition: string.hxx:1613
sal_Int32 compareTo(const OString &str) const
Compares two strings.
Definition: string.hxx:488
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:1689
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_NoAcquire
Definition: types.h:371
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:1006
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:1167
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.
sal_Char toChar() const
Returns the first character from this string.
Definition: string.hxx:1536
bool matchL(char const *str, sal_Int32 strLength, sal_Int32 fromIndex=0) const
Match against a substring appearing in this string.
Definition: string.hxx:741
#define SAL_DEPRECATED(message)
Use as follows: SAL_DEPRECATED("Don't use, it's evil.") void doit(int nPara);.
Definition: types.h:465
const sal_Char * getStr() const SAL_RETURNS_NONNULL
Returns a pointer to the characters of this string.
Definition: string.hxx:459
bool operator()(const char *p1, const char *p2) const
Definition: string.hxx:1935
static OString number(int i, sal_Int16 radix=10)
Returns the string representation of the integer argument.
Definition: string.hxx:1676
sal_Int32 lastIndexOf(sal_Char ch) const
Returns the index within this string of the last occurrence of the specified character,...
Definition: string.hxx:1130
Definition: stringutils.hxx:130
sal_uInt64 toUInt64(sal_Int16 radix=10) const
Returns the uint64 value from this string.
Definition: string.hxx:1600
SAL_WARN_UNUSED_RESULT OString copy(sal_Int32 beginIndex) const
Returns a new string that is a substring of this string.
Definition: string.hxx:1280
A helper to use OStrings with hash maps.
Definition: string.hxx:1918
bool equalsIgnoreAsciiCaseL(const sal_Char *asciiStr, sal_Int32 asciiStrLength) const
Perform an ASCII lowercase comparison of two strings.
Definition: string.hxx:674
Definition: stringutils.hxx:185
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:880
#define SAL_WARN_UNUSED_RESULT
Use this as markup for functions and methods whose return value must be checked.
Definition: types.h:302
double toDouble() const
Returns the double value from this string.
Definition: string.hxx:1626
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:1210
sal_Int32 getLength() const
Returns the length of this string.
Definition: string.hxx:433
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:776
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.
SAL_DLLPUBLIC sal_Int32 rtl_str_valueOfFloat(sal_Char *str, float f) SAL_THROW_EXTERN_C()
Create the string representation of a float.
#define RTL_STR_MAX_VALUEOFINT32
Definition: string.h:627
sal_uInt16 sal_Unicode
Definition: types.h:141
SAL_DLLPUBLIC sal_Int32 rtl_str_compare(const sal_Char *first, const sal_Char *second) SAL_THROW_EXTERN_C()
Compare two strings.
libreoffice_internal::CharPtrDetector< T, bool >::Type equalsIgnoreAsciiCase(const T &asciiStr) const
Perform an ASCII lowercase comparison of two strings.
Definition: string.hxx:622
OString(rtl_String *str, __sal_NoAcquire)
New string from OString data without acquiring it.
Definition: string.hxx:159
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:1384
SAL_DLLPUBLIC float rtl_str_toFloat(const sal_Char *str) SAL_THROW_EXTERN_C()
Interpret a string as a float.
bool operator==(const TTimeValue &rTimeA, const TTimeValue &rTimeB)
Definition: timer.hxx:110
OString getToken(sal_Int32 token, sal_Char cTok, sal_Int32 &index) const
Returns a token in the string.
Definition: string.hxx:1492
friend libreoffice_internal::CharPtrDetector< T, bool >::Type operator!=(const T &value, const OString &rStr2)
Definition: string.hxx:1057
sal_Int32 hashCode() const
Returns a hashcode for this string.
Definition: string.hxx:1097
sal_Int32 compareTo(const OString &rObj, sal_Int32 maxLength) const
Compares two strings with an maximum count of characters.
Definition: string.hxx:507
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:1443
Definition: stringutils.hxx:157
OString(const OString &str)
New string from OString.
Definition: string.hxx:118
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:789
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:1264
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()
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:1955
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.
friend libreoffice_internal::CharPtrDetector< T, bool >::Type operator==(const T &value, const OString &rStr2)
Definition: string.hxx:989
OString(const sal_Char *value, sal_Int32 length)
New string from a character buffer array.
Definition: string.hxx:235
bool isEmpty() const
Checks if a string is empty.
Definition: string.hxx:443
bool equalsIgnoreAsciiCase(const OString &str) const
Perform an ASCII lowercase comparison of two strings.
Definition: string.hxx:590
SAL_DLLPUBLIC void rtl_string_release(rtl_String *str) SAL_THROW_EXTERN_C()
Decrement the reference count of a string.
static OString number(float f)
Returns the string representation of the float argument.
Definition: string.hxx:1723
Hashing functor for classic c-strings (i.e., null-terminated char* strings).
Definition: string.hxx:1941
OString(T &value, typename libreoffice_internal::NonConstCharArrayDetector< T, libreoffice_internal::Dummy >::Type=libreoffice_internal::Dummy())
Definition: string.hxx:191
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:342
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_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:1408
sal_Int32 toInt32(sal_Int16 radix=10) const
Returns the int32 value from this string.
Definition: string.hxx:1551
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:1180
friend libreoffice_internal::NonConstCharArrayDetector< T, bool >::Type operator!=(T &value, const OString &rStr2)
Definition: string.hxx:1063
bool startsWith(OString const &str, OString *rest=NULL) const
Check whether this string starts with a given substring.
Definition: string.hxx:818
OString & operator=(const OString &str)
Assign a new string.
Definition: string.hxx:311
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:710
SAL_DLLPUBLIC double rtl_str_toDouble(const sal_Char *str) SAL_THROW_EXTERN_C()
Interpret a string as a double.