36#ifdef LIBO_INTERNAL_ONLY  
   37#include "rtl/stringconcat.hxx" 
   42#ifdef RTL_STRING_UNITTEST 
   43extern bool rtl_string_unittest_const_literal;
 
   44extern 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 
   93        , nCapacity( value.nCapacity )
 
 
  106        , nCapacity( length )
 
 
  110#if defined LIBO_INTERNAL_ONLY 
  112    explicit OStringBuffer(T length, std::enable_if_t<std::is_integral_v<T>, 
int> = 0)
 
  117            && 
static_cast<std::make_unsigned_t<T>
>(length)
 
  118                <= 
static_cast<std::make_unsigned_t<sal_Int32>
>(
 
  119                    std::numeric_limits<sal_Int32>::max()));
 
  122    explicit OStringBuffer(
bool) = 
delete;
 
  123    explicit OStringBuffer(
char) = 
delete;
 
  124    explicit OStringBuffer(
wchar_t) = 
delete;
 
  125#if !(defined _MSC_VER && _MSC_VER >= 1930 && _MSC_VER <= 1939 && defined _MANAGED) 
  126    explicit OStringBuffer(
char8_t) = 
delete;
 
  128    explicit OStringBuffer(
char16_t) = 
delete;
 
  129    explicit OStringBuffer(
char32_t) = 
delete;
 
  142#if defined LIBO_INTERNAL_ONLY 
  143    OStringBuffer(std::string_view sv)
 
  145        , nCapacity( sv.length() + 16 )
 
  147        if (sv.size() > sal_uInt32(std::numeric_limits<sal_Int32>::max())) {
 
  148            throw std::bad_alloc();
 
  165    template< 
typename T >
 
  170        nCapacity = length + 16;
 
 
  174    template< 
typename T >
 
  179        nCapacity = length + 16;
 
 
  183#if __cplusplus > 202002L  
  184    template< 
typename T >
 
  189        nCapacity = length + 16;
 
  205    template< 
typename T >
 
  216#ifdef RTL_STRING_UNITTEST 
  217        rtl_string_unittest_const_literal = 
true;
 
 
  235        , nCapacity( length + 16 )
 
 
  240#ifdef LIBO_INTERNAL_ONLY  
  245    template< 
typename T1, 
typename T2 >
 
  248        const sal_Int32 l = c.length();
 
  251        char* end = c.addData( pData->buffer );
 
  260    template< std::
size_t N >
 
  261    OStringBuffer( OStringNumber< N >&& n )
 
  262        : OStringBuffer( n.buf, n.length)
 
  266#if defined LIBO_INTERNAL_ONLY 
  267    operator std::string_view()
 const { 
return {getStr(), sal_uInt32(getLength())}; }
 
  279            nCapacity = value.nCapacity;
 
 
  288#if defined LIBO_INTERNAL_ONLY 
  290        sal_Int32 n = 
string.length();
 
  291        if (n >= nCapacity) {
 
  292            ensureCapacity(n + 16); 
 
  294        std::memcpy(pData->buffer, 
string.data(), n);
 
  295        pData->buffer[n] = 
'\0';
 
  301        sal_Int32 n = 
string.getLength();
 
  302        if (n >= nCapacity) {
 
  305        std::memcpy(pData->buffer, 
string.pData->buffer, n + 1);
 
 
  318    operator =(T & literal) {
 
  323        if (n >= nCapacity) {
 
 
  334#if defined LIBO_INTERNAL_ONLY 
  336    template<
typename T1, 
typename T2>
 
  337    OStringBuffer & operator =(OStringConcat<T1, T2> && concat) {
 
  338        sal_Int32 
const n = concat.length();
 
  339        if (n >= nCapacity) {
 
  340            ensureCapacity(n + 16); 
 
  342        *concat.addData(pData->buffer) = 0;
 
  348    template<std::
size_t N>
 
  349    OStringBuffer & operator =(OStringNumber<N> && n)
 
  351        return operator =(std::string_view(n));
 
  386        return pData->length;
 
 
  399        return pData->length == 0;
 
 
  453        assert(newLength >= 0);
 
  455        if( newLength != pData->length )
 
  457            if( newLength > nCapacity )
 
  460                pData->buffer[newLength] = 
'\0';
 
  461            pData->length = newLength;
 
 
  481        assert(index >= 0 && index < pData->length);
 
  482        return pData->buffer[ index ];
 
 
  498        assert(index >= 0 && index < pData->length);
 
  499        pData->buffer[ index ] = ch;
 
 
  506    const char* 
getStr() const SAL_RETURNS_NONNULL { 
return pData->buffer; }
 
  517    char & operator [](sal_Int32 index)
 
  519        assert(index >= 0 && index < pData->length);
 
  520        return pData->buffer[index];
 
 
  529        return OString(pData->buffer, pData->length);
 
 
  532#if !defined LIBO_INTERNAL_ONLY 
  560    template< 
typename T >
 
  566    template< 
typename T >
 
  577    template< 
typename T >
 
  601#ifdef LIBO_INTERNAL_ONLY  
  606    template< 
typename T1, 
typename T2 >
 
  609        sal_Int32 l = c.length();
 
  611            c.addData(appendUninitialized(l));
 
  619    OStringBuffer& append( std::string_view s )
 
  621        return insert(getLength(), s);
 
  664    template< 
typename T >
 
  769        return pData->buffer + n;
 
 
  787#if defined LIBO_INTERNAL_ONLY 
  788    OStringBuffer & insert(sal_Int32 offset, std::string_view str)
 
  790        return insert( offset, str.data(), str.length() );
 
  816    template< 
typename T >
 
  822    template< 
typename T >
 
  833    template< 
typename T >
 
  836        RTL_STRING_CONST_FUNCTION
 
 
  865        assert( len == 0 || str != NULL ); 
 
 
  936        return insert( offset, &c, 1 );
 
 
 1075        rtl_String *** pInternalData, sal_Int32 ** pInternalCapacity)
 
 1077        *pInternalData = &pData;
 
 1078        *pInternalCapacity = &nCapacity;
 
 
 1090    sal_Int32       nCapacity;
 
 
 1093#if defined LIBO_INTERNAL_ONLY 
 1094template<> 
struct ToStringHelper<OStringBuffer> {
 
 1095    static std::size_t length(OStringBuffer 
const & s) { 
return s.getLength(); }
 
 1097    char * operator()(
char * buffer, OStringBuffer 
const & s) 
const SAL_RETURNS_NONNULL
 
 1098    { 
return addDataHelper(buffer, s.getStr(), s.getLength()); }
 
 1104#ifdef RTL_STRING_UNITTEST 
 1109#undef RTL_STRING_CONST_FUNCTION 
 1112#if defined LIBO_INTERNAL_ONLY && !defined RTL_STRING_UNITTEST 
#define SAL_DEPRECATED(message)
Use as follows: SAL_DEPRECATED("Don't use, it's evil.") void doit(int nPara);.
Definition types.h:492
#define SAL_DELETED_FUNCTION
short-circuit extra-verbose API namespaces
Definition types.h:396
unsigned char sal_Bool
Definition types.h:38
#define SAL_WARN_UNUSED_RESULT
Use this as markup for functions and methods whose return value must be used.
Definition types.h:288
#define SAL_WARN_UNUSED
Annotate classes where a compiler should warn if an instance is unused.
Definition types.h:611
#define SAL_N_ELEMENTS(arr)
Definition macros.h:51
#define RTL_STR_MAX_VALUEOFDOUBLE
Definition string.h:715
#define RTL_STR_MAX_VALUEOFINT32
Definition string.h:631
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.
SAL_DLLPUBLIC sal_Int32 rtl_str_valueOfInt64(char *str, sal_Int64 l, sal_Int16 radix) SAL_THROW_EXTERN_C()
Create the string representation of a long integer.
SAL_DLLPUBLIC void rtl_string_new(rtl_String **newStr) SAL_THROW_EXTERN_C()
Allocate a new string containing no characters.
SAL_DLLPUBLIC sal_Int32 rtl_str_valueOfBoolean(char *str, sal_Bool b) SAL_THROW_EXTERN_C()
Create the string representation of a boolean.
SAL_DLLPUBLIC void rtl_string_newFromLiteral(rtl_String **newStr, const char *value, sal_Int32 len, sal_Int32 allocExtra) SAL_THROW_EXTERN_C()
#define RTL_STR_MAX_VALUEOFBOOLEAN
Definition string.h:589
#define RTL_STR_MAX_VALUEOFFLOAT
Definition string.h:696
SAL_DLLPUBLIC void rtl_string_new_WithLength(rtl_String **newStr, sal_Int32 len) SAL_THROW_EXTERN_C()
Allocate a new string containing space for a given number of characters.
SAL_DLLPUBLIC sal_Int32 rtl_str_valueOfInt32(char *str, sal_Int32 i, sal_Int16 radix) SAL_THROW_EXTERN_C()
Create the string representation of an integer.
SAL_DLLPUBLIC sal_Int32 rtl_str_getLength(const char *str) SAL_THROW_EXTERN_C()
Return the length of a string.
#define RTL_STR_MAX_VALUEOFINT64
Definition string.h:654
SAL_DLLPUBLIC void rtl_string_release(rtl_String *str) SAL_THROW_EXTERN_C()
Decrement the reference count of a string.
@ rtl_math_StringFormat_G
Like sprintf() G, 'F' or 'E' format is used depending on which one is more compact.
Definition math.h:53
SAL_DLLPUBLIC void rtl_math_doubleToString(rtl_String **pResult, sal_Int32 *pResultCapacity, sal_Int32 nResultOffset, double fValue, enum rtl_math_StringFormat eFormat, sal_Int32 nDecPlaces, char cDecSeparator, sal_Int32 const *pGroups, char cGroupSeparator, sal_Bool bEraseTrailingDecZeros) SAL_THROW_EXTERN_C()
Conversions analogous to sprintf() using internal rounding.
SAL_DLLPUBLIC void rtl_stringbuffer_ensureCapacity(rtl_String **This, sal_Int32 *capacity, sal_Int32 minimumCapacity)
Ensures that the capacity of the buffer is at least equal to the specified minimum.
SAL_DLLPUBLIC sal_Int32 rtl_stringbuffer_newFromStringBuffer(rtl_String **newStr, sal_Int32 capacity, rtl_String *oldStr)
Allocates a new String that contains the same sequence of characters as the string argument.
SAL_DLLPUBLIC void rtl_stringbuffer_remove(rtl_String **This, sal_Int32 start, sal_Int32 len)
Removes the characters in a substring of this sequence.
SAL_DLLPUBLIC void rtl_stringbuffer_insert(rtl_String **This, sal_Int32 *capacity, sal_Int32 offset, const char *str, sal_Int32 len)
Inserts the string representation of the char array argument into this string buffer.
SAL_DLLPUBLIC void rtl_stringbuffer_newFromStr_WithLength(rtl_String **newStr, const char *value, sal_Int32 count)
Allocates a new String that contains characters from the character array argument.
Definition bootstrap.hxx:34
Definition stringutils.hxx:117
A string buffer implements a mutable sequence of characters.
Definition strbuf.hxx:72
SAL_WARN_UNUSED_RESULT OString makeStringAndClear()
Fill the string data in the new string and clear the buffer.
Definition strbuf.hxx:371
OStringBuffer()
Constructs a string buffer with no characters in it and an initial capacity of 16 characters.
Definition strbuf.hxx:78
OStringBuffer & append(sal_Int32 i, sal_Int16 radix=10)
Appends the string representation of the sal_Int32 argument to this string buffer.
Definition strbuf.hxx:697
OStringBuffer & insert(sal_Int32 offset, sal_Int32 i, sal_Int16 radix=10)
Inserts the string representation of the second sal_Int32 argument into this string buffer.
Definition strbuf.hxx:957
void accessInternals(rtl_String ***pInternalData, sal_Int32 **pInternalCapacity)
Allows access to the internal data of this OStringBuffer, for effective manipulation.
Definition strbuf.hxx:1074
libreoffice_internal::NonConstCharArrayDetector< T, OStringBuffer & >::Type insert(sal_Int32 offset, T &str)
Definition strbuf.hxx:823
OStringBuffer(const T &value, typename libreoffice_internal::CharPtrDetector< T, libreoffice_internal::Dummy >::Type=libreoffice_internal::Dummy())
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition strbuf.hxx:166
OStringBuffer & insert(sal_Int32 offset, float f)
Inserts the string representation of the float argument into this string buffer.
Definition strbuf.hxx:1004
OStringBuffer & append(char c)
Appends the string representation of the char argument to this string buffer.
Definition strbuf.hxx:680
char charAt(sal_Int32 index)
Returns the character at a specific index in this string buffer.
Definition strbuf.hxx:479
OStringBuffer(sal_Int32 length)
Constructs a string buffer with no characters in it and an initial capacity specified by the length a...
Definition strbuf.hxx:104
void setLength(sal_Int32 newLength)
Sets the length of this String buffer.
Definition strbuf.hxx:451
OStringBuffer & append(double d)
Appends the string representation of the double argument to this string buffer.
Definition strbuf.hxx:746
OStringBuffer & setCharAt(sal_Int32 index, char ch)
The character at the specified index of this string buffer is set to ch.
Definition strbuf.hxx:496
OStringBuffer & append(const OString &str)
Appends the string to this string buffer.
Definition strbuf.hxx:543
OStringBuffer(const OString &value)
Constructs a string buffer so that it represents the same sequence of characters as the string argume...
Definition strbuf.hxx:153
OStringBuffer & insert(sal_Int32 offset, double d)
Inserts the string representation of the double argument into this string buffer.
Definition strbuf.hxx:1030
bool isEmpty() const
Checks if a string buffer is empty.
Definition strbuf.hxx:397
OStringBuffer & append(const char *str, sal_Int32 len)
Appends the string representation of the char array argument to this string buffer.
Definition strbuf.hxx:596
OStringBuffer & insert(sal_Int32 offset, bool b)
Inserts the string representation of the bool argument into this string buffer.
Definition strbuf.hxx:912
libreoffice_internal::ConstCharArrayDetector< T, OStringBuffer & >::Type insert(sal_Int32 offset, T &literal)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition strbuf.hxx:834
OStringBuffer(T &literal, typename libreoffice_internal::ConstCharArrayDetector< T, libreoffice_internal::Dummy >::Type=libreoffice_internal::Dummy())
Constructs a string buffer so that it represents the same sequence of characters as the string litera...
Definition strbuf.hxx:206
OStringBuffer & append(float f)
Appends the string representation of the float argument to this string buffer.
Definition strbuf.hxx:730
OStringBuffer & append(bool b)
Appends the string representation of the bool argument to the string buffer.
Definition strbuf.hxx:655
const char * getStr() const SAL_RETURNS_NONNULL
Return a null terminated character array.
Definition strbuf.hxx:506
sal_Int32 getCapacity() const
Returns the current capacity of the String buffer.
Definition strbuf.hxx:412
OStringBuffer & remove(sal_Int32 start, sal_Int32 len)
Removes the characters in a substring of this sequence.
Definition strbuf.hxx:1051
OStringBuffer & insert(sal_Int32 offset, char c)
Inserts the string representation of the char argument into this string buffer.
Definition strbuf.hxx:934
~OStringBuffer()
Release the string data.
Definition strbuf.hxx:358
void ensureCapacity(sal_Int32 minimumCapacity)
Ensures that the capacity of the buffer is at least equal to the specified minimum.
Definition strbuf.hxx:428
OString toString() const
Return an OString instance reflecting the current content of this OStringBuffer.
Definition strbuf.hxx:527
OStringBuffer & insert(sal_Int32 offset, const OString &str)
Inserts the string into this string buffer.
Definition strbuf.hxx:793
libreoffice_internal::ConstCharArrayDetector< T, OStringBuffer & >::Type append(T &literal)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition strbuf.hxx:578
libreoffice_internal::CharPtrDetector< T, OStringBuffer & >::Type append(const T &str)
Appends the string representation of the char array argument to this string buffer.
Definition strbuf.hxx:561
OStringBuffer & insert(sal_Int32 offset, const char *str, sal_Int32 len)
Inserts the string representation of the char array argument into this string buffer.
Definition strbuf.hxx:863
OStringBuffer & append(sal_Int64 l, sal_Int16 radix=10)
Appends the string representation of the long argument to this string buffer.
Definition strbuf.hxx:714
OStringBuffer(const OStringBuffer &value)
Allocates a new string buffer that contains the same sequence of characters as the string buffer argu...
Definition strbuf.hxx:91
libreoffice_internal::NonConstCharArrayDetector< T, OStringBuffer & >::Type append(T &str)
Definition strbuf.hxx:567
OStringBuffer & append(sal_Bool b)
Appends the string representation of the sal_Bool argument to the string buffer.
Definition strbuf.hxx:637
char * appendUninitialized(sal_Int32 length) SAL_RETURNS_NONNULL
Unsafe way to make space for a fixed amount of characters to be appended into this OStringBuffer.
Definition strbuf.hxx:766
OStringBuffer(const char *value, sal_Int32 length)
Constructs a string buffer so that it represents the same sequence of characters as the string argume...
Definition strbuf.hxx:233
OStringBuffer(T &value, typename libreoffice_internal::NonConstCharArrayDetector< T, libreoffice_internal::Dummy >::Type=libreoffice_internal::Dummy())
Definition strbuf.hxx:175
OStringBuffer & insert(sal_Int32 offset, sal_Bool b)
Inserts the string representation of the sal_Bool argument into this string buffer.
Definition strbuf.hxx:887
libreoffice_internal::CharPtrDetector< T, OStringBuffer & >::Type insert(sal_Int32 offset, const T &str)
Inserts the string representation of the char array argument into this string buffer.
Definition strbuf.hxx:817
sal_Int32 getLength() const
Returns the length (character count) of this string buffer.
Definition strbuf.hxx:384
OStringBuffer & insert(sal_Int32 offset, sal_Int64 l, sal_Int16 radix=10)
Inserts the string representation of the long argument into this string buffer.
Definition strbuf.hxx:981
This String class provide base functionality for C++ like 8-Bit character array handling.
Definition string.hxx:193
const char * getStr() const SAL_RETURNS_NONNULL
Returns a pointer to the characters of this string.
Definition string.hxx:690
sal_Int32 getLength() const
Returns the length of this string.
Definition string.hxx:664
Definition stringutils.hxx:146
Definition stringutils.hxx:149
static const bool ok
Definition stringutils.hxx:150
Definition stringutils.hxx:173
Definition stringutils.hxx:201
Definition stringutils.hxx:382