Format.h revision a1ceb000
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
15enum {
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
34struct format_field_position {
35	uint32	field_type;
36	int32	start;
37	int32	length;
38};
39
40
41class BLocale;
42
43class BFormat {
44public:
45			status_t			InitCheck() const;
46protected:
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
54private:
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
61protected:
62			BFormattingConventions	fConventions;
63			BLanguage			fLanguage;
64			status_t			fInitStatus;
65};
66
67
68#endif	// _B_FORMAT_H_
69