00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __APPENDABLE_H__
00018 #define __APPENDABLE_H__
00019
00025 #include "unicode/utypes.h"
00026 #include "unicode/uobject.h"
00027
00028 U_NAMESPACE_BEGIN
00029
00030 class UnicodeString;
00031
00051 class U_COMMON_API Appendable : public UObject {
00052 public:
00057 ~Appendable();
00058
00065 virtual UBool appendCodeUnit(char16_t c) = 0;
00066
00074 virtual UBool appendCodePoint(UChar32 c);
00075
00084 virtual UBool appendString(const char16_t *s, int32_t length);
00085
00095 virtual UBool reserveAppendCapacity(int32_t appendCapacity);
00096
00141 virtual char16_t *getAppendBuffer(int32_t minCapacity,
00142 int32_t desiredCapacityHint,
00143 char16_t *scratch, int32_t scratchCapacity,
00144 int32_t *resultCapacity);
00145 };
00146
00153 class U_COMMON_API UnicodeStringAppendable : public Appendable {
00154 public:
00160 explicit UnicodeStringAppendable(UnicodeString &s) : str(s) {}
00161
00166 ~UnicodeStringAppendable();
00167
00174 virtual UBool appendCodeUnit(char16_t c);
00175
00182 virtual UBool appendCodePoint(UChar32 c);
00183
00191 virtual UBool appendString(const char16_t *s, int32_t length);
00192
00200 virtual UBool reserveAppendCapacity(int32_t appendCapacity);
00201
00223 virtual char16_t *getAppendBuffer(int32_t minCapacity,
00224 int32_t desiredCapacityHint,
00225 char16_t *scratch, int32_t scratchCapacity,
00226 int32_t *resultCapacity);
00227
00228 private:
00229 UnicodeString &str;
00230 };
00231
00232 U_NAMESPACE_END
00233
00234 #endif // __APPENDABLE_H__