ICU 4.8.1.1
4.8.1.1
|
00001 /* 00002 ******************************************************************************* 00003 * Copyright (C) 2011, International Business Machines 00004 * Corporation and others. All Rights Reserved. 00005 ******************************************************************************* 00006 * file name: appendable.h 00007 * encoding: US-ASCII 00008 * tab size: 8 (not used) 00009 * indentation:4 00010 * 00011 * created on: 2010dec07 00012 * created by: Markus W. Scherer 00013 */ 00014 00015 #ifndef __APPENDABLE_H__ 00016 #define __APPENDABLE_H__ 00017 00023 #include "unicode/utypes.h" 00024 #include "unicode/uobject.h" 00025 00026 U_NAMESPACE_BEGIN 00027 00028 class UnicodeString; 00029 00049 class U_COMMON_API Appendable : public UObject { 00050 public: 00057 virtual UBool appendCodeUnit(UChar c) = 0; 00058 00066 virtual UBool appendCodePoint(UChar32 c); 00067 00076 virtual UBool appendString(const UChar *s, int32_t length); 00077 00087 virtual UBool reserveAppendCapacity(int32_t appendCapacity); 00088 00133 virtual UChar *getAppendBuffer(int32_t minCapacity, 00134 int32_t desiredCapacityHint, 00135 UChar *scratch, int32_t scratchCapacity, 00136 int32_t *resultCapacity); 00137 00138 private: 00139 // No ICU "poor man's RTTI" for this class nor its subclasses. 00140 virtual UClassID getDynamicClassID() const; 00141 }; 00142 00149 class U_COMMON_API UnicodeStringAppendable : public Appendable { 00150 public: 00156 explicit UnicodeStringAppendable(UnicodeString &s) : str(s) {} 00157 00164 virtual UBool appendCodeUnit(UChar c); 00165 00172 virtual UBool appendCodePoint(UChar32 c); 00173 00181 virtual UBool appendString(const UChar *s, int32_t length); 00182 00190 virtual UBool reserveAppendCapacity(int32_t appendCapacity); 00191 00213 virtual UChar *getAppendBuffer(int32_t minCapacity, 00214 int32_t desiredCapacityHint, 00215 UChar *scratch, int32_t scratchCapacity, 00216 int32_t *resultCapacity); 00217 00218 private: 00219 UnicodeString &str; 00220 }; 00221 00222 U_NAMESPACE_END 00223 00224 #endif // __APPENDABLE_H__