xref: /haiku/headers/os/locale/NumberFormat.h (revision 95c9effd68127df2dce202d5e254a7c86560010a)
1 /*
2  * Copyright 2003-2017, 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_DECIMAL_SEPARATOR = 10, // Values 0-9 are reserved for digit symbols
14 	B_GROUPING_SEPARATOR,
15 };
16 
17 class BNumberFormatImpl;
18 
19 
20 class BNumberFormat : public BFormat {
21 public:
22 								BNumberFormat();
23 								~BNumberFormat();
24 
25 			ssize_t				Format(char* string, size_t maxSize,
26 									const double value);
27 			status_t			Format(BString& string, const double value);
28 			ssize_t				Format(char* string, size_t maxSize,
29 									const int32 value);
30 			status_t			Format(BString& string, const int32 value);
31 
32 			ssize_t				FormatMonetary(char* string, size_t maxSize,
33 									const double value);
34 			status_t			FormatMonetary(BString& string,
35 									const double value);
36 
37 			status_t			Parse(const BString& string, double& value);
38 
39 			BString			GetSeparator(BNumberElement element);
40 
41 private:
42 								BNumberFormat(const BNumberFormat &other);
43 
44 private:
45 			BNumberFormatImpl*	fPrivateData;
46 };
47 
48 
49 #endif	// _B_NUMBER_FORMAT_H_
50