]>
git.saurik.com Git - apple/icu.git/blob - icuSources/common/appendable.cpp
2 *******************************************************************************
3 * Copyright (C) 2011-2012, International Business Machines
4 * Corporation and others. All Rights Reserved.
5 *******************************************************************************
6 * file name: appendable.cpp
8 * tab size: 8 (not used)
11 * created on: 2010dec07
12 * created by: Markus W. Scherer
15 #include "unicode/utypes.h"
16 #include "unicode/appendable.h"
17 #include "unicode/utf16.h"
21 Appendable::~Appendable() {}
24 Appendable::appendCodePoint(UChar32 c
) {
26 return appendCodeUnit((UChar
)c
);
28 return appendCodeUnit(U16_LEAD(c
)) && appendCodeUnit(U16_TRAIL(c
));
33 Appendable::appendString(const UChar
*s
, int32_t length
) {
37 if(!appendCodeUnit(c
)) {
42 const UChar
*limit
=s
+length
;
44 if(!appendCodeUnit(*s
++)) {
53 Appendable::reserveAppendCapacity(int32_t /*appendCapacity*/) {
58 Appendable::getAppendBuffer(int32_t minCapacity
,
59 int32_t /*desiredCapacityHint*/,
60 UChar
*scratch
, int32_t scratchCapacity
,
61 int32_t *resultCapacity
) {
62 if(minCapacity
<1 || scratchCapacity
<minCapacity
) {
66 *resultCapacity
=scratchCapacity
;
70 // UnicodeStringAppendable is implemented in unistr.cpp.