scuffed-code/icu4c/source/i18n/decnumstr.h
Andy Heninger 4e56218eb1 ICU-5193 Big decimal number formatting.
X-SVN-Rev: 27696
2010-02-26 02:29:00 +00:00

55 lines
1.4 KiB
C++

/*
******************************************************************************
*
* Copyright (C) 2010, International Business Machines
* Corporation and others. All Rights Reserved.
*
******************************************************************************
*
* File decnumstr.h
*
* A simple eight bit char string class.
* Used by decimal number formatting to hold the string form of numbers.
*
* For internal ICU use only. Not public API.
*
* TODO: ICU should have a light-weight general purpose (char *) string class
* available for internal use; this would eliminate the
* need for this class.
*/
#ifndef DECNUMSTR_H
#define DECNUMSTR_H
#include "unicode/utypes.h"
#include "unicode/stringpiece.h"
#include "cmemory.h"
U_NAMESPACE_BEGIN
class DecimalNumberString: public UMemory {
public:
DecimalNumberString();
~DecimalNumberString();
DecimalNumberString(const StringPiece &, UErrorCode &status);
DecimalNumberString &append(char, UErrorCode &status);
DecimalNumberString &append(const StringPiece &s, UErrorCode &status);
char &operator[] (int32_t index);
const char &operator[] (int32_t index) const;
int32_t length() const;
void setLength(int32_t length, UErrorCode &status);
operator StringPiece() const;
private:
int32_t fLength;
MaybeStackArray<char, 40> fText;
UBool ensureCapacity(int32_t neededSize, UErrorCode &status);
};
U_NAMESPACE_END
#endif // DECNUMSTR_H