Copy as Markdown

Other Tools

//
// Automatically generated by ipdlc.
// Edit at your own risk
//
#include "mozilla/dom/PrefsTypes.h"
#include "ipc/IPCMessageUtils.h"
#include "ipc/IPCMessageUtilsSpecializations.h"
#include "nsIFile.h"
#include "mozilla/ipc/Endpoint.h"
#include "mozilla/ipc/ProtocolMessageUtils.h"
#include "mozilla/ipc/ProtocolUtils.h"
#include "mozilla/ipc/ShmemMessageUtils.h"
#include "mozilla/ipc/TaintingIPCUtils.h"
//-----------------------------------------------------------------------------
// Method definitions for the IPDL type |union PrefValue|
//
namespace mozilla {
namespace dom {
auto PrefValue::MaybeDestroy() -> void
{
if ((mType) == (T__None)) {
return;
}
switch (mType) {
case TnsCString:
{
(ptr_nsCString())->~nsCString__tdef();
break;
}
case Tint32_t:
{
(ptr_int32_t())->~int32_t__tdef();
break;
}
case Tbool:
{
(ptr_bool())->~bool__tdef();
break;
}
default:
{
mozilla::ipc::LogicError("not reached");
break;
}
}
}
MOZ_IMPLICIT PrefValue::PrefValue(const nsCString& aOther)
{
new (mozilla::KnownNotNull, ptr_nsCString()) nsCString(aOther);
mType = TnsCString;
}
MOZ_IMPLICIT PrefValue::PrefValue(nsCString&& aOther)
{
new (mozilla::KnownNotNull, ptr_nsCString()) nsCString(std::move(aOther));
mType = TnsCString;
}
MOZ_IMPLICIT PrefValue::PrefValue(const int32_t& aOther)
{
new (mozilla::KnownNotNull, ptr_int32_t()) int32_t(aOther);
mType = Tint32_t;
}
MOZ_IMPLICIT PrefValue::PrefValue(int32_t&& aOther)
{
new (mozilla::KnownNotNull, ptr_int32_t()) int32_t(std::move(aOther));
mType = Tint32_t;
}
MOZ_IMPLICIT PrefValue::PrefValue(const bool& aOther)
{
new (mozilla::KnownNotNull, ptr_bool()) bool(aOther);
mType = Tbool;
}
MOZ_IMPLICIT PrefValue::PrefValue(bool&& aOther)
{
new (mozilla::KnownNotNull, ptr_bool()) bool(std::move(aOther));
mType = Tbool;
}
MOZ_IMPLICIT PrefValue::PrefValue(const PrefValue& aOther)
{
(aOther).AssertSanity();
switch ((aOther).type()) {
case TnsCString:
{
new (mozilla::KnownNotNull, ptr_nsCString()) nsCString((aOther).get_nsCString());
break;
}
case Tint32_t:
{
new (mozilla::KnownNotNull, ptr_int32_t()) int32_t((aOther).get_int32_t());
break;
}
case Tbool:
{
new (mozilla::KnownNotNull, ptr_bool()) bool((aOther).get_bool());
break;
}
case T__None:
{
break;
}
default:
{
mozilla::ipc::LogicError("unreached");
return;
}
}
mType = (aOther).type();
}
MOZ_IMPLICIT PrefValue::PrefValue(PrefValue&& aOther)
{
(aOther).AssertSanity();
Type t = (aOther).type();
switch (t) {
case TnsCString:
{
new (mozilla::KnownNotNull, ptr_nsCString()) nsCString(std::move((aOther).get_nsCString()));
(aOther).MaybeDestroy();
break;
}
case Tint32_t:
{
new (mozilla::KnownNotNull, ptr_int32_t()) int32_t(std::move((aOther).get_int32_t()));
(aOther).MaybeDestroy();
break;
}
case Tbool:
{
new (mozilla::KnownNotNull, ptr_bool()) bool(std::move((aOther).get_bool()));
(aOther).MaybeDestroy();
break;
}
case T__None:
{
break;
}
default:
{
mozilla::ipc::LogicError("unreached");
return;
}
}
(aOther).mType = T__None;
mType = t;
}
PrefValue::~PrefValue()
{
MaybeDestroy();
}
auto PrefValue::operator=(const nsCString& aRhs) -> PrefValue&
{
MaybeDestroy();
new (mozilla::KnownNotNull, ptr_nsCString()) nsCString(aRhs);
mType = TnsCString;
return (*(this));
}
auto PrefValue::operator=(nsCString&& aRhs) -> PrefValue&
{
MaybeDestroy();
new (mozilla::KnownNotNull, ptr_nsCString()) nsCString(std::move(aRhs));
mType = TnsCString;
return (*(this));
}
auto PrefValue::operator=(const int32_t& aRhs) -> PrefValue&
{
MaybeDestroy();
new (mozilla::KnownNotNull, ptr_int32_t()) int32_t(aRhs);
mType = Tint32_t;
return (*(this));
}
auto PrefValue::operator=(int32_t&& aRhs) -> PrefValue&
{
MaybeDestroy();
new (mozilla::KnownNotNull, ptr_int32_t()) int32_t(std::move(aRhs));
mType = Tint32_t;
return (*(this));
}
auto PrefValue::operator=(const bool& aRhs) -> PrefValue&
{
MaybeDestroy();
new (mozilla::KnownNotNull, ptr_bool()) bool(aRhs);
mType = Tbool;
return (*(this));
}
auto PrefValue::operator=(bool&& aRhs) -> PrefValue&
{
MaybeDestroy();
new (mozilla::KnownNotNull, ptr_bool()) bool(std::move(aRhs));
mType = Tbool;
return (*(this));
}
auto PrefValue::operator=(const PrefValue& aRhs) -> PrefValue&
{
(aRhs).AssertSanity();
Type t = (aRhs).type();
switch (t) {
case TnsCString:
{
MaybeDestroy();
new (mozilla::KnownNotNull, ptr_nsCString()) nsCString((aRhs).get_nsCString());
break;
}
case Tint32_t:
{
MaybeDestroy();
new (mozilla::KnownNotNull, ptr_int32_t()) int32_t((aRhs).get_int32_t());
break;
}
case Tbool:
{
MaybeDestroy();
new (mozilla::KnownNotNull, ptr_bool()) bool((aRhs).get_bool());
break;
}
case T__None:
{
MaybeDestroy();
break;
}
default:
{
mozilla::ipc::LogicError("unreached");
break;
}
}
mType = t;
return (*(this));
}
auto PrefValue::operator=(PrefValue&& aRhs) -> PrefValue&
{
(aRhs).AssertSanity();
Type t = (aRhs).type();
switch (t) {
case TnsCString:
{
MaybeDestroy();
new (mozilla::KnownNotNull, ptr_nsCString()) nsCString(std::move((aRhs).get_nsCString()));
(aRhs).MaybeDestroy();
break;
}
case Tint32_t:
{
MaybeDestroy();
new (mozilla::KnownNotNull, ptr_int32_t()) int32_t(std::move((aRhs).get_int32_t()));
(aRhs).MaybeDestroy();
break;
}
case Tbool:
{
MaybeDestroy();
new (mozilla::KnownNotNull, ptr_bool()) bool(std::move((aRhs).get_bool()));
(aRhs).MaybeDestroy();
break;
}
case T__None:
{
MaybeDestroy();
break;
}
default:
{
mozilla::ipc::LogicError("unreached");
break;
}
}
(aRhs).mType = T__None;
mType = t;
return (*(this));
}
} // namespace dom
} // namespace mozilla
namespace IPC {
auto ParamTraits<::mozilla::dom::PrefValue>::Write(
IPC::MessageWriter* aWriter,
const paramType& aVar) -> void
{
typedef ::mozilla::dom::PrefValue union__;
int type = (aVar).type();
IPC::WriteParam(aWriter, type);
// Sentinel = 'PrefValue'
(aWriter)->WriteSentinel(290784139);
switch (type) {
case union__::TnsCString:
{
IPC::WriteParam(aWriter, (aVar).get_nsCString());
// Sentinel = 'TnsCString'
(aWriter)->WriteSentinel(353960944);
return;
}
case union__::Tint32_t:
{
IPC::WriteParam(aWriter, (aVar).get_int32_t());
// Sentinel = 'Tint32_t'
(aWriter)->WriteSentinel(217252568);
return;
}
case union__::Tbool:
{
IPC::WriteParam(aWriter, (aVar).get_bool());
// Sentinel = 'Tbool'
(aWriter)->WriteSentinel(96993793);
return;
}
default:
{
aWriter->FatalError("unknown variant of union PrefValue");
return;
}
}
}
auto ParamTraits<::mozilla::dom::PrefValue>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
typedef ::mozilla::dom::PrefValue union__;
auto maybe__type = IPC::ReadParam<int>(aReader);
if (!maybe__type) {
aReader->FatalError("Error deserializing type of union PrefValue");
return {};
}
auto& type = *maybe__type;
// Sentinel = 'PrefValue'
if ((!((aReader)->ReadSentinel(290784139)))) {
mozilla::ipc::SentinelReadError("Error deserializing type of union PrefValue");
return {};
}
switch (type) {
case union__::TnsCString:
{
auto maybe__tmp = IPC::ReadParam<::nsCString>(aReader);
if (!maybe__tmp) {
aReader->FatalError("Error deserializing variant TnsCString of union PrefValue");
return {};
}
auto& tmp = *maybe__tmp;
// Sentinel = 'TnsCString'
if ((!((aReader)->ReadSentinel(353960944)))) {
mozilla::ipc::SentinelReadError("Error deserializing variant TnsCString of union PrefValue");
return {};
}
return std::move(tmp);
}
case union__::Tint32_t:
{
auto maybe__tmp = IPC::ReadParam<::int32_t>(aReader);
if (!maybe__tmp) {
aReader->FatalError("Error deserializing variant Tint32_t of union PrefValue");
return {};
}
auto& tmp = *maybe__tmp;
// Sentinel = 'Tint32_t'
if ((!((aReader)->ReadSentinel(217252568)))) {
mozilla::ipc::SentinelReadError("Error deserializing variant Tint32_t of union PrefValue");
return {};
}
return std::move(tmp);
}
case union__::Tbool:
{
auto maybe__tmp = IPC::ReadParam<bool>(aReader);
if (!maybe__tmp) {
aReader->FatalError("Error deserializing variant Tbool of union PrefValue");
return {};
}
auto& tmp = *maybe__tmp;
// Sentinel = 'Tbool'
if ((!((aReader)->ReadSentinel(96993793)))) {
mozilla::ipc::SentinelReadError("Error deserializing variant Tbool of union PrefValue");
return {};
}
return std::move(tmp);
}
default:
{
aReader->FatalError("unknown variant of union PrefValue");
return {};
}
}
}
} // namespace IPC
//-----------------------------------------------------------------------------
// Method definitions for the IPDL type |struct Pref|
//
namespace mozilla {
namespace dom {
} // namespace dom
} // namespace mozilla
namespace IPC {
auto ParamTraits<::mozilla::dom::Pref>::Write(
IPC::MessageWriter* aWriter,
const paramType& aVar) -> void
{
IPC::WriteParam(aWriter, (aVar).name());
// Sentinel = 'name'
(aWriter)->WriteSentinel(69075362);
IPC::WriteParam(aWriter, (aVar).isLocked());
// Sentinel = 'isLocked'
(aWriter)->WriteSentinel(241369903);
IPC::WriteParam(aWriter, (aVar).isSanitized());
// Sentinel = 'isSanitized'
(aWriter)->WriteSentinel(452658312);
IPC::WriteParam(aWriter, (aVar).defaultValue());
// Sentinel = 'defaultValue'
(aWriter)->WriteSentinel(529597667);
IPC::WriteParam(aWriter, (aVar).userValue());
// Sentinel = 'userValue'
(aWriter)->WriteSentinel(317850557);
}
auto ParamTraits<::mozilla::dom::Pref>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
auto maybe___name = IPC::ReadParam<::nsCString>(aReader);
if (!maybe___name) {
aReader->FatalError("Error deserializing 'name' (nsCString) member of 'Pref'");
return {};
}
auto& _name = *maybe___name;
// Sentinel = 'name'
if ((!((aReader)->ReadSentinel(69075362)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'name' (nsCString) member of 'Pref'");
return {};
}
auto maybe___isLocked = IPC::ReadParam<bool>(aReader);
if (!maybe___isLocked) {
aReader->FatalError("Error deserializing 'isLocked' (bool) member of 'Pref'");
return {};
}
auto& _isLocked = *maybe___isLocked;
// Sentinel = 'isLocked'
if ((!((aReader)->ReadSentinel(241369903)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'isLocked' (bool) member of 'Pref'");
return {};
}
auto maybe___isSanitized = IPC::ReadParam<bool>(aReader);
if (!maybe___isSanitized) {
aReader->FatalError("Error deserializing 'isSanitized' (bool) member of 'Pref'");
return {};
}
auto& _isSanitized = *maybe___isSanitized;
// Sentinel = 'isSanitized'
if ((!((aReader)->ReadSentinel(452658312)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'isSanitized' (bool) member of 'Pref'");
return {};
}
auto maybe___defaultValue = IPC::ReadParam<mozilla::Maybe<::mozilla::dom::PrefValue>>(aReader);
if (!maybe___defaultValue) {
aReader->FatalError("Error deserializing 'defaultValue' (PrefValue?) member of 'Pref'");
return {};
}
auto& _defaultValue = *maybe___defaultValue;
// Sentinel = 'defaultValue'
if ((!((aReader)->ReadSentinel(529597667)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'defaultValue' (PrefValue?) member of 'Pref'");
return {};
}
auto maybe___userValue = IPC::ReadParam<mozilla::Maybe<::mozilla::dom::PrefValue>>(aReader);
if (!maybe___userValue) {
aReader->FatalError("Error deserializing 'userValue' (PrefValue?) member of 'Pref'");
return {};
}
auto& _userValue = *maybe___userValue;
// Sentinel = 'userValue'
if ((!((aReader)->ReadSentinel(317850557)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'userValue' (PrefValue?) member of 'Pref'");
return {};
}
IPC::ReadResult<paramType> result__{
std::in_place,
std::move(_name),
std::move(_isLocked),
std::move(_isSanitized),
std::move(_defaultValue),
std::move(_userValue)};
return result__;
}
} // namespace IPC