ICU 56.1: appendable.h Source File

ICU 56.1 56.1

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

- File List
- Globals

appendable.h
Go to the documentation of this file.
1 /*
2 *******************************************************************************
3 * Copyright (C) 2011-2012, International Business Machines
4 * Corporation and others. All Rights Reserved.
5 *******************************************************************************
6 * file name: appendable.h
7 * encoding: US-ASCII
8 * tab size: 8 (not used)
9 * indentation:4
10 *
11 * created on: 2010dec07
12 * created by: Markus W. Scherer
13 */
14
15 #ifndef __APPENDABLE_H__
16 #define __APPENDABLE_H__
17
23 #include "unicode/utypes.h"
24 #include "unicode/uobject.h"
25
26 U_NAMESPACE_BEGIN
27
28 class UnicodeString;
29
49 class U_COMMON_API Appendable : public UObject {
50 public:
55 ~Appendable();
56
63 virtual UBool appendCodeUnit(UChar c) = 0;
64
72 virtual UBool appendCodePoint(UChar32 c);
73
82 virtual UBool appendString(const UChar *s, int32_t length);
83
93 virtual UBool reserveAppendCapacity(int32_t appendCapacity);
94
139 virtual UChar *getAppendBuffer(int32_t minCapacity,
140 int32_t desiredCapacityHint,
141 UChar *scratch, int32_t scratchCapacity,
142 int32_t *resultCapacity);
143 };
144
151 class U_COMMON_API UnicodeStringAppendable : public Appendable {
152 public:
158 explicit UnicodeStringAppendable(UnicodeString &s) : str(s) {}
159
164 ~UnicodeStringAppendable();
165
172 virtual UBool appendCodeUnit(UChar c);
173
180 virtual UBool appendCodePoint(UChar32 c);
181
189 virtual UBool appendString(const UChar *s, int32_t length);
190
198 virtual UBool reserveAppendCapacity(int32_t appendCapacity);
199
221 virtual UChar *getAppendBuffer(int32_t minCapacity,
222 int32_t desiredCapacityHint,
223 UChar *scratch, int32_t scratchCapacity,
224 int32_t *resultCapacity);
225
226 private:
227 UnicodeString &str;
228 };
229
230 U_NAMESPACE_END
231
232 #endif // __APPENDABLE_H__
icu::Appendable::reserveAppendCapacity
virtual UBool reserveAppendCapacity(int32_t appendCapacity)
Tells the object that the caller is going to append roughly appendCapacity UChars.
icu::Appendable::appendCodeUnit
virtual UBool appendCodeUnit(UChar c)=0
Appends a 16-bit code unit.
icu::UnicodeStringAppendable
An Appendable implementation which writes to a UnicodeString.
Definition: appendable.h:151
icu::Appendable::getAppendBuffer
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.
U_NAMESPACE_BEGIN
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
Definition: uversion.h:129
icu::Appendable::appendCodePoint
virtual UBool appendCodePoint(UChar32 c)
Appends a code point.
UChar32
int32_t UChar32
Define UChar32 as a type for single Unicode code points.
Definition: umachine.h:332
icu::UnicodeStringAppendable::UnicodeStringAppendable
UnicodeStringAppendable(UnicodeString &s)
Aliases the UnicodeString (keeps its reference) for writing.
Definition: appendable.h:158
uobject.h
C++ API: Common ICU base class UObject.
UChar
uint16_t UChar
Define UChar to be UCHAR_TYPE, if that is #defined (for example, to char16_t), or wchar_t if that is ...
Definition: umachine.h:312
U_NAMESPACE_END
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
Definition: uversion.h:130
icu::Appendable::appendString
virtual UBool appendString(const UChar *s, int32_t length)
Appends a string.
utypes.h
Basic definitions for ICU, for both C and C++ APIs.
U_COMMON_API
#define U_COMMON_API
Set to export library symbols from inside the common library, and to import them from outside...
Definition: utypes.h:357
icu::UnicodeString
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
Definition: unistr.h:293
icu::UObject
UObject is the common ICU "boilerplate" class.
Definition: uobject.h:221
UBool
int8_t UBool
The ICU boolean type.
Definition: umachine.h:234
icu::Appendable
Base class for objects to which Unicode characters and strings can be appended.
Definition: appendable.h:49