ICU 60.2 60.2

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- Data Structures
- Data Structure Index
- Class Hierarchy
- Data Fields

Public Member Functions
icu::UnicodeStringAppendable Class Reference

An Appendable implementation which writes to a UnicodeString. More...

`#include <appendable.h>`

Inheritance diagram for icu::UnicodeStringAppendable:

## Public Member Functions
| UnicodeStringAppendable (UnicodeString &s)
| Aliases the UnicodeString (keeps its reference) for writing. More...
| ~UnicodeStringAppendable ()
| Destructor. More...
virtual UBool | appendCodeUnit (char16_t c)
| Appends a 16-bit code unit to the string. More...
virtual UBool | appendCodePoint (UChar32 c)
| Appends a code point to the string. More...
virtual UBool | appendString (const char16_t *s, int32_t length)
| Appends a string to the UnicodeString. More...
virtual UBool | reserveAppendCapacity (int32_t appendCapacity)
| Tells the UnicodeString that the caller is going to append roughly appendCapacity char16_ts. More...
virtual char16_t * | getAppendBuffer (int32_t minCapacity, int32_t desiredCapacityHint, char16_t *scratch, int32_t scratchCapacity, int32_t *resultCapacity)
| Returns a writable buffer for appending and writes the buffer's capacity to *resultCapacity. More...
Public Member Functions inherited from icu::Appendable
| ~Appendable ()
| Destructor. More...
Public Member Functions inherited from icu::UObject
virtual | ~UObject ()
| Destructor. More...
virtual UClassID | getDynamicClassID () const
| ICU4C "poor man's RTTI", returns a UClassID for the actual ICU class. More...

## Detailed Description

An Appendable implementation which writes to a UnicodeString.

This class is not intended for public subclassing.

Stable:
  ICU 4.8

Definition at line 153 of file appendable.h.

## Constructor & Destructor Documentation

icu::UnicodeStringAppendable::UnicodeStringAppendable | ( | UnicodeString & | s | ) |
| inline explicit

Aliases the UnicodeString (keeps its reference) for writing.

Parameters

  s | The UnicodeString to which this Appendable will write.

Stable:
  ICU 4.8

Definition at line 160 of file appendable.h.

References icu::Appendable::appendCodePoint(), icu::Appendable::appendCodeUnit(), icu::Appendable::appendString(), icu::Appendable::getAppendBuffer(), icu::Appendable::reserveAppendCapacity(), and U_NAMESPACE_END.

icu::UnicodeStringAppendable::~UnicodeStringAppendable | ( |  | ) |

Destructor.

Stable:
  ICU 4.8

## Member Function Documentation

virtual UBool icu::UnicodeStringAppendable::appendCodePoint | ( | UChar32 | c | ) |
| virtual

Appends a code point to the string.

Parameters

  c | code point 0..0x10ffff

Returns
  TRUE if the operation succeeded

Stable:
  ICU 4.8

Reimplemented from icu::Appendable.

virtual UBool icu::UnicodeStringAppendable::appendCodeUnit | ( | char16_t | c | ) |
| virtual

Appends a 16-bit code unit to the string.

Parameters

  c | code unit

Returns
  TRUE if the operation succeeded

Stable:
  ICU 4.8

Implements icu::Appendable.

virtual UBool icu::UnicodeStringAppendable::appendString | ( | const char16_t * | s,
|  | int32_t | length
| ) |  |
| virtual

Appends a string to the UnicodeString.

Parameters

  s | string, must not be NULL if length!=0
  length | string length, or -1 if NUL-terminated

Returns
  TRUE if the operation succeeded

Stable:
  ICU 4.8

Reimplemented from icu::Appendable.

virtual char16_t* icu::UnicodeStringAppendable::getAppendBuffer | ( | int32_t | minCapacity,
|  | int32_t | desiredCapacityHint,
|  | char16_t * | 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().

Parameters

  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

Returns
  a buffer with *resultCapacity>=minCapacity

Stable:
  ICU 4.8

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 char16_ts.

Parameters

  appendCapacity | estimated number of char16_ts that will be appended

Returns
  TRUE if the operation succeeded

Stable:
  ICU 4.8

Reimplemented from icu::Appendable.

The documentation for this class was generated from the following file:

- appendable.h