IntlUtils.h (1534B)
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 #ifndef mozilla_dom_IntlUtils_h 7 #define mozilla_dom_IntlUtils_h 8 9 #include "mozilla/dom/IntlUtilsBinding.h" 10 #include "nsWrapperCache.h" 11 #include "xpcprivate.h" 12 13 class nsPIDOMWindowInner; 14 15 namespace mozilla::dom { 16 17 #ifdef XP_WIN 18 # undef GetLocaleInfo 19 #endif 20 21 class IntlUtils final : public nsISupports, public nsWrapperCache { 22 public: 23 explicit IntlUtils(nsPIDOMWindowInner* aWindow); 24 25 NS_DECL_CYCLE_COLLECTING_ISUPPORTS 26 NS_DECL_CYCLE_COLLECTION_WRAPPERCACHE_CLASS(IntlUtils) 27 28 nsPIDOMWindowInner* GetParentObject() const { return mWindow; } 29 30 JSObject* WrapObject(JSContext* aCx, 31 JS::Handle<JSObject*> aGivenProto) override; 32 33 void GetDisplayNames(const Sequence<nsString>& aLocales, 34 const mozilla::dom::DisplayNameOptions& aOptions, 35 mozilla::dom::DisplayNameResult& aResult, 36 mozilla::ErrorResult& aError); 37 38 void GetLocaleInfo(const Sequence<nsString>& aLocales, 39 mozilla::dom::LocaleInfo& aResult, 40 mozilla::ErrorResult& aError); 41 42 bool IsAppLocaleRTL(); 43 44 private: 45 ~IntlUtils(); 46 47 nsCOMPtr<nsPIDOMWindowInner> mWindow; 48 }; 49 50 } // namespace mozilla::dom 51 #endif