/* This file is autogenerated. DO NOT CHANGE. All changes will be lost */


#include "google/protobuf/struct.qpb.h"

#include <QtProtobuf/qprotobufregistration.h>

#include <cmath>

namespace google::protobuf {
static QtProtobuf::ProtoTypeRegistrar ProtoTypeRegistrarNullValueGadget(NullValueGadget::registerTypes);
void NullValueGadget::registerTypes()
{
    qRegisterMetaType<NullValue>();
    qRegisterMetaType<google::protobuf::NullValueGadget::NullValue>();
    qRegisterProtobufEnumType<google::protobuf::NullValueGadget::NullValue>();
}


class Struct_QtProtobufData : public QSharedData
{
public:
    Struct_QtProtobufData()
        : QSharedData()
    {
    }

    Struct_QtProtobufData(const Struct_QtProtobufData &other)
        : QSharedData(other),
          m_fields(other.m_fields)
    {
    }

    Struct::FieldsEntry m_fields;
};

Struct::~Struct() = default;

static constexpr struct {
    QtProtobufPrivate::QProtobufPropertyOrdering::Data data;
    const std::array<uint, 5> qt_protobuf_Struct_uint_data;
    const char qt_protobuf_Struct_char_data[31];
} qt_protobuf_Struct_metadata {
    // data
    {
        0, /* = version */
        1, /* = num fields */
        2, /* = field number offset */
        3, /* = property index offset */
        4, /* = field flags offset */
        22, /* = message full name length */
    },
    // uint_data
    {
        // JSON name offsets:
        23, /* = fields */
        30, /* = end-of-string-marker */
        // Field numbers:
        1, /* = fields */
        // Property indices:
        0, /* = fields */
        // Field flags:
        uint(QtProtobufPrivate::FieldFlag::Map | QtProtobufPrivate::FieldFlag::Message), /* = fields */
    },
    // char_data
    /* metadata char_data: */
    "google.protobuf.Struct\0" /* = full message name */
    /* field char_data: */
    "fields\0"
};

const QtProtobufPrivate::QProtobufPropertyOrdering Struct::staticPropertyOrdering = {
    &qt_protobuf_Struct_metadata.data
};

void Struct::registerTypes()
{
    qRegisterMetaType<Struct>();
    qRegisterMetaType<QList<Struct>>();
    qRegisterMetaType<Struct::FieldsEntry>();
    qRegisterProtobufMapType<QString, Value>();
}

Struct::Struct()
    : QProtobufMessage(&Struct::staticMetaObject, &Struct::staticPropertyOrdering),
      dptr(new Struct_QtProtobufData)
{
}

Struct::Struct(const Struct &other)
    = default;
Struct &Struct::operator =(const Struct &other)
{
    Struct temp(other);
    swap(temp);
    return *this;
}
Struct::Struct(Struct &&other) noexcept
    = default;
Struct::operator QVariant() const
{
    return QVariant::fromValue(*this);
}
bool comparesEqual(const Struct &lhs, const Struct &rhs) noexcept
{
    return operator ==(static_cast<const QProtobufMessage&>(lhs),
                       static_cast<const QProtobufMessage&>(rhs))
        && lhs.dptr->m_fields == rhs.dptr->m_fields;
}

const Struct::FieldsEntry &Struct::fields() const &
{
    return dptr->m_fields;
}

void Struct::setFields(const Struct::FieldsEntry &fields)
{
    if (dptr->m_fields != fields) {
        dptr.detach();
        dptr->m_fields = fields;
    }
}

void Struct::setFields(Struct::FieldsEntry &&fields)
{
    if (dptr->m_fields != fields) {
        dptr.detach();
        dptr->m_fields = std::move(fields);
    }
}


class Value_QtProtobufData : public QSharedData
{
public:
    Value_QtProtobufData()
        : QSharedData()
    {
    }

    Value_QtProtobufData(const Value_QtProtobufData &other)
        : QSharedData(other),
          m_kind(other.m_kind)
    {
    }

    QtProtobufPrivate::QProtobufOneof m_kind;
};

Value::~Value() = default;

static constexpr struct {
    QtProtobufPrivate::QProtobufPropertyOrdering::Data data;
    const std::array<uint, 25> qt_protobuf_Value_uint_data;
    const char qt_protobuf_Value_char_data[89];
} qt_protobuf_Value_metadata {
    // data
    {
        0, /* = version */
        6, /* = num fields */
        7, /* = field number offset */
        13, /* = property index offset */
        19, /* = field flags offset */
        21, /* = message full name length */
    },
    // uint_data
    {
        // JSON name offsets:
        22, /* = nullValue */
        32, /* = numberValue */
        44, /* = stringValue */
        56, /* = boolValue */
        66, /* = structValue */
        78, /* = listValue */
        88, /* = end-of-string-marker */
        // Field numbers:
        1, /* = nullValue */
        2, /* = numberValue */
        3, /* = stringValue */
        4, /* = boolValue */
        5, /* = structValue */
        6, /* = listValue */
        // Property indices:
        0, /* = nullValue */
        2, /* = numberValue */
        4, /* = stringValue */
        6, /* = boolValue */
        8, /* = structValue */
        10, /* = listValue */
        // Field flags:
        uint(QtProtobufPrivate::FieldFlag::Oneof | QtProtobufPrivate::FieldFlag::ExplicitPresence | QtProtobufPrivate::FieldFlag::Enum), /* = nullValue */
        uint(QtProtobufPrivate::FieldFlag::Oneof | QtProtobufPrivate::FieldFlag::ExplicitPresence), /* = numberValue */
        uint(QtProtobufPrivate::FieldFlag::Oneof | QtProtobufPrivate::FieldFlag::ExplicitPresence), /* = stringValue */
        uint(QtProtobufPrivate::FieldFlag::Oneof | QtProtobufPrivate::FieldFlag::ExplicitPresence), /* = boolValue */
        uint(QtProtobufPrivate::FieldFlag::Oneof | QtProtobufPrivate::FieldFlag::ExplicitPresence | QtProtobufPrivate::FieldFlag::Message), /* = structValue */
        uint(QtProtobufPrivate::FieldFlag::Oneof | QtProtobufPrivate::FieldFlag::ExplicitPresence | QtProtobufPrivate::FieldFlag::Message), /* = listValue */
    },
    // char_data
    /* metadata char_data: */
    "google.protobuf.Value\0" /* = full message name */
    /* field char_data: */
    "nullValue\0numberValue\0stringValue\0boolValue\0structValue\0"
    "listValue\0"
};

const QtProtobufPrivate::QProtobufPropertyOrdering Value::staticPropertyOrdering = {
    &qt_protobuf_Value_metadata.data
};

void Value::registerTypes()
{
    qRegisterMetaType<Value>();
    qRegisterMetaType<QList<Value>>();
}

Value::Value()
    : QProtobufMessage(&Value::staticMetaObject, &Value::staticPropertyOrdering),
      dptr(new Value_QtProtobufData)
{
}

Value::Value(const Value &other)
    = default;
Value &Value::operator =(const Value &other)
{
    Value temp(other);
    swap(temp);
    return *this;
}
Value::Value(Value &&other) noexcept
    = default;
Value::operator QVariant() const
{
    return QVariant::fromValue(*this);
}
bool comparesEqual(const Value &lhs, const Value &rhs) noexcept
{
    return operator ==(static_cast<const QProtobufMessage&>(lhs),
                       static_cast<const QProtobufMessage&>(rhs))
        && lhs.dptr->m_kind == rhs.dptr->m_kind;
}

NullValueGadget::NullValue Value::nullValue_p() const
{
    return dptr->m_kind.holdsField(1) ?
        dptr->m_kind.value<NullValueGadget::NullValue>() : NullValueGadget::NullValue(NullValueGadget::NullValue::NULL_VALUE);
}

bool Value::hasNullValue() const
{
    return dptr->m_kind.holdsField(1);
}
NullValueGadget::NullValue Value::nullValue() const
{
    Q_ASSERT(dptr->m_kind.holdsField(1));
    return dptr->m_kind.value<NullValueGadget::NullValue>();
}

double Value::numberValue_p() const
{
    return dptr->m_kind.holdsField(2) ?
        dptr->m_kind.value<double>() : double(0.0);
}

bool Value::hasNumberValue() const
{
    return dptr->m_kind.holdsField(2);
}
double Value::numberValue() const
{
    Q_ASSERT(dptr->m_kind.holdsField(2));
    return dptr->m_kind.value<double>();
}

QString Value::stringValue_p() const
{
    return dptr->m_kind.holdsField(3) ?
        dptr->m_kind.value<QString>() : QString();
}

bool Value::hasStringValue() const
{
    return dptr->m_kind.holdsField(3);
}
QString Value::stringValue() const
{
    Q_ASSERT(dptr->m_kind.holdsField(3));
    return dptr->m_kind.value<QString>();
}

bool Value::boolValue_p() const
{
    return dptr->m_kind.holdsField(4) ?
        dptr->m_kind.value<bool>() : bool(false);
}

bool Value::hasBoolValue() const
{
    return dptr->m_kind.holdsField(4);
}
bool Value::boolValue() const
{
    Q_ASSERT(dptr->m_kind.holdsField(4));
    return dptr->m_kind.value<bool>();
}

Struct *Value::structValue_p()
{
    if (!dptr->m_kind.holdsField(5))
        dptr.detach();
    return dptr->m_kind.message<Struct>();
}

bool Value::hasStructValue() const
{
    return dptr->m_kind.holdsField(5);
}
Struct &Value::structValue() const
{
    Q_ASSERT(dptr->m_kind.holdsField(5));
    return *(dptr->m_kind.message<Struct>());
}

ListValue *Value::listValue_p()
{
    if (!dptr->m_kind.holdsField(6))
        dptr.detach();
    return dptr->m_kind.message<ListValue>();
}

bool Value::hasListValue() const
{
    return dptr->m_kind.holdsField(6);
}
ListValue &Value::listValue() const
{
    Q_ASSERT(dptr->m_kind.holdsField(6));
    return *(dptr->m_kind.message<ListValue>());
}

void Value::setNullValue(NullValueGadget::NullValue nullValue)
{
    if (!dptr->m_kind.isEqual(nullValue, 1)) {
        dptr.detach();
        dptr->m_kind.setValue(nullValue, 1);
    }
}

void Value::setNullValue_p(NullValueGadget::NullValue nullValue)
{
    if (!dptr->m_kind.isEqual(nullValue, 1)) {
        dptr.detach();
        dptr->m_kind.setValue(nullValue, 1);
    }
}

void Value::setNumberValue(double numberValue)
{
    if (!dptr->m_kind.isEqual(numberValue, 2)) {
        dptr.detach();
        dptr->m_kind.setValue(numberValue, 2);
    }
}

void Value::setNumberValue_p(double numberValue)
{
    if (!dptr->m_kind.isEqual(numberValue, 2)) {
        dptr.detach();
        dptr->m_kind.setValue(numberValue, 2);
    }
}

void Value::setStringValue(const QString &stringValue)
{
    if (!dptr->m_kind.isEqual(stringValue, 3)) {
        dptr.detach();
        dptr->m_kind.setValue(stringValue, 3);
    }
}

void Value::setStringValue(QString &&stringValue)
{
    if (!dptr->m_kind.isEqual(stringValue, 3)) {
        dptr.detach();
        dptr->m_kind.setValue(std::move(stringValue), 3);
    }
}

void Value::setStringValue_p(QString stringValue)
{
    if (!dptr->m_kind.isEqual(stringValue, 3)) {
        dptr.detach();
        dptr->m_kind.setValue(stringValue, 3);
    }
}

void Value::setBoolValue(bool boolValue)
{
    if (!dptr->m_kind.isEqual(boolValue, 4)) {
        dptr.detach();
        dptr->m_kind.setValue(boolValue, 4);
    }
}

void Value::setBoolValue_p(bool boolValue)
{
    if (!dptr->m_kind.isEqual(boolValue, 4)) {
        dptr.detach();
        dptr->m_kind.setValue(boolValue, 4);
    }
}

void Value::setStructValue(const Struct &structValue)
{
    if (!dptr->m_kind.isEqual(structValue, 5)) {
        dptr.detach();
        dptr->m_kind.setValue(structValue, 5);
    }
}

void Value::setStructValue(Struct &&structValue)
{
    if (!dptr->m_kind.isEqual(structValue, 5)) {
        dptr.detach();
        dptr->m_kind.setValue(std::move(structValue), 5);
    }
}

void Value::setStructValue_p(Struct *structValue)
{
    const Struct &value = *structValue;
    if (!dptr->m_kind.isEqual(value, 5)) {
        dptr.detach();
        dptr->m_kind.setValue(value, 5);
    }
}

void Value::setListValue(const ListValue &listValue)
{
    if (!dptr->m_kind.isEqual(listValue, 6)) {
        dptr.detach();
        dptr->m_kind.setValue(listValue, 6);
    }
}

void Value::setListValue(ListValue &&listValue)
{
    if (!dptr->m_kind.isEqual(listValue, 6)) {
        dptr.detach();
        dptr->m_kind.setValue(std::move(listValue), 6);
    }
}

void Value::setListValue_p(ListValue *listValue)
{
    const ListValue &value = *listValue;
    if (!dptr->m_kind.isEqual(value, 6)) {
        dptr.detach();
        dptr->m_kind.setValue(value, 6);
    }
}

Value::KindFields Value::kindField() const
{
    return static_cast<KindFields>(dptr->m_kind.fieldNumber());
}
void Value::clearKind()
{
    if (dptr->m_kind.fieldNumber() != QtProtobuf::InvalidFieldNumber) {
        dptr.detach();
        dptr->m_kind = QtProtobufPrivate::QProtobufOneof();
    }
}

class ListValue_QtProtobufData : public QSharedData
{
public:
    ListValue_QtProtobufData()
        : QSharedData()
    {
    }

    ListValue_QtProtobufData(const ListValue_QtProtobufData &other)
        : QSharedData(other),
          m_values(other.m_values)
    {
    }

    QList<Value> m_values;
};

ListValue::~ListValue() = default;

static constexpr struct {
    QtProtobufPrivate::QProtobufPropertyOrdering::Data data;
    const std::array<uint, 5> qt_protobuf_ListValue_uint_data;
    const char qt_protobuf_ListValue_char_data[34];
} qt_protobuf_ListValue_metadata {
    // data
    {
        0, /* = version */
        1, /* = num fields */
        2, /* = field number offset */
        3, /* = property index offset */
        4, /* = field flags offset */
        25, /* = message full name length */
    },
    // uint_data
    {
        // JSON name offsets:
        26, /* = values */
        33, /* = end-of-string-marker */
        // Field numbers:
        1, /* = values */
        // Property indices:
        0, /* = values */
        // Field flags:
        uint(QtProtobufPrivate::FieldFlag::Repeated | QtProtobufPrivate::FieldFlag::Message), /* = values */
    },
    // char_data
    /* metadata char_data: */
    "google.protobuf.ListValue\0" /* = full message name */
    /* field char_data: */
    "values\0"
};

const QtProtobufPrivate::QProtobufPropertyOrdering ListValue::staticPropertyOrdering = {
    &qt_protobuf_ListValue_metadata.data
};

void ListValue::registerTypes()
{
    qRegisterMetaType<ListValue>();
    qRegisterMetaType<QList<ListValue>>();
}

ListValue::ListValue()
    : QProtobufMessage(&ListValue::staticMetaObject, &ListValue::staticPropertyOrdering),
      dptr(new ListValue_QtProtobufData)
{
}

ListValue::ListValue(const ListValue &other)
    = default;
ListValue &ListValue::operator =(const ListValue &other)
{
    ListValue temp(other);
    swap(temp);
    return *this;
}
ListValue::ListValue(ListValue &&other) noexcept
    = default;
ListValue::operator QVariant() const
{
    return QVariant::fromValue(*this);
}
bool comparesEqual(const ListValue &lhs, const ListValue &rhs) noexcept
{
    return operator ==(static_cast<const QProtobufMessage&>(lhs),
                       static_cast<const QProtobufMessage&>(rhs))
        && lhs.dptr->m_values == rhs.dptr->m_values;
}

const QList<Value> &ListValue::values() const &
{
    return dptr->m_values;
}

void ListValue::setValues(const QList<Value> &values)
{
    if (dptr->m_values != values) {
        dptr.detach();
        dptr->m_values = values;
    }
}

void ListValue::setValues(QList<Value> &&values)
{
    if (dptr->m_values != values) {
        dptr.detach();
        dptr->m_values = std::move(values);
    }
}

} // namespace google::protobuf

#include "moc_struct.qpb.cpp"
