xref: /haiku/headers/os/locale/Format.h (revision ca8ed5ea660fb6275799a3b7f138b201c41a667b)
1 /*
2  * Copyright 2003-2010, Haiku, Inc.
3  * Distributed under the terms of the MIT Licence.
4 */
5 #ifndef _B_FORMAT_H_
6 #define _B_FORMAT_H_
7 
8 #include <FormatParameters.h>
9 #include <FormattingConventions.h>
10 #include <Locker.h>
11 #include <Language.h>
12 #include <SupportDefs.h>
13 
14 
15 // types of fields contained in formatted strings
16 enum {
17 	// number format fields
18 	B_CURRENCY_FIELD,
19 	B_DECIMAL_SEPARATOR_FIELD,
20 	B_EXPONENT_FIELD,
21 	B_EXPONENT_SIGN_FIELD,
22 	B_EXPONENT_SYMBOL_FIELD,
23 	B_FRACTION_FIELD,
24 	B_GROUPING_SEPARATOR_FIELD,
25 	B_INTEGER_FIELD,
26 	B_PERCENT_FIELD,
27 	B_PERMILLE_FIELD,
28 	B_SIGN_FIELD,
29 
30 	// date format fields
31 	// TODO: ...
32 };
33 
34 // structure filled in while formatting
35 struct format_field_position {
36 	uint32	field_type;
37 	int32	start;
38 	int32	length;
39 };
40 
41 
42 class BLocale;
43 
44 class BFormat {
45 public:
46 			status_t			InitCheck() const;
47 protected:
48 								BFormat(const BLocale* locale = NULL);
49 								BFormat(const BLanguage& language,
50 									const BFormattingConventions& conventions);
51 
52 								BFormat(const BFormat& other);
53 	virtual 					~BFormat();
54 
55 private:
56 			BFormat&			operator=(const BFormat& other);
57 
58 			status_t			_Initialize(const BLocale& locale);
59 			status_t			_Initialize(const BLanguage& language,
60 									const BFormattingConventions& conventions);
61 
62 protected:
63 			BFormattingConventions	fConventions;
64 			BLanguage			fLanguage;
65 			status_t			fInitStatus;
66 };
67 
68 
69 #endif	// _B_FORMAT_H_
70