1 /* 2 * Copyright 2003-2014, Haiku, Inc. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef _B_NUMBER_FORMAT_H_ 6 #define _B_NUMBER_FORMAT_H_ 7 8 9 #include <Format.h> 10 11 12 enum BNumberElement { 13 B_NUMBER_ELEMENT_INVALID = B_BAD_DATA, 14 B_NUMBER_ELEMENT_INTEGER = 0, 15 B_NUMBER_ELEMENT_FRACTIONAL, 16 B_NUMBER_ELEMENT_CURRENCY 17 }; 18 19 20 class BNumberFormat : public BFormat { 21 public: 22 BNumberFormat(); 23 BNumberFormat(const BNumberFormat &other); 24 ~BNumberFormat(); 25 26 BNumberFormat& operator=(const BNumberFormat &other); 27 28 // formatting 29 30 ssize_t Format(char* string, size_t maxSize, 31 const double value) const; 32 status_t Format(BString& string, const double value) 33 const; 34 ssize_t Format(char* string, size_t maxSize, 35 const int32 value) const; 36 status_t Format(BString& string, const int32 value) 37 const; 38 39 // monetary 40 41 ssize_t FormatMonetary(char* string, size_t maxSize, 42 const double value) const; 43 status_t FormatMonetary(BString& string, 44 const double value) const; 45 }; 46 47 48 #endif // _B_NUMBER_FORMAT_H_ 49