xref: /haiku/headers/os/locale/LocaleRoster.h (revision c0cd8cf1999b2266ed949f079916c1d35cd387fa)
1 #ifndef _LOCALE_ROSTER_H_
2 #define _LOCALE_ROSTER_H_
3 
4 
5 #include <String.h>
6 
7 
8 class BLanguage;
9 class BLocale;
10 class BCollator;
11 class BCountry;
12 class BCatalog;
13 class BCatalogAddOn;
14 class BMessage;
15 
16 struct entry_ref;
17 
18 namespace BPrivate {
19 	class EditableCatalog;
20 };
21 
22 enum {
23 	B_LOCALE_CHANGED	= '_LCC',
24 };
25 
26 
27 class BLocaleRoster {
28 
29 	public:
30 		BLocaleRoster();
31 		~BLocaleRoster();
32 
33 //		status_t GetCatalog(BLocale *,const char *mimeType, BCatalog *catalog);
34 //		status_t GetCatalog(const char *mimeType, BCatalog *catalog);
35 //		status_t SetCatalog(BLocale *,const char *mimeType, BCatalog *catalog);
36 
37 //		status_t GetLocaleFor(const char *langCode, const char *countryCode);
38 
39 		status_t GetDefaultCollator(BCollator **) const;
40 		status_t GetDefaultLanguage(BLanguage **) const;
41 		status_t GetDefaultCountry(BCountry **) const;
42 		void SetDefaultCountry(BCountry *) const;
43 
44 		status_t GetLanguage(BLanguage** language, BString languageCode) const;
45 
46 		status_t GetPreferredLanguages(BMessage *) const;
47 		status_t SetPreferredLanguages(BMessage *);
48 			// the message contains one or more 'language'-string-fields
49 			// which contain the language-name(s)
50 
51 		status_t GetInstalledLanguages(BMessage *) const;
52 			// the message contains one or more 'language'-string-fields
53 			// which contain the language-name(s)
54 
55 		status_t GetInstalledCatalogs(BMessage *, const char* sigPattern = NULL,
56 			const char* langPattern = NULL,	int32 fingerprint = 0) const;
57 			// the message contains...
58 
59 		static const char *kCatLangAttr;
60 		static const char *kCatSigAttr;
61 		static const char *kCatFingerprintAttr;
62 
63 		static const char *kCatManagerMimeType;
64 		static const char *kCatEditorMimeType;
65 
66 		static const char *kEmbeddedCatAttr;
67 		static int32 kEmbeddedCatResId;
68 
69 	private:
70 
71 		BCatalogAddOn* LoadCatalog(const char *signature,
72 			const char *language = NULL, int32 fingerprint = 0);
73 		BCatalogAddOn* LoadEmbeddedCatalog(entry_ref *appOrAddOnRef);
74 		status_t UnloadCatalog(BCatalogAddOn *addOn);
75 
76 		BCatalogAddOn* CreateCatalog(const char *type,
77 			const char *signature, const char *language);
78 
79 		friend class BCatalog;
80 		friend class BPrivate::EditableCatalog;
81 		friend status_t get_add_on_catalog(BCatalog*, const char *);
82 };
83 
84 #endif	/* _LOCALE_ROSTER_H_ */
85