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/. */
7 #ifndef mozilla_intl_l10n_FluentResource_h
8 #define mozilla_intl_l10n_FluentResource_h
10 #include "mozilla/ErrorResult.h"
11 #include "mozilla/dom/BindingDeclarations.h"
12 #include "nsCycleCollectionParticipant.h"
13 #include "nsWrapperCache.h"
14 #include "mozilla/dom/FluentBinding.h"
15 #include "mozilla/intl/FluentBindings.h"
20 struct FluentTextElementItem
;
25 class FluentResource
: public nsWrapperCache
{
27 NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(FluentResource
)
28 NS_DECL_CYCLE_COLLECTION_NATIVE_WRAPPERCACHE_CLASS(FluentResource
)
30 FluentResource(nsISupports
* aParent
, const ffi::FluentResource
* aRaw
);
31 FluentResource(nsISupports
* aParent
, const nsACString
& aSource
);
33 static already_AddRefed
<FluentResource
> Constructor(
34 const dom::GlobalObject
& aGlobal
, const nsACString
& aSource
);
36 void TextElements(nsTArray
<dom::FluentTextElementItem
>& aElements
,
39 JSObject
* WrapObject(JSContext
* aCx
,
40 JS::Handle
<JSObject
*> aGivenProto
) override
;
41 nsISupports
* GetParentObject() const { return mParent
; }
43 const ffi::FluentResource
* Raw() const { return mRaw
; }
46 virtual ~FluentResource() = default;
48 nsCOMPtr
<nsISupports
> mParent
;
49 RefPtr
<const ffi::FluentResource
> mRaw
;
54 } // namespace mozilla