ICU 54.1 54.1

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

- File List
- Globals

All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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__