1/* 2****************************************************************************** 3* 4* Copyright (C) 2010, International Business Machines 5* Corporation and others. All Rights Reserved. 6* 7****************************************************************************** 8* 9* File decnumstr.h 10* 11* A simple eight bit char string class. 12* Used by decimal number formatting to hold the string form of numbers. 13* 14* For internal ICU use only. Not public API. 15* 16* TODO: ICU should have a light-weight general purpose (char *) string class 17* available for internal use; this would eliminate the 18* need for this class. 19*/ 20 21#ifndef DECNUMSTR_H 22#define DECNUMSTR_H 23 24#include "unicode/utypes.h" 25#include "unicode/stringpiece.h" 26#include "cmemory.h" 27 28U_NAMESPACE_BEGIN 29 30class DecimalNumberString: public UMemory { 31public: 32 DecimalNumberString(); 33 ~DecimalNumberString(); 34 35 DecimalNumberString(const StringPiece &, UErrorCode &status); 36 37 DecimalNumberString &append(char, UErrorCode &status); 38 DecimalNumberString &append(const StringPiece &s, UErrorCode &status); 39 char &operator[] (int32_t index); 40 const char &operator[] (int32_t index) const; 41 int32_t length() const; 42 void setLength(int32_t length, UErrorCode &status); 43 operator StringPiece() const; 44 private: 45 int32_t fLength; 46 MaybeStackArray<char, 40> fText; 47 48 UBool ensureCapacity(int32_t neededSize, UErrorCode &status); 49}; 50 51U_NAMESPACE_END 52 53#endif // DECNUMSTR_H 54 55