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

#include "extranamespace.qpb.h"
#include <QProtobufSerializer>

namespace MyTopLevelNamespace::qtprotobufnamespace::tests {
EmptyMessage::~EmptyMessage() = default;

static constexpr struct {
    QtProtobufPrivate::QProtobufPropertyOrdering::Data data;
    const std::array<uint, 1> qt_protobuf_EmptyMessage_uint_data;
    const char qt_protobuf_EmptyMessage_char_data[40];
} qt_protobuf_EmptyMessage_metadata {
    // data
    {
        0, /* = version */
        0, /* = num fields */
        1, /* = field number offset */
        1, /* = property index offset */
        1, /* = field flags offset */
        38, /* = message full name length */
    },
    // uint_data
    {
        // JSON name offsets:
        39, /* = end-of-string-marker */
        // Field numbers:
        // Property indices:
        // Field flags:
    },
    // char_data
    /* metadata char_data: */
    "qtprotobufnamespace.tests.EmptyMessage\0" /* = full message name */
    /* field char_data: */
    ""
};

const QtProtobufPrivate::QProtobufPropertyOrdering EmptyMessage::propertyOrdering = {
    &qt_protobuf_EmptyMessage_metadata.data
};

void EmptyMessage::registerTypes()
{
    qRegisterMetaType<EmptyMessage>();
    qRegisterMetaType<EmptyMessageRepeated>();
}
EmptyMessage::EmptyMessage() : QProtobufMessage(&EmptyMessage::staticMetaObject)
{
}
EmptyMessage::EmptyMessage(const EmptyMessage &other) : QProtobufMessage(other)
{
}
EmptyMessage &EmptyMessage::operator =(const EmptyMessage &other)
{
    QProtobufMessage::operator=(other);
    return *this;
}
EmptyMessage::EmptyMessage(EmptyMessage &&other) noexcept : QProtobufMessage(std::move(other))
{
}
EmptyMessage &EmptyMessage::operator =(EmptyMessage &&other) noexcept
{
    QProtobufMessage::operator=(std::move(other));
    return *this;
}
bool EmptyMessage::operator ==(const EmptyMessage &other) const
{
    return QProtobufMessage::isEqual(*this, other);
}
bool EmptyMessage::operator !=(const EmptyMessage &other) const
{
    return !this->operator ==(other);
}

SimpleStringMessage::~SimpleStringMessage() = default;

static constexpr struct {
    QtProtobufPrivate::QProtobufPropertyOrdering::Data data;
    const std::array<uint, 5> qt_protobuf_SimpleStringMessage_uint_data;
    const char qt_protobuf_SimpleStringMessage_char_data[63];
} qt_protobuf_SimpleStringMessage_metadata {
    // data
    {
        0, /* = version */
        1, /* = num fields */
        2, /* = field number offset */
        3, /* = property index offset */
        4, /* = field flags offset */
        45, /* = message full name length */
    },
    // uint_data
    {
        // JSON name offsets:
        46, /* = testFieldString */
        62, /* = end-of-string-marker */
        // Field numbers:
        6, /* = testFieldString */
        // Property indices:
        0, /* = testFieldString */
        // Field flags:
        QtProtobufPrivate::NoFlags, /* = testFieldString */
    },
    // char_data
    /* metadata char_data: */
    "qtprotobufnamespace.tests.SimpleStringMessage\0" /* = full message name */
    /* field char_data: */
    "testFieldString\0"
};

const QtProtobufPrivate::QProtobufPropertyOrdering SimpleStringMessage::propertyOrdering = {
    &qt_protobuf_SimpleStringMessage_metadata.data
};

void SimpleStringMessage::registerTypes()
{
    qRegisterMetaType<SimpleStringMessage>();
    qRegisterMetaType<SimpleStringMessageRepeated>();
}
SimpleStringMessage::SimpleStringMessage() : QProtobufMessage(&SimpleStringMessage::staticMetaObject)
{
}
SimpleStringMessage::SimpleStringMessage(const SimpleStringMessage &other) : QProtobufMessage(other),
    m_testFieldString(other.m_testFieldString)
{
}
SimpleStringMessage &SimpleStringMessage::operator =(const SimpleStringMessage &other)
{
    QProtobufMessage::operator=(other);
    setTestFieldString(other.m_testFieldString);
    return *this;
}
SimpleStringMessage::SimpleStringMessage(SimpleStringMessage &&other) noexcept : QProtobufMessage(std::move(other))
{
    m_testFieldString = std::move(other.m_testFieldString);
}
SimpleStringMessage &SimpleStringMessage::operator =(SimpleStringMessage &&other) noexcept
{
    QProtobufMessage::operator=(std::move(other));
    if (m_testFieldString != other.m_testFieldString)
        m_testFieldString = std::move(other.m_testFieldString);
    return *this;
}
bool SimpleStringMessage::operator ==(const SimpleStringMessage &other) const
{
    return QProtobufMessage::isEqual(*this, other)
        && m_testFieldString == other.m_testFieldString;
}
bool SimpleStringMessage::operator !=(const SimpleStringMessage &other) const
{
    return !this->operator ==(other);
}

void SimpleStringMessage::setTestFieldString(const QString &testFieldString)
{
    if (m_testFieldString != testFieldString)
        m_testFieldString = testFieldString;
}

ComplexMessage::~ComplexMessage() = default;

static constexpr struct {
    QtProtobufPrivate::QProtobufPropertyOrdering::Data data;
    const std::array<uint, 9> qt_protobuf_ComplexMessage_uint_data;
    const char qt_protobuf_ComplexMessage_char_data[72];
} qt_protobuf_ComplexMessage_metadata {
    // data
    {
        0, /* = version */
        2, /* = num fields */
        3, /* = field number offset */
        5, /* = property index offset */
        7, /* = field flags offset */
        40, /* = message full name length */
    },
    // uint_data
    {
        // JSON name offsets:
        41, /* = testFieldInt */
        54, /* = testComplexField */
        71, /* = end-of-string-marker */
        // Field numbers:
        1, /* = testFieldInt */
        2, /* = testComplexField */
        // Property indices:
        0, /* = testFieldInt */
        1, /* = testComplexField */
        // Field flags:
        QtProtobufPrivate::NoFlags, /* = testFieldInt */
        QtProtobufPrivate::NoFlags, /* = testComplexField */
    },
    // char_data
    /* metadata char_data: */
    "qtprotobufnamespace.tests.ComplexMessage\0" /* = full message name */
    /* field char_data: */
    "testFieldInt\0testComplexField\0"
};

const QtProtobufPrivate::QProtobufPropertyOrdering ComplexMessage::propertyOrdering = {
    &qt_protobuf_ComplexMessage_metadata.data
};

void ComplexMessage::registerTypes()
{
    qRegisterMetaType<ComplexMessage>();
    qRegisterMetaType<ComplexMessageRepeated>();
}
ComplexMessage::ComplexMessage() : QProtobufMessage(&ComplexMessage::staticMetaObject),
    m_testFieldInt(0),
    m_testComplexField(nullptr)
{
}
ComplexMessage::ComplexMessage(const ComplexMessage &other) : QProtobufMessage(other),
    m_testFieldInt(other.m_testFieldInt),
    m_testComplexField(nullptr)
{
    if (m_testComplexField != other.m_testComplexField) {
        *m_testComplexField = *other.m_testComplexField;
    }
}
ComplexMessage &ComplexMessage::operator =(const ComplexMessage &other)
{
    QProtobufMessage::operator=(other);
    setTestFieldInt(other.m_testFieldInt);
    if (m_testComplexField != other.m_testComplexField)
        *m_testComplexField = *other.m_testComplexField;
    return *this;
}
ComplexMessage::ComplexMessage(ComplexMessage &&other) noexcept : QProtobufMessage(std::move(other)),
m_testComplexField(nullptr)
{
    setTestFieldInt(std::exchange(other.m_testFieldInt, 0));
    if (m_testComplexField != other.m_testComplexField) {
        *m_testComplexField = std::move(*other.m_testComplexField);
    }
}
ComplexMessage &ComplexMessage::operator =(ComplexMessage &&other) noexcept
{
    QProtobufMessage::operator=(std::move(other));
    setTestFieldInt(std::exchange(other.m_testFieldInt, 0));
    if (m_testComplexField != other.m_testComplexField)
        *m_testComplexField = std::move(*other.m_testComplexField);
    return *this;
}
bool ComplexMessage::operator ==(const ComplexMessage &other) const
{
    return QProtobufMessage::isEqual(*this, other)
        && m_testFieldInt == other.m_testFieldInt
        && (m_testComplexField == other.m_testComplexField
            || *m_testComplexField == *other.m_testComplexField)
;
}
bool ComplexMessage::operator !=(const ComplexMessage &other) const
{
    return !this->operator ==(other);
}

SimpleStringMessage *ComplexMessage::testComplexField_p() const
{
    return m_testComplexField ? m_testComplexField.get() : nullptr;
}

SimpleStringMessage &ComplexMessage::testComplexField() const
{
    return *m_testComplexField;
}

void ComplexMessage::setTestComplexField_p(SimpleStringMessage *testComplexField)
{
    if (m_testComplexField.get() != testComplexField)
        m_testComplexField.reset(testComplexField);
}

void ComplexMessage::setTestComplexField(const SimpleStringMessage &testComplexField)
{
    if (*m_testComplexField != testComplexField)
        *m_testComplexField = testComplexField;
}

} // namespace MyTopLevelNamespace::qtprotobufnamespace::tests

#include "moc_extranamespace.qpb.cpp"
