xref: /haiku/headers/os/locale/Language.h (revision 17889a8c70dbb3d59c1412f6431968753c767bab)
1 /*
2  * Copyright 2003-2011, Haiku, Inc.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef _LANGUAGE_H_
6 #define _LANGUAGE_H_
7 
8 
9 #include <LocaleStrings.h>
10 #include <String.h>
11 #include <SupportDefs.h>
12 
13 
14 class BBitmap;
15 
16 // We must not include the icu headers in there as it could mess up binary
17 // compatibility.
18 #ifndef U_ICU_NAMESPACE
19   #define U_ICU_NAMESPACE icu
20 #endif
21 namespace U_ICU_NAMESPACE {
22 	class Locale;
23 }
24 
25 
26 enum script_direction {
27 	B_LEFT_TO_RIGHT = 0,
28 	B_RIGHT_TO_LEFT,
29 	B_TOP_TO_BOTTOM,	// seems not to be supported anywhere else?
30 };
31 
32 
33 class BLanguage {
34 public:
35 								BLanguage();
36 								BLanguage(const char* language);
37 								BLanguage(const BLanguage& other);
38 								~BLanguage();
39 
40 			status_t			SetTo(const char* language);
41 
42 			status_t			GetNativeName(BString& name) const;
43 			status_t			GetName(BString& name,
44 									const BLanguage* displayLanguage = NULL
45 									) const;
46 			const char*			GetString(uint32 id) const;
47 			status_t			GetIcon(BBitmap* result) const;
48 
49 			const char*			Code() const;
50 									// ISO-639-1
51 			const char*			CountryCode() const;
52 									// ISO-3166
53 			const char*			ScriptCode() const;
54 									// ISO-15924
55 			const char*			Variant() const;
56 			const char*			ID() const;
57 
58 			bool				IsCountrySpecific() const;
59 			bool				IsVariant() const;
60 
61 			uint8				Direction() const;
62 
63 			BLanguage&			operator=(const BLanguage& source);
64 
65 			class Private;
66 private:
67 	friend	class Private;
68 
69 			uint8				fDirection;
70 			U_ICU_NAMESPACE::Locale*		fICULocale;
71 };
72 
73 
74 #endif	// _LANGUAGE_H_
75