Copy as Markdown

Other Tools

/* THIS FILE IS AUTOGENERATED FROM XSLTProcessor.webidl BY Codegen.py - DO NOT EDIT */
#ifndef DOM_XSLTPROCESSORBINDING_H_
#define DOM_XSLTPROCESSORBINDING_H_
#include "js/CallAndConstruct.h"
#include "js/RootingAPI.h"
#include "js/TypeDecls.h"
#include "mozilla/dom/BindingDeclarations.h"
#include "mozilla/dom/FakeString.h"
#include "mozilla/dom/Nullable.h"
#include "mozilla/dom/PrototypeList.h"
#include "mozilla/dom/UnionMember.h"
#include "nsIContent.h"
class nsINode;
class txMozillaXSLTProcessor;
namespace mozilla {
namespace dom {
struct NativePropertyHooks;
class OwningUnrestrictedDoubleOrBooleanOrStringOrNodeOrNodeSequenceOrXPathResult;
class ProtoAndIfaceCache;
class XPathResult;
} // namespace dom
} // namespace mozilla
namespace mozilla::dom {
void
ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& aCallback, OwningUnrestrictedDoubleOrBooleanOrStringOrNodeOrNodeSequenceOrXPathResult& aUnion, const char* aName, uint32_t aFlags = 0);
void
ImplCycleCollectionUnlink(OwningUnrestrictedDoubleOrBooleanOrStringOrNodeOrNodeSequenceOrXPathResult& aUnion);
class UnrestrictedDoubleOrBooleanOrStringOrNodeOrNodeSequenceOrXPathResult : public AllUnionBase
{
enum TypeOrUninit
{
eUninitialized,
eUnrestrictedDouble,
eBoolean,
eString,
eNode,
eNodeSequence,
eXPathResult
};
public:
enum class Type
{
eUnrestrictedDouble = TypeOrUninit::eUnrestrictedDouble,
eBoolean = TypeOrUninit::eBoolean,
eString = TypeOrUninit::eString,
eNode = TypeOrUninit::eNode,
eNodeSequence = TypeOrUninit::eNodeSequence,
eXPathResult = TypeOrUninit::eXPathResult
};
private:
union Value
{
UnionMember<double > mUnrestrictedDouble;
UnionMember<bool > mBoolean;
UnionMember<binding_detail::FakeString<char16_t> > mString;
UnionMember<NonNull<nsINode> > mNode;
UnionMember<binding_detail::AutoSequence<OwningNonNull<nsINode>> > mNodeSequence;
UnionMember<NonNull<mozilla::dom::XPathResult> > mXPathResult;
};
TypeOrUninit mType;
Value mValue;
UnrestrictedDoubleOrBooleanOrStringOrNodeOrNodeSequenceOrXPathResult(const UnrestrictedDoubleOrBooleanOrStringOrNodeOrNodeSequenceOrXPathResult&) = delete;
UnrestrictedDoubleOrBooleanOrStringOrNodeOrNodeSequenceOrXPathResult& operator=(const UnrestrictedDoubleOrBooleanOrStringOrNodeOrNodeSequenceOrXPathResult&) = delete;
public:
explicit inline UnrestrictedDoubleOrBooleanOrStringOrNodeOrNodeSequenceOrXPathResult()
: mType(eUninitialized)
{
}
inline ~UnrestrictedDoubleOrBooleanOrStringOrNodeOrNodeSequenceOrXPathResult()
{
Uninit();
}
[[nodiscard]] inline double&
RawSetAsUnrestrictedDouble()
{
if (mType == eUnrestrictedDouble) {
return mValue.mUnrestrictedDouble.Value();
}
MOZ_ASSERT(mType == eUninitialized);
mType = eUnrestrictedDouble;
return mValue.mUnrestrictedDouble.SetValue();
}
[[nodiscard]] inline double&
SetAsUnrestrictedDouble()
{
if (mType == eUnrestrictedDouble) {
return mValue.mUnrestrictedDouble.Value();
}
Uninit();
mType = eUnrestrictedDouble;
return mValue.mUnrestrictedDouble.SetValue();
}
inline bool
IsUnrestrictedDouble() const
{
return mType == eUnrestrictedDouble;
}
inline double&
GetAsUnrestrictedDouble()
{
MOZ_RELEASE_ASSERT(IsUnrestrictedDouble(), "Wrong type!");
return mValue.mUnrestrictedDouble.Value();
}
inline double
GetAsUnrestrictedDouble() const
{
MOZ_RELEASE_ASSERT(IsUnrestrictedDouble(), "Wrong type!");
return mValue.mUnrestrictedDouble.Value();
}
[[nodiscard]] inline bool&
RawSetAsBoolean()
{
if (mType == eBoolean) {
return mValue.mBoolean.Value();
}
MOZ_ASSERT(mType == eUninitialized);
mType = eBoolean;
return mValue.mBoolean.SetValue();
}
[[nodiscard]] inline bool&
SetAsBoolean()
{
if (mType == eBoolean) {
return mValue.mBoolean.Value();
}
Uninit();
mType = eBoolean;
return mValue.mBoolean.SetValue();
}
inline bool
IsBoolean() const
{
return mType == eBoolean;
}
inline bool&
GetAsBoolean()
{
MOZ_RELEASE_ASSERT(IsBoolean(), "Wrong type!");
return mValue.mBoolean.Value();
}
inline bool
GetAsBoolean() const
{
MOZ_RELEASE_ASSERT(IsBoolean(), "Wrong type!");
return mValue.mBoolean.Value();
}
[[nodiscard]] inline binding_detail::FakeString<char16_t>&
RawSetAsString()
{
if (mType == eString) {
return mValue.mString.Value();
}
MOZ_ASSERT(mType == eUninitialized);
mType = eString;
return mValue.mString.SetValue();
}
[[nodiscard]] inline binding_detail::FakeString<char16_t>&
SetAsString()
{
if (mType == eString) {
return mValue.mString.Value();
}
Uninit();
mType = eString;
return mValue.mString.SetValue();
}
template <int N>
inline void
SetStringLiteral(const nsString::char_type (&aData)[N])
{
RawSetAsString().AssignLiteral(aData);
}
inline bool
IsString() const
{
return mType == eString;
}
inline binding_detail::FakeString<char16_t>&
GetAsString()
{
MOZ_RELEASE_ASSERT(IsString(), "Wrong type!");
return mValue.mString.Value();
}
inline const nsAString&
GetAsString() const
{
MOZ_RELEASE_ASSERT(IsString(), "Wrong type!");
return mValue.mString.Value();
}
[[nodiscard]] inline NonNull<nsINode>&
RawSetAsNode()
{
if (mType == eNode) {
return mValue.mNode.Value();
}
MOZ_ASSERT(mType == eUninitialized);
mType = eNode;
return mValue.mNode.SetValue();
}
[[nodiscard]] inline NonNull<nsINode>&
SetAsNode()
{
if (mType == eNode) {
return mValue.mNode.Value();
}
Uninit();
mType = eNode;
return mValue.mNode.SetValue();
}
inline bool
IsNode() const
{
return mType == eNode;
}
inline NonNull<nsINode>&
GetAsNode()
{
MOZ_RELEASE_ASSERT(IsNode(), "Wrong type!");
return mValue.mNode.Value();
}
inline nsINode&
GetAsNode() const
{
MOZ_RELEASE_ASSERT(IsNode(), "Wrong type!");
return mValue.mNode.Value();
}
[[nodiscard]] inline binding_detail::AutoSequence<OwningNonNull<nsINode>>&
RawSetAsNodeSequence()
{
if (mType == eNodeSequence) {
return mValue.mNodeSequence.Value();
}
MOZ_ASSERT(mType == eUninitialized);
mType = eNodeSequence;
return mValue.mNodeSequence.SetValue();
}
[[nodiscard]] inline binding_detail::AutoSequence<OwningNonNull<nsINode>>&
SetAsNodeSequence()
{
if (mType == eNodeSequence) {
return mValue.mNodeSequence.Value();
}
Uninit();
mType = eNodeSequence;
return mValue.mNodeSequence.SetValue();
}
inline bool
IsNodeSequence() const
{
return mType == eNodeSequence;
}
inline binding_detail::AutoSequence<OwningNonNull<nsINode>>&
GetAsNodeSequence()
{
MOZ_RELEASE_ASSERT(IsNodeSequence(), "Wrong type!");
return mValue.mNodeSequence.Value();
}
inline const Sequence<OwningNonNull<nsINode>>&
GetAsNodeSequence() const
{
MOZ_RELEASE_ASSERT(IsNodeSequence(), "Wrong type!");
return mValue.mNodeSequence.Value();
}
[[nodiscard]] inline NonNull<mozilla::dom::XPathResult>&
RawSetAsXPathResult()
{
if (mType == eXPathResult) {
return mValue.mXPathResult.Value();
}
MOZ_ASSERT(mType == eUninitialized);
mType = eXPathResult;
return mValue.mXPathResult.SetValue();
}
[[nodiscard]] inline NonNull<mozilla::dom::XPathResult>&
SetAsXPathResult()
{
if (mType == eXPathResult) {
return mValue.mXPathResult.Value();
}
Uninit();
mType = eXPathResult;
return mValue.mXPathResult.SetValue();
}
inline bool
IsXPathResult() const
{
return mType == eXPathResult;
}
inline NonNull<mozilla::dom::XPathResult>&
GetAsXPathResult()
{
MOZ_RELEASE_ASSERT(IsXPathResult(), "Wrong type!");
return mValue.mXPathResult.Value();
}
inline mozilla::dom::XPathResult&
GetAsXPathResult() const
{
MOZ_RELEASE_ASSERT(IsXPathResult(), "Wrong type!");
return mValue.mXPathResult.Value();
}
bool
Init(BindingCallContext& cx, JS::Handle<JS::Value> value, const char* sourceDescription = "Value", bool passedToJSImpl = false);
bool
Init(JSContext* cx_, JS::Handle<JS::Value> value, const char* sourceDescription = "Value", bool passedToJSImpl = false);
inline void
Uninit()
{
switch (mType) {
case eUninitialized: {
break;
}
case eUnrestrictedDouble: {
DestroyUnrestrictedDouble();
break;
}
case eBoolean: {
DestroyBoolean();
break;
}
case eString: {
DestroyString();
break;
}
case eNode: {
DestroyNode();
break;
}
case eNodeSequence: {
DestroyNodeSequence();
break;
}
case eXPathResult: {
DestroyXPathResult();
break;
}
}
}
bool
ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const;
private:
bool
TrySetToUnrestrictedDouble(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
inline void
DestroyUnrestrictedDouble()
{
MOZ_RELEASE_ASSERT(IsUnrestrictedDouble(), "Wrong type!");
mValue.mUnrestrictedDouble.Destroy();
mType = eUninitialized;
}
bool
TrySetToBoolean(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
inline void
DestroyBoolean()
{
MOZ_RELEASE_ASSERT(IsBoolean(), "Wrong type!");
mValue.mBoolean.Destroy();
mType = eUninitialized;
}
bool
TrySetToString(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
inline void
DestroyString()
{
MOZ_RELEASE_ASSERT(IsString(), "Wrong type!");
mValue.mString.Destroy();
mType = eUninitialized;
}
bool
TrySetToNode(BindingCallContext& cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
bool
TrySetToNode(JSContext* cx_, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
inline void
DestroyNode()
{
MOZ_RELEASE_ASSERT(IsNode(), "Wrong type!");
mValue.mNode.Destroy();
mType = eUninitialized;
}
bool
TrySetToNodeSequence(BindingCallContext& cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
bool
TrySetToNodeSequence(JSContext* cx_, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
inline void
DestroyNodeSequence()
{
MOZ_RELEASE_ASSERT(IsNodeSequence(), "Wrong type!");
mValue.mNodeSequence.Destroy();
mType = eUninitialized;
}
bool
TrySetToXPathResult(BindingCallContext& cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
bool
TrySetToXPathResult(JSContext* cx_, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
inline void
DestroyXPathResult()
{
MOZ_RELEASE_ASSERT(IsXPathResult(), "Wrong type!");
mValue.mXPathResult.Destroy();
mType = eUninitialized;
}
};
class OwningUnrestrictedDoubleOrBooleanOrStringOrNodeOrNodeSequenceOrXPathResult : public AllOwningUnionBase
{
friend void ImplCycleCollectionUnlink(OwningUnrestrictedDoubleOrBooleanOrStringOrNodeOrNodeSequenceOrXPathResult& aUnion);
enum TypeOrUninit
{
eUninitialized,
eUnrestrictedDouble,
eBoolean,
eString,
eNode,
eNodeSequence,
eXPathResult
};
public:
enum class Type
{
eUnrestrictedDouble = TypeOrUninit::eUnrestrictedDouble,
eBoolean = TypeOrUninit::eBoolean,
eString = TypeOrUninit::eString,
eNode = TypeOrUninit::eNode,
eNodeSequence = TypeOrUninit::eNodeSequence,
eXPathResult = TypeOrUninit::eXPathResult
};
private:
union Value
{
UnionMember<double > mUnrestrictedDouble;
UnionMember<bool > mBoolean;
UnionMember<nsString > mString;
UnionMember<OwningNonNull<nsINode> > mNode;
UnionMember<Sequence<OwningNonNull<nsINode>> > mNodeSequence;
UnionMember<OwningNonNull<mozilla::dom::XPathResult> > mXPathResult;
};
TypeOrUninit mType;
Value mValue;
public:
explicit inline OwningUnrestrictedDoubleOrBooleanOrStringOrNodeOrNodeSequenceOrXPathResult()
: mType(eUninitialized)
{
}
OwningUnrestrictedDoubleOrBooleanOrStringOrNodeOrNodeSequenceOrXPathResult(OwningUnrestrictedDoubleOrBooleanOrStringOrNodeOrNodeSequenceOrXPathResult&& aOther);
explicit inline OwningUnrestrictedDoubleOrBooleanOrStringOrNodeOrNodeSequenceOrXPathResult(const OwningUnrestrictedDoubleOrBooleanOrStringOrNodeOrNodeSequenceOrXPathResult& aOther)
: mType(eUninitialized)
{
*this = aOther;
}
inline ~OwningUnrestrictedDoubleOrBooleanOrStringOrNodeOrNodeSequenceOrXPathResult()
{
Uninit();
}
[[nodiscard]] double&
RawSetAsUnrestrictedDouble();
[[nodiscard]] double&
SetAsUnrestrictedDouble();
inline bool
IsUnrestrictedDouble() const
{
return mType == eUnrestrictedDouble;
}
inline double&
GetAsUnrestrictedDouble()
{
MOZ_RELEASE_ASSERT(IsUnrestrictedDouble(), "Wrong type!");
return mValue.mUnrestrictedDouble.Value();
}
inline double const &
GetAsUnrestrictedDouble() const
{
MOZ_RELEASE_ASSERT(IsUnrestrictedDouble(), "Wrong type!");
return mValue.mUnrestrictedDouble.Value();
}
[[nodiscard]] bool&
RawSetAsBoolean();
[[nodiscard]] bool&
SetAsBoolean();
inline bool
IsBoolean() const
{
return mType == eBoolean;
}
inline bool&
GetAsBoolean()
{
MOZ_RELEASE_ASSERT(IsBoolean(), "Wrong type!");
return mValue.mBoolean.Value();
}
inline bool const &
GetAsBoolean() const
{
MOZ_RELEASE_ASSERT(IsBoolean(), "Wrong type!");
return mValue.mBoolean.Value();
}
[[nodiscard]] nsString&
RawSetAsString();
[[nodiscard]] nsString&
SetAsString();
template <int N>
inline void
SetStringLiteral(const nsString::char_type (&aData)[N])
{
RawSetAsString().AssignLiteral(aData);
}
inline bool
IsString() const
{
return mType == eString;
}
inline nsString&
GetAsString()
{
MOZ_RELEASE_ASSERT(IsString(), "Wrong type!");
return mValue.mString.Value();
}
inline nsString const &
GetAsString() const
{
MOZ_RELEASE_ASSERT(IsString(), "Wrong type!");
return mValue.mString.Value();
}
[[nodiscard]] OwningNonNull<nsINode>&
RawSetAsNode();
[[nodiscard]] OwningNonNull<nsINode>&
SetAsNode();
inline bool
IsNode() const
{
return mType == eNode;
}
inline OwningNonNull<nsINode>&
GetAsNode()
{
MOZ_RELEASE_ASSERT(IsNode(), "Wrong type!");
return mValue.mNode.Value();
}
inline OwningNonNull<nsINode> const &
GetAsNode() const
{
MOZ_RELEASE_ASSERT(IsNode(), "Wrong type!");
return mValue.mNode.Value();
}
[[nodiscard]] Sequence<OwningNonNull<nsINode>>&
RawSetAsNodeSequence();
[[nodiscard]] Sequence<OwningNonNull<nsINode>>&
SetAsNodeSequence();
inline bool
IsNodeSequence() const
{
return mType == eNodeSequence;
}
inline Sequence<OwningNonNull<nsINode>>&
GetAsNodeSequence()
{
MOZ_RELEASE_ASSERT(IsNodeSequence(), "Wrong type!");
return mValue.mNodeSequence.Value();
}
inline Sequence<OwningNonNull<nsINode>> const &
GetAsNodeSequence() const
{
MOZ_RELEASE_ASSERT(IsNodeSequence(), "Wrong type!");
return mValue.mNodeSequence.Value();
}
[[nodiscard]] OwningNonNull<mozilla::dom::XPathResult>&
RawSetAsXPathResult();
[[nodiscard]] OwningNonNull<mozilla::dom::XPathResult>&
SetAsXPathResult();
inline bool
IsXPathResult() const
{
return mType == eXPathResult;
}
inline OwningNonNull<mozilla::dom::XPathResult>&
GetAsXPathResult()
{
MOZ_RELEASE_ASSERT(IsXPathResult(), "Wrong type!");
return mValue.mXPathResult.Value();
}
inline OwningNonNull<mozilla::dom::XPathResult> const &
GetAsXPathResult() const
{
MOZ_RELEASE_ASSERT(IsXPathResult(), "Wrong type!");
return mValue.mXPathResult.Value();
}
bool
Init(BindingCallContext& cx, JS::Handle<JS::Value> value, const char* sourceDescription = "Value", bool passedToJSImpl = false);
bool
Init(JSContext* cx_, JS::Handle<JS::Value> value, const char* sourceDescription = "Value", bool passedToJSImpl = false);
void
Uninit();
bool
ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const;
OwningUnrestrictedDoubleOrBooleanOrStringOrNodeOrNodeSequenceOrXPathResult&
operator=(OwningUnrestrictedDoubleOrBooleanOrStringOrNodeOrNodeSequenceOrXPathResult&& aOther);
inline Type
GetType() const
{
MOZ_RELEASE_ASSERT(mType != eUninitialized);
return static_cast<Type>(mType);
}
OwningUnrestrictedDoubleOrBooleanOrStringOrNodeOrNodeSequenceOrXPathResult&
operator=(const OwningUnrestrictedDoubleOrBooleanOrStringOrNodeOrNodeSequenceOrXPathResult& aOther);
private:
bool
TrySetToUnrestrictedDouble(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
void
DestroyUnrestrictedDouble();
bool
TrySetToBoolean(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
void
DestroyBoolean();
bool
TrySetToString(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
void
DestroyString();
bool
TrySetToNode(BindingCallContext& cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
bool
TrySetToNode(JSContext* cx_, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
void
DestroyNode();
bool
TrySetToNodeSequence(BindingCallContext& cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
bool
TrySetToNodeSequence(JSContext* cx_, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
void
DestroyNodeSequence();
bool
TrySetToXPathResult(BindingCallContext& cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
bool
TrySetToXPathResult(JSContext* cx_, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
void
DestroyXPathResult();
};
namespace XSLTProcessor_Binding {
typedef txMozillaXSLTProcessor NativeType;
static const uint32_t DISABLE_ALL_LOADS = 1;
bool
Wrap(JSContext* aCx, txMozillaXSLTProcessor* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
template <class T>
inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
{
JS::Rooted<JSObject*> reflector(aCx);
return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
}
void
CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, DefineInterfaceProperty aDefineOnGlobal);
JS::Handle<JSObject*>
GetConstructorObjectHandle(JSContext* aCx);
inline bool CreateAndDefineOnGlobal(JSContext* aCx)
{
// Get the interface or namespace object for this class. This will
// create the object as needed and always define the properties for
// it on the global. The caller should make sure the interface or
// namespace is exposed on the global before calling this.
return GetPerInterfaceObjectHandle(aCx, constructors::id::XSLTProcessor,
&CreateInterfaceObjects,
DefineInterfaceProperty::Always);
}
} // namespace XSLTProcessor_Binding
} // namespace mozilla::dom
#endif // DOM_XSLTPROCESSORBINDING_H_