00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
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:
00055 ~Appendable();
00056
00063 virtual UBool appendCodeUnit(UChar c) = 0;
00064
00072 virtual UBool appendCodePoint(UChar32 c);
00073
00082 virtual UBool appendString(const UChar *s, int32_t length);
00083
00093 virtual UBool reserveAppendCapacity(int32_t appendCapacity);
00094
00139 virtual UChar *getAppendBuffer(int32_t minCapacity,
00140 int32_t desiredCapacityHint,
00141 UChar *scratch, int32_t scratchCapacity,
00142 int32_t *resultCapacity);
00143
00144 private:
00145
00146 virtual UClassID getDynamicClassID() const;
00147 };
00148
00155 class U_COMMON_API UnicodeStringAppendable : public Appendable {
00156 public:
00162 explicit UnicodeStringAppendable(UnicodeString &s) : str(s) {}
00163
00168 ~UnicodeStringAppendable();
00169
00176 virtual UBool appendCodeUnit(UChar c);
00177
00184 virtual UBool appendCodePoint(UChar32 c);
00185
00193 virtual UBool appendString(const UChar *s, int32_t length);
00194
00202 virtual UBool reserveAppendCapacity(int32_t appendCapacity);
00203
00225 virtual UChar *getAppendBuffer(int32_t minCapacity,
00226 int32_t desiredCapacityHint,
00227 UChar *scratch, int32_t scratchCapacity,
00228 int32_t *resultCapacity);
00229
00230 private:
00231 UnicodeString &str;
00232 };
00233
00234 U_NAMESPACE_END
00235
00236 #endif // __APPENDABLE_H__