|
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
2 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
5 |
|
6 #include "nsCOMPtr.h" |
|
7 #include "nsICharsetConverterManager.h" |
|
8 #include "nsILanguageAtomService.h" |
|
9 #include "nsIStringBundle.h" |
|
10 #include "nsInterfaceHashtable.h" |
|
11 #include "nsIAtom.h" |
|
12 #include "mozilla/Attributes.h" |
|
13 |
|
14 #define NS_LANGUAGEATOMSERVICE_CID \ |
|
15 {0xB7C65853, 0x2996, 0x435E, {0x96, 0x54, 0xDC, 0xC1, 0x78, 0xAA, 0xB4, 0x8C}} |
|
16 |
|
17 class nsLanguageAtomService MOZ_FINAL : public nsILanguageAtomService |
|
18 { |
|
19 public: |
|
20 NS_DECL_ISUPPORTS |
|
21 |
|
22 // nsILanguageAtomService |
|
23 virtual NS_HIDDEN_(nsIAtom*) |
|
24 LookupLanguage(const nsACString &aLanguage, nsresult *aError); |
|
25 |
|
26 virtual NS_HIDDEN_(already_AddRefed<nsIAtom>) |
|
27 LookupCharSet(const char *aCharSet, nsresult *aError); |
|
28 |
|
29 virtual NS_HIDDEN_(nsIAtom*) GetLocaleLanguage(nsresult *aError); |
|
30 |
|
31 virtual NS_HIDDEN_(nsIAtom*) GetLanguageGroup(nsIAtom *aLanguage, |
|
32 nsresult *aError); |
|
33 |
|
34 nsLanguageAtomService() NS_HIDDEN; |
|
35 |
|
36 private: |
|
37 NS_HIDDEN ~nsLanguageAtomService() { } |
|
38 |
|
39 protected: |
|
40 NS_HIDDEN_(nsresult) InitLangGroupTable(); |
|
41 |
|
42 nsCOMPtr<nsICharsetConverterManager> mCharSets; |
|
43 nsInterfaceHashtable<nsISupportsHashKey, nsIAtom> mLangToGroup; |
|
44 nsCOMPtr<nsIStringBundle> mLangGroups; |
|
45 nsCOMPtr<nsIAtom> mLocaleLanguage; |
|
46 }; |