ICU 50.1.2  50.1.2
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 
27 
28 class UnicodeString;
29 
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 private:
145  // No ICU "poor man's RTTI" for this class nor its subclasses.
146  virtual UClassID getDynamicClassID() const;
147 };
148 
156 public:
162  explicit UnicodeStringAppendable(UnicodeString &s) : str(s) {}
163 
169 
176  virtual UBool appendCodeUnit(UChar c);
177 
184  virtual UBool appendCodePoint(UChar32 c);
185 
193  virtual UBool appendString(const UChar *s, int32_t length);
194 
202  virtual UBool reserveAppendCapacity(int32_t appendCapacity);
203 
225  virtual UChar *getAppendBuffer(int32_t minCapacity,
226  int32_t desiredCapacityHint,
227  UChar *scratch, int32_t scratchCapacity,
228  int32_t *resultCapacity);
229 
230 private:
231  UnicodeString &str;
232 };
233 
235 
236 #endif // __APPENDABLE_H__