1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/intl/locale/src/nsLanguageAtomService.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,46 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#include "nsCOMPtr.h" 1.10 +#include "nsICharsetConverterManager.h" 1.11 +#include "nsILanguageAtomService.h" 1.12 +#include "nsIStringBundle.h" 1.13 +#include "nsInterfaceHashtable.h" 1.14 +#include "nsIAtom.h" 1.15 +#include "mozilla/Attributes.h" 1.16 + 1.17 +#define NS_LANGUAGEATOMSERVICE_CID \ 1.18 + {0xB7C65853, 0x2996, 0x435E, {0x96, 0x54, 0xDC, 0xC1, 0x78, 0xAA, 0xB4, 0x8C}} 1.19 + 1.20 +class nsLanguageAtomService MOZ_FINAL : public nsILanguageAtomService 1.21 +{ 1.22 +public: 1.23 + NS_DECL_ISUPPORTS 1.24 + 1.25 + // nsILanguageAtomService 1.26 + virtual NS_HIDDEN_(nsIAtom*) 1.27 + LookupLanguage(const nsACString &aLanguage, nsresult *aError); 1.28 + 1.29 + virtual NS_HIDDEN_(already_AddRefed<nsIAtom>) 1.30 + LookupCharSet(const char *aCharSet, nsresult *aError); 1.31 + 1.32 + virtual NS_HIDDEN_(nsIAtom*) GetLocaleLanguage(nsresult *aError); 1.33 + 1.34 + virtual NS_HIDDEN_(nsIAtom*) GetLanguageGroup(nsIAtom *aLanguage, 1.35 + nsresult *aError); 1.36 + 1.37 + nsLanguageAtomService() NS_HIDDEN; 1.38 + 1.39 +private: 1.40 + NS_HIDDEN ~nsLanguageAtomService() { } 1.41 + 1.42 +protected: 1.43 + NS_HIDDEN_(nsresult) InitLangGroupTable(); 1.44 + 1.45 + nsCOMPtr<nsICharsetConverterManager> mCharSets; 1.46 + nsInterfaceHashtable<nsISupportsHashKey, nsIAtom> mLangToGroup; 1.47 + nsCOMPtr<nsIStringBundle> mLangGroups; 1.48 + nsCOMPtr<nsIAtom> mLocaleLanguage; 1.49 +};