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