xref: /haiku/headers/os/locale/Country.h (revision b671e9bbdbd10268a042b4f4cc4317ccd03d105e)
1 #ifndef _COUNTRY_H_
2 #define _COUNTRY_H_
3 
4 
5 #include <SupportDefs.h>
6 #include <LocaleStrings.h>
7 #include <String.h>
8 
9 namespace icu_4_2 {
10 	class DateFormat;
11 	class Locale;
12 }
13 
14 enum {
15 	B_METRIC = 0,
16 	B_US
17 };
18 
19 
20 class BCountry {
21 	public:
22 		BCountry(const char* languageCode, const char* countryCode);
23 		BCountry(const char* languageAndCountryCode = "en_US");
24 		virtual ~BCountry();
25 
26 		virtual bool Name(BString&) const;
27 		const char* Code() const;
28 
29 		// see definitions below
30 		const char *GetString(uint32 id) const;
31 
32 		// date & time
33 
34 		virtual void FormatDate(char* string, size_t maxSize, time_t time,
35 			bool longFormat);
36 		virtual void FormatDate(BString* string, time_t time, bool longFormat);
37 		virtual void FormatTime(char* string, size_t maxSize, time_t time,
38 			bool longFormat);
39 		virtual void FormatTime(BString* string, time_t time,
40 			bool longFormat);
41 
42 		bool		DateFormat(BString&, bool longFormat) const;
43 		void		SetDateFormat(const char* formatString,
44 						bool longFormat = true);
45 		bool		TimeFormat(BString&, bool longFormat) const;
46 		const char*	DateSeparator() const;
47 		const char*	TimeSeparator() const;
48 
49 		// numbers
50 
51 		virtual void FormatNumber(char* string, size_t maxSize, double value);
52 		virtual status_t FormatNumber(BString* string, double value);
53 		virtual void FormatNumber(char* string, size_t maxSize, int32 value);
54 		virtual void FormatNumber(BString* string, int32 value);
55 
56 		bool		DecimalPoint(BString&) const;
57 		bool		ThousandsSeparator(BString&) const;
58 		bool		Grouping(BString&) const;
59 
60 		bool		PositiveSign(BString&) const;
61 		bool		NegativeSign(BString&) const;
62 
63 		// measurements
64 
65 		virtual int8	Measurement() const;
66 
67 		// monetary
68 
69 		virtual ssize_t	FormatMonetary(char* string, size_t maxSize,
70 			double value);
71 		virtual ssize_t	FormatMonetary(BString* string, double value);
72 
73 		bool		CurrencySymbol(BString&) const;
74 		bool		InternationalCurrencySymbol(BString&) const;
75 		bool		MonDecimalPoint(BString&) const;
76 		bool		MonThousandsSeparator(BString&) const;
77 		bool		MonGrouping(BString&) const;
78 		virtual int32	MonFracDigits() const;
79 
80 	private:
81 		icu_4_2::DateFormat* fICULongDateFormatter;
82 		icu_4_2::DateFormat* fICUShortDateFormatter;
83 		const char**	fStrings;
84 		icu_4_2::Locale* fICULocale;
85 };
86 
87 #endif	/* _COUNTRY_H_ */
88