nsLanguageAtomService.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. #include "nsCOMPtr.h"
  6. #include "nsILanguageAtomService.h"
  7. #include "nsIStringBundle.h"
  8. #include "nsInterfaceHashtable.h"
  9. #include "nsIAtom.h"
  10. #include "nsUConvPropertySearch.h"
  11. #include "mozilla/Attributes.h"
  12. #define NS_LANGUAGEATOMSERVICE_CID \
  13. {0xB7C65853, 0x2996, 0x435E, {0x96, 0x54, 0xDC, 0xC1, 0x78, 0xAA, 0xB4, 0x8C}}
  14. class nsLanguageAtomService final : public nsILanguageAtomService
  15. {
  16. public:
  17. NS_DECL_ISUPPORTS
  18. // nsILanguageAtomService
  19. virtual nsIAtom*
  20. LookupLanguage(const nsACString &aLanguage, nsresult *aError) override;
  21. virtual already_AddRefed<nsIAtom>
  22. LookupCharSet(const nsACString& aCharSet) override;
  23. virtual nsIAtom* GetLocaleLanguage(nsresult *aError) override;
  24. virtual nsIAtom* GetLanguageGroup(nsIAtom *aLanguage,
  25. nsresult *aError) override;
  26. nsLanguageAtomService();
  27. private:
  28. ~nsLanguageAtomService() { }
  29. protected:
  30. nsInterfaceHashtable<nsISupportsHashKey, nsIAtom> mLangToGroup;
  31. nsCOMPtr<nsIAtom> mLocaleLanguage;
  32. };