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