xref: /haiku/headers/os/locale/LocaleRoster.h (revision be8fa2fb3088ab1921612b60f352dd9334b40b3d)
196eaa02eSAxel Dörfler /*
296eaa02eSAxel Dörfler  * Copyright 2003-2010, Haiku. All rights reserved.
396eaa02eSAxel Dörfler  * Distributed under the terms of the MIT license.
496eaa02eSAxel Dörfler  */
5c3ac87e8SOliver Tappe #ifndef _LOCALE_ROSTER_H_
6c3ac87e8SOliver Tappe #define _LOCALE_ROSTER_H_
7c3ac87e8SOliver Tappe 
875f15221SOliver Tappe 
9c3ac87e8SOliver Tappe #include <String.h>
10c3ac87e8SOliver Tappe 
1175f15221SOliver Tappe 
12c3ac87e8SOliver Tappe class BLanguage;
13c3ac87e8SOliver Tappe class BLocale;
14c3ac87e8SOliver Tappe class BCollator;
15c3ac87e8SOliver Tappe class BCountry;
16c3ac87e8SOliver Tappe class BCatalog;
17c3ac87e8SOliver Tappe class BCatalogAddOn;
18f9a80fecSAxel Dörfler class BMessage;
19c3ac87e8SOliver Tappe 
2075f15221SOliver Tappe struct entry_ref;
2175f15221SOliver Tappe 
22c3ac87e8SOliver Tappe namespace BPrivate {
23c3ac87e8SOliver Tappe 	class EditableCatalog;
2496eaa02eSAxel Dörfler }
25c3ac87e8SOliver Tappe 
26c3ac87e8SOliver Tappe enum {
27c3ac87e8SOliver Tappe 	B_LOCALE_CHANGED	= '_LCC',
28c3ac87e8SOliver Tappe };
29c3ac87e8SOliver Tappe 
3075f15221SOliver Tappe 
31723383c0SOliver Tappe class BLocaleRoster {
32c3ac87e8SOliver Tappe 	public:
33c3ac87e8SOliver Tappe 		BLocaleRoster();
34c3ac87e8SOliver Tappe 		~BLocaleRoster();
35c3ac87e8SOliver Tappe 
36c3ac87e8SOliver Tappe //		status_t GetLocaleFor(const char *langCode, const char *countryCode);
37c3ac87e8SOliver Tappe 
38e9024a3bSAdrien Destugues 		status_t GetSystemCatalog(BCatalogAddOn **) const;
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 
4496eaa02eSAxel Dörfler 			status_t			GetLanguage(const char* languageCode,
4596eaa02eSAxel Dörfler 									BLanguage** _language) const;
465570fd11SAdrien Destugues 
47c3ac87e8SOliver Tappe 		status_t GetPreferredLanguages(BMessage *) const;
48c3ac87e8SOliver Tappe 		status_t SetPreferredLanguages(BMessage *);
49c3ac87e8SOliver Tappe 			// the message contains one or more 'language'-string-fields
50c3ac87e8SOliver Tappe 			// which contain the language-name(s)
51c3ac87e8SOliver Tappe 
52c3ac87e8SOliver Tappe 		status_t GetInstalledLanguages(BMessage *) const;
53c3ac87e8SOliver Tappe 			// the message contains one or more 'language'-string-fields
54c3ac87e8SOliver Tappe 			// which contain the language-name(s)
55c3ac87e8SOliver Tappe 
5675f15221SOliver Tappe 		status_t GetInstalledCatalogs(BMessage *, const char* sigPattern = NULL,
5775f15221SOliver Tappe 			const char* langPattern = NULL,	int32 fingerprint = 0) const;
58c3ac87e8SOliver Tappe 			// the message contains...
59c3ac87e8SOliver Tappe 
60c3ac87e8SOliver Tappe 		static const char *kCatLangAttr;
61c3ac87e8SOliver Tappe 		static const char *kCatSigAttr;
62c3ac87e8SOliver Tappe 		static const char *kCatFingerprintAttr;
6375f15221SOliver Tappe 
64c3ac87e8SOliver Tappe 		static const char *kCatManagerMimeType;
65c3ac87e8SOliver Tappe 		static const char *kCatEditorMimeType;
6675f15221SOliver Tappe 
67c3ac87e8SOliver Tappe 		static const char *kEmbeddedCatAttr;
68c3ac87e8SOliver Tappe 		static int32 kEmbeddedCatResId;
69c3ac87e8SOliver Tappe 
70c3ac87e8SOliver Tappe 	private:
71*be8fa2fbSAdrien Destugues 		BCatalog* GetCatalog(BCatalog* catalog, vint32* catalogInitStatus);
72c3ac87e8SOliver Tappe 
73c3ac87e8SOliver Tappe 		BCatalogAddOn* LoadCatalog(const char *signature,
7475f15221SOliver Tappe 			const char *language = NULL, int32 fingerprint = 0);
75c3ac87e8SOliver Tappe 		BCatalogAddOn* LoadEmbeddedCatalog(entry_ref *appOrAddOnRef);
76c3ac87e8SOliver Tappe 		status_t UnloadCatalog(BCatalogAddOn *addOn);
7775f15221SOliver Tappe 
78c3ac87e8SOliver Tappe 		BCatalogAddOn* CreateCatalog(const char *type,
7975f15221SOliver Tappe 			const char *signature, const char *language);
80c3ac87e8SOliver Tappe 
81c3ac87e8SOliver Tappe 		friend class BCatalog;
82*be8fa2fbSAdrien Destugues 		friend class BCatalogStub;
83c3ac87e8SOliver Tappe 		friend class BPrivate::EditableCatalog;
84c3ac87e8SOliver Tappe 		friend status_t get_add_on_catalog(BCatalog*, const char *);
85c3ac87e8SOliver Tappe };
86c3ac87e8SOliver Tappe 
87c3ac87e8SOliver Tappe #endif	/* _LOCALE_ROSTER_H_ */
88