EncodingToLang.h (1078B)
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 #ifndef mozilla_intl_EncodingToLang_h 7 #define mozilla_intl_EncodingToLang_h 8 9 #include "nsAtom.h" 10 #include "mozilla/Encoding.h" 11 12 namespace mozilla::intl { 13 14 class EncodingToLang { 15 public: 16 // Call once from nsLayoutStatics::Initialize() 17 static void Initialize(); 18 // Call once from nsLayoutStatics::Shutdown() 19 static void Shutdown(); 20 21 // Looks up a font matching language atom by encoding. 22 // The atom will be kept alive until nsLayoutStatics::Shutdown(), 23 // which is why it's a raw pointer. 24 static nsAtom* Lookup(mozilla::NotNull<const mozilla::Encoding*> aEncoding); 25 26 private: 27 static nsAtom* sLangs[]; 28 static const mozilla::NotNull<const mozilla::Encoding*>* 29 kEncodingsByRoughFrequency[]; 30 }; 31 32 }; // namespace mozilla::intl 33 34 #endif // mozilla_intl_EncodingToLang_h