ICU 4.8.1.1  4.8.1.1
 All Data Structures 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, 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 
27 
28 class UnicodeString;
29 
50 public:
57  virtual UBool appendCodeUnit(UChar c) = 0;
58 
66  virtual UBool appendCodePoint(UChar32 c);
67 
76  virtual UBool appendString(const UChar *s, int32_t length);
77 
87  virtual UBool reserveAppendCapacity(int32_t appendCapacity);
88 
133  virtual UChar *getAppendBuffer(int32_t minCapacity,
134  int32_t desiredCapacityHint,
135  UChar *scratch, int32_t scratchCapacity,
136  int32_t *resultCapacity);
137 
138 private:
139  // No ICU "poor man's RTTI" for this class nor its subclasses.
140  virtual UClassID getDynamicClassID() const;
141 };
142 
150 public:
156  explicit UnicodeStringAppendable(UnicodeString &s) : str(s) {}
157 
164  virtual UBool appendCodeUnit(UChar c);
165 
172  virtual UBool appendCodePoint(UChar32 c);
173 
181  virtual UBool appendString(const UChar *s, int32_t length);
182 
190  virtual UBool reserveAppendCapacity(int32_t appendCapacity);
191 
213  virtual UChar *getAppendBuffer(int32_t minCapacity,
214  int32_t desiredCapacityHint,
215  UChar *scratch, int32_t scratchCapacity,
216  int32_t *resultCapacity);
217 
218 private:
219  UnicodeString &str;
220 };
221 
223 
224 #endif // __APPENDABLE_H__