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