Copy as Markdown

Other Tools

/* THIS FILE IS AUTOGENERATED FROM URLSearchParams.webidl BY Codegen.py - DO NOT EDIT */
#ifndef DOM_URLSEARCHPARAMSBINDING_H_
#define DOM_URLSEARCHPARAMSBINDING_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/Record.h"
#include "mozilla/dom/UnionMember.h"
namespace mozilla {
namespace dom {
struct NativePropertyHooks;
class ProtoAndIfaceCache;
class URLSearchParams;
} // namespace dom
} // namespace mozilla
namespace mozilla::dom {
class UTF8StringSequenceSequenceOrUTF8StringUTF8StringRecordOrUTF8String : public AllUnionBase
{
enum TypeOrUninit
{
eUninitialized,
eUTF8StringSequenceSequence,
eUTF8StringUTF8StringRecord,
eUTF8String
};
public:
enum class Type
{
eUTF8StringSequenceSequence = TypeOrUninit::eUTF8StringSequenceSequence,
eUTF8StringUTF8StringRecord = TypeOrUninit::eUTF8StringUTF8StringRecord,
eUTF8String = TypeOrUninit::eUTF8String
};
private:
union Value
{
UnionMember<binding_detail::AutoSequence<Sequence<nsCString>> > mUTF8StringSequenceSequence;
UnionMember<Record<nsCString, nsCString> > mUTF8StringUTF8StringRecord;
UnionMember<binding_detail::FakeString<char> > mUTF8String;
};
TypeOrUninit mType;
Value mValue;
UTF8StringSequenceSequenceOrUTF8StringUTF8StringRecordOrUTF8String(const UTF8StringSequenceSequenceOrUTF8StringUTF8StringRecordOrUTF8String&) = delete;
UTF8StringSequenceSequenceOrUTF8StringUTF8StringRecordOrUTF8String& operator=(const UTF8StringSequenceSequenceOrUTF8StringUTF8StringRecordOrUTF8String&) = delete;
public:
explicit inline UTF8StringSequenceSequenceOrUTF8StringUTF8StringRecordOrUTF8String()
: mType(eUninitialized)
{
}
inline ~UTF8StringSequenceSequenceOrUTF8StringUTF8StringRecordOrUTF8String()
{
Uninit();
}
[[nodiscard]] inline binding_detail::AutoSequence<Sequence<nsCString>>&
RawSetAsUTF8StringSequenceSequence()
{
if (mType == eUTF8StringSequenceSequence) {
return mValue.mUTF8StringSequenceSequence.Value();
}
MOZ_ASSERT(mType == eUninitialized);
mType = eUTF8StringSequenceSequence;
return mValue.mUTF8StringSequenceSequence.SetValue();
}
[[nodiscard]] inline binding_detail::AutoSequence<Sequence<nsCString>>&
SetAsUTF8StringSequenceSequence()
{
if (mType == eUTF8StringSequenceSequence) {
return mValue.mUTF8StringSequenceSequence.Value();
}
Uninit();
mType = eUTF8StringSequenceSequence;
return mValue.mUTF8StringSequenceSequence.SetValue();
}
inline bool
IsUTF8StringSequenceSequence() const
{
return mType == eUTF8StringSequenceSequence;
}
inline binding_detail::AutoSequence<Sequence<nsCString>>&
GetAsUTF8StringSequenceSequence()
{
MOZ_RELEASE_ASSERT(IsUTF8StringSequenceSequence(), "Wrong type!");
return mValue.mUTF8StringSequenceSequence.Value();
}
inline const Sequence<Sequence<nsCString>>&
GetAsUTF8StringSequenceSequence() const
{
MOZ_RELEASE_ASSERT(IsUTF8StringSequenceSequence(), "Wrong type!");
return mValue.mUTF8StringSequenceSequence.Value();
}
[[nodiscard]] inline Record<nsCString, nsCString>&
RawSetAsUTF8StringUTF8StringRecord()
{
if (mType == eUTF8StringUTF8StringRecord) {
return mValue.mUTF8StringUTF8StringRecord.Value();
}
MOZ_ASSERT(mType == eUninitialized);
mType = eUTF8StringUTF8StringRecord;
return mValue.mUTF8StringUTF8StringRecord.SetValue();
}
[[nodiscard]] inline Record<nsCString, nsCString>&
SetAsUTF8StringUTF8StringRecord()
{
if (mType == eUTF8StringUTF8StringRecord) {
return mValue.mUTF8StringUTF8StringRecord.Value();
}
Uninit();
mType = eUTF8StringUTF8StringRecord;
return mValue.mUTF8StringUTF8StringRecord.SetValue();
}
inline bool
IsUTF8StringUTF8StringRecord() const
{
return mType == eUTF8StringUTF8StringRecord;
}
inline Record<nsCString, nsCString>&
GetAsUTF8StringUTF8StringRecord()
{
MOZ_RELEASE_ASSERT(IsUTF8StringUTF8StringRecord(), "Wrong type!");
return mValue.mUTF8StringUTF8StringRecord.Value();
}
inline const Record<nsCString, nsCString>&
GetAsUTF8StringUTF8StringRecord() const
{
MOZ_RELEASE_ASSERT(IsUTF8StringUTF8StringRecord(), "Wrong type!");
return mValue.mUTF8StringUTF8StringRecord.Value();
}
[[nodiscard]] inline binding_detail::FakeString<char>&
RawSetAsUTF8String()
{
if (mType == eUTF8String) {
return mValue.mUTF8String.Value();
}
MOZ_ASSERT(mType == eUninitialized);
mType = eUTF8String;
return mValue.mUTF8String.SetValue();
}
[[nodiscard]] inline binding_detail::FakeString<char>&
SetAsUTF8String()
{
if (mType == eUTF8String) {
return mValue.mUTF8String.Value();
}
Uninit();
mType = eUTF8String;
return mValue.mUTF8String.SetValue();
}
template <int N>
inline void
SetStringLiteral(const nsCString::char_type (&aData)[N])
{
RawSetAsUTF8String().AssignLiteral(aData);
}
inline bool
IsUTF8String() const
{
return mType == eUTF8String;
}
inline binding_detail::FakeString<char>&
GetAsUTF8String()
{
MOZ_RELEASE_ASSERT(IsUTF8String(), "Wrong type!");
return mValue.mUTF8String.Value();
}
inline const nsACString&
GetAsUTF8String() const
{
MOZ_RELEASE_ASSERT(IsUTF8String(), "Wrong type!");
return mValue.mUTF8String.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 eUTF8StringSequenceSequence: {
DestroyUTF8StringSequenceSequence();
break;
}
case eUTF8StringUTF8StringRecord: {
DestroyUTF8StringUTF8StringRecord();
break;
}
case eUTF8String: {
DestroyUTF8String();
break;
}
}
}
bool
ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const;
private:
bool
TrySetToUTF8StringSequenceSequence(BindingCallContext& cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
bool
TrySetToUTF8StringSequenceSequence(JSContext* cx_, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
inline void
DestroyUTF8StringSequenceSequence()
{
MOZ_RELEASE_ASSERT(IsUTF8StringSequenceSequence(), "Wrong type!");
mValue.mUTF8StringSequenceSequence.Destroy();
mType = eUninitialized;
}
bool
TrySetToUTF8StringUTF8StringRecord(BindingCallContext& cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
bool
TrySetToUTF8StringUTF8StringRecord(JSContext* cx_, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
inline void
DestroyUTF8StringUTF8StringRecord()
{
MOZ_RELEASE_ASSERT(IsUTF8StringUTF8StringRecord(), "Wrong type!");
mValue.mUTF8StringUTF8StringRecord.Destroy();
mType = eUninitialized;
}
bool
TrySetToUTF8String(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
inline void
DestroyUTF8String()
{
MOZ_RELEASE_ASSERT(IsUTF8String(), "Wrong type!");
mValue.mUTF8String.Destroy();
mType = eUninitialized;
}
};
class OwningUTF8StringSequenceSequenceOrUTF8StringUTF8StringRecordOrUTF8String : public AllOwningUnionBase
{
enum TypeOrUninit
{
eUninitialized,
eUTF8StringSequenceSequence,
eUTF8StringUTF8StringRecord,
eUTF8String
};
public:
enum class Type
{
eUTF8StringSequenceSequence = TypeOrUninit::eUTF8StringSequenceSequence,
eUTF8StringUTF8StringRecord = TypeOrUninit::eUTF8StringUTF8StringRecord,
eUTF8String = TypeOrUninit::eUTF8String
};
private:
union Value
{
UnionMember<Sequence<Sequence<nsCString>> > mUTF8StringSequenceSequence;
UnionMember<Record<nsCString, nsCString> > mUTF8StringUTF8StringRecord;
UnionMember<nsCString > mUTF8String;
};
TypeOrUninit mType;
Value mValue;
OwningUTF8StringSequenceSequenceOrUTF8StringUTF8StringRecordOrUTF8String(const OwningUTF8StringSequenceSequenceOrUTF8StringUTF8StringRecordOrUTF8String&) = delete;
OwningUTF8StringSequenceSequenceOrUTF8StringUTF8StringRecordOrUTF8String& operator=(const OwningUTF8StringSequenceSequenceOrUTF8StringUTF8StringRecordOrUTF8String&) = delete;
public:
explicit inline OwningUTF8StringSequenceSequenceOrUTF8StringUTF8StringRecordOrUTF8String()
: mType(eUninitialized)
{
}
OwningUTF8StringSequenceSequenceOrUTF8StringUTF8StringRecordOrUTF8String(OwningUTF8StringSequenceSequenceOrUTF8StringUTF8StringRecordOrUTF8String&& aOther);
inline ~OwningUTF8StringSequenceSequenceOrUTF8StringUTF8StringRecordOrUTF8String()
{
Uninit();
}
[[nodiscard]] Sequence<Sequence<nsCString>>&
RawSetAsUTF8StringSequenceSequence();
[[nodiscard]] Sequence<Sequence<nsCString>>&
SetAsUTF8StringSequenceSequence();
inline bool
IsUTF8StringSequenceSequence() const
{
return mType == eUTF8StringSequenceSequence;
}
inline Sequence<Sequence<nsCString>>&
GetAsUTF8StringSequenceSequence()
{
MOZ_RELEASE_ASSERT(IsUTF8StringSequenceSequence(), "Wrong type!");
return mValue.mUTF8StringSequenceSequence.Value();
}
inline Sequence<Sequence<nsCString>> const &
GetAsUTF8StringSequenceSequence() const
{
MOZ_RELEASE_ASSERT(IsUTF8StringSequenceSequence(), "Wrong type!");
return mValue.mUTF8StringSequenceSequence.Value();
}
[[nodiscard]] Record<nsCString, nsCString>&
RawSetAsUTF8StringUTF8StringRecord();
[[nodiscard]] Record<nsCString, nsCString>&
SetAsUTF8StringUTF8StringRecord();
inline bool
IsUTF8StringUTF8StringRecord() const
{
return mType == eUTF8StringUTF8StringRecord;
}
inline Record<nsCString, nsCString>&
GetAsUTF8StringUTF8StringRecord()
{
MOZ_RELEASE_ASSERT(IsUTF8StringUTF8StringRecord(), "Wrong type!");
return mValue.mUTF8StringUTF8StringRecord.Value();
}
inline Record<nsCString, nsCString> const &
GetAsUTF8StringUTF8StringRecord() const
{
MOZ_RELEASE_ASSERT(IsUTF8StringUTF8StringRecord(), "Wrong type!");
return mValue.mUTF8StringUTF8StringRecord.Value();
}
[[nodiscard]] nsCString&
RawSetAsUTF8String();
[[nodiscard]] nsCString&
SetAsUTF8String();
template <int N>
inline void
SetStringLiteral(const nsCString::char_type (&aData)[N])
{
RawSetAsUTF8String().AssignLiteral(aData);
}
inline bool
IsUTF8String() const
{
return mType == eUTF8String;
}
inline nsCString&
GetAsUTF8String()
{
MOZ_RELEASE_ASSERT(IsUTF8String(), "Wrong type!");
return mValue.mUTF8String.Value();
}
inline nsCString const &
GetAsUTF8String() const
{
MOZ_RELEASE_ASSERT(IsUTF8String(), "Wrong type!");
return mValue.mUTF8String.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;
OwningUTF8StringSequenceSequenceOrUTF8StringUTF8StringRecordOrUTF8String&
operator=(OwningUTF8StringSequenceSequenceOrUTF8StringUTF8StringRecordOrUTF8String&& aOther);
inline Type
GetType() const
{
MOZ_RELEASE_ASSERT(mType != eUninitialized);
return static_cast<Type>(mType);
}
private:
bool
TrySetToUTF8StringSequenceSequence(BindingCallContext& cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
bool
TrySetToUTF8StringSequenceSequence(JSContext* cx_, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
void
DestroyUTF8StringSequenceSequence();
bool
TrySetToUTF8StringUTF8StringRecord(BindingCallContext& cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
bool
TrySetToUTF8StringUTF8StringRecord(JSContext* cx_, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
void
DestroyUTF8StringUTF8StringRecord();
bool
TrySetToUTF8String(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
void
DestroyUTF8String();
};
namespace URLSearchParams_Binding {
typedef mozilla::dom::URLSearchParams NativeType;
bool
Wrap(JSContext* aCx, mozilla::dom::URLSearchParams* 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::URLSearchParams,
&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::URLSearchParams,
&CreateInterfaceObjects,
aDefineOnGlobal);
}
JSObject*
GetConstructorObject(JSContext* aCx);
} // namespace URLSearchParams_Binding
} // namespace mozilla::dom
#endif // DOM_URLSEARCHPARAMSBINDING_H_