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
00027 #if U_SHOW_CPLUSPLUS_API
00028
00029 #include "unicode/uobject.h"
00030
00031 U_NAMESPACE_BEGIN
00032
00033 class UnicodeString;
00034
00054 class U_COMMON_API Appendable : public UObject {
00055 public:
00060 ~Appendable();
00061
00068 virtual UBool appendCodeUnit(char16_t c) = 0;
00069
00077 virtual UBool appendCodePoint(UChar32 c);
00078
00087 virtual UBool appendString(const char16_t *s, int32_t length);
00088
00098 virtual UBool reserveAppendCapacity(int32_t appendCapacity);
00099
00144 virtual char16_t *getAppendBuffer(int32_t minCapacity,
00145 int32_t desiredCapacityHint,
00146 char16_t *scratch, int32_t scratchCapacity,
00147 int32_t *resultCapacity);
00148 };
00149
00156 class U_COMMON_API UnicodeStringAppendable : public Appendable {
00157 public:
00163 explicit UnicodeStringAppendable(UnicodeString &s) : str(s) {}
00164
00169 ~UnicodeStringAppendable();
00170
00177 virtual UBool appendCodeUnit(char16_t c);
00178
00185 virtual UBool appendCodePoint(UChar32 c);
00186
00194 virtual UBool appendString(const char16_t *s, int32_t length);
00195
00203 virtual UBool reserveAppendCapacity(int32_t appendCapacity);
00204
00226 virtual char16_t *getAppendBuffer(int32_t minCapacity,
00227 int32_t desiredCapacityHint,
00228 char16_t *scratch, int32_t scratchCapacity,
00229 int32_t *resultCapacity);
00230
00231 private:
00232 UnicodeString &str;
00233 };
00234
00235 U_NAMESPACE_END
00236
00237 #endif
00238
00239 #endif // __APPENDABLE_H__