My Project
UDK 3.2.7 C/C++ API Reference
|
A string buffer implements a mutable sequence of characters. More...
#include <strbuf.hxx>
Public Member Functions | |
OStringBuffer () | |
Constructs a string buffer with no characters in it and an initial capacity of 16 characters. | |
OStringBuffer (const OStringBuffer &value) | |
Allocates a new string buffer that contains the same sequence of characters as the string buffer argument. | |
OStringBuffer (int length) | |
Constructs a string buffer with no characters in it and an initial capacity specified by the length argument. | |
OStringBuffer (OString value) | |
Constructs a string buffer so that it represents the same sequence of characters as the string argument. | |
template<typename T > | |
OStringBuffer (const T &value, typename internal::CharPtrDetector< T, internal::Dummy >::Type=internal::Dummy()) | |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
template<typename T > | |
OStringBuffer (T &value, typename internal::NonConstCharArrayDetector< T, internal::Dummy >::Type=internal::Dummy()) | |
template<typename T > | |
OStringBuffer (T &literal, typename internal::ConstCharArrayDetector< T, internal::Dummy >::Type=internal::Dummy()) | |
Constructs a string buffer so that it represents the same sequence of characters as the string literal. | |
OStringBuffer (const sal_Char *value, sal_Int32 length) | |
Constructs a string buffer so that it represents the same sequence of characters as the string argument. | |
OStringBuffer & | operator= (const OStringBuffer &value) |
Assign to this a copy of value. | |
~OStringBuffer () | |
Release the string data. | |
OString | makeStringAndClear () |
Fill the string data in the new string and clear the buffer. | |
sal_Int32 | getLength () const |
Returns the length (character count) of this string buffer. | |
sal_Int32 | getCapacity () const |
Returns the current capacity of the String buffer. | |
void | ensureCapacity (sal_Int32 minimumCapacity) |
Ensures that the capacity of the buffer is at least equal to the specified minimum. | |
void | setLength (sal_Int32 newLength) |
Sets the length of this String buffer. | |
sal_Char | charAt (sal_Int32 index) |
Returns the character at a specific index in this string buffer. | |
OStringBuffer & | setCharAt (sal_Int32 index, sal_Char ch) |
The character at the specified index of this string buffer is set to ch . | |
const sal_Char * | getStr () const |
Return a null terminated character array. | |
sal_Char & | operator[] (sal_Int32 index) |
Access to individual characters. | |
const OString | toString () const |
Return a OString instance reflecting the current content of this OStringBuffer. | |
OStringBuffer & | append (const OString &str) |
Appends the string to this string buffer. | |
template<typename T > | |
internal::CharPtrDetector< T, OStringBuffer & >::Type | append (const T &str) |
Appends the string representation of the char array argument to this string buffer. | |
template<typename T > | |
internal::NonConstCharArrayDetector < T, OStringBuffer & >::Type | append (T &str) |
template<typename T > | |
internal::ConstCharArrayDetector < T, OStringBuffer & >::Type | append (T &literal) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.This function accepts an ASCII string literal as its argument. | |
OStringBuffer & | append (const sal_Char *str, sal_Int32 len) |
Appends the string representation of the char array argument to this string buffer. | |
OStringBuffer & | append (sal_Bool b) |
Appends the string representation of the sal_Bool argument to the string buffer. | |
OStringBuffer & | append (sal_Char c) |
Appends the string representation of the char argument to this string buffer. | |
OStringBuffer & | append (sal_Int32 i, sal_Int16 radix=10) |
Appends the string representation of the sal_Int32 argument to this string buffer. | |
OStringBuffer & | append (sal_Int64 l, sal_Int16 radix=10) |
Appends the string representation of the long argument to this string buffer. | |
OStringBuffer & | append (float f) |
Appends the string representation of the float argument to this string buffer. | |
OStringBuffer & | append (double d) |
Appends the string representation of the double argument to this string buffer. | |
OStringBuffer & | insert (sal_Int32 offset, const OString &str) |
Inserts the string into this string buffer. | |
template<typename T > | |
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. | |
template<typename T > | |
internal::NonConstCharArrayDetector < T, OStringBuffer & >::Type | insert (sal_Int32 offset, T &str) |
template<typename T > | |
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 only in what argument(s) it accepts.This function accepts an ASCII string literal as its argument. | |
OStringBuffer & | insert (sal_Int32 offset, const sal_Char *str, sal_Int32 len) |
Inserts the string representation of the char array argument into this string buffer. | |
OStringBuffer & | insert (sal_Int32 offset, sal_Bool b) |
Inserts the string representation of the sal_Bool argument into this string buffer. | |
OStringBuffer & | insert (sal_Int32 offset, sal_Char c) |
Inserts the string representation of the char argument into this string buffer. | |
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. | |
OStringBuffer & | insert (sal_Int32 offset, sal_Int64 l, sal_Int16 radix=10) |
Inserts the string representation of the long argument into this string buffer. | |
OStringBuffer | insert (sal_Int32 offset, float f) |
Inserts the string representation of the float argument into this string buffer. | |
OStringBuffer & | insert (sal_Int32 offset, double d) |
Inserts the string representation of the double argument into this string buffer. | |
OStringBuffer & | remove (sal_Int32 start, sal_Int32 len) |
Removes the characters in a substring of this sequence. |
A string buffer implements a mutable sequence of characters.
String buffers are safe for use by multiple threads. The methods are synchronized where necessary so that all the operations on any particular instance behave as if they occur in some serial order.
String buffers are used by the compiler to implement the binary string concatenation operator +
. For example, the code:
x = "a" + 4 + "c"
is compiled to the equivalent of:
x = new OStringBuffer().append("a").append(4).append("c") .makeStringAndClear()
The principal operations on a OStringBuffer
are the append
and insert
methods, which are overloaded so as to accept data of any type. Each effectively converts a given datum to a string and then appends or inserts the characters of that string to the string buffer. The append
method always adds these characters at the end of the buffer; the insert
method adds the characters at a specified point.
For example, if z
refers to a string buffer object whose current contents are "<code>start</code>", then the method call z.append("le")
would cause the string buffer to contain "<code>startle</code>", whereas z.insert(4, "le")
would alter the string buffer to contain "<code>starlet</code>".
Every string buffer has a capacity. As long as the length of the character sequence contained in the string buffer does not exceed the capacity, it is not necessary to allocate a new internal buffer array. If the internal buffer overflows, it is automatically made larger.
|
inline |
Constructs a string buffer with no characters in it and an initial capacity of 16 characters.
|
inline |
Allocates a new string buffer that contains the same sequence of characters as the string buffer argument.
value | a OStringBuffer . |
|
inlineexplicit |
Constructs a string buffer with no characters in it and an initial capacity specified by the length
argument.
length | the initial capacity. |
|
inline |
Constructs a string buffer so that it represents the same sequence of characters as the string argument.
The initial capacity of the string buffer is 16
plus the length of the string argument.
value | the initial string value. |
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
inline |
|
inline |
Constructs a string buffer so that it represents the same sequence of characters as the string literal.
If there are any embedded \0's in the string literal, the result is undefined. Use the overload that explicitly accepts length.
literal | a string literal |
|
inline |
Constructs a string buffer so that it represents the same sequence of characters as the string argument.
The initial capacity of the string buffer is 16
plus length
value | a character array. |
length | the number of character which should be copied. The character array length must be greater or equal than this value. |
|
inline |
Release the string data.
|
inline |
Appends the string to this string buffer.
The characters of the String
argument are appended, in order, to the contents of this string buffer, increasing the length of this string buffer by the length of the argument.
str | a string. |
|
inline |
Appends the string representation of the char
array argument to this string buffer.
The characters of the array argument are appended, in order, to the contents of this string buffer. The length of this string buffer increases by the length of the argument.
str | the characters to be appended. |
|
inline |
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.This function accepts an ASCII string literal as its argument.
|
inline |
Appends the string representation of the char
array argument to this string buffer.
Characters of the character array str
are appended, in order, to the contents of this string buffer. The length of this string buffer increases by the value of len
.
str | the characters to be appended; must be non-null, and must point to at least len characters |
len | the number of characters to append; must be non-negative |
|
inline |
Appends the string representation of the sal_Bool
argument to the string buffer.
The argument is converted to a string as if by the method String.valueOf
, and the characters of that string are then appended to this string buffer.
b | a sal_Bool . |
|
inline |
Appends the string representation of the char
argument to this string buffer.
The argument is appended to the contents of this string buffer. The length of this string buffer increases by 1
.
c | a char . |
|
inline |
Appends the string representation of the sal_Int32
argument to this string buffer.
The argument is converted to a string as if by the method String.valueOf
, and the characters of that string are then appended to this string buffer.
i | an sal_Int32 . |
|
inline |
Appends the string representation of the long
argument to this string buffer.
The argument is converted to a string as if by the method String.valueOf
, and the characters of that string are then appended to this string buffer.
l | a long . |
|
inline |
Appends the string representation of the float
argument to this string buffer.
The argument is converted to a string as if by the method String.valueOf
, and the characters of that string are then appended to this string buffer.
f | a float . |
|
inline |
Appends the string representation of the double
argument to this string buffer.
The argument is converted to a string as if by the method String.valueOf
, and the characters of that string are then appended to this string buffer.
d | a double . |
|
inline |
Returns the character at a specific index in this string buffer.
The first character of a string buffer is at index 0
, the next at index 1
, and so on, for array indexing.
The index argument must be greater than or equal to 0
, and less than the length of this string buffer.
index | the index of the desired character. |
|
inline |
Ensures that the capacity of the buffer is at least equal to the specified minimum.
The new capacity will be at least as large as the maximum of the current length (so that no contents of the buffer is destroyed) and the given minimumCapacity. If the given minimumCapacity is negative, nothing is changed.
minimumCapacity | the minimum desired capacity. |
|
inline |
Returns the current capacity of the String buffer.
The capacity is the amount of storage available for newly inserted characters. The real buffer size is 2 bytes longer, because all strings are 0 terminated.
|
inline |
Returns the length (character count) of this string buffer.
|
inline |
Return a null terminated character array.
|
inline |
Inserts the string into this string buffer.
The characters of the String
argument are inserted, in order, into this string buffer at the indicated offset. The length of this string buffer is increased by the length of the argument.
The offset argument must be greater than or equal to 0
, and less than or equal to the length of this string buffer.
offset | the offset. |
str | a string. |
|
inline |
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.
The offset argument must be greater than or equal to 0
, and less than or equal to the length of this string buffer.
offset | the offset. |
str | a character array. |
|
inline |
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.This function accepts an ASCII string literal as its argument.
|
inline |
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.
The offset argument must be greater than or equal to 0
, and less than or equal to the length of this string buffer.
offset | the offset. |
str | a character array. |
len | the number of characters to append. |
|
inline |
Inserts the string representation of the sal_Bool
argument into this string buffer.
The second argument is converted to a string as if by the method String.valueOf
, and the characters of that string are then inserted into this string buffer at the indicated offset.
The offset argument must be greater than or equal to 0
, and less than or equal to the length of this string buffer.
offset | the offset. |
b | a sal_Bool . |
|
inline |
Inserts the string representation of the char
argument into this string buffer.
The second argument is inserted into the contents of this string buffer at the position indicated by offset
. The length of this string buffer increases by one.
The offset argument must be greater than or equal to 0
, and less than or equal to the length of this string buffer.
offset | the offset. |
c | a char . |
|
inline |
Inserts the string representation of the second sal_Int32
argument into this string buffer.
The second argument is converted to a string as if by the method String.valueOf
, and the characters of that string are then inserted into this string buffer at the indicated offset.
The offset argument must be greater than or equal to 0
, and less than or equal to the length of this string buffer.
offset | the offset. |
i | an sal_Int32 . |
|
inline |
Inserts the string representation of the long
argument into this string buffer.
The second argument is converted to a string as if by the method String.valueOf
, and the characters of that string are then inserted into this string buffer at the indicated offset.
The offset argument must be greater than or equal to 0
, and less than or equal to the length of this string buffer.
offset | the offset. |
l | a long . |
|
inline |
Inserts the string representation of the float
argument into this string buffer.
The second argument is converted to a string as if by the method String.valueOf
, and the characters of that string are then inserted into this string buffer at the indicated offset.
The offset argument must be greater than or equal to 0
, and less than or equal to the length of this string buffer.
offset | the offset. |
f | a float . |
|
inline |
Inserts the string representation of the double
argument into this string buffer.
The second argument is converted to a string as if by the method String.valueOf
, and the characters of that string are then inserted into this string buffer at the indicated offset.
The offset argument must be greater than or equal to 0
, and less than or equal to the length of this string buffer.
offset | the offset. |
d | a double . |
|
inline |
Fill the string data in the new string and clear the buffer.
This method is more efficient than the contructor of the string. It does not copy the buffer.
|
inline |
Assign to this a copy of value.
|
inline |
Access to individual characters.
index | must be non-negative and less than length. |
|
inline |
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 && <= getLength() && <= end
start | The beginning index, inclusive |
len | The substring length |
|
inline |
The character at the specified index of this string buffer is set to ch
.
The index argument must be greater than or equal to 0
, and less than the length of this string buffer.
index | the index of the character to modify. |
ch | the new character. |
|
inline |
Sets the length of this String buffer.
If the newLength
argument is less than the current length of the string buffer, the string buffer is truncated to contain exactly the number of characters given by the newLength
argument.
If the newLength
argument is greater than or equal to the current length, sufficient null characters ('\u0000'
) are appended to the string buffer so that length becomes the newLength
argument.
The newLength
argument must be greater than or equal to 0
.
newLength | the new length of the buffer. |
|
inline |
Return a OString instance reflecting the current content of this OStringBuffer.