xref: /haiku/headers/os/locale/LocaleRoster.h (revision 4b37c7f861efbf2e31685ffaba80f3e923a8a6c8)
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 
26*4b37c7f8SAdrien Destugues 
27c3ac87e8SOliver Tappe enum {
28c3ac87e8SOliver Tappe 	B_LOCALE_CHANGED	= '_LCC',
29c3ac87e8SOliver Tappe };
30c3ac87e8SOliver Tappe 
3175f15221SOliver Tappe 
32723383c0SOliver Tappe class BLocaleRoster {
33c3ac87e8SOliver Tappe 	public:
34c3ac87e8SOliver Tappe 		BLocaleRoster();
35c3ac87e8SOliver Tappe 		~BLocaleRoster();
36c3ac87e8SOliver Tappe 
37e9024a3bSAdrien Destugues 		status_t GetSystemCatalog(BCatalogAddOn **) const;
38c3ac87e8SOliver Tappe 		status_t GetDefaultCollator(BCollator **) const;
39c3ac87e8SOliver Tappe 		status_t GetDefaultLanguage(BLanguage **) const;
40c3ac87e8SOliver Tappe 		status_t GetDefaultCountry(BCountry **) const;
4175f15221SOliver Tappe 		void SetDefaultCountry(BCountry *) const;
42c3ac87e8SOliver Tappe 
43*4b37c7f8SAdrien Destugues 		status_t GetLanguage(const char* languageCode, BLanguage** _language)
44*4b37c7f8SAdrien Destugues 			const;
455570fd11SAdrien 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 
59fe8d7c02SAdrien Destugues 		BCatalog* GetCatalog();
60fe8d7c02SAdrien Destugues 			// Get the catalog for the calling image (that needs to link with
61fe8d7c02SAdrien Destugues 			// liblocalestub.a)
62fe8d7c02SAdrien Destugues 
63c3ac87e8SOliver Tappe 		static const char *kCatLangAttr;
64c3ac87e8SOliver Tappe 		static const char *kCatSigAttr;
65c3ac87e8SOliver Tappe 		static const char *kCatFingerprintAttr;
6675f15221SOliver Tappe 
67c3ac87e8SOliver Tappe 		static const char *kCatManagerMimeType;
68c3ac87e8SOliver Tappe 		static const char *kCatEditorMimeType;
6975f15221SOliver Tappe 
70c3ac87e8SOliver Tappe 		static const char *kEmbeddedCatAttr;
71c3ac87e8SOliver Tappe 		static int32 kEmbeddedCatResId;
72c3ac87e8SOliver Tappe 
73c3ac87e8SOliver Tappe 	private:
74be8fa2fbSAdrien Destugues 		BCatalog* GetCatalog(BCatalog* catalog, vint32* catalogInitStatus);
75c3ac87e8SOliver Tappe 
76c3ac87e8SOliver Tappe 		BCatalogAddOn* LoadCatalog(const char *signature,
7775f15221SOliver Tappe 			const char *language = NULL, int32 fingerprint = 0);
78c3ac87e8SOliver Tappe 		BCatalogAddOn* LoadEmbeddedCatalog(entry_ref *appOrAddOnRef);
79c3ac87e8SOliver Tappe 		status_t UnloadCatalog(BCatalogAddOn *addOn);
8075f15221SOliver Tappe 
81c3ac87e8SOliver Tappe 		BCatalogAddOn* CreateCatalog(const char *type,
8275f15221SOliver Tappe 			const char *signature, const char *language);
83c3ac87e8SOliver Tappe 
84c3ac87e8SOliver Tappe 		friend class BCatalog;
85be8fa2fbSAdrien Destugues 		friend class BCatalogStub;
86c3ac87e8SOliver Tappe 		friend class BPrivate::EditableCatalog;
87c3ac87e8SOliver Tappe 		friend status_t get_add_on_catalog(BCatalog*, const char *);
88c3ac87e8SOliver Tappe };
89c3ac87e8SOliver Tappe 
90c3ac87e8SOliver Tappe #endif	/* _LOCALE_ROSTER_H_ */
91