An Appendable implementation which writes to a UnicodeString. More...
#include <appendable.h>
Public Member Functions | |
UnicodeStringAppendable (UnicodeString &s) | |
Aliases the UnicodeString (keeps its reference) for writing. | |
~UnicodeStringAppendable () | |
Destructor. | |
virtual UBool | appendCodeUnit (UChar c) |
Appends a 16-bit code unit to the string. | |
virtual UBool | appendCodePoint (UChar32 c) |
Appends a code point to the string. | |
virtual UBool | appendString (const UChar *s, int32_t length) |
Appends a string to the UnicodeString. | |
virtual UBool | reserveAppendCapacity (int32_t appendCapacity) |
Tells the UnicodeString that the caller is going to append roughly appendCapacity UChars. | |
virtual UChar * | getAppendBuffer (int32_t minCapacity, int32_t desiredCapacityHint, UChar *scratch, int32_t scratchCapacity, int32_t *resultCapacity) |
Returns a writable buffer for appending and writes the buffer's capacity to *resultCapacity. |
An Appendable implementation which writes to a UnicodeString.
This class is not intended for public subclassing.
Definition at line 155 of file appendable.h.
icu::UnicodeStringAppendable::UnicodeStringAppendable | ( | UnicodeString & | s | ) | [inline, explicit] |
Aliases the UnicodeString (keeps its reference) for writing.
s | The UnicodeString to which this Appendable will write. |
Definition at line 162 of file appendable.h.
icu::UnicodeStringAppendable::~UnicodeStringAppendable | ( | ) |
Destructor.
Appends a code point to the string.
c | code point 0..0x10ffff |
Reimplemented from icu::Appendable.
Appends a 16-bit code unit to the string.
c | code unit |
Implements icu::Appendable.
virtual UBool icu::UnicodeStringAppendable::appendString | ( | const UChar * | s, | |
int32_t | length | |||
) | [virtual] |
Appends a string to the UnicodeString.
s | string, must not be NULL if length!=0 | |
length | string length, or -1 if NUL-terminated |
Reimplemented from icu::Appendable.
virtual UChar* icu::UnicodeStringAppendable::getAppendBuffer | ( | int32_t | minCapacity, | |
int32_t | desiredCapacityHint, | |||
UChar * | scratch, | |||
int32_t | scratchCapacity, | |||
int32_t * | resultCapacity | |||
) | [virtual] |
Returns a writable buffer for appending and writes the buffer's capacity to *resultCapacity.
Guarantees *resultCapacity>=minCapacity. May return a pointer to the caller-owned scratch buffer which must have scratchCapacity>=minCapacity. The returned buffer is only valid until the next write operation on the UnicodeString.
For details see Appendable::getAppendBuffer().
minCapacity | required minimum capacity of the returned buffer; must be non-negative | |
desiredCapacityHint | desired capacity of the returned buffer; must be non-negative | |
scratch | default caller-owned buffer | |
scratchCapacity | capacity of the scratch buffer | |
resultCapacity | pointer to an integer which will be set to the capacity of the returned buffer |
Reimplemented from icu::Appendable.
virtual UBool icu::UnicodeStringAppendable::reserveAppendCapacity | ( | int32_t | appendCapacity | ) | [virtual] |
Tells the UnicodeString that the caller is going to append roughly appendCapacity UChars.
appendCapacity | estimated number of UChars that will be appended |
Reimplemented from icu::Appendable.