LibreOffice
LibreOffice 24.2 SDK C/C++ API Reference
Functions
strbuf.h File Reference
#include "sal/config.h"
#include "rtl/string.h"
#include "sal/saldllapi.h"

Go to the source code of this file.

Functions

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. More...
 
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. More...
 
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. More...
 
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. More...
 
SAL_DLLPUBLIC void rtl_stringbuffer_remove (rtl_String **This, sal_Int32 start, sal_Int32 len)
 Removes the characters in a substring of this sequence. More...
 

Function Documentation

◆ rtl_stringbuffer_ensureCapacity()

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.

If the current capacity of this string buffer is less than the argument, then a new internal buffer is allocated with greater capacity. The new capacity is the larger of:

  • The minimumCapacity argument.
  • Twice the old capacity, plus 2.

If the minimumCapacity argument is nonpositive, this method takes no action and simply returns.

Parameters
[in,out]Thisthe String to operate on.
[in,out]capacityin: old capacity, out: new capacity.
[in]minimumCapacitythe minimum desired capacity.

◆ rtl_stringbuffer_insert()

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.

The characters of the array argument are inserted into the contents of this string buffer at the position indicated by offset. The length of this string buffer increases by the length of the argument.

Parameters
[in,out]Thisthe String to operate on.
[in,out]capacitythe capacity of the string buffer
[in]offsetthe offset.
[in]stra character array. Since LibreOffice 4.4, as a special case, if str is null then the len added characters are left uninitialized.
[in]lenthe number of characters to append.

◆ rtl_stringbuffer_newFromStr_WithLength()

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.

The count argument specifies the length of the array. The initial capacity of the string buffer is 16 plus the length of the string argument.

Parameters
newStrout parameter, contains the new string. The reference count is 1.
valuethe initial value of the string.
countthe length of value.

◆ rtl_stringbuffer_newFromStringBuffer()

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.

The initial capacity is the larger of:

  • The bufferLen argument.
  • The length of the string argument.
Parameters
newStrout parameter, contains the new string. The reference count is 1.
capacitythe initial len of the string buffer.
oldStrthe initial value of the string.
Returns
the new capacity of the string buffer

◆ rtl_stringbuffer_remove()

SAL_DLLPUBLIC void rtl_stringbuffer_remove ( rtl_String **  This,
sal_Int32  start,
sal_Int32  len 
)

Removes the characters in a substring of this sequence.

The substring begins at the specified start and is len characters long.

start must be >= 0 && <= This->length

Parameters
[in,out]ThisThe String to operate on.
[in]startThe beginning index, inclusive
[in]lenThe substring length