FluentBindings.h (940B)
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_FluentBindings_h 6 #define mozilla_intl_l10n_FluentBindings_h 7 8 #include "mozilla/intl/fluent_ffi_generated.h" 9 10 #include "mozilla/RefPtr.h" 11 12 namespace mozilla { 13 14 template <> 15 struct RefPtrTraits<intl::ffi::FluentResource> { 16 static void AddRef(const intl::ffi::FluentResource* aPtr) { 17 intl::ffi::fluent_resource_addref(aPtr); 18 } 19 static void Release(const intl::ffi::FluentResource* aPtr) { 20 intl::ffi::fluent_resource_release(aPtr); 21 } 22 }; 23 24 } // namespace mozilla 25 26 namespace std { 27 28 template <> 29 struct default_delete<mozilla::intl::ffi::FluentBundleRc> { 30 public: 31 void operator()(mozilla::intl::ffi::FluentBundleRc* aPtr) const { 32 fluent_bundle_destroy(aPtr); 33 } 34 }; 35 36 } // namespace std 37 38 #endif