xref: /haiku/headers/os/locale/LocaleRoster.h (revision fe8d7c0225bd8e782b0a9b281d895bde6bbcc15e)
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 
60*fe8d7c02SAdrien Destugues 		BCatalog* GetCatalog();
61*fe8d7c02SAdrien Destugues 			// Get the catalog for the calling image (that needs to link with
62*fe8d7c02SAdrien Destugues 			// liblocalestub.a)
63*fe8d7c02SAdrien Destugues 
64c3ac87e8SOliver Tappe 		static const char *kCatLangAttr;
65c3ac87e8SOliver Tappe 		static const char *kCatSigAttr;
66c3ac87e8SOliver Tappe 		static const char *kCatFingerprintAttr;
6775f15221SOliver Tappe 
68c3ac87e8SOliver Tappe 		static const char *kCatManagerMimeType;
69c3ac87e8SOliver Tappe 		static const char *kCatEditorMimeType;
7075f15221SOliver Tappe 
71c3ac87e8SOliver Tappe 		static const char *kEmbeddedCatAttr;
72c3ac87e8SOliver Tappe 		static int32 kEmbeddedCatResId;
73c3ac87e8SOliver Tappe 
74c3ac87e8SOliver Tappe 	private:
75be8fa2fbSAdrien Destugues 		BCatalog* GetCatalog(BCatalog* catalog, vint32* catalogInitStatus);
76c3ac87e8SOliver Tappe 
77c3ac87e8SOliver Tappe 		BCatalogAddOn* LoadCatalog(const char *signature,
7875f15221SOliver Tappe 			const char *language = NULL, int32 fingerprint = 0);
79c3ac87e8SOliver Tappe 		BCatalogAddOn* LoadEmbeddedCatalog(entry_ref *appOrAddOnRef);
80c3ac87e8SOliver Tappe 		status_t UnloadCatalog(BCatalogAddOn *addOn);
8175f15221SOliver Tappe 
82c3ac87e8SOliver Tappe 		BCatalogAddOn* CreateCatalog(const char *type,
8375f15221SOliver Tappe 			const char *signature, const char *language);
84c3ac87e8SOliver Tappe 
85c3ac87e8SOliver Tappe 		friend class BCatalog;
86be8fa2fbSAdrien Destugues 		friend class BCatalogStub;
87c3ac87e8SOliver Tappe 		friend class BPrivate::EditableCatalog;
88c3ac87e8SOliver Tappe 		friend status_t get_add_on_catalog(BCatalog*, const char *);
89c3ac87e8SOliver Tappe };
90c3ac87e8SOliver Tappe 
91c3ac87e8SOliver Tappe #endif	/* _LOCALE_ROSTER_H_ */
92