RegistryBindings.h (1549B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 #ifndef mozilla_intl_l10n_RegistryBindings_h 6 #define mozilla_intl_l10n_RegistryBindings_h 7 8 #include "mozilla/intl/l10nregistry_ffi_generated.h" 9 10 #include "mozilla/RefPtr.h" 11 12 namespace mozilla { 13 14 template <> 15 struct RefPtrTraits<intl::ffi::FileSource> { 16 static void AddRef(const intl::ffi::FileSource* aPtr) { 17 intl::ffi::l10nfilesource_addref(aPtr); 18 } 19 static void Release(const intl::ffi::FileSource* aPtr) { 20 intl::ffi::l10nfilesource_release(aPtr); 21 } 22 }; 23 24 } // namespace mozilla 25 26 namespace std { 27 template <> 28 struct default_delete<mozilla::intl::ffi::GeckoFluentBundleIterator> { 29 void operator()(mozilla::intl::ffi::GeckoFluentBundleIterator* aPtr) const { 30 fluent_bundle_iterator_destroy(aPtr); 31 } 32 }; 33 34 template <> 35 struct default_delete< 36 mozilla::intl::ffi::GeckoFluentBundleAsyncIteratorWrapper> { 37 void operator()( 38 mozilla::intl::ffi::GeckoFluentBundleAsyncIteratorWrapper* aPtr) const { 39 fluent_bundle_async_iterator_destroy(aPtr); 40 } 41 }; 42 43 } // namespace std 44 45 namespace mozilla { 46 47 template <> 48 struct RefPtrTraits<intl::ffi::GeckoL10nRegistry> { 49 static void AddRef(const intl::ffi::GeckoL10nRegistry* aPtr) { 50 intl::ffi::l10nregistry_addref(aPtr); 51 } 52 static void Release(const intl::ffi::GeckoL10nRegistry* aPtr) { 53 intl::ffi::l10nregistry_release(aPtr); 54 } 55 }; 56 57 } // namespace mozilla 58 59 #endif