Copy as Markdown

Other Tools

/* THIS FILE IS AUTOGENERATED FROM VTTCue.webidl BY Codegen.py - DO NOT EDIT */
#ifndef DOM_VTTCUEBINDING_H_
#define DOM_VTTCUEBINDING_H_
#include "js/CallAndConstruct.h"
#include "js/RootingAPI.h"
#include "js/TypeDecls.h"
#include "mozilla/ArrayUtils.h"
#include "mozilla/EnumTypeTraits.h"
#include "mozilla/Span.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"
namespace mozilla {
namespace dom {
struct NativePropertyHooks;
class ProtoAndIfaceCache;
class TextTrackCue;
} // namespace dom
} // namespace mozilla
namespace mozilla {
namespace dom {
enum class AutoKeyword : uint8_t {
Auto,
};
namespace binding_detail {
template <> struct EnumStrings<AutoKeyword> {
static const nsLiteralCString Values[1];
};
} // namespace binding_detail
bool
ToJSValue(JSContext* aCx, AutoKeyword aArgument, JS::MutableHandle<JS::Value> aValue);
enum class LineAlignSetting : uint8_t {
Start,
Center,
End,
};
namespace binding_detail {
template <> struct EnumStrings<LineAlignSetting> {
static const nsLiteralCString Values[3];
};
} // namespace binding_detail
bool
ToJSValue(JSContext* aCx, LineAlignSetting aArgument, JS::MutableHandle<JS::Value> aValue);
enum class PositionAlignSetting : uint8_t {
Line_left,
Center,
Line_right,
Auto,
};
namespace binding_detail {
template <> struct EnumStrings<PositionAlignSetting> {
static const nsLiteralCString Values[4];
};
} // namespace binding_detail
bool
ToJSValue(JSContext* aCx, PositionAlignSetting aArgument, JS::MutableHandle<JS::Value> aValue);
enum class AlignSetting : uint8_t {
Start,
Center,
End,
Left,
Right,
};
namespace binding_detail {
template <> struct EnumStrings<AlignSetting> {
static const nsLiteralCString Values[5];
};
} // namespace binding_detail
bool
ToJSValue(JSContext* aCx, AlignSetting aArgument, JS::MutableHandle<JS::Value> aValue);
enum class DirectionSetting : uint8_t {
_empty,
Rl,
Lr,
};
namespace binding_detail {
template <> struct EnumStrings<DirectionSetting> {
static const nsLiteralCString Values[3];
};
} // namespace binding_detail
bool
ToJSValue(JSContext* aCx, DirectionSetting aArgument, JS::MutableHandle<JS::Value> aValue);
class DoubleOrAutoKeyword : public AllUnionBase
{
enum TypeOrUninit
{
eUninitialized,
eDouble,
eAutoKeyword
};
public:
enum class Type
{
eDouble = TypeOrUninit::eDouble,
eAutoKeyword = TypeOrUninit::eAutoKeyword
};
private:
union Value
{
UnionMember<double > mDouble;
UnionMember<AutoKeyword > mAutoKeyword;
};
TypeOrUninit mType;
Value mValue;
DoubleOrAutoKeyword(const DoubleOrAutoKeyword&) = delete;
DoubleOrAutoKeyword& operator=(const DoubleOrAutoKeyword&) = delete;
public:
explicit inline DoubleOrAutoKeyword()
: mType(eUninitialized)
{
}
inline ~DoubleOrAutoKeyword()
{
Uninit();
}
[[nodiscard]] inline double&
RawSetAsDouble()
{
if (mType == eDouble) {
return mValue.mDouble.Value();
}
MOZ_ASSERT(mType == eUninitialized);
mType = eDouble;
return mValue.mDouble.SetValue();
}
[[nodiscard]] inline double&
SetAsDouble()
{
if (mType == eDouble) {
return mValue.mDouble.Value();
}
Uninit();
mType = eDouble;
return mValue.mDouble.SetValue();
}
inline bool
IsDouble() const
{
return mType == eDouble;
}
inline double&
GetAsDouble()
{
MOZ_RELEASE_ASSERT(IsDouble(), "Wrong type!");
return mValue.mDouble.Value();
}
inline double
GetAsDouble() const
{
MOZ_RELEASE_ASSERT(IsDouble(), "Wrong type!");
return mValue.mDouble.Value();
}
[[nodiscard]] inline AutoKeyword&
RawSetAsAutoKeyword()
{
if (mType == eAutoKeyword) {
return mValue.mAutoKeyword.Value();
}
MOZ_ASSERT(mType == eUninitialized);
mType = eAutoKeyword;
return mValue.mAutoKeyword.SetValue();
}
[[nodiscard]] inline AutoKeyword&
SetAsAutoKeyword()
{
if (mType == eAutoKeyword) {
return mValue.mAutoKeyword.Value();
}
Uninit();
mType = eAutoKeyword;
return mValue.mAutoKeyword.SetValue();
}
inline bool
IsAutoKeyword() const
{
return mType == eAutoKeyword;
}
inline AutoKeyword&
GetAsAutoKeyword()
{
MOZ_RELEASE_ASSERT(IsAutoKeyword(), "Wrong type!");
return mValue.mAutoKeyword.Value();
}
inline AutoKeyword
GetAsAutoKeyword() const
{
MOZ_RELEASE_ASSERT(IsAutoKeyword(), "Wrong type!");
return mValue.mAutoKeyword.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 eDouble: {
DestroyDouble();
break;
}
case eAutoKeyword: {
DestroyAutoKeyword();
break;
}
}
}
bool
ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const;
private:
bool
TrySetToDouble(BindingCallContext& cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
bool
TrySetToDouble(JSContext* cx_, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
inline void
DestroyDouble()
{
MOZ_RELEASE_ASSERT(IsDouble(), "Wrong type!");
mValue.mDouble.Destroy();
mType = eUninitialized;
}
bool
TrySetToAutoKeyword(BindingCallContext& cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
bool
TrySetToAutoKeyword(JSContext* cx_, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
inline void
DestroyAutoKeyword()
{
MOZ_RELEASE_ASSERT(IsAutoKeyword(), "Wrong type!");
mValue.mAutoKeyword.Destroy();
mType = eUninitialized;
}
};
class OwningDoubleOrAutoKeyword : public AllOwningUnionBase
{
enum TypeOrUninit
{
eUninitialized,
eDouble,
eAutoKeyword
};
public:
enum class Type
{
eDouble = TypeOrUninit::eDouble,
eAutoKeyword = TypeOrUninit::eAutoKeyword
};
private:
union Value
{
UnionMember<double > mDouble;
UnionMember<AutoKeyword > mAutoKeyword;
};
TypeOrUninit mType;
Value mValue;
public:
explicit inline OwningDoubleOrAutoKeyword()
: mType(eUninitialized)
{
}
OwningDoubleOrAutoKeyword(OwningDoubleOrAutoKeyword&& aOther);
explicit inline OwningDoubleOrAutoKeyword(const OwningDoubleOrAutoKeyword& aOther)
: mType(eUninitialized)
{
*this = aOther;
}
inline ~OwningDoubleOrAutoKeyword()
{
Uninit();
}
[[nodiscard]] double&
RawSetAsDouble();
[[nodiscard]] double&
SetAsDouble();
inline bool
IsDouble() const
{
return mType == eDouble;
}
inline double&
GetAsDouble()
{
MOZ_RELEASE_ASSERT(IsDouble(), "Wrong type!");
return mValue.mDouble.Value();
}
inline double const &
GetAsDouble() const
{
MOZ_RELEASE_ASSERT(IsDouble(), "Wrong type!");
return mValue.mDouble.Value();
}
[[nodiscard]] AutoKeyword&
RawSetAsAutoKeyword();
[[nodiscard]] AutoKeyword&
SetAsAutoKeyword();
inline bool
IsAutoKeyword() const
{
return mType == eAutoKeyword;
}
inline AutoKeyword&
GetAsAutoKeyword()
{
MOZ_RELEASE_ASSERT(IsAutoKeyword(), "Wrong type!");
return mValue.mAutoKeyword.Value();
}
inline AutoKeyword const &
GetAsAutoKeyword() const
{
MOZ_RELEASE_ASSERT(IsAutoKeyword(), "Wrong type!");
return mValue.mAutoKeyword.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;
OwningDoubleOrAutoKeyword&
operator=(OwningDoubleOrAutoKeyword&& aOther);
inline Type
GetType() const
{
MOZ_RELEASE_ASSERT(mType != eUninitialized);
return static_cast<Type>(mType);
}
OwningDoubleOrAutoKeyword&
operator=(const OwningDoubleOrAutoKeyword& aOther);
private:
bool
TrySetToDouble(BindingCallContext& cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
bool
TrySetToDouble(JSContext* cx_, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
void
DestroyDouble();
bool
TrySetToAutoKeyword(BindingCallContext& cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
bool
TrySetToAutoKeyword(JSContext* cx_, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
void
DestroyAutoKeyword();
};
namespace VTTCue_Binding {
typedef mozilla::dom::TextTrackCue NativeType;
bool
Wrap(JSContext* aCx, mozilla::dom::TextTrackCue* 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, bool aDefineOnGlobal);
inline JS::Handle<JSObject*> GetProtoObjectHandle(JSContext* aCx)
{
/* Get the interface prototype object for this class. This will create the
object as needed. */
return GetPerInterfaceObjectHandle(aCx, prototypes::id::VTTCue,
&CreateInterfaceObjects,
/* aDefineOnGlobal = */ true);
}
inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true)
{
/* Get the interface object for this class. This will create the object as
needed. */
return GetPerInterfaceObjectHandle(aCx, constructors::id::VTTCue,
&CreateInterfaceObjects,
aDefineOnGlobal);
}
JSObject*
GetConstructorObject(JSContext* aCx);
} // namespace VTTCue_Binding
} // namespace dom
template <>
struct MaxContiguousEnumValue<dom::AutoKeyword>
{
static constexpr dom::AutoKeyword value = dom::AutoKeyword::Auto;
static_assert(static_cast<uint8_t>(dom::AutoKeyword::Auto) == 0,
"We rely on this in ContiguousEnumValues");
static_assert(mozilla::ArrayLength(dom::binding_detail::EnumStrings<dom::AutoKeyword>::Values) - 1 == UnderlyingValue(value),
"Mismatch between enum strings and enum count");
};
template <>
struct MaxContiguousEnumValue<dom::LineAlignSetting>
{
static constexpr dom::LineAlignSetting value = dom::LineAlignSetting::End;
static_assert(static_cast<uint8_t>(dom::LineAlignSetting::Start) == 0,
"We rely on this in ContiguousEnumValues");
static_assert(mozilla::ArrayLength(dom::binding_detail::EnumStrings<dom::LineAlignSetting>::Values) - 1 == UnderlyingValue(value),
"Mismatch between enum strings and enum count");
};
template <>
struct MaxContiguousEnumValue<dom::PositionAlignSetting>
{
static constexpr dom::PositionAlignSetting value = dom::PositionAlignSetting::Auto;
static_assert(static_cast<uint8_t>(dom::PositionAlignSetting::Line_left) == 0,
"We rely on this in ContiguousEnumValues");
static_assert(mozilla::ArrayLength(dom::binding_detail::EnumStrings<dom::PositionAlignSetting>::Values) - 1 == UnderlyingValue(value),
"Mismatch between enum strings and enum count");
};
template <>
struct MaxContiguousEnumValue<dom::AlignSetting>
{
static constexpr dom::AlignSetting value = dom::AlignSetting::Right;
static_assert(static_cast<uint8_t>(dom::AlignSetting::Start) == 0,
"We rely on this in ContiguousEnumValues");
static_assert(mozilla::ArrayLength(dom::binding_detail::EnumStrings<dom::AlignSetting>::Values) - 1 == UnderlyingValue(value),
"Mismatch between enum strings and enum count");
};
template <>
struct MaxContiguousEnumValue<dom::DirectionSetting>
{
static constexpr dom::DirectionSetting value = dom::DirectionSetting::Lr;
static_assert(static_cast<uint8_t>(dom::DirectionSetting::_empty) == 0,
"We rely on this in ContiguousEnumValues");
static_assert(mozilla::ArrayLength(dom::binding_detail::EnumStrings<dom::DirectionSetting>::Values) - 1 == UnderlyingValue(value),
"Mismatch between enum strings and enum count");
};
} // namespace mozilla
#endif // DOM_VTTCUEBINDING_H_