diff --git a/src/tools/qtgrpcgen/Qt6GrpcToolsMacros.cmake b/src/tools/qtgrpcgen/Qt6GrpcToolsMacros.cmake index 23983af4..d5ce0170 100644 --- a/src/tools/qtgrpcgen/Qt6GrpcToolsMacros.cmake +++ b/src/tools/qtgrpcgen/Qt6GrpcToolsMacros.cmake @@ -148,15 +148,15 @@ function(qt6_add_grpc target type) message(FATAL_ERROR "Unsupported target type '${target_type}'.") endif() - if(is_static OR is_shared) - # Add EXPORT_MACRO if the target is, or we will create, a shared library - string(TOUPPER "${target}" target_upper) - if (is_shared) - list(APPEND generation_options "EXPORT_MACRO=${target_upper}") + if(is_shared) + set(generated_export "") + set(generated_export_options "") + _qt_internal_protoc_generate_cpp_exports(generated_export generated_export_options + ${target} "${arg_EXPORT_MACRO}") + if(generated_export) + list(APPEND cpp_sources "${generated_export}") # TODO: Unused, see QTBUG-121856 endif() - # Define this so we can conditionally set the export macro - target_compile_definitions(${target} - PRIVATE "QT_BUILD_${target_upper}_LIB") + list(APPEND generation_options "${generated_export_options}") endif() set(output_directory "${CMAKE_CURRENT_BINARY_DIR}") diff --git a/src/tools/qtprotobufgen/Qt6ProtobufToolsMacros.cmake b/src/tools/qtprotobufgen/Qt6ProtobufToolsMacros.cmake index 536a3225..5964192b 100644 --- a/src/tools/qtprotobufgen/Qt6ProtobufToolsMacros.cmake +++ b/src/tools/qtprotobufgen/Qt6ProtobufToolsMacros.cmake @@ -12,7 +12,6 @@ macro(_qt_internal_get_protoc_common_options option_args single_args multi_args) ) set(${single_args} EXTRA_NAMESPACE - EXPORT_MACRO QML_URI ) @@ -27,6 +26,7 @@ macro(_qt_internal_get_protoc_generate_arguments option_args single_args multi_a PROTO_FILES_BASE_DIR OUTPUT_HEADERS OUTPUT_TARGETS + EXPORT_MACRO ) set(${multi_args} PROTO_FILES @@ -241,6 +241,60 @@ function(_qt_internal_protobuf_package_qml_uri out_uri) set(${out_uri} ${qml_uri} PARENT_SCOPE) endfunction() +function(_qt_internal_protoc_generate_cpp_exports out_generated_file out_generation_options target + export_macro) + + # Add EXPORT_MACRO if the target is a shared library + string(TOUPPER "${target}" target_upper) + string(TOLOWER "${target}" target_lower) + get_target_property(export_macro_previous ${target} _qt_internal_protobuf_export_macro) + + # This is not the first time we enter this function for the target. + if(export_macro_previous) + if(export_macro AND NOT "${export_macro}" STREQUAL "${export_macro_previous}") + message(FATAL_ERROR "EXPORT_MACRO argument doesn't match the one that already" + "used for ${target}.\n" + "Previous: ${export_macro_previous}\n" + "New: ${export_macro}" + ) + endif() + set(export_macro "${export_macro_previous}") + set(skip_generating TRUE) + else() + set(skip_generating FALSE) + endif() + + if(NOT export_macro) + set(export_macro "${target_upper}") + endif() + + # Export filename is always based on target name. + set(export_macro_filename "${target_lower}_exports.qpb.h") + + if(skip_generating) + # Tell the generator that we have export macro but we don't want to generate exports, + # since they were generated in previous qt_add_ call. + set(${out_generation_options} + "EXPORT_MACRO=${export_macro}:${export_macro_filename}:false") + + # Avoid scheduling the file generating twice + set(export_macro_filename "") + else() + set(${out_generation_options} + "EXPORT_MACRO=${export_macro}:${export_macro_filename}:true") + + set_target_properties(${target} PROPERTIES + _qt_internal_protobuf_export_macro "${export_macro}") + + # Define this so we can conditionally set the export macro behavior + target_compile_definitions(${target} + PRIVATE "QT_BUILD_${export_macro}_LIB") + endif() + + set(${out_generated_file} "${export_macro_filename}" PARENT_SCOPE) + set(${out_generation_options} "${${out_generation_options}}" PARENT_SCOPE) +endfunction() + # TODO Qt6: # - Collect PROTO_INCLUDES from the LINK_LIBRARIES property of TARGET # - Collect proto files from the source files of the ${TARGET} @@ -422,32 +476,15 @@ function(qt6_add_protobuf target) message(FATAL_ERROR "Unsupported target type '${target_type}'.") endif() - if(is_static OR is_shared) - # Add EXPORT_MACRO if the target is, or we will create, a shared library - string(TOUPPER "${target}" target_upper) - string(TOLOWER "${target}" target_lower) - if (is_shared) - list(APPEND generation_options "EXPORT_MACRO=${target_upper}") - get_target_property(export_name ${target} _qt_internal_protobuf_export_file) - if(NOT export_name) - set(export_name "${output_directory}/${target_lower}_exports.qpb.h") - get_property(existing_exports GLOBAL PROPERTY - _qt_internal_existing_protobuf_exports) - if("${export_name}" IN_LIST existing_exports) - message(FATAL_ERROR "The export file ${export_name} is generated by multiple - targets, which is prohibited, please make sure that you have unique target - names.") - endif() - set_property(GLOBAL APPEND PROPERTY _qt_internal_existing_protobuf_exports - "${export_name}") - set_target_properties(${target} PROPERTIES _qt_internal_protobuf_export_file - "${export_name}") - list(APPEND cpp_sources ${export_name}) - endif() + if(is_shared) + set(generated_export "") + set(generated_export_options "") + _qt_internal_protoc_generate_cpp_exports(generated_export generated_export_options + ${target} "${arg_EXPORT_MACRO}") + if(generated_export) + list(APPEND cpp_sources "${output_directory}/${generated_export}") endif() - # Define this so we can conditionally set the export macro - target_compile_definitions(${target} - PRIVATE "QT_BUILD_${target_upper}_LIB") + list(APPEND generation_options "${generated_export_options}") endif() _qt_internal_protoc_generate(${target} qtprotobufgen "${output_directory}" diff --git a/src/tools/qtprotobufgen/qprotobufgenerator.cpp b/src/tools/qtprotobufgen/qprotobufgenerator.cpp index e8395968..fbdbe253 100644 --- a/src/tools/qtprotobufgen/qprotobufgenerator.cpp +++ b/src/tools/qtprotobufgen/qprotobufgenerator.cpp @@ -30,8 +30,6 @@ using namespace ::google::protobuf; using namespace ::google::protobuf::io; using namespace ::google::protobuf::compiler; -static std::string ExportStr("_exports.qpb"); - QProtobufGenerator::QProtobufGenerator() : GeneratorBase() {} @@ -128,11 +126,15 @@ bool QProtobufGenerator::GenerateAll(const std::vector & assert(generatorContext != nullptr); Options::setFromString(parameter); - if (!Options::instance().exportMacro().empty()) { + if (Options::instance().generateMacroExportFile()) { std::string exportMacroName = Options::instance().exportMacro(); - utils::asciiToLower(exportMacroName); - std::unique_ptr headerStream( - generatorContext->Open(exportMacroName + ExportStr + ".h")); + std::string exportMacroFilename = Options::instance().exportMacroFilename(); + + assert(!exportMacroName.empty()); + assert(!exportMacroFilename.empty()); + + std::unique_ptr headerStream(generatorContext + ->Open(exportMacroFilename)); std::shared_ptr headerPrinter(new Printer(headerStream.get(), '$')); printDisclaimer(headerPrinter.get()); headerPrinter->Print({ { "export_macro", Options::instance().exportMacro() } }, @@ -165,10 +167,9 @@ void QProtobufGenerator::GenerateHeader(const FileDescriptor *file, fileNameToUpper.begin(), utils::toAsciiUpper); headerPrinter->Print({{"filename", fileNameToUpper}}, CommonTemplates::PreambleTemplate()); - if (!Options::instance().exportMacro().empty()) { - std::string exportMacroName = Options::instance().exportMacro(); - utils::asciiToLower(exportMacroName); - internalIncludes.insert(exportMacroName + ExportStr); + if (!Options::instance().exportMacroFilename().empty()) { + std::string exportMacroFilename = Options::instance().exportMacroFilename(); + internalIncludes.insert(utils::removeFileSuffix(exportMacroFilename)); } headerPrinter->Print(CommonTemplates::DefaultProtobufIncludesTemplate()); diff --git a/src/tools/qtprotoccommon/options.cpp b/src/tools/qtprotoccommon/options.cpp index efe44d02..e3c433ca 100644 --- a/src/tools/qtprotoccommon/options.cpp +++ b/src/tools/qtprotoccommon/options.cpp @@ -15,8 +15,10 @@ static const char FieldEnumGenerationOption[] = "FIELD_ENUM"; static const char ExtraNamespaceGenerationOption[] = "EXTRA_NAMESPACE"; static const char ExportMacroGenerationOption[] = "EXPORT_MACRO"; +static const char ExportSuffix[] = "_exports.qpb.h"; + Options::Options() - : m_generateComments(false), m_isFolder(false), m_generateFieldEnum(true), m_qml(false) + : m_generateComments(false), m_isFolder(false), m_generateFieldEnum(true), m_generateMacroExportFile(false), m_qml(false) { } @@ -65,8 +67,28 @@ void Options::setFromString(const std::string &options, GeneratorType type) instance.m_extraNamespace = extractCompositeOptionValue(option); QT_PROTOBUF_DEBUG("set m_extraNamespace: " << instance.m_extraNamespace); } else if (option.find(ExportMacroGenerationOption) == 0) { - instance.m_exportMacro = extractCompositeOptionValue(option); - QT_PROTOBUF_DEBUG("set m_exportMacro: " << instance.m_exportMacro); + auto export_macro_values = utils::split(extractCompositeOptionValue(option), ":"); + if (!export_macro_values.empty()) { + instance.m_exportMacro = export_macro_values[0]; + QT_PROTOBUF_DEBUG("set m_exportMacro: " << instance.m_exportMacro); + if (export_macro_values.size() > 1) { + instance.m_exportMacroFilename = export_macro_values[1]; + QT_PROTOBUF_DEBUG("set m_exportMacroFilename: " + << instance.m_exportMacroFilename); + if (export_macro_values.size() > 2) { + instance.m_generateMacroExportFile = export_macro_values[2] == "true"; + QT_PROTOBUF_DEBUG("set m_generateMacroExportFile: " + << instance.m_generateMacroExportFile); + } + } + if (instance.m_exportMacroFilename.empty()) { + std::string exportMacroLower = instance.m_exportMacro; + utils::asciiToLower(exportMacroLower); + instance.m_exportMacroFilename = exportMacroLower + ExportSuffix; + QT_PROTOBUF_DEBUG("set m_exportMacroFilename: " + << instance.m_exportMacroFilename); + } + } } else if (option.find(QmlPluginUriOption) == 0 && type != QtGrpcGen) { instance.m_qmlUri = extractCompositeOptionValue(option); QT_PROTOBUF_DEBUG("set m_qmlUri: " << instance.m_qmlUri); diff --git a/src/tools/qtprotoccommon/options.h b/src/tools/qtprotoccommon/options.h index 51fa07b1..9d0b4a89 100644 --- a/src/tools/qtprotoccommon/options.h +++ b/src/tools/qtprotoccommon/options.h @@ -39,6 +39,8 @@ public: bool generateFieldEnum() const { return m_generateFieldEnum; } const std::string &extraNamespace() const { return m_extraNamespace; } const std::string &exportMacro() const { return m_exportMacro; } + const std::string &exportMacroFilename() const { return m_exportMacroFilename; } + bool generateMacroExportFile() const { return m_generateMacroExportFile; } const std::string &qmlUri() const { return m_qmlUri; } private: @@ -47,6 +49,8 @@ private: bool m_generateFieldEnum; std::string m_extraNamespace; std::string m_exportMacro; + std::string m_exportMacroFilename; + bool m_generateMacroExportFile; std::string m_qmlUri; bool m_qml; }; diff --git a/tests/auto/grpcquick/client/CMakeLists.txt b/tests/auto/grpcquick/client/CMakeLists.txt index bd1a5ce2..10d7418e 100644 --- a/tests/auto/grpcquick/client/CMakeLists.txt +++ b/tests/auto/grpcquick/client/CMakeLists.txt @@ -25,14 +25,6 @@ qt_internal_add_test(tst_grpc_client_unarycall_qml Qt::Grpc ) -qt_add_grpc(tst_grpc_client_unarycall_qml_gen CLIENT - PROTO_FILES - ../../shared/data/proto/testservice.proto - QML - OUTPUT_DIRECTORY - "${CMAKE_CURRENT_BINARY_DIR}/qt_grpc_generated_qml" -) - qt_add_protobuf(tst_grpc_client_unarycall_qml_gen PROTO_FILES ../../shared/data/proto/testservice.proto @@ -42,6 +34,14 @@ qt_add_protobuf(tst_grpc_client_unarycall_qml_gen "${CMAKE_CURRENT_BINARY_DIR}/qt_grpc_generated_qml" ) +qt_add_grpc(tst_grpc_client_unarycall_qml_gen CLIENT + PROTO_FILES + ../../shared/data/proto/testservice.proto + QML + OUTPUT_DIRECTORY + "${CMAKE_CURRENT_BINARY_DIR}/qt_grpc_generated_qml" +) + qt_policy(SET QTP0001 NEW) qt_add_qml_module(tst_grpc_client_unarycall_qml diff --git a/tests/auto/protobufgen/CMakeLists.txt b/tests/auto/protobufgen/CMakeLists.txt index 57cea7de..1fe629df 100644 --- a/tests/auto/protobufgen/CMakeLists.txt +++ b/tests/auto/protobufgen/CMakeLists.txt @@ -38,6 +38,7 @@ qt_add_protobuf(tst_qtprotobufgen OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/qt_protobuf_generated/extra-namespace" ) +add_library(tst_qtprotobufgen_gen SHARED) qt_add_protobuf(tst_qtprotobufgen_gen PROTO_FILES ../shared/data/proto/basicmessages.proto @@ -50,6 +51,24 @@ qt_add_protobuf(tst_qtprotobufgen_gen ) qt_autogen_tools_initial_setup(tst_qtprotobufgen_gen) +add_library(tst_qtprotobufgen_custom_exports_gen SHARED) +qt_add_protobuf(tst_qtprotobufgen_custom_exports_gen + PROTO_FILES + ../shared/data/proto/basicmessages.proto + EXPORT_MACRO "CUSTOM_EXPORT_NAME" + OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/qt_protobuf_generated/custom-exports" +) +qt_autogen_tools_initial_setup(tst_qtprotobufgen_custom_exports_gen) + +add_library(tst_qtprotobufgen_no_exports_gen STATIC) +qt_add_protobuf(tst_qtprotobufgen_no_exports_gen + PROTO_FILES + ../shared/data/proto/basicmessages.proto + EXPORT_MACRO "CUSTOM_EXPORT_NAME" + OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/qt_protobuf_generated/no-exports" +) +qt_autogen_tools_initial_setup(tst_qtprotobufgen_no_exports_gen) + qt_add_protobuf(tst_qtprotobufgen PROTO_FILES ../shared/data/proto/repeatednonpackedmessages.proto diff --git a/tests/auto/protobufgen/data/expected_result/custom-exports/basicmessages.qpb.cpp b/tests/auto/protobufgen/data/expected_result/custom-exports/basicmessages.qpb.cpp new file mode 100644 index 00000000..5ccebf15 --- /dev/null +++ b/tests/auto/protobufgen/data/expected_result/custom-exports/basicmessages.qpb.cpp @@ -0,0 +1,2009 @@ +/* This file is autogenerated. DO NOT CHANGE. All changes will be lost */ + +#include "basicmessages.qpb.h" +#include +#include + +namespace qtprotobufnamespace::tests { + +class EmptyMessage_QtProtobufData : public QSharedData +{ +public: + EmptyMessage_QtProtobufData() + : QSharedData() + { + } + + EmptyMessage_QtProtobufData(const EmptyMessage_QtProtobufData &other) + : QSharedData(other) + { + } + +}; + +EmptyMessage::~EmptyMessage() = default; + +static constexpr struct { + QtProtobufPrivate::QProtobufPropertyOrdering::Data data; + const std::array 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::staticPropertyOrdering = { + &qt_protobuf_EmptyMessage_metadata.data +}; + +void EmptyMessage::registerTypes() +{ + qRegisterMetaType(); + qRegisterMetaType(); +} + +EmptyMessage::EmptyMessage() + : QProtobufMessage(&EmptyMessage::staticMetaObject, &EmptyMessage::staticPropertyOrdering), + dptr(new EmptyMessage_QtProtobufData) +{ +} + +EmptyMessage::EmptyMessage(const EmptyMessage &other) + : QProtobufMessage(other), + dptr(other.dptr) +{ +} +EmptyMessage &EmptyMessage::operator =(const EmptyMessage &other) +{ + QProtobufMessage::operator=(other); + dptr = other.dptr; + return *this; +} +EmptyMessage::EmptyMessage(EmptyMessage &&other) noexcept + : QProtobufMessage(std::move(other)), + dptr(std::move(other.dptr)) +{ +} +EmptyMessage &EmptyMessage::operator =(EmptyMessage &&other) noexcept +{ + QProtobufMessage::operator=(std::move(other)); + dptr.swap(other.dptr); + 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); +} + + +class SimpleBoolMessage_QtProtobufData : public QSharedData +{ +public: + SimpleBoolMessage_QtProtobufData() + : QSharedData(), + m_testFieldBool(false) + { + } + + SimpleBoolMessage_QtProtobufData(const SimpleBoolMessage_QtProtobufData &other) + : QSharedData(other), + m_testFieldBool(other.m_testFieldBool) + { + } + + bool m_testFieldBool; +}; + +SimpleBoolMessage::~SimpleBoolMessage() = default; + +static constexpr struct { + QtProtobufPrivate::QProtobufPropertyOrdering::Data data; + const std::array qt_protobuf_SimpleBoolMessage_uint_data; + const char qt_protobuf_SimpleBoolMessage_char_data[59]; +} qt_protobuf_SimpleBoolMessage_metadata { + // data + { + 0, /* = version */ + 1, /* = num fields */ + 2, /* = field number offset */ + 3, /* = property index offset */ + 4, /* = field flags offset */ + 43, /* = message full name length */ + }, + // uint_data + { + // JSON name offsets: + 44, /* = testFieldBool */ + 58, /* = end-of-string-marker */ + // Field numbers: + 1, /* = testFieldBool */ + // Property indices: + 0, /* = testFieldBool */ + // Field flags: + QtProtobufPrivate::NoFlags, /* = testFieldBool */ + }, + // char_data + /* metadata char_data: */ + "qtprotobufnamespace.tests.SimpleBoolMessage\0" /* = full message name */ + /* field char_data: */ + "testFieldBool\0" +}; + +const QtProtobufPrivate::QProtobufPropertyOrdering SimpleBoolMessage::staticPropertyOrdering = { + &qt_protobuf_SimpleBoolMessage_metadata.data +}; + +void SimpleBoolMessage::registerTypes() +{ + qRegisterMetaType(); + qRegisterMetaType(); +} + +SimpleBoolMessage::SimpleBoolMessage() + : QProtobufMessage(&SimpleBoolMessage::staticMetaObject, &SimpleBoolMessage::staticPropertyOrdering), + dptr(new SimpleBoolMessage_QtProtobufData) +{ +} + +SimpleBoolMessage::SimpleBoolMessage(const SimpleBoolMessage &other) + : QProtobufMessage(other), + dptr(other.dptr) +{ +} +SimpleBoolMessage &SimpleBoolMessage::operator =(const SimpleBoolMessage &other) +{ + QProtobufMessage::operator=(other); + dptr = other.dptr; + return *this; +} +SimpleBoolMessage::SimpleBoolMessage(SimpleBoolMessage &&other) noexcept + : QProtobufMessage(std::move(other)), + dptr(std::move(other.dptr)) +{ +} +SimpleBoolMessage &SimpleBoolMessage::operator =(SimpleBoolMessage &&other) noexcept +{ + QProtobufMessage::operator=(std::move(other)); + dptr.swap(other.dptr); + return *this; +} +bool SimpleBoolMessage::operator ==(const SimpleBoolMessage &other) const +{ + return QProtobufMessage::isEqual(*this, other) + && dptr->m_testFieldBool == other.dptr->m_testFieldBool; +} + +bool SimpleBoolMessage::operator !=(const SimpleBoolMessage &other) const +{ + return !this->operator ==(other); +} + +bool SimpleBoolMessage::testFieldBool() const +{ + return dptr->m_testFieldBool; +} + +void SimpleBoolMessage::setTestFieldBool(const bool &testFieldBool) +{ + if (dptr->m_testFieldBool != testFieldBool) { + dptr.detach(); + dptr->m_testFieldBool = testFieldBool; + } +} + + +class SimpleIntMessage_QtProtobufData : public QSharedData +{ +public: + SimpleIntMessage_QtProtobufData() + : QSharedData(), + m_testFieldInt(0) + { + } + + SimpleIntMessage_QtProtobufData(const SimpleIntMessage_QtProtobufData &other) + : QSharedData(other), + m_testFieldInt(other.m_testFieldInt) + { + } + + QtProtobuf::int32 m_testFieldInt; +}; + +SimpleIntMessage::~SimpleIntMessage() = default; + +static constexpr struct { + QtProtobufPrivate::QProtobufPropertyOrdering::Data data; + const std::array qt_protobuf_SimpleIntMessage_uint_data; + const char qt_protobuf_SimpleIntMessage_char_data[57]; +} qt_protobuf_SimpleIntMessage_metadata { + // data + { + 0, /* = version */ + 1, /* = num fields */ + 2, /* = field number offset */ + 3, /* = property index offset */ + 4, /* = field flags offset */ + 42, /* = message full name length */ + }, + // uint_data + { + // JSON name offsets: + 43, /* = testFieldInt */ + 56, /* = end-of-string-marker */ + // Field numbers: + 1, /* = testFieldInt */ + // Property indices: + 0, /* = testFieldInt */ + // Field flags: + QtProtobufPrivate::NoFlags, /* = testFieldInt */ + }, + // char_data + /* metadata char_data: */ + "qtprotobufnamespace.tests.SimpleIntMessage\0" /* = full message name */ + /* field char_data: */ + "testFieldInt\0" +}; + +const QtProtobufPrivate::QProtobufPropertyOrdering SimpleIntMessage::staticPropertyOrdering = { + &qt_protobuf_SimpleIntMessage_metadata.data +}; + +void SimpleIntMessage::registerTypes() +{ + qRegisterMetaType(); + qRegisterMetaType(); +} + +SimpleIntMessage::SimpleIntMessage() + : QProtobufMessage(&SimpleIntMessage::staticMetaObject, &SimpleIntMessage::staticPropertyOrdering), + dptr(new SimpleIntMessage_QtProtobufData) +{ +} + +SimpleIntMessage::SimpleIntMessage(const SimpleIntMessage &other) + : QProtobufMessage(other), + dptr(other.dptr) +{ +} +SimpleIntMessage &SimpleIntMessage::operator =(const SimpleIntMessage &other) +{ + QProtobufMessage::operator=(other); + dptr = other.dptr; + return *this; +} +SimpleIntMessage::SimpleIntMessage(SimpleIntMessage &&other) noexcept + : QProtobufMessage(std::move(other)), + dptr(std::move(other.dptr)) +{ +} +SimpleIntMessage &SimpleIntMessage::operator =(SimpleIntMessage &&other) noexcept +{ + QProtobufMessage::operator=(std::move(other)); + dptr.swap(other.dptr); + return *this; +} +bool SimpleIntMessage::operator ==(const SimpleIntMessage &other) const +{ + return QProtobufMessage::isEqual(*this, other) + && dptr->m_testFieldInt == other.dptr->m_testFieldInt; +} + +bool SimpleIntMessage::operator !=(const SimpleIntMessage &other) const +{ + return !this->operator ==(other); +} + +QtProtobuf::int32 SimpleIntMessage::testFieldInt() const +{ + return dptr->m_testFieldInt; +} + +void SimpleIntMessage::setTestFieldInt(const QtProtobuf::int32 &testFieldInt) +{ + if (dptr->m_testFieldInt != testFieldInt) { + dptr.detach(); + dptr->m_testFieldInt = testFieldInt; + } +} + + +class SimpleSIntMessage_QtProtobufData : public QSharedData +{ +public: + SimpleSIntMessage_QtProtobufData() + : QSharedData(), + m_testFieldInt(0) + { + } + + SimpleSIntMessage_QtProtobufData(const SimpleSIntMessage_QtProtobufData &other) + : QSharedData(other), + m_testFieldInt(other.m_testFieldInt) + { + } + + QtProtobuf::sint32 m_testFieldInt; +}; + +SimpleSIntMessage::~SimpleSIntMessage() = default; + +static constexpr struct { + QtProtobufPrivate::QProtobufPropertyOrdering::Data data; + const std::array qt_protobuf_SimpleSIntMessage_uint_data; + const char qt_protobuf_SimpleSIntMessage_char_data[58]; +} qt_protobuf_SimpleSIntMessage_metadata { + // data + { + 0, /* = version */ + 1, /* = num fields */ + 2, /* = field number offset */ + 3, /* = property index offset */ + 4, /* = field flags offset */ + 43, /* = message full name length */ + }, + // uint_data + { + // JSON name offsets: + 44, /* = testFieldInt */ + 57, /* = end-of-string-marker */ + // Field numbers: + 1, /* = testFieldInt */ + // Property indices: + 0, /* = testFieldInt */ + // Field flags: + QtProtobufPrivate::NoFlags, /* = testFieldInt */ + }, + // char_data + /* metadata char_data: */ + "qtprotobufnamespace.tests.SimpleSIntMessage\0" /* = full message name */ + /* field char_data: */ + "testFieldInt\0" +}; + +const QtProtobufPrivate::QProtobufPropertyOrdering SimpleSIntMessage::staticPropertyOrdering = { + &qt_protobuf_SimpleSIntMessage_metadata.data +}; + +void SimpleSIntMessage::registerTypes() +{ + qRegisterMetaType(); + qRegisterMetaType(); +} + +SimpleSIntMessage::SimpleSIntMessage() + : QProtobufMessage(&SimpleSIntMessage::staticMetaObject, &SimpleSIntMessage::staticPropertyOrdering), + dptr(new SimpleSIntMessage_QtProtobufData) +{ +} + +SimpleSIntMessage::SimpleSIntMessage(const SimpleSIntMessage &other) + : QProtobufMessage(other), + dptr(other.dptr) +{ +} +SimpleSIntMessage &SimpleSIntMessage::operator =(const SimpleSIntMessage &other) +{ + QProtobufMessage::operator=(other); + dptr = other.dptr; + return *this; +} +SimpleSIntMessage::SimpleSIntMessage(SimpleSIntMessage &&other) noexcept + : QProtobufMessage(std::move(other)), + dptr(std::move(other.dptr)) +{ +} +SimpleSIntMessage &SimpleSIntMessage::operator =(SimpleSIntMessage &&other) noexcept +{ + QProtobufMessage::operator=(std::move(other)); + dptr.swap(other.dptr); + return *this; +} +bool SimpleSIntMessage::operator ==(const SimpleSIntMessage &other) const +{ + return QProtobufMessage::isEqual(*this, other) + && dptr->m_testFieldInt == other.dptr->m_testFieldInt; +} + +bool SimpleSIntMessage::operator !=(const SimpleSIntMessage &other) const +{ + return !this->operator ==(other); +} + +QtProtobuf::sint32 SimpleSIntMessage::testFieldInt() const +{ + return dptr->m_testFieldInt; +} + +void SimpleSIntMessage::setTestFieldInt(const QtProtobuf::sint32 &testFieldInt) +{ + if (dptr->m_testFieldInt != testFieldInt) { + dptr.detach(); + dptr->m_testFieldInt = testFieldInt; + } +} + + +class SimpleUIntMessage_QtProtobufData : public QSharedData +{ +public: + SimpleUIntMessage_QtProtobufData() + : QSharedData(), + m_testFieldInt(0) + { + } + + SimpleUIntMessage_QtProtobufData(const SimpleUIntMessage_QtProtobufData &other) + : QSharedData(other), + m_testFieldInt(other.m_testFieldInt) + { + } + + QtProtobuf::uint32 m_testFieldInt; +}; + +SimpleUIntMessage::~SimpleUIntMessage() = default; + +static constexpr struct { + QtProtobufPrivate::QProtobufPropertyOrdering::Data data; + const std::array qt_protobuf_SimpleUIntMessage_uint_data; + const char qt_protobuf_SimpleUIntMessage_char_data[58]; +} qt_protobuf_SimpleUIntMessage_metadata { + // data + { + 0, /* = version */ + 1, /* = num fields */ + 2, /* = field number offset */ + 3, /* = property index offset */ + 4, /* = field flags offset */ + 43, /* = message full name length */ + }, + // uint_data + { + // JSON name offsets: + 44, /* = testFieldInt */ + 57, /* = end-of-string-marker */ + // Field numbers: + 1, /* = testFieldInt */ + // Property indices: + 0, /* = testFieldInt */ + // Field flags: + QtProtobufPrivate::NoFlags, /* = testFieldInt */ + }, + // char_data + /* metadata char_data: */ + "qtprotobufnamespace.tests.SimpleUIntMessage\0" /* = full message name */ + /* field char_data: */ + "testFieldInt\0" +}; + +const QtProtobufPrivate::QProtobufPropertyOrdering SimpleUIntMessage::staticPropertyOrdering = { + &qt_protobuf_SimpleUIntMessage_metadata.data +}; + +void SimpleUIntMessage::registerTypes() +{ + qRegisterMetaType(); + qRegisterMetaType(); +} + +SimpleUIntMessage::SimpleUIntMessage() + : QProtobufMessage(&SimpleUIntMessage::staticMetaObject, &SimpleUIntMessage::staticPropertyOrdering), + dptr(new SimpleUIntMessage_QtProtobufData) +{ +} + +SimpleUIntMessage::SimpleUIntMessage(const SimpleUIntMessage &other) + : QProtobufMessage(other), + dptr(other.dptr) +{ +} +SimpleUIntMessage &SimpleUIntMessage::operator =(const SimpleUIntMessage &other) +{ + QProtobufMessage::operator=(other); + dptr = other.dptr; + return *this; +} +SimpleUIntMessage::SimpleUIntMessage(SimpleUIntMessage &&other) noexcept + : QProtobufMessage(std::move(other)), + dptr(std::move(other.dptr)) +{ +} +SimpleUIntMessage &SimpleUIntMessage::operator =(SimpleUIntMessage &&other) noexcept +{ + QProtobufMessage::operator=(std::move(other)); + dptr.swap(other.dptr); + return *this; +} +bool SimpleUIntMessage::operator ==(const SimpleUIntMessage &other) const +{ + return QProtobufMessage::isEqual(*this, other) + && dptr->m_testFieldInt == other.dptr->m_testFieldInt; +} + +bool SimpleUIntMessage::operator !=(const SimpleUIntMessage &other) const +{ + return !this->operator ==(other); +} + +QtProtobuf::uint32 SimpleUIntMessage::testFieldInt() const +{ + return dptr->m_testFieldInt; +} + +void SimpleUIntMessage::setTestFieldInt(const QtProtobuf::uint32 &testFieldInt) +{ + if (dptr->m_testFieldInt != testFieldInt) { + dptr.detach(); + dptr->m_testFieldInt = testFieldInt; + } +} + + +class SimpleInt64Message_QtProtobufData : public QSharedData +{ +public: + SimpleInt64Message_QtProtobufData() + : QSharedData(), + m_testFieldInt(0) + { + } + + SimpleInt64Message_QtProtobufData(const SimpleInt64Message_QtProtobufData &other) + : QSharedData(other), + m_testFieldInt(other.m_testFieldInt) + { + } + + QtProtobuf::int64 m_testFieldInt; +}; + +SimpleInt64Message::~SimpleInt64Message() = default; + +static constexpr struct { + QtProtobufPrivate::QProtobufPropertyOrdering::Data data; + const std::array qt_protobuf_SimpleInt64Message_uint_data; + const char qt_protobuf_SimpleInt64Message_char_data[59]; +} qt_protobuf_SimpleInt64Message_metadata { + // data + { + 0, /* = version */ + 1, /* = num fields */ + 2, /* = field number offset */ + 3, /* = property index offset */ + 4, /* = field flags offset */ + 44, /* = message full name length */ + }, + // uint_data + { + // JSON name offsets: + 45, /* = testFieldInt */ + 58, /* = end-of-string-marker */ + // Field numbers: + 1, /* = testFieldInt */ + // Property indices: + 0, /* = testFieldInt */ + // Field flags: + QtProtobufPrivate::NoFlags, /* = testFieldInt */ + }, + // char_data + /* metadata char_data: */ + "qtprotobufnamespace.tests.SimpleInt64Message\0" /* = full message name */ + /* field char_data: */ + "testFieldInt\0" +}; + +const QtProtobufPrivate::QProtobufPropertyOrdering SimpleInt64Message::staticPropertyOrdering = { + &qt_protobuf_SimpleInt64Message_metadata.data +}; + +void SimpleInt64Message::registerTypes() +{ + qRegisterMetaType(); + qRegisterMetaType(); +} + +SimpleInt64Message::SimpleInt64Message() + : QProtobufMessage(&SimpleInt64Message::staticMetaObject, &SimpleInt64Message::staticPropertyOrdering), + dptr(new SimpleInt64Message_QtProtobufData) +{ +} + +SimpleInt64Message::SimpleInt64Message(const SimpleInt64Message &other) + : QProtobufMessage(other), + dptr(other.dptr) +{ +} +SimpleInt64Message &SimpleInt64Message::operator =(const SimpleInt64Message &other) +{ + QProtobufMessage::operator=(other); + dptr = other.dptr; + return *this; +} +SimpleInt64Message::SimpleInt64Message(SimpleInt64Message &&other) noexcept + : QProtobufMessage(std::move(other)), + dptr(std::move(other.dptr)) +{ +} +SimpleInt64Message &SimpleInt64Message::operator =(SimpleInt64Message &&other) noexcept +{ + QProtobufMessage::operator=(std::move(other)); + dptr.swap(other.dptr); + return *this; +} +bool SimpleInt64Message::operator ==(const SimpleInt64Message &other) const +{ + return QProtobufMessage::isEqual(*this, other) + && dptr->m_testFieldInt == other.dptr->m_testFieldInt; +} + +bool SimpleInt64Message::operator !=(const SimpleInt64Message &other) const +{ + return !this->operator ==(other); +} + +QtProtobuf::int64 SimpleInt64Message::testFieldInt() const +{ + return dptr->m_testFieldInt; +} + +void SimpleInt64Message::setTestFieldInt(const QtProtobuf::int64 &testFieldInt) +{ + if (dptr->m_testFieldInt != testFieldInt) { + dptr.detach(); + dptr->m_testFieldInt = testFieldInt; + } +} + + +class SimpleSInt64Message_QtProtobufData : public QSharedData +{ +public: + SimpleSInt64Message_QtProtobufData() + : QSharedData(), + m_testFieldInt(0) + { + } + + SimpleSInt64Message_QtProtobufData(const SimpleSInt64Message_QtProtobufData &other) + : QSharedData(other), + m_testFieldInt(other.m_testFieldInt) + { + } + + QtProtobuf::sint64 m_testFieldInt; +}; + +SimpleSInt64Message::~SimpleSInt64Message() = default; + +static constexpr struct { + QtProtobufPrivate::QProtobufPropertyOrdering::Data data; + const std::array qt_protobuf_SimpleSInt64Message_uint_data; + const char qt_protobuf_SimpleSInt64Message_char_data[60]; +} qt_protobuf_SimpleSInt64Message_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, /* = testFieldInt */ + 59, /* = end-of-string-marker */ + // Field numbers: + 1, /* = testFieldInt */ + // Property indices: + 0, /* = testFieldInt */ + // Field flags: + QtProtobufPrivate::NoFlags, /* = testFieldInt */ + }, + // char_data + /* metadata char_data: */ + "qtprotobufnamespace.tests.SimpleSInt64Message\0" /* = full message name */ + /* field char_data: */ + "testFieldInt\0" +}; + +const QtProtobufPrivate::QProtobufPropertyOrdering SimpleSInt64Message::staticPropertyOrdering = { + &qt_protobuf_SimpleSInt64Message_metadata.data +}; + +void SimpleSInt64Message::registerTypes() +{ + qRegisterMetaType(); + qRegisterMetaType(); +} + +SimpleSInt64Message::SimpleSInt64Message() + : QProtobufMessage(&SimpleSInt64Message::staticMetaObject, &SimpleSInt64Message::staticPropertyOrdering), + dptr(new SimpleSInt64Message_QtProtobufData) +{ +} + +SimpleSInt64Message::SimpleSInt64Message(const SimpleSInt64Message &other) + : QProtobufMessage(other), + dptr(other.dptr) +{ +} +SimpleSInt64Message &SimpleSInt64Message::operator =(const SimpleSInt64Message &other) +{ + QProtobufMessage::operator=(other); + dptr = other.dptr; + return *this; +} +SimpleSInt64Message::SimpleSInt64Message(SimpleSInt64Message &&other) noexcept + : QProtobufMessage(std::move(other)), + dptr(std::move(other.dptr)) +{ +} +SimpleSInt64Message &SimpleSInt64Message::operator =(SimpleSInt64Message &&other) noexcept +{ + QProtobufMessage::operator=(std::move(other)); + dptr.swap(other.dptr); + return *this; +} +bool SimpleSInt64Message::operator ==(const SimpleSInt64Message &other) const +{ + return QProtobufMessage::isEqual(*this, other) + && dptr->m_testFieldInt == other.dptr->m_testFieldInt; +} + +bool SimpleSInt64Message::operator !=(const SimpleSInt64Message &other) const +{ + return !this->operator ==(other); +} + +QtProtobuf::sint64 SimpleSInt64Message::testFieldInt() const +{ + return dptr->m_testFieldInt; +} + +void SimpleSInt64Message::setTestFieldInt(const QtProtobuf::sint64 &testFieldInt) +{ + if (dptr->m_testFieldInt != testFieldInt) { + dptr.detach(); + dptr->m_testFieldInt = testFieldInt; + } +} + + +class SimpleUInt64Message_QtProtobufData : public QSharedData +{ +public: + SimpleUInt64Message_QtProtobufData() + : QSharedData(), + m_testFieldInt(0) + { + } + + SimpleUInt64Message_QtProtobufData(const SimpleUInt64Message_QtProtobufData &other) + : QSharedData(other), + m_testFieldInt(other.m_testFieldInt) + { + } + + QtProtobuf::uint64 m_testFieldInt; +}; + +SimpleUInt64Message::~SimpleUInt64Message() = default; + +static constexpr struct { + QtProtobufPrivate::QProtobufPropertyOrdering::Data data; + const std::array qt_protobuf_SimpleUInt64Message_uint_data; + const char qt_protobuf_SimpleUInt64Message_char_data[60]; +} qt_protobuf_SimpleUInt64Message_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, /* = testFieldInt */ + 59, /* = end-of-string-marker */ + // Field numbers: + 1, /* = testFieldInt */ + // Property indices: + 0, /* = testFieldInt */ + // Field flags: + QtProtobufPrivate::NoFlags, /* = testFieldInt */ + }, + // char_data + /* metadata char_data: */ + "qtprotobufnamespace.tests.SimpleUInt64Message\0" /* = full message name */ + /* field char_data: */ + "testFieldInt\0" +}; + +const QtProtobufPrivate::QProtobufPropertyOrdering SimpleUInt64Message::staticPropertyOrdering = { + &qt_protobuf_SimpleUInt64Message_metadata.data +}; + +void SimpleUInt64Message::registerTypes() +{ + qRegisterMetaType(); + qRegisterMetaType(); +} + +SimpleUInt64Message::SimpleUInt64Message() + : QProtobufMessage(&SimpleUInt64Message::staticMetaObject, &SimpleUInt64Message::staticPropertyOrdering), + dptr(new SimpleUInt64Message_QtProtobufData) +{ +} + +SimpleUInt64Message::SimpleUInt64Message(const SimpleUInt64Message &other) + : QProtobufMessage(other), + dptr(other.dptr) +{ +} +SimpleUInt64Message &SimpleUInt64Message::operator =(const SimpleUInt64Message &other) +{ + QProtobufMessage::operator=(other); + dptr = other.dptr; + return *this; +} +SimpleUInt64Message::SimpleUInt64Message(SimpleUInt64Message &&other) noexcept + : QProtobufMessage(std::move(other)), + dptr(std::move(other.dptr)) +{ +} +SimpleUInt64Message &SimpleUInt64Message::operator =(SimpleUInt64Message &&other) noexcept +{ + QProtobufMessage::operator=(std::move(other)); + dptr.swap(other.dptr); + return *this; +} +bool SimpleUInt64Message::operator ==(const SimpleUInt64Message &other) const +{ + return QProtobufMessage::isEqual(*this, other) + && dptr->m_testFieldInt == other.dptr->m_testFieldInt; +} + +bool SimpleUInt64Message::operator !=(const SimpleUInt64Message &other) const +{ + return !this->operator ==(other); +} + +QtProtobuf::uint64 SimpleUInt64Message::testFieldInt() const +{ + return dptr->m_testFieldInt; +} + +void SimpleUInt64Message::setTestFieldInt(const QtProtobuf::uint64 &testFieldInt) +{ + if (dptr->m_testFieldInt != testFieldInt) { + dptr.detach(); + dptr->m_testFieldInt = testFieldInt; + } +} + + +class SimpleStringMessage_QtProtobufData : public QSharedData +{ +public: + SimpleStringMessage_QtProtobufData() + : QSharedData() + { + } + + SimpleStringMessage_QtProtobufData(const SimpleStringMessage_QtProtobufData &other) + : QSharedData(other), + m_testFieldString(other.m_testFieldString) + { + } + + QString m_testFieldString; +}; + +SimpleStringMessage::~SimpleStringMessage() = default; + +static constexpr struct { + QtProtobufPrivate::QProtobufPropertyOrdering::Data data; + const std::array 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::staticPropertyOrdering = { + &qt_protobuf_SimpleStringMessage_metadata.data +}; + +void SimpleStringMessage::registerTypes() +{ + qRegisterMetaType(); + qRegisterMetaType(); +} + +SimpleStringMessage::SimpleStringMessage() + : QProtobufMessage(&SimpleStringMessage::staticMetaObject, &SimpleStringMessage::staticPropertyOrdering), + dptr(new SimpleStringMessage_QtProtobufData) +{ +} + +SimpleStringMessage::SimpleStringMessage(const SimpleStringMessage &other) + : QProtobufMessage(other), + dptr(other.dptr) +{ +} +SimpleStringMessage &SimpleStringMessage::operator =(const SimpleStringMessage &other) +{ + QProtobufMessage::operator=(other); + dptr = other.dptr; + return *this; +} +SimpleStringMessage::SimpleStringMessage(SimpleStringMessage &&other) noexcept + : QProtobufMessage(std::move(other)), + dptr(std::move(other.dptr)) +{ +} +SimpleStringMessage &SimpleStringMessage::operator =(SimpleStringMessage &&other) noexcept +{ + QProtobufMessage::operator=(std::move(other)); + dptr.swap(other.dptr); + return *this; +} +bool SimpleStringMessage::operator ==(const SimpleStringMessage &other) const +{ + return QProtobufMessage::isEqual(*this, other) + && dptr->m_testFieldString == other.dptr->m_testFieldString; +} + +bool SimpleStringMessage::operator !=(const SimpleStringMessage &other) const +{ + return !this->operator ==(other); +} + +QString SimpleStringMessage::testFieldString() const +{ + return dptr->m_testFieldString; +} + +void SimpleStringMessage::setTestFieldString(const QString &testFieldString) +{ + if (dptr->m_testFieldString != testFieldString) { + dptr.detach(); + dptr->m_testFieldString = testFieldString; + } +} + + +class SimpleFloatMessage_QtProtobufData : public QSharedData +{ +public: + SimpleFloatMessage_QtProtobufData() + : QSharedData(), + m_testFieldFloat(0.0) + { + } + + SimpleFloatMessage_QtProtobufData(const SimpleFloatMessage_QtProtobufData &other) + : QSharedData(other), + m_testFieldFloat(other.m_testFieldFloat) + { + } + + float m_testFieldFloat; +}; + +SimpleFloatMessage::~SimpleFloatMessage() = default; + +static constexpr struct { + QtProtobufPrivate::QProtobufPropertyOrdering::Data data; + const std::array qt_protobuf_SimpleFloatMessage_uint_data; + const char qt_protobuf_SimpleFloatMessage_char_data[61]; +} qt_protobuf_SimpleFloatMessage_metadata { + // data + { + 0, /* = version */ + 1, /* = num fields */ + 2, /* = field number offset */ + 3, /* = property index offset */ + 4, /* = field flags offset */ + 44, /* = message full name length */ + }, + // uint_data + { + // JSON name offsets: + 45, /* = testFieldFloat */ + 60, /* = end-of-string-marker */ + // Field numbers: + 7, /* = testFieldFloat */ + // Property indices: + 0, /* = testFieldFloat */ + // Field flags: + QtProtobufPrivate::NoFlags, /* = testFieldFloat */ + }, + // char_data + /* metadata char_data: */ + "qtprotobufnamespace.tests.SimpleFloatMessage\0" /* = full message name */ + /* field char_data: */ + "testFieldFloat\0" +}; + +const QtProtobufPrivate::QProtobufPropertyOrdering SimpleFloatMessage::staticPropertyOrdering = { + &qt_protobuf_SimpleFloatMessage_metadata.data +}; + +void SimpleFloatMessage::registerTypes() +{ + qRegisterMetaType(); + qRegisterMetaType(); +} + +SimpleFloatMessage::SimpleFloatMessage() + : QProtobufMessage(&SimpleFloatMessage::staticMetaObject, &SimpleFloatMessage::staticPropertyOrdering), + dptr(new SimpleFloatMessage_QtProtobufData) +{ +} + +SimpleFloatMessage::SimpleFloatMessage(const SimpleFloatMessage &other) + : QProtobufMessage(other), + dptr(other.dptr) +{ +} +SimpleFloatMessage &SimpleFloatMessage::operator =(const SimpleFloatMessage &other) +{ + QProtobufMessage::operator=(other); + dptr = other.dptr; + return *this; +} +SimpleFloatMessage::SimpleFloatMessage(SimpleFloatMessage &&other) noexcept + : QProtobufMessage(std::move(other)), + dptr(std::move(other.dptr)) +{ +} +SimpleFloatMessage &SimpleFloatMessage::operator =(SimpleFloatMessage &&other) noexcept +{ + QProtobufMessage::operator=(std::move(other)); + dptr.swap(other.dptr); + return *this; +} +bool SimpleFloatMessage::operator ==(const SimpleFloatMessage &other) const +{ + return QProtobufMessage::isEqual(*this, other) + && dptr->m_testFieldFloat == other.dptr->m_testFieldFloat; +} + +bool SimpleFloatMessage::operator !=(const SimpleFloatMessage &other) const +{ + return !this->operator ==(other); +} + +float SimpleFloatMessage::testFieldFloat() const +{ + return dptr->m_testFieldFloat; +} + +void SimpleFloatMessage::setTestFieldFloat(const float &testFieldFloat) +{ + if (dptr->m_testFieldFloat != testFieldFloat || + std::signbit(dptr->m_testFieldFloat) != std::signbit(testFieldFloat)) { + dptr.detach(); + dptr->m_testFieldFloat = testFieldFloat; + } +} + + +class SimpleDoubleMessage_QtProtobufData : public QSharedData +{ +public: + SimpleDoubleMessage_QtProtobufData() + : QSharedData(), + m_testFieldDouble(0.0) + { + } + + SimpleDoubleMessage_QtProtobufData(const SimpleDoubleMessage_QtProtobufData &other) + : QSharedData(other), + m_testFieldDouble(other.m_testFieldDouble) + { + } + + double m_testFieldDouble; +}; + +SimpleDoubleMessage::~SimpleDoubleMessage() = default; + +static constexpr struct { + QtProtobufPrivate::QProtobufPropertyOrdering::Data data; + const std::array qt_protobuf_SimpleDoubleMessage_uint_data; + const char qt_protobuf_SimpleDoubleMessage_char_data[63]; +} qt_protobuf_SimpleDoubleMessage_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, /* = testFieldDouble */ + 62, /* = end-of-string-marker */ + // Field numbers: + 8, /* = testFieldDouble */ + // Property indices: + 0, /* = testFieldDouble */ + // Field flags: + QtProtobufPrivate::NoFlags, /* = testFieldDouble */ + }, + // char_data + /* metadata char_data: */ + "qtprotobufnamespace.tests.SimpleDoubleMessage\0" /* = full message name */ + /* field char_data: */ + "testFieldDouble\0" +}; + +const QtProtobufPrivate::QProtobufPropertyOrdering SimpleDoubleMessage::staticPropertyOrdering = { + &qt_protobuf_SimpleDoubleMessage_metadata.data +}; + +void SimpleDoubleMessage::registerTypes() +{ + qRegisterMetaType(); + qRegisterMetaType(); +} + +SimpleDoubleMessage::SimpleDoubleMessage() + : QProtobufMessage(&SimpleDoubleMessage::staticMetaObject, &SimpleDoubleMessage::staticPropertyOrdering), + dptr(new SimpleDoubleMessage_QtProtobufData) +{ +} + +SimpleDoubleMessage::SimpleDoubleMessage(const SimpleDoubleMessage &other) + : QProtobufMessage(other), + dptr(other.dptr) +{ +} +SimpleDoubleMessage &SimpleDoubleMessage::operator =(const SimpleDoubleMessage &other) +{ + QProtobufMessage::operator=(other); + dptr = other.dptr; + return *this; +} +SimpleDoubleMessage::SimpleDoubleMessage(SimpleDoubleMessage &&other) noexcept + : QProtobufMessage(std::move(other)), + dptr(std::move(other.dptr)) +{ +} +SimpleDoubleMessage &SimpleDoubleMessage::operator =(SimpleDoubleMessage &&other) noexcept +{ + QProtobufMessage::operator=(std::move(other)); + dptr.swap(other.dptr); + return *this; +} +bool SimpleDoubleMessage::operator ==(const SimpleDoubleMessage &other) const +{ + return QProtobufMessage::isEqual(*this, other) + && dptr->m_testFieldDouble == other.dptr->m_testFieldDouble; +} + +bool SimpleDoubleMessage::operator !=(const SimpleDoubleMessage &other) const +{ + return !this->operator ==(other); +} + +double SimpleDoubleMessage::testFieldDouble() const +{ + return dptr->m_testFieldDouble; +} + +void SimpleDoubleMessage::setTestFieldDouble(const double &testFieldDouble) +{ + if (dptr->m_testFieldDouble != testFieldDouble || + std::signbit(dptr->m_testFieldDouble) != std::signbit(testFieldDouble)) { + dptr.detach(); + dptr->m_testFieldDouble = testFieldDouble; + } +} + + +class SimpleBytesMessage_QtProtobufData : public QSharedData +{ +public: + SimpleBytesMessage_QtProtobufData() + : QSharedData() + { + } + + SimpleBytesMessage_QtProtobufData(const SimpleBytesMessage_QtProtobufData &other) + : QSharedData(other), + m_testFieldBytes(other.m_testFieldBytes) + { + } + + QByteArray m_testFieldBytes; +}; + +SimpleBytesMessage::~SimpleBytesMessage() = default; + +static constexpr struct { + QtProtobufPrivate::QProtobufPropertyOrdering::Data data; + const std::array qt_protobuf_SimpleBytesMessage_uint_data; + const char qt_protobuf_SimpleBytesMessage_char_data[61]; +} qt_protobuf_SimpleBytesMessage_metadata { + // data + { + 0, /* = version */ + 1, /* = num fields */ + 2, /* = field number offset */ + 3, /* = property index offset */ + 4, /* = field flags offset */ + 44, /* = message full name length */ + }, + // uint_data + { + // JSON name offsets: + 45, /* = testFieldBytes */ + 60, /* = end-of-string-marker */ + // Field numbers: + 1, /* = testFieldBytes */ + // Property indices: + 0, /* = testFieldBytes */ + // Field flags: + QtProtobufPrivate::NoFlags, /* = testFieldBytes */ + }, + // char_data + /* metadata char_data: */ + "qtprotobufnamespace.tests.SimpleBytesMessage\0" /* = full message name */ + /* field char_data: */ + "testFieldBytes\0" +}; + +const QtProtobufPrivate::QProtobufPropertyOrdering SimpleBytesMessage::staticPropertyOrdering = { + &qt_protobuf_SimpleBytesMessage_metadata.data +}; + +void SimpleBytesMessage::registerTypes() +{ + qRegisterMetaType(); + qRegisterMetaType(); +} + +SimpleBytesMessage::SimpleBytesMessage() + : QProtobufMessage(&SimpleBytesMessage::staticMetaObject, &SimpleBytesMessage::staticPropertyOrdering), + dptr(new SimpleBytesMessage_QtProtobufData) +{ +} + +SimpleBytesMessage::SimpleBytesMessage(const SimpleBytesMessage &other) + : QProtobufMessage(other), + dptr(other.dptr) +{ +} +SimpleBytesMessage &SimpleBytesMessage::operator =(const SimpleBytesMessage &other) +{ + QProtobufMessage::operator=(other); + dptr = other.dptr; + return *this; +} +SimpleBytesMessage::SimpleBytesMessage(SimpleBytesMessage &&other) noexcept + : QProtobufMessage(std::move(other)), + dptr(std::move(other.dptr)) +{ +} +SimpleBytesMessage &SimpleBytesMessage::operator =(SimpleBytesMessage &&other) noexcept +{ + QProtobufMessage::operator=(std::move(other)); + dptr.swap(other.dptr); + return *this; +} +bool SimpleBytesMessage::operator ==(const SimpleBytesMessage &other) const +{ + return QProtobufMessage::isEqual(*this, other) + && dptr->m_testFieldBytes == other.dptr->m_testFieldBytes; +} + +bool SimpleBytesMessage::operator !=(const SimpleBytesMessage &other) const +{ + return !this->operator ==(other); +} + +QByteArray SimpleBytesMessage::testFieldBytes() const +{ + return dptr->m_testFieldBytes; +} + +void SimpleBytesMessage::setTestFieldBytes(const QByteArray &testFieldBytes) +{ + if (dptr->m_testFieldBytes != testFieldBytes) { + dptr.detach(); + dptr->m_testFieldBytes = testFieldBytes; + } +} + + +class SimpleFixedInt32Message_QtProtobufData : public QSharedData +{ +public: + SimpleFixedInt32Message_QtProtobufData() + : QSharedData(), + m_testFieldFixedInt32(0) + { + } + + SimpleFixedInt32Message_QtProtobufData(const SimpleFixedInt32Message_QtProtobufData &other) + : QSharedData(other), + m_testFieldFixedInt32(other.m_testFieldFixedInt32) + { + } + + QtProtobuf::fixed32 m_testFieldFixedInt32; +}; + +SimpleFixedInt32Message::~SimpleFixedInt32Message() = default; + +static constexpr struct { + QtProtobufPrivate::QProtobufPropertyOrdering::Data data; + const std::array qt_protobuf_SimpleFixedInt32Message_uint_data; + const char qt_protobuf_SimpleFixedInt32Message_char_data[71]; +} qt_protobuf_SimpleFixedInt32Message_metadata { + // data + { + 0, /* = version */ + 1, /* = num fields */ + 2, /* = field number offset */ + 3, /* = property index offset */ + 4, /* = field flags offset */ + 49, /* = message full name length */ + }, + // uint_data + { + // JSON name offsets: + 50, /* = testFieldFixedInt32 */ + 70, /* = end-of-string-marker */ + // Field numbers: + 1, /* = testFieldFixedInt32 */ + // Property indices: + 0, /* = testFieldFixedInt32 */ + // Field flags: + QtProtobufPrivate::NoFlags, /* = testFieldFixedInt32 */ + }, + // char_data + /* metadata char_data: */ + "qtprotobufnamespace.tests.SimpleFixedInt32Message\0" /* = full message name */ + /* field char_data: */ + "testFieldFixedInt32\0" +}; + +const QtProtobufPrivate::QProtobufPropertyOrdering SimpleFixedInt32Message::staticPropertyOrdering = { + &qt_protobuf_SimpleFixedInt32Message_metadata.data +}; + +void SimpleFixedInt32Message::registerTypes() +{ + qRegisterMetaType(); + qRegisterMetaType(); +} + +SimpleFixedInt32Message::SimpleFixedInt32Message() + : QProtobufMessage(&SimpleFixedInt32Message::staticMetaObject, &SimpleFixedInt32Message::staticPropertyOrdering), + dptr(new SimpleFixedInt32Message_QtProtobufData) +{ +} + +SimpleFixedInt32Message::SimpleFixedInt32Message(const SimpleFixedInt32Message &other) + : QProtobufMessage(other), + dptr(other.dptr) +{ +} +SimpleFixedInt32Message &SimpleFixedInt32Message::operator =(const SimpleFixedInt32Message &other) +{ + QProtobufMessage::operator=(other); + dptr = other.dptr; + return *this; +} +SimpleFixedInt32Message::SimpleFixedInt32Message(SimpleFixedInt32Message &&other) noexcept + : QProtobufMessage(std::move(other)), + dptr(std::move(other.dptr)) +{ +} +SimpleFixedInt32Message &SimpleFixedInt32Message::operator =(SimpleFixedInt32Message &&other) noexcept +{ + QProtobufMessage::operator=(std::move(other)); + dptr.swap(other.dptr); + return *this; +} +bool SimpleFixedInt32Message::operator ==(const SimpleFixedInt32Message &other) const +{ + return QProtobufMessage::isEqual(*this, other) + && dptr->m_testFieldFixedInt32 == other.dptr->m_testFieldFixedInt32; +} + +bool SimpleFixedInt32Message::operator !=(const SimpleFixedInt32Message &other) const +{ + return !this->operator ==(other); +} + +QtProtobuf::fixed32 SimpleFixedInt32Message::testFieldFixedInt32() const +{ + return dptr->m_testFieldFixedInt32; +} + +void SimpleFixedInt32Message::setTestFieldFixedInt32(const QtProtobuf::fixed32 &testFieldFixedInt32) +{ + if (dptr->m_testFieldFixedInt32 != testFieldFixedInt32) { + dptr.detach(); + dptr->m_testFieldFixedInt32 = testFieldFixedInt32; + } +} + + +class SimpleFixedInt64Message_QtProtobufData : public QSharedData +{ +public: + SimpleFixedInt64Message_QtProtobufData() + : QSharedData(), + m_testFieldFixedInt64(0) + { + } + + SimpleFixedInt64Message_QtProtobufData(const SimpleFixedInt64Message_QtProtobufData &other) + : QSharedData(other), + m_testFieldFixedInt64(other.m_testFieldFixedInt64) + { + } + + QtProtobuf::fixed64 m_testFieldFixedInt64; +}; + +SimpleFixedInt64Message::~SimpleFixedInt64Message() = default; + +static constexpr struct { + QtProtobufPrivate::QProtobufPropertyOrdering::Data data; + const std::array qt_protobuf_SimpleFixedInt64Message_uint_data; + const char qt_protobuf_SimpleFixedInt64Message_char_data[71]; +} qt_protobuf_SimpleFixedInt64Message_metadata { + // data + { + 0, /* = version */ + 1, /* = num fields */ + 2, /* = field number offset */ + 3, /* = property index offset */ + 4, /* = field flags offset */ + 49, /* = message full name length */ + }, + // uint_data + { + // JSON name offsets: + 50, /* = testFieldFixedInt64 */ + 70, /* = end-of-string-marker */ + // Field numbers: + 1, /* = testFieldFixedInt64 */ + // Property indices: + 0, /* = testFieldFixedInt64 */ + // Field flags: + QtProtobufPrivate::NoFlags, /* = testFieldFixedInt64 */ + }, + // char_data + /* metadata char_data: */ + "qtprotobufnamespace.tests.SimpleFixedInt64Message\0" /* = full message name */ + /* field char_data: */ + "testFieldFixedInt64\0" +}; + +const QtProtobufPrivate::QProtobufPropertyOrdering SimpleFixedInt64Message::staticPropertyOrdering = { + &qt_protobuf_SimpleFixedInt64Message_metadata.data +}; + +void SimpleFixedInt64Message::registerTypes() +{ + qRegisterMetaType(); + qRegisterMetaType(); +} + +SimpleFixedInt64Message::SimpleFixedInt64Message() + : QProtobufMessage(&SimpleFixedInt64Message::staticMetaObject, &SimpleFixedInt64Message::staticPropertyOrdering), + dptr(new SimpleFixedInt64Message_QtProtobufData) +{ +} + +SimpleFixedInt64Message::SimpleFixedInt64Message(const SimpleFixedInt64Message &other) + : QProtobufMessage(other), + dptr(other.dptr) +{ +} +SimpleFixedInt64Message &SimpleFixedInt64Message::operator =(const SimpleFixedInt64Message &other) +{ + QProtobufMessage::operator=(other); + dptr = other.dptr; + return *this; +} +SimpleFixedInt64Message::SimpleFixedInt64Message(SimpleFixedInt64Message &&other) noexcept + : QProtobufMessage(std::move(other)), + dptr(std::move(other.dptr)) +{ +} +SimpleFixedInt64Message &SimpleFixedInt64Message::operator =(SimpleFixedInt64Message &&other) noexcept +{ + QProtobufMessage::operator=(std::move(other)); + dptr.swap(other.dptr); + return *this; +} +bool SimpleFixedInt64Message::operator ==(const SimpleFixedInt64Message &other) const +{ + return QProtobufMessage::isEqual(*this, other) + && dptr->m_testFieldFixedInt64 == other.dptr->m_testFieldFixedInt64; +} + +bool SimpleFixedInt64Message::operator !=(const SimpleFixedInt64Message &other) const +{ + return !this->operator ==(other); +} + +QtProtobuf::fixed64 SimpleFixedInt64Message::testFieldFixedInt64() const +{ + return dptr->m_testFieldFixedInt64; +} + +void SimpleFixedInt64Message::setTestFieldFixedInt64(const QtProtobuf::fixed64 &testFieldFixedInt64) +{ + if (dptr->m_testFieldFixedInt64 != testFieldFixedInt64) { + dptr.detach(); + dptr->m_testFieldFixedInt64 = testFieldFixedInt64; + } +} + + +class SimpleSFixedInt32Message_QtProtobufData : public QSharedData +{ +public: + SimpleSFixedInt32Message_QtProtobufData() + : QSharedData() + { + } + + SimpleSFixedInt32Message_QtProtobufData(const SimpleSFixedInt32Message_QtProtobufData &other) + : QSharedData(other), + m_testFieldFixedInt32(other.m_testFieldFixedInt32) + { + } + + QtProtobuf::sfixed32 m_testFieldFixedInt32; +}; + +SimpleSFixedInt32Message::~SimpleSFixedInt32Message() = default; + +static constexpr struct { + QtProtobufPrivate::QProtobufPropertyOrdering::Data data; + const std::array qt_protobuf_SimpleSFixedInt32Message_uint_data; + const char qt_protobuf_SimpleSFixedInt32Message_char_data[72]; +} qt_protobuf_SimpleSFixedInt32Message_metadata { + // data + { + 0, /* = version */ + 1, /* = num fields */ + 2, /* = field number offset */ + 3, /* = property index offset */ + 4, /* = field flags offset */ + 50, /* = message full name length */ + }, + // uint_data + { + // JSON name offsets: + 51, /* = testFieldFixedInt32 */ + 71, /* = end-of-string-marker */ + // Field numbers: + 1, /* = testFieldFixedInt32 */ + // Property indices: + 0, /* = testFieldFixedInt32 */ + // Field flags: + QtProtobufPrivate::NoFlags, /* = testFieldFixedInt32 */ + }, + // char_data + /* metadata char_data: */ + "qtprotobufnamespace.tests.SimpleSFixedInt32Message\0" /* = full message name */ + /* field char_data: */ + "testFieldFixedInt32\0" +}; + +const QtProtobufPrivate::QProtobufPropertyOrdering SimpleSFixedInt32Message::staticPropertyOrdering = { + &qt_protobuf_SimpleSFixedInt32Message_metadata.data +}; + +void SimpleSFixedInt32Message::registerTypes() +{ + qRegisterMetaType(); + qRegisterMetaType(); +} + +SimpleSFixedInt32Message::SimpleSFixedInt32Message() + : QProtobufMessage(&SimpleSFixedInt32Message::staticMetaObject, &SimpleSFixedInt32Message::staticPropertyOrdering), + dptr(new SimpleSFixedInt32Message_QtProtobufData) +{ +} + +SimpleSFixedInt32Message::SimpleSFixedInt32Message(const SimpleSFixedInt32Message &other) + : QProtobufMessage(other), + dptr(other.dptr) +{ +} +SimpleSFixedInt32Message &SimpleSFixedInt32Message::operator =(const SimpleSFixedInt32Message &other) +{ + QProtobufMessage::operator=(other); + dptr = other.dptr; + return *this; +} +SimpleSFixedInt32Message::SimpleSFixedInt32Message(SimpleSFixedInt32Message &&other) noexcept + : QProtobufMessage(std::move(other)), + dptr(std::move(other.dptr)) +{ +} +SimpleSFixedInt32Message &SimpleSFixedInt32Message::operator =(SimpleSFixedInt32Message &&other) noexcept +{ + QProtobufMessage::operator=(std::move(other)); + dptr.swap(other.dptr); + return *this; +} +bool SimpleSFixedInt32Message::operator ==(const SimpleSFixedInt32Message &other) const +{ + return QProtobufMessage::isEqual(*this, other) + && dptr->m_testFieldFixedInt32 == other.dptr->m_testFieldFixedInt32; +} + +bool SimpleSFixedInt32Message::operator !=(const SimpleSFixedInt32Message &other) const +{ + return !this->operator ==(other); +} + +QtProtobuf::sfixed32 SimpleSFixedInt32Message::testFieldFixedInt32() const +{ + return dptr->m_testFieldFixedInt32; +} + +void SimpleSFixedInt32Message::setTestFieldFixedInt32(const QtProtobuf::sfixed32 &testFieldFixedInt32) +{ + if (dptr->m_testFieldFixedInt32 != testFieldFixedInt32) { + dptr.detach(); + dptr->m_testFieldFixedInt32 = testFieldFixedInt32; + } +} + + +class SimpleSFixedInt64Message_QtProtobufData : public QSharedData +{ +public: + SimpleSFixedInt64Message_QtProtobufData() + : QSharedData() + { + } + + SimpleSFixedInt64Message_QtProtobufData(const SimpleSFixedInt64Message_QtProtobufData &other) + : QSharedData(other), + m_testFieldFixedInt64(other.m_testFieldFixedInt64) + { + } + + QtProtobuf::sfixed64 m_testFieldFixedInt64; +}; + +SimpleSFixedInt64Message::~SimpleSFixedInt64Message() = default; + +static constexpr struct { + QtProtobufPrivate::QProtobufPropertyOrdering::Data data; + const std::array qt_protobuf_SimpleSFixedInt64Message_uint_data; + const char qt_protobuf_SimpleSFixedInt64Message_char_data[72]; +} qt_protobuf_SimpleSFixedInt64Message_metadata { + // data + { + 0, /* = version */ + 1, /* = num fields */ + 2, /* = field number offset */ + 3, /* = property index offset */ + 4, /* = field flags offset */ + 50, /* = message full name length */ + }, + // uint_data + { + // JSON name offsets: + 51, /* = testFieldFixedInt64 */ + 71, /* = end-of-string-marker */ + // Field numbers: + 1, /* = testFieldFixedInt64 */ + // Property indices: + 0, /* = testFieldFixedInt64 */ + // Field flags: + QtProtobufPrivate::NoFlags, /* = testFieldFixedInt64 */ + }, + // char_data + /* metadata char_data: */ + "qtprotobufnamespace.tests.SimpleSFixedInt64Message\0" /* = full message name */ + /* field char_data: */ + "testFieldFixedInt64\0" +}; + +const QtProtobufPrivate::QProtobufPropertyOrdering SimpleSFixedInt64Message::staticPropertyOrdering = { + &qt_protobuf_SimpleSFixedInt64Message_metadata.data +}; + +void SimpleSFixedInt64Message::registerTypes() +{ + qRegisterMetaType(); + qRegisterMetaType(); +} + +SimpleSFixedInt64Message::SimpleSFixedInt64Message() + : QProtobufMessage(&SimpleSFixedInt64Message::staticMetaObject, &SimpleSFixedInt64Message::staticPropertyOrdering), + dptr(new SimpleSFixedInt64Message_QtProtobufData) +{ +} + +SimpleSFixedInt64Message::SimpleSFixedInt64Message(const SimpleSFixedInt64Message &other) + : QProtobufMessage(other), + dptr(other.dptr) +{ +} +SimpleSFixedInt64Message &SimpleSFixedInt64Message::operator =(const SimpleSFixedInt64Message &other) +{ + QProtobufMessage::operator=(other); + dptr = other.dptr; + return *this; +} +SimpleSFixedInt64Message::SimpleSFixedInt64Message(SimpleSFixedInt64Message &&other) noexcept + : QProtobufMessage(std::move(other)), + dptr(std::move(other.dptr)) +{ +} +SimpleSFixedInt64Message &SimpleSFixedInt64Message::operator =(SimpleSFixedInt64Message &&other) noexcept +{ + QProtobufMessage::operator=(std::move(other)); + dptr.swap(other.dptr); + return *this; +} +bool SimpleSFixedInt64Message::operator ==(const SimpleSFixedInt64Message &other) const +{ + return QProtobufMessage::isEqual(*this, other) + && dptr->m_testFieldFixedInt64 == other.dptr->m_testFieldFixedInt64; +} + +bool SimpleSFixedInt64Message::operator !=(const SimpleSFixedInt64Message &other) const +{ + return !this->operator ==(other); +} + +QtProtobuf::sfixed64 SimpleSFixedInt64Message::testFieldFixedInt64() const +{ + return dptr->m_testFieldFixedInt64; +} + +void SimpleSFixedInt64Message::setTestFieldFixedInt64(const QtProtobuf::sfixed64 &testFieldFixedInt64) +{ + if (dptr->m_testFieldFixedInt64 != testFieldFixedInt64) { + dptr.detach(); + dptr->m_testFieldFixedInt64 = testFieldFixedInt64; + } +} + + +class ComplexMessage_QtProtobufData : public QSharedData +{ +public: + ComplexMessage_QtProtobufData() + : QSharedData(), + m_testFieldInt(0), + m_testComplexField(nullptr) + { + } + + ComplexMessage_QtProtobufData(const ComplexMessage_QtProtobufData &other) + : QSharedData(other), + m_testFieldInt(other.m_testFieldInt), + m_testComplexField(other.m_testComplexField + ? new SimpleStringMessage(*other.m_testComplexField) + : nullptr) + { + } + + QtProtobuf::int32 m_testFieldInt; + QtProtobufPrivate::QProtobufLazyMessagePointer m_testComplexField; +}; + +ComplexMessage::~ComplexMessage() = default; + +static constexpr struct { + QtProtobufPrivate::QProtobufPropertyOrdering::Data data; + const std::array 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::staticPropertyOrdering = { + &qt_protobuf_ComplexMessage_metadata.data +}; + +void ComplexMessage::registerTypes() +{ + qRegisterMetaType(); + qRegisterMetaType(); +} + +ComplexMessage::ComplexMessage() + : QProtobufMessage(&ComplexMessage::staticMetaObject, &ComplexMessage::staticPropertyOrdering), + dptr(new ComplexMessage_QtProtobufData) +{ +} + +ComplexMessage::ComplexMessage(const ComplexMessage &other) + : QProtobufMessage(other), + dptr(other.dptr) +{ +} +ComplexMessage &ComplexMessage::operator =(const ComplexMessage &other) +{ + QProtobufMessage::operator=(other); + dptr = other.dptr; + return *this; +} +ComplexMessage::ComplexMessage(ComplexMessage &&other) noexcept + : QProtobufMessage(std::move(other)), + dptr(std::move(other.dptr)) +{ +} +ComplexMessage &ComplexMessage::operator =(ComplexMessage &&other) noexcept +{ + QProtobufMessage::operator=(std::move(other)); + dptr.swap(other.dptr); + return *this; +} +bool ComplexMessage::operator ==(const ComplexMessage &other) const +{ + return QProtobufMessage::isEqual(*this, other) + && dptr->m_testFieldInt == other.dptr->m_testFieldInt + && (dptr->m_testComplexField == other.dptr->m_testComplexField + || *dptr->m_testComplexField == *other.dptr->m_testComplexField); +} + +bool ComplexMessage::operator !=(const ComplexMessage &other) const +{ + return !this->operator ==(other); +} + +QtProtobuf::int32 ComplexMessage::testFieldInt() const +{ + return dptr->m_testFieldInt; +} + +SimpleStringMessage *ComplexMessage::testComplexField_p() const +{ + return dptr->m_testComplexField ? dptr->m_testComplexField.get() : nullptr; +} + +bool ComplexMessage::hasTestComplexField() const +{ + return dptr->m_testComplexField.operator bool(); +} + +SimpleStringMessage &ComplexMessage::testComplexField() const +{ + return *dptr->m_testComplexField; +} + +void ComplexMessage::clearTestComplexField() +{ + if (dptr->m_testComplexField) { + dptr.detach(); + dptr->m_testComplexField.reset(); + } +} + +void ComplexMessage::setTestFieldInt(const QtProtobuf::int32 &testFieldInt) +{ + if (dptr->m_testFieldInt != testFieldInt) { + dptr.detach(); + dptr->m_testFieldInt = testFieldInt; + } +} + +void ComplexMessage::setTestComplexField_p(SimpleStringMessage *testComplexField) +{ + if (dptr->m_testComplexField.get() != testComplexField) { + dptr.detach(); + dptr->m_testComplexField.reset(testComplexField); + } +} + +void ComplexMessage::setTestComplexField(const SimpleStringMessage &testComplexField) +{ + if (*dptr->m_testComplexField != testComplexField) { + dptr.detach(); + *dptr->m_testComplexField = testComplexField; + } +} + +} // namespace qtprotobufnamespace::tests + +#include "moc_basicmessages.qpb.cpp" diff --git a/tests/auto/protobufgen/data/expected_result/custom-exports/basicmessages.qpb.h b/tests/auto/protobufgen/data/expected_result/custom-exports/basicmessages.qpb.h new file mode 100644 index 00000000..ba10362a --- /dev/null +++ b/tests/auto/protobufgen/data/expected_result/custom-exports/basicmessages.qpb.h @@ -0,0 +1,738 @@ +/* This file is autogenerated. DO NOT CHANGE. All changes will be lost */ + +#ifndef QPROTOBUF_BASICMESSAGES_H +#define QPROTOBUF_BASICMESSAGES_H + +#include +#include +#include + +#include +#include +#include "tst_qtprotobufgen_custom_exports_gen_exports.qpb.h" + +#include +#include +#include + +#include + + +namespace qtprotobufnamespace::tests { +class EmptyMessage; +using EmptyMessageRepeated = QList; +namespace EmptyMessage_QtProtobufNested { +enum class QtProtobufFieldEnum; +} // namespace EmptyMessage_QtProtobufNested + +class SimpleBoolMessage; +using SimpleBoolMessageRepeated = QList; +namespace SimpleBoolMessage_QtProtobufNested { +enum class QtProtobufFieldEnum; +} // namespace SimpleBoolMessage_QtProtobufNested + +class SimpleIntMessage; +using SimpleIntMessageRepeated = QList; +namespace SimpleIntMessage_QtProtobufNested { +enum class QtProtobufFieldEnum; +} // namespace SimpleIntMessage_QtProtobufNested + +class SimpleSIntMessage; +using SimpleSIntMessageRepeated = QList; +namespace SimpleSIntMessage_QtProtobufNested { +enum class QtProtobufFieldEnum; +} // namespace SimpleSIntMessage_QtProtobufNested + +class SimpleUIntMessage; +using SimpleUIntMessageRepeated = QList; +namespace SimpleUIntMessage_QtProtobufNested { +enum class QtProtobufFieldEnum; +} // namespace SimpleUIntMessage_QtProtobufNested + +class SimpleInt64Message; +using SimpleInt64MessageRepeated = QList; +namespace SimpleInt64Message_QtProtobufNested { +enum class QtProtobufFieldEnum; +} // namespace SimpleInt64Message_QtProtobufNested + +class SimpleSInt64Message; +using SimpleSInt64MessageRepeated = QList; +namespace SimpleSInt64Message_QtProtobufNested { +enum class QtProtobufFieldEnum; +} // namespace SimpleSInt64Message_QtProtobufNested + +class SimpleUInt64Message; +using SimpleUInt64MessageRepeated = QList; +namespace SimpleUInt64Message_QtProtobufNested { +enum class QtProtobufFieldEnum; +} // namespace SimpleUInt64Message_QtProtobufNested + +class SimpleStringMessage; +using SimpleStringMessageRepeated = QList; +namespace SimpleStringMessage_QtProtobufNested { +enum class QtProtobufFieldEnum; +} // namespace SimpleStringMessage_QtProtobufNested + +class SimpleFloatMessage; +using SimpleFloatMessageRepeated = QList; +namespace SimpleFloatMessage_QtProtobufNested { +enum class QtProtobufFieldEnum; +} // namespace SimpleFloatMessage_QtProtobufNested + +class SimpleDoubleMessage; +using SimpleDoubleMessageRepeated = QList; +namespace SimpleDoubleMessage_QtProtobufNested { +enum class QtProtobufFieldEnum; +} // namespace SimpleDoubleMessage_QtProtobufNested + +class SimpleBytesMessage; +using SimpleBytesMessageRepeated = QList; +namespace SimpleBytesMessage_QtProtobufNested { +enum class QtProtobufFieldEnum; +} // namespace SimpleBytesMessage_QtProtobufNested + +class SimpleFixedInt32Message; +using SimpleFixedInt32MessageRepeated = QList; +namespace SimpleFixedInt32Message_QtProtobufNested { +enum class QtProtobufFieldEnum; +} // namespace SimpleFixedInt32Message_QtProtobufNested + +class SimpleFixedInt64Message; +using SimpleFixedInt64MessageRepeated = QList; +namespace SimpleFixedInt64Message_QtProtobufNested { +enum class QtProtobufFieldEnum; +} // namespace SimpleFixedInt64Message_QtProtobufNested + +class SimpleSFixedInt32Message; +using SimpleSFixedInt32MessageRepeated = QList; +namespace SimpleSFixedInt32Message_QtProtobufNested { +enum class QtProtobufFieldEnum; +} // namespace SimpleSFixedInt32Message_QtProtobufNested + +class SimpleSFixedInt64Message; +using SimpleSFixedInt64MessageRepeated = QList; +namespace SimpleSFixedInt64Message_QtProtobufNested { +enum class QtProtobufFieldEnum; +} // namespace SimpleSFixedInt64Message_QtProtobufNested + +class ComplexMessage; +using ComplexMessageRepeated = QList; +namespace ComplexMessage_QtProtobufNested { +enum class QtProtobufFieldEnum; +} // namespace ComplexMessage_QtProtobufNested + + +class EmptyMessage_QtProtobufData; +class QPB_CUSTOM_EXPORT_NAME_EXPORT EmptyMessage : public QProtobufMessage +{ + Q_GADGET + Q_PROTOBUF_OBJECT + +public: + using QtProtobufFieldEnum = EmptyMessage_QtProtobufNested::QtProtobufFieldEnum; + EmptyMessage(); + ~EmptyMessage(); + EmptyMessage(const EmptyMessage &other); + EmptyMessage &operator =(const EmptyMessage &other); + EmptyMessage(EmptyMessage &&other) noexcept; + EmptyMessage &operator =(EmptyMessage &&other) noexcept; + bool operator ==(const EmptyMessage &other) const; + bool operator !=(const EmptyMessage &other) const; + static void registerTypes(); + +private: + QExplicitlySharedDataPointer dptr; +}; +namespace EmptyMessage_QtProtobufNested { +Q_NAMESPACE_EXPORT(QPB_CUSTOM_EXPORT_NAME_EXPORT) + +} // namespace EmptyMessage_QtProtobufNested + +class SimpleBoolMessage_QtProtobufData; +class QPB_CUSTOM_EXPORT_NAME_EXPORT SimpleBoolMessage : public QProtobufMessage +{ + Q_GADGET + Q_PROTOBUF_OBJECT + Q_PROPERTY(bool testFieldBool READ testFieldBool WRITE setTestFieldBool SCRIPTABLE true) + +public: + using QtProtobufFieldEnum = SimpleBoolMessage_QtProtobufNested::QtProtobufFieldEnum; + SimpleBoolMessage(); + ~SimpleBoolMessage(); + SimpleBoolMessage(const SimpleBoolMessage &other); + SimpleBoolMessage &operator =(const SimpleBoolMessage &other); + SimpleBoolMessage(SimpleBoolMessage &&other) noexcept; + SimpleBoolMessage &operator =(SimpleBoolMessage &&other) noexcept; + bool operator ==(const SimpleBoolMessage &other) const; + bool operator !=(const SimpleBoolMessage &other) const; + + bool testFieldBool() const; + void setTestFieldBool(const bool &testFieldBool); + static void registerTypes(); + +private: + QExplicitlySharedDataPointer dptr; +}; +namespace SimpleBoolMessage_QtProtobufNested { +Q_NAMESPACE_EXPORT(QPB_CUSTOM_EXPORT_NAME_EXPORT) + +enum class QtProtobufFieldEnum { + TestFieldBoolProtoFieldNumber = 1, +}; +Q_ENUM_NS(QtProtobufFieldEnum) + +} // namespace SimpleBoolMessage_QtProtobufNested + +class SimpleIntMessage_QtProtobufData; +class QPB_CUSTOM_EXPORT_NAME_EXPORT SimpleIntMessage : public QProtobufMessage +{ + Q_GADGET + Q_PROTOBUF_OBJECT + Q_PROPERTY(QtProtobuf::int32 testFieldInt READ testFieldInt WRITE setTestFieldInt SCRIPTABLE true) + +public: + using QtProtobufFieldEnum = SimpleIntMessage_QtProtobufNested::QtProtobufFieldEnum; + SimpleIntMessage(); + ~SimpleIntMessage(); + SimpleIntMessage(const SimpleIntMessage &other); + SimpleIntMessage &operator =(const SimpleIntMessage &other); + SimpleIntMessage(SimpleIntMessage &&other) noexcept; + SimpleIntMessage &operator =(SimpleIntMessage &&other) noexcept; + bool operator ==(const SimpleIntMessage &other) const; + bool operator !=(const SimpleIntMessage &other) const; + + QtProtobuf::int32 testFieldInt() const; + void setTestFieldInt(const QtProtobuf::int32 &testFieldInt); + static void registerTypes(); + +private: + QExplicitlySharedDataPointer dptr; +}; +namespace SimpleIntMessage_QtProtobufNested { +Q_NAMESPACE_EXPORT(QPB_CUSTOM_EXPORT_NAME_EXPORT) + +enum class QtProtobufFieldEnum { + TestFieldIntProtoFieldNumber = 1, +}; +Q_ENUM_NS(QtProtobufFieldEnum) + +} // namespace SimpleIntMessage_QtProtobufNested + +class SimpleSIntMessage_QtProtobufData; +class QPB_CUSTOM_EXPORT_NAME_EXPORT SimpleSIntMessage : public QProtobufMessage +{ + Q_GADGET + Q_PROTOBUF_OBJECT + Q_PROPERTY(QtProtobuf::sint32 testFieldInt READ testFieldInt WRITE setTestFieldInt SCRIPTABLE true) + +public: + using QtProtobufFieldEnum = SimpleSIntMessage_QtProtobufNested::QtProtobufFieldEnum; + SimpleSIntMessage(); + ~SimpleSIntMessage(); + SimpleSIntMessage(const SimpleSIntMessage &other); + SimpleSIntMessage &operator =(const SimpleSIntMessage &other); + SimpleSIntMessage(SimpleSIntMessage &&other) noexcept; + SimpleSIntMessage &operator =(SimpleSIntMessage &&other) noexcept; + bool operator ==(const SimpleSIntMessage &other) const; + bool operator !=(const SimpleSIntMessage &other) const; + + QtProtobuf::sint32 testFieldInt() const; + void setTestFieldInt(const QtProtobuf::sint32 &testFieldInt); + static void registerTypes(); + +private: + QExplicitlySharedDataPointer dptr; +}; +namespace SimpleSIntMessage_QtProtobufNested { +Q_NAMESPACE_EXPORT(QPB_CUSTOM_EXPORT_NAME_EXPORT) + +enum class QtProtobufFieldEnum { + TestFieldIntProtoFieldNumber = 1, +}; +Q_ENUM_NS(QtProtobufFieldEnum) + +} // namespace SimpleSIntMessage_QtProtobufNested + +class SimpleUIntMessage_QtProtobufData; +class QPB_CUSTOM_EXPORT_NAME_EXPORT SimpleUIntMessage : public QProtobufMessage +{ + Q_GADGET + Q_PROTOBUF_OBJECT + Q_PROPERTY(QtProtobuf::uint32 testFieldInt READ testFieldInt WRITE setTestFieldInt SCRIPTABLE true) + +public: + using QtProtobufFieldEnum = SimpleUIntMessage_QtProtobufNested::QtProtobufFieldEnum; + SimpleUIntMessage(); + ~SimpleUIntMessage(); + SimpleUIntMessage(const SimpleUIntMessage &other); + SimpleUIntMessage &operator =(const SimpleUIntMessage &other); + SimpleUIntMessage(SimpleUIntMessage &&other) noexcept; + SimpleUIntMessage &operator =(SimpleUIntMessage &&other) noexcept; + bool operator ==(const SimpleUIntMessage &other) const; + bool operator !=(const SimpleUIntMessage &other) const; + + QtProtobuf::uint32 testFieldInt() const; + void setTestFieldInt(const QtProtobuf::uint32 &testFieldInt); + static void registerTypes(); + +private: + QExplicitlySharedDataPointer dptr; +}; +namespace SimpleUIntMessage_QtProtobufNested { +Q_NAMESPACE_EXPORT(QPB_CUSTOM_EXPORT_NAME_EXPORT) + +enum class QtProtobufFieldEnum { + TestFieldIntProtoFieldNumber = 1, +}; +Q_ENUM_NS(QtProtobufFieldEnum) + +} // namespace SimpleUIntMessage_QtProtobufNested + +class SimpleInt64Message_QtProtobufData; +class QPB_CUSTOM_EXPORT_NAME_EXPORT SimpleInt64Message : public QProtobufMessage +{ + Q_GADGET + Q_PROTOBUF_OBJECT + Q_PROPERTY(QtProtobuf::int64 testFieldInt READ testFieldInt WRITE setTestFieldInt SCRIPTABLE false) + +public: + using QtProtobufFieldEnum = SimpleInt64Message_QtProtobufNested::QtProtobufFieldEnum; + SimpleInt64Message(); + ~SimpleInt64Message(); + SimpleInt64Message(const SimpleInt64Message &other); + SimpleInt64Message &operator =(const SimpleInt64Message &other); + SimpleInt64Message(SimpleInt64Message &&other) noexcept; + SimpleInt64Message &operator =(SimpleInt64Message &&other) noexcept; + bool operator ==(const SimpleInt64Message &other) const; + bool operator !=(const SimpleInt64Message &other) const; + + QtProtobuf::int64 testFieldInt() const; + void setTestFieldInt(const QtProtobuf::int64 &testFieldInt); + static void registerTypes(); + +private: + QExplicitlySharedDataPointer dptr; +}; +namespace SimpleInt64Message_QtProtobufNested { +Q_NAMESPACE_EXPORT(QPB_CUSTOM_EXPORT_NAME_EXPORT) + +enum class QtProtobufFieldEnum { + TestFieldIntProtoFieldNumber = 1, +}; +Q_ENUM_NS(QtProtobufFieldEnum) + +} // namespace SimpleInt64Message_QtProtobufNested + +class SimpleSInt64Message_QtProtobufData; +class QPB_CUSTOM_EXPORT_NAME_EXPORT SimpleSInt64Message : public QProtobufMessage +{ + Q_GADGET + Q_PROTOBUF_OBJECT + Q_PROPERTY(QtProtobuf::sint64 testFieldInt READ testFieldInt WRITE setTestFieldInt SCRIPTABLE false) + +public: + using QtProtobufFieldEnum = SimpleSInt64Message_QtProtobufNested::QtProtobufFieldEnum; + SimpleSInt64Message(); + ~SimpleSInt64Message(); + SimpleSInt64Message(const SimpleSInt64Message &other); + SimpleSInt64Message &operator =(const SimpleSInt64Message &other); + SimpleSInt64Message(SimpleSInt64Message &&other) noexcept; + SimpleSInt64Message &operator =(SimpleSInt64Message &&other) noexcept; + bool operator ==(const SimpleSInt64Message &other) const; + bool operator !=(const SimpleSInt64Message &other) const; + + QtProtobuf::sint64 testFieldInt() const; + void setTestFieldInt(const QtProtobuf::sint64 &testFieldInt); + static void registerTypes(); + +private: + QExplicitlySharedDataPointer dptr; +}; +namespace SimpleSInt64Message_QtProtobufNested { +Q_NAMESPACE_EXPORT(QPB_CUSTOM_EXPORT_NAME_EXPORT) + +enum class QtProtobufFieldEnum { + TestFieldIntProtoFieldNumber = 1, +}; +Q_ENUM_NS(QtProtobufFieldEnum) + +} // namespace SimpleSInt64Message_QtProtobufNested + +class SimpleUInt64Message_QtProtobufData; +class QPB_CUSTOM_EXPORT_NAME_EXPORT SimpleUInt64Message : public QProtobufMessage +{ + Q_GADGET + Q_PROTOBUF_OBJECT + Q_PROPERTY(QtProtobuf::uint64 testFieldInt READ testFieldInt WRITE setTestFieldInt SCRIPTABLE true) + +public: + using QtProtobufFieldEnum = SimpleUInt64Message_QtProtobufNested::QtProtobufFieldEnum; + SimpleUInt64Message(); + ~SimpleUInt64Message(); + SimpleUInt64Message(const SimpleUInt64Message &other); + SimpleUInt64Message &operator =(const SimpleUInt64Message &other); + SimpleUInt64Message(SimpleUInt64Message &&other) noexcept; + SimpleUInt64Message &operator =(SimpleUInt64Message &&other) noexcept; + bool operator ==(const SimpleUInt64Message &other) const; + bool operator !=(const SimpleUInt64Message &other) const; + + QtProtobuf::uint64 testFieldInt() const; + void setTestFieldInt(const QtProtobuf::uint64 &testFieldInt); + static void registerTypes(); + +private: + QExplicitlySharedDataPointer dptr; +}; +namespace SimpleUInt64Message_QtProtobufNested { +Q_NAMESPACE_EXPORT(QPB_CUSTOM_EXPORT_NAME_EXPORT) + +enum class QtProtobufFieldEnum { + TestFieldIntProtoFieldNumber = 1, +}; +Q_ENUM_NS(QtProtobufFieldEnum) + +} // namespace SimpleUInt64Message_QtProtobufNested + +class SimpleStringMessage_QtProtobufData; +class QPB_CUSTOM_EXPORT_NAME_EXPORT SimpleStringMessage : public QProtobufMessage +{ + Q_GADGET + Q_PROTOBUF_OBJECT + Q_PROPERTY(QString testFieldString READ testFieldString WRITE setTestFieldString SCRIPTABLE true) + +public: + using QtProtobufFieldEnum = SimpleStringMessage_QtProtobufNested::QtProtobufFieldEnum; + SimpleStringMessage(); + ~SimpleStringMessage(); + SimpleStringMessage(const SimpleStringMessage &other); + SimpleStringMessage &operator =(const SimpleStringMessage &other); + SimpleStringMessage(SimpleStringMessage &&other) noexcept; + SimpleStringMessage &operator =(SimpleStringMessage &&other) noexcept; + bool operator ==(const SimpleStringMessage &other) const; + bool operator !=(const SimpleStringMessage &other) const; + + QString testFieldString() const; + void setTestFieldString(const QString &testFieldString); + static void registerTypes(); + +private: + QExplicitlySharedDataPointer dptr; +}; +namespace SimpleStringMessage_QtProtobufNested { +Q_NAMESPACE_EXPORT(QPB_CUSTOM_EXPORT_NAME_EXPORT) + +enum class QtProtobufFieldEnum { + TestFieldStringProtoFieldNumber = 6, +}; +Q_ENUM_NS(QtProtobufFieldEnum) + +} // namespace SimpleStringMessage_QtProtobufNested + +class SimpleFloatMessage_QtProtobufData; +class QPB_CUSTOM_EXPORT_NAME_EXPORT SimpleFloatMessage : public QProtobufMessage +{ + Q_GADGET + Q_PROTOBUF_OBJECT + Q_PROPERTY(float testFieldFloat READ testFieldFloat WRITE setTestFieldFloat SCRIPTABLE true) + +public: + using QtProtobufFieldEnum = SimpleFloatMessage_QtProtobufNested::QtProtobufFieldEnum; + SimpleFloatMessage(); + ~SimpleFloatMessage(); + SimpleFloatMessage(const SimpleFloatMessage &other); + SimpleFloatMessage &operator =(const SimpleFloatMessage &other); + SimpleFloatMessage(SimpleFloatMessage &&other) noexcept; + SimpleFloatMessage &operator =(SimpleFloatMessage &&other) noexcept; + bool operator ==(const SimpleFloatMessage &other) const; + bool operator !=(const SimpleFloatMessage &other) const; + + float testFieldFloat() const; + void setTestFieldFloat(const float &testFieldFloat); + static void registerTypes(); + +private: + QExplicitlySharedDataPointer dptr; +}; +namespace SimpleFloatMessage_QtProtobufNested { +Q_NAMESPACE_EXPORT(QPB_CUSTOM_EXPORT_NAME_EXPORT) + +enum class QtProtobufFieldEnum { + TestFieldFloatProtoFieldNumber = 7, +}; +Q_ENUM_NS(QtProtobufFieldEnum) + +} // namespace SimpleFloatMessage_QtProtobufNested + +class SimpleDoubleMessage_QtProtobufData; +class QPB_CUSTOM_EXPORT_NAME_EXPORT SimpleDoubleMessage : public QProtobufMessage +{ + Q_GADGET + Q_PROTOBUF_OBJECT + Q_PROPERTY(double testFieldDouble READ testFieldDouble WRITE setTestFieldDouble SCRIPTABLE true) + +public: + using QtProtobufFieldEnum = SimpleDoubleMessage_QtProtobufNested::QtProtobufFieldEnum; + SimpleDoubleMessage(); + ~SimpleDoubleMessage(); + SimpleDoubleMessage(const SimpleDoubleMessage &other); + SimpleDoubleMessage &operator =(const SimpleDoubleMessage &other); + SimpleDoubleMessage(SimpleDoubleMessage &&other) noexcept; + SimpleDoubleMessage &operator =(SimpleDoubleMessage &&other) noexcept; + bool operator ==(const SimpleDoubleMessage &other) const; + bool operator !=(const SimpleDoubleMessage &other) const; + + double testFieldDouble() const; + void setTestFieldDouble(const double &testFieldDouble); + static void registerTypes(); + +private: + QExplicitlySharedDataPointer dptr; +}; +namespace SimpleDoubleMessage_QtProtobufNested { +Q_NAMESPACE_EXPORT(QPB_CUSTOM_EXPORT_NAME_EXPORT) + +enum class QtProtobufFieldEnum { + TestFieldDoubleProtoFieldNumber = 8, +}; +Q_ENUM_NS(QtProtobufFieldEnum) + +} // namespace SimpleDoubleMessage_QtProtobufNested + +class SimpleBytesMessage_QtProtobufData; +class QPB_CUSTOM_EXPORT_NAME_EXPORT SimpleBytesMessage : public QProtobufMessage +{ + Q_GADGET + Q_PROTOBUF_OBJECT + Q_PROPERTY(QByteArray testFieldBytes READ testFieldBytes WRITE setTestFieldBytes SCRIPTABLE true) + +public: + using QtProtobufFieldEnum = SimpleBytesMessage_QtProtobufNested::QtProtobufFieldEnum; + SimpleBytesMessage(); + ~SimpleBytesMessage(); + SimpleBytesMessage(const SimpleBytesMessage &other); + SimpleBytesMessage &operator =(const SimpleBytesMessage &other); + SimpleBytesMessage(SimpleBytesMessage &&other) noexcept; + SimpleBytesMessage &operator =(SimpleBytesMessage &&other) noexcept; + bool operator ==(const SimpleBytesMessage &other) const; + bool operator !=(const SimpleBytesMessage &other) const; + + QByteArray testFieldBytes() const; + void setTestFieldBytes(const QByteArray &testFieldBytes); + static void registerTypes(); + +private: + QExplicitlySharedDataPointer dptr; +}; +namespace SimpleBytesMessage_QtProtobufNested { +Q_NAMESPACE_EXPORT(QPB_CUSTOM_EXPORT_NAME_EXPORT) + +enum class QtProtobufFieldEnum { + TestFieldBytesProtoFieldNumber = 1, +}; +Q_ENUM_NS(QtProtobufFieldEnum) + +} // namespace SimpleBytesMessage_QtProtobufNested + +class SimpleFixedInt32Message_QtProtobufData; +class QPB_CUSTOM_EXPORT_NAME_EXPORT SimpleFixedInt32Message : public QProtobufMessage +{ + Q_GADGET + Q_PROTOBUF_OBJECT + Q_PROPERTY(QtProtobuf::fixed32 testFieldFixedInt32 READ testFieldFixedInt32 WRITE setTestFieldFixedInt32 SCRIPTABLE true) + +public: + using QtProtobufFieldEnum = SimpleFixedInt32Message_QtProtobufNested::QtProtobufFieldEnum; + SimpleFixedInt32Message(); + ~SimpleFixedInt32Message(); + SimpleFixedInt32Message(const SimpleFixedInt32Message &other); + SimpleFixedInt32Message &operator =(const SimpleFixedInt32Message &other); + SimpleFixedInt32Message(SimpleFixedInt32Message &&other) noexcept; + SimpleFixedInt32Message &operator =(SimpleFixedInt32Message &&other) noexcept; + bool operator ==(const SimpleFixedInt32Message &other) const; + bool operator !=(const SimpleFixedInt32Message &other) const; + + QtProtobuf::fixed32 testFieldFixedInt32() const; + void setTestFieldFixedInt32(const QtProtobuf::fixed32 &testFieldFixedInt32); + static void registerTypes(); + +private: + QExplicitlySharedDataPointer dptr; +}; +namespace SimpleFixedInt32Message_QtProtobufNested { +Q_NAMESPACE_EXPORT(QPB_CUSTOM_EXPORT_NAME_EXPORT) + +enum class QtProtobufFieldEnum { + TestFieldFixedInt32ProtoFieldNumber = 1, +}; +Q_ENUM_NS(QtProtobufFieldEnum) + +} // namespace SimpleFixedInt32Message_QtProtobufNested + +class SimpleFixedInt64Message_QtProtobufData; +class QPB_CUSTOM_EXPORT_NAME_EXPORT SimpleFixedInt64Message : public QProtobufMessage +{ + Q_GADGET + Q_PROTOBUF_OBJECT + Q_PROPERTY(QtProtobuf::fixed64 testFieldFixedInt64 READ testFieldFixedInt64 WRITE setTestFieldFixedInt64 SCRIPTABLE false) + +public: + using QtProtobufFieldEnum = SimpleFixedInt64Message_QtProtobufNested::QtProtobufFieldEnum; + SimpleFixedInt64Message(); + ~SimpleFixedInt64Message(); + SimpleFixedInt64Message(const SimpleFixedInt64Message &other); + SimpleFixedInt64Message &operator =(const SimpleFixedInt64Message &other); + SimpleFixedInt64Message(SimpleFixedInt64Message &&other) noexcept; + SimpleFixedInt64Message &operator =(SimpleFixedInt64Message &&other) noexcept; + bool operator ==(const SimpleFixedInt64Message &other) const; + bool operator !=(const SimpleFixedInt64Message &other) const; + + QtProtobuf::fixed64 testFieldFixedInt64() const; + void setTestFieldFixedInt64(const QtProtobuf::fixed64 &testFieldFixedInt64); + static void registerTypes(); + +private: + QExplicitlySharedDataPointer dptr; +}; +namespace SimpleFixedInt64Message_QtProtobufNested { +Q_NAMESPACE_EXPORT(QPB_CUSTOM_EXPORT_NAME_EXPORT) + +enum class QtProtobufFieldEnum { + TestFieldFixedInt64ProtoFieldNumber = 1, +}; +Q_ENUM_NS(QtProtobufFieldEnum) + +} // namespace SimpleFixedInt64Message_QtProtobufNested + +class SimpleSFixedInt32Message_QtProtobufData; +class QPB_CUSTOM_EXPORT_NAME_EXPORT SimpleSFixedInt32Message : public QProtobufMessage +{ + Q_GADGET + Q_PROTOBUF_OBJECT + Q_PROPERTY(QtProtobuf::sfixed32 testFieldFixedInt32 READ testFieldFixedInt32 WRITE setTestFieldFixedInt32 SCRIPTABLE true) + +public: + using QtProtobufFieldEnum = SimpleSFixedInt32Message_QtProtobufNested::QtProtobufFieldEnum; + SimpleSFixedInt32Message(); + ~SimpleSFixedInt32Message(); + SimpleSFixedInt32Message(const SimpleSFixedInt32Message &other); + SimpleSFixedInt32Message &operator =(const SimpleSFixedInt32Message &other); + SimpleSFixedInt32Message(SimpleSFixedInt32Message &&other) noexcept; + SimpleSFixedInt32Message &operator =(SimpleSFixedInt32Message &&other) noexcept; + bool operator ==(const SimpleSFixedInt32Message &other) const; + bool operator !=(const SimpleSFixedInt32Message &other) const; + + QtProtobuf::sfixed32 testFieldFixedInt32() const; + void setTestFieldFixedInt32(const QtProtobuf::sfixed32 &testFieldFixedInt32); + static void registerTypes(); + +private: + QExplicitlySharedDataPointer dptr; +}; +namespace SimpleSFixedInt32Message_QtProtobufNested { +Q_NAMESPACE_EXPORT(QPB_CUSTOM_EXPORT_NAME_EXPORT) + +enum class QtProtobufFieldEnum { + TestFieldFixedInt32ProtoFieldNumber = 1, +}; +Q_ENUM_NS(QtProtobufFieldEnum) + +} // namespace SimpleSFixedInt32Message_QtProtobufNested + +class SimpleSFixedInt64Message_QtProtobufData; +class QPB_CUSTOM_EXPORT_NAME_EXPORT SimpleSFixedInt64Message : public QProtobufMessage +{ + Q_GADGET + Q_PROTOBUF_OBJECT + Q_PROPERTY(QtProtobuf::sfixed64 testFieldFixedInt64 READ testFieldFixedInt64 WRITE setTestFieldFixedInt64 SCRIPTABLE false) + +public: + using QtProtobufFieldEnum = SimpleSFixedInt64Message_QtProtobufNested::QtProtobufFieldEnum; + SimpleSFixedInt64Message(); + ~SimpleSFixedInt64Message(); + SimpleSFixedInt64Message(const SimpleSFixedInt64Message &other); + SimpleSFixedInt64Message &operator =(const SimpleSFixedInt64Message &other); + SimpleSFixedInt64Message(SimpleSFixedInt64Message &&other) noexcept; + SimpleSFixedInt64Message &operator =(SimpleSFixedInt64Message &&other) noexcept; + bool operator ==(const SimpleSFixedInt64Message &other) const; + bool operator !=(const SimpleSFixedInt64Message &other) const; + + QtProtobuf::sfixed64 testFieldFixedInt64() const; + void setTestFieldFixedInt64(const QtProtobuf::sfixed64 &testFieldFixedInt64); + static void registerTypes(); + +private: + QExplicitlySharedDataPointer dptr; +}; +namespace SimpleSFixedInt64Message_QtProtobufNested { +Q_NAMESPACE_EXPORT(QPB_CUSTOM_EXPORT_NAME_EXPORT) + +enum class QtProtobufFieldEnum { + TestFieldFixedInt64ProtoFieldNumber = 1, +}; +Q_ENUM_NS(QtProtobufFieldEnum) + +} // namespace SimpleSFixedInt64Message_QtProtobufNested + +class ComplexMessage_QtProtobufData; +class QPB_CUSTOM_EXPORT_NAME_EXPORT ComplexMessage : public QProtobufMessage +{ + Q_GADGET + Q_PROTOBUF_OBJECT + Q_PROPERTY(QtProtobuf::int32 testFieldInt READ testFieldInt WRITE setTestFieldInt SCRIPTABLE true) + Q_PROPERTY(qtprotobufnamespace::tests::SimpleStringMessage *testComplexField_p READ testComplexField_p WRITE setTestComplexField_p SCRIPTABLE false) + +public: + using QtProtobufFieldEnum = ComplexMessage_QtProtobufNested::QtProtobufFieldEnum; + ComplexMessage(); + ~ComplexMessage(); + ComplexMessage(const ComplexMessage &other); + ComplexMessage &operator =(const ComplexMessage &other); + ComplexMessage(ComplexMessage &&other) noexcept; + ComplexMessage &operator =(ComplexMessage &&other) noexcept; + bool operator ==(const ComplexMessage &other) const; + bool operator !=(const ComplexMessage &other) const; + + QtProtobuf::int32 testFieldInt() const; + + bool hasTestComplexField() const; + SimpleStringMessage &testComplexField() const; + void clearTestComplexField(); + void setTestFieldInt(const QtProtobuf::int32 &testFieldInt); + void setTestComplexField(const SimpleStringMessage &testComplexField); + static void registerTypes(); + +private: + SimpleStringMessage *testComplexField_p() const; + void setTestComplexField_p(SimpleStringMessage *testComplexField); + QExplicitlySharedDataPointer dptr; +}; +namespace ComplexMessage_QtProtobufNested { +Q_NAMESPACE_EXPORT(QPB_CUSTOM_EXPORT_NAME_EXPORT) + +enum class QtProtobufFieldEnum { + TestFieldIntProtoFieldNumber = 1, + TestComplexFieldProtoFieldNumber = 2, +}; +Q_ENUM_NS(QtProtobufFieldEnum) + +} // namespace ComplexMessage_QtProtobufNested +} // namespace qtprotobufnamespace::tests + +Q_DECLARE_METATYPE(qtprotobufnamespace::tests::EmptyMessage) +Q_DECLARE_METATYPE(qtprotobufnamespace::tests::SimpleBoolMessage) +Q_DECLARE_METATYPE(qtprotobufnamespace::tests::SimpleIntMessage) +Q_DECLARE_METATYPE(qtprotobufnamespace::tests::SimpleSIntMessage) +Q_DECLARE_METATYPE(qtprotobufnamespace::tests::SimpleUIntMessage) +Q_DECLARE_METATYPE(qtprotobufnamespace::tests::SimpleInt64Message) +Q_DECLARE_METATYPE(qtprotobufnamespace::tests::SimpleSInt64Message) +Q_DECLARE_METATYPE(qtprotobufnamespace::tests::SimpleUInt64Message) +Q_DECLARE_METATYPE(qtprotobufnamespace::tests::SimpleStringMessage) +Q_DECLARE_METATYPE(qtprotobufnamespace::tests::SimpleFloatMessage) +Q_DECLARE_METATYPE(qtprotobufnamespace::tests::SimpleDoubleMessage) +Q_DECLARE_METATYPE(qtprotobufnamespace::tests::SimpleBytesMessage) +Q_DECLARE_METATYPE(qtprotobufnamespace::tests::SimpleFixedInt32Message) +Q_DECLARE_METATYPE(qtprotobufnamespace::tests::SimpleFixedInt64Message) +Q_DECLARE_METATYPE(qtprotobufnamespace::tests::SimpleSFixedInt32Message) +Q_DECLARE_METATYPE(qtprotobufnamespace::tests::SimpleSFixedInt64Message) +Q_DECLARE_METATYPE(qtprotobufnamespace::tests::ComplexMessage) +#endif // QPROTOBUF_BASICMESSAGES_H diff --git a/tests/auto/protobufgen/data/expected_result/custom-exports/basicmessages_protobuftyperegistrations.cpp b/tests/auto/protobufgen/data/expected_result/custom-exports/basicmessages_protobuftyperegistrations.cpp new file mode 100644 index 00000000..87282948 --- /dev/null +++ b/tests/auto/protobufgen/data/expected_result/custom-exports/basicmessages_protobuftyperegistrations.cpp @@ -0,0 +1,24 @@ +#include +#include "basicmessages.qpb.h" + +namespace qtprotobufnamespace::tests { +static QtProtobuf::ProtoTypeRegistrar ProtoTypeRegistrarEmptyMessage(qRegisterProtobufType); +static QtProtobuf::ProtoTypeRegistrar ProtoTypeRegistrarSimpleBoolMessage(qRegisterProtobufType); +static QtProtobuf::ProtoTypeRegistrar ProtoTypeRegistrarSimpleIntMessage(qRegisterProtobufType); +static QtProtobuf::ProtoTypeRegistrar ProtoTypeRegistrarSimpleSIntMessage(qRegisterProtobufType); +static QtProtobuf::ProtoTypeRegistrar ProtoTypeRegistrarSimpleUIntMessage(qRegisterProtobufType); +static QtProtobuf::ProtoTypeRegistrar ProtoTypeRegistrarSimpleInt64Message(qRegisterProtobufType); +static QtProtobuf::ProtoTypeRegistrar ProtoTypeRegistrarSimpleSInt64Message(qRegisterProtobufType); +static QtProtobuf::ProtoTypeRegistrar ProtoTypeRegistrarSimpleUInt64Message(qRegisterProtobufType); +static QtProtobuf::ProtoTypeRegistrar ProtoTypeRegistrarSimpleStringMessage(qRegisterProtobufType); +static QtProtobuf::ProtoTypeRegistrar ProtoTypeRegistrarSimpleFloatMessage(qRegisterProtobufType); +static QtProtobuf::ProtoTypeRegistrar ProtoTypeRegistrarSimpleDoubleMessage(qRegisterProtobufType); +static QtProtobuf::ProtoTypeRegistrar ProtoTypeRegistrarSimpleBytesMessage(qRegisterProtobufType); +static QtProtobuf::ProtoTypeRegistrar ProtoTypeRegistrarSimpleFixedInt32Message(qRegisterProtobufType); +static QtProtobuf::ProtoTypeRegistrar ProtoTypeRegistrarSimpleFixedInt64Message(qRegisterProtobufType); +static QtProtobuf::ProtoTypeRegistrar ProtoTypeRegistrarSimpleSFixedInt32Message(qRegisterProtobufType); +static QtProtobuf::ProtoTypeRegistrar ProtoTypeRegistrarSimpleSFixedInt64Message(qRegisterProtobufType); +static QtProtobuf::ProtoTypeRegistrar ProtoTypeRegistrarComplexMessage(qRegisterProtobufType); +static bool RegisterBasicmessagesProtobufTypes = [](){ qRegisterProtobufTypes(); return true; }(); +} // namespace qtprotobufnamespace::tests + diff --git a/tests/auto/protobufgen/data/expected_result/custom-exports/tst_qtprotobufgen_custom_exports_gen_exports.qpb.h b/tests/auto/protobufgen/data/expected_result/custom-exports/tst_qtprotobufgen_custom_exports_gen_exports.qpb.h new file mode 100644 index 00000000..9801b748 --- /dev/null +++ b/tests/auto/protobufgen/data/expected_result/custom-exports/tst_qtprotobufgen_custom_exports_gen_exports.qpb.h @@ -0,0 +1,12 @@ +/* This file is autogenerated. DO NOT CHANGE. All changes will be lost */ + +#if defined(QT_SHARED) || !defined(QT_STATIC) +# if defined(QT_BUILD_CUSTOM_EXPORT_NAME_LIB) +# define QPB_CUSTOM_EXPORT_NAME_EXPORT Q_DECL_EXPORT +# else +# define QPB_CUSTOM_EXPORT_NAME_EXPORT Q_DECL_IMPORT +# endif +#else +# define QPB_CUSTOM_EXPORT_NAME_EXPORT +#endif + diff --git a/tests/auto/protobufgen/data/expected_result/no-exports/basicmessages.qpb.cpp b/tests/auto/protobufgen/data/expected_result/no-exports/basicmessages.qpb.cpp new file mode 100644 index 00000000..5ccebf15 --- /dev/null +++ b/tests/auto/protobufgen/data/expected_result/no-exports/basicmessages.qpb.cpp @@ -0,0 +1,2009 @@ +/* This file is autogenerated. DO NOT CHANGE. All changes will be lost */ + +#include "basicmessages.qpb.h" +#include +#include + +namespace qtprotobufnamespace::tests { + +class EmptyMessage_QtProtobufData : public QSharedData +{ +public: + EmptyMessage_QtProtobufData() + : QSharedData() + { + } + + EmptyMessage_QtProtobufData(const EmptyMessage_QtProtobufData &other) + : QSharedData(other) + { + } + +}; + +EmptyMessage::~EmptyMessage() = default; + +static constexpr struct { + QtProtobufPrivate::QProtobufPropertyOrdering::Data data; + const std::array 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::staticPropertyOrdering = { + &qt_protobuf_EmptyMessage_metadata.data +}; + +void EmptyMessage::registerTypes() +{ + qRegisterMetaType(); + qRegisterMetaType(); +} + +EmptyMessage::EmptyMessage() + : QProtobufMessage(&EmptyMessage::staticMetaObject, &EmptyMessage::staticPropertyOrdering), + dptr(new EmptyMessage_QtProtobufData) +{ +} + +EmptyMessage::EmptyMessage(const EmptyMessage &other) + : QProtobufMessage(other), + dptr(other.dptr) +{ +} +EmptyMessage &EmptyMessage::operator =(const EmptyMessage &other) +{ + QProtobufMessage::operator=(other); + dptr = other.dptr; + return *this; +} +EmptyMessage::EmptyMessage(EmptyMessage &&other) noexcept + : QProtobufMessage(std::move(other)), + dptr(std::move(other.dptr)) +{ +} +EmptyMessage &EmptyMessage::operator =(EmptyMessage &&other) noexcept +{ + QProtobufMessage::operator=(std::move(other)); + dptr.swap(other.dptr); + 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); +} + + +class SimpleBoolMessage_QtProtobufData : public QSharedData +{ +public: + SimpleBoolMessage_QtProtobufData() + : QSharedData(), + m_testFieldBool(false) + { + } + + SimpleBoolMessage_QtProtobufData(const SimpleBoolMessage_QtProtobufData &other) + : QSharedData(other), + m_testFieldBool(other.m_testFieldBool) + { + } + + bool m_testFieldBool; +}; + +SimpleBoolMessage::~SimpleBoolMessage() = default; + +static constexpr struct { + QtProtobufPrivate::QProtobufPropertyOrdering::Data data; + const std::array qt_protobuf_SimpleBoolMessage_uint_data; + const char qt_protobuf_SimpleBoolMessage_char_data[59]; +} qt_protobuf_SimpleBoolMessage_metadata { + // data + { + 0, /* = version */ + 1, /* = num fields */ + 2, /* = field number offset */ + 3, /* = property index offset */ + 4, /* = field flags offset */ + 43, /* = message full name length */ + }, + // uint_data + { + // JSON name offsets: + 44, /* = testFieldBool */ + 58, /* = end-of-string-marker */ + // Field numbers: + 1, /* = testFieldBool */ + // Property indices: + 0, /* = testFieldBool */ + // Field flags: + QtProtobufPrivate::NoFlags, /* = testFieldBool */ + }, + // char_data + /* metadata char_data: */ + "qtprotobufnamespace.tests.SimpleBoolMessage\0" /* = full message name */ + /* field char_data: */ + "testFieldBool\0" +}; + +const QtProtobufPrivate::QProtobufPropertyOrdering SimpleBoolMessage::staticPropertyOrdering = { + &qt_protobuf_SimpleBoolMessage_metadata.data +}; + +void SimpleBoolMessage::registerTypes() +{ + qRegisterMetaType(); + qRegisterMetaType(); +} + +SimpleBoolMessage::SimpleBoolMessage() + : QProtobufMessage(&SimpleBoolMessage::staticMetaObject, &SimpleBoolMessage::staticPropertyOrdering), + dptr(new SimpleBoolMessage_QtProtobufData) +{ +} + +SimpleBoolMessage::SimpleBoolMessage(const SimpleBoolMessage &other) + : QProtobufMessage(other), + dptr(other.dptr) +{ +} +SimpleBoolMessage &SimpleBoolMessage::operator =(const SimpleBoolMessage &other) +{ + QProtobufMessage::operator=(other); + dptr = other.dptr; + return *this; +} +SimpleBoolMessage::SimpleBoolMessage(SimpleBoolMessage &&other) noexcept + : QProtobufMessage(std::move(other)), + dptr(std::move(other.dptr)) +{ +} +SimpleBoolMessage &SimpleBoolMessage::operator =(SimpleBoolMessage &&other) noexcept +{ + QProtobufMessage::operator=(std::move(other)); + dptr.swap(other.dptr); + return *this; +} +bool SimpleBoolMessage::operator ==(const SimpleBoolMessage &other) const +{ + return QProtobufMessage::isEqual(*this, other) + && dptr->m_testFieldBool == other.dptr->m_testFieldBool; +} + +bool SimpleBoolMessage::operator !=(const SimpleBoolMessage &other) const +{ + return !this->operator ==(other); +} + +bool SimpleBoolMessage::testFieldBool() const +{ + return dptr->m_testFieldBool; +} + +void SimpleBoolMessage::setTestFieldBool(const bool &testFieldBool) +{ + if (dptr->m_testFieldBool != testFieldBool) { + dptr.detach(); + dptr->m_testFieldBool = testFieldBool; + } +} + + +class SimpleIntMessage_QtProtobufData : public QSharedData +{ +public: + SimpleIntMessage_QtProtobufData() + : QSharedData(), + m_testFieldInt(0) + { + } + + SimpleIntMessage_QtProtobufData(const SimpleIntMessage_QtProtobufData &other) + : QSharedData(other), + m_testFieldInt(other.m_testFieldInt) + { + } + + QtProtobuf::int32 m_testFieldInt; +}; + +SimpleIntMessage::~SimpleIntMessage() = default; + +static constexpr struct { + QtProtobufPrivate::QProtobufPropertyOrdering::Data data; + const std::array qt_protobuf_SimpleIntMessage_uint_data; + const char qt_protobuf_SimpleIntMessage_char_data[57]; +} qt_protobuf_SimpleIntMessage_metadata { + // data + { + 0, /* = version */ + 1, /* = num fields */ + 2, /* = field number offset */ + 3, /* = property index offset */ + 4, /* = field flags offset */ + 42, /* = message full name length */ + }, + // uint_data + { + // JSON name offsets: + 43, /* = testFieldInt */ + 56, /* = end-of-string-marker */ + // Field numbers: + 1, /* = testFieldInt */ + // Property indices: + 0, /* = testFieldInt */ + // Field flags: + QtProtobufPrivate::NoFlags, /* = testFieldInt */ + }, + // char_data + /* metadata char_data: */ + "qtprotobufnamespace.tests.SimpleIntMessage\0" /* = full message name */ + /* field char_data: */ + "testFieldInt\0" +}; + +const QtProtobufPrivate::QProtobufPropertyOrdering SimpleIntMessage::staticPropertyOrdering = { + &qt_protobuf_SimpleIntMessage_metadata.data +}; + +void SimpleIntMessage::registerTypes() +{ + qRegisterMetaType(); + qRegisterMetaType(); +} + +SimpleIntMessage::SimpleIntMessage() + : QProtobufMessage(&SimpleIntMessage::staticMetaObject, &SimpleIntMessage::staticPropertyOrdering), + dptr(new SimpleIntMessage_QtProtobufData) +{ +} + +SimpleIntMessage::SimpleIntMessage(const SimpleIntMessage &other) + : QProtobufMessage(other), + dptr(other.dptr) +{ +} +SimpleIntMessage &SimpleIntMessage::operator =(const SimpleIntMessage &other) +{ + QProtobufMessage::operator=(other); + dptr = other.dptr; + return *this; +} +SimpleIntMessage::SimpleIntMessage(SimpleIntMessage &&other) noexcept + : QProtobufMessage(std::move(other)), + dptr(std::move(other.dptr)) +{ +} +SimpleIntMessage &SimpleIntMessage::operator =(SimpleIntMessage &&other) noexcept +{ + QProtobufMessage::operator=(std::move(other)); + dptr.swap(other.dptr); + return *this; +} +bool SimpleIntMessage::operator ==(const SimpleIntMessage &other) const +{ + return QProtobufMessage::isEqual(*this, other) + && dptr->m_testFieldInt == other.dptr->m_testFieldInt; +} + +bool SimpleIntMessage::operator !=(const SimpleIntMessage &other) const +{ + return !this->operator ==(other); +} + +QtProtobuf::int32 SimpleIntMessage::testFieldInt() const +{ + return dptr->m_testFieldInt; +} + +void SimpleIntMessage::setTestFieldInt(const QtProtobuf::int32 &testFieldInt) +{ + if (dptr->m_testFieldInt != testFieldInt) { + dptr.detach(); + dptr->m_testFieldInt = testFieldInt; + } +} + + +class SimpleSIntMessage_QtProtobufData : public QSharedData +{ +public: + SimpleSIntMessage_QtProtobufData() + : QSharedData(), + m_testFieldInt(0) + { + } + + SimpleSIntMessage_QtProtobufData(const SimpleSIntMessage_QtProtobufData &other) + : QSharedData(other), + m_testFieldInt(other.m_testFieldInt) + { + } + + QtProtobuf::sint32 m_testFieldInt; +}; + +SimpleSIntMessage::~SimpleSIntMessage() = default; + +static constexpr struct { + QtProtobufPrivate::QProtobufPropertyOrdering::Data data; + const std::array qt_protobuf_SimpleSIntMessage_uint_data; + const char qt_protobuf_SimpleSIntMessage_char_data[58]; +} qt_protobuf_SimpleSIntMessage_metadata { + // data + { + 0, /* = version */ + 1, /* = num fields */ + 2, /* = field number offset */ + 3, /* = property index offset */ + 4, /* = field flags offset */ + 43, /* = message full name length */ + }, + // uint_data + { + // JSON name offsets: + 44, /* = testFieldInt */ + 57, /* = end-of-string-marker */ + // Field numbers: + 1, /* = testFieldInt */ + // Property indices: + 0, /* = testFieldInt */ + // Field flags: + QtProtobufPrivate::NoFlags, /* = testFieldInt */ + }, + // char_data + /* metadata char_data: */ + "qtprotobufnamespace.tests.SimpleSIntMessage\0" /* = full message name */ + /* field char_data: */ + "testFieldInt\0" +}; + +const QtProtobufPrivate::QProtobufPropertyOrdering SimpleSIntMessage::staticPropertyOrdering = { + &qt_protobuf_SimpleSIntMessage_metadata.data +}; + +void SimpleSIntMessage::registerTypes() +{ + qRegisterMetaType(); + qRegisterMetaType(); +} + +SimpleSIntMessage::SimpleSIntMessage() + : QProtobufMessage(&SimpleSIntMessage::staticMetaObject, &SimpleSIntMessage::staticPropertyOrdering), + dptr(new SimpleSIntMessage_QtProtobufData) +{ +} + +SimpleSIntMessage::SimpleSIntMessage(const SimpleSIntMessage &other) + : QProtobufMessage(other), + dptr(other.dptr) +{ +} +SimpleSIntMessage &SimpleSIntMessage::operator =(const SimpleSIntMessage &other) +{ + QProtobufMessage::operator=(other); + dptr = other.dptr; + return *this; +} +SimpleSIntMessage::SimpleSIntMessage(SimpleSIntMessage &&other) noexcept + : QProtobufMessage(std::move(other)), + dptr(std::move(other.dptr)) +{ +} +SimpleSIntMessage &SimpleSIntMessage::operator =(SimpleSIntMessage &&other) noexcept +{ + QProtobufMessage::operator=(std::move(other)); + dptr.swap(other.dptr); + return *this; +} +bool SimpleSIntMessage::operator ==(const SimpleSIntMessage &other) const +{ + return QProtobufMessage::isEqual(*this, other) + && dptr->m_testFieldInt == other.dptr->m_testFieldInt; +} + +bool SimpleSIntMessage::operator !=(const SimpleSIntMessage &other) const +{ + return !this->operator ==(other); +} + +QtProtobuf::sint32 SimpleSIntMessage::testFieldInt() const +{ + return dptr->m_testFieldInt; +} + +void SimpleSIntMessage::setTestFieldInt(const QtProtobuf::sint32 &testFieldInt) +{ + if (dptr->m_testFieldInt != testFieldInt) { + dptr.detach(); + dptr->m_testFieldInt = testFieldInt; + } +} + + +class SimpleUIntMessage_QtProtobufData : public QSharedData +{ +public: + SimpleUIntMessage_QtProtobufData() + : QSharedData(), + m_testFieldInt(0) + { + } + + SimpleUIntMessage_QtProtobufData(const SimpleUIntMessage_QtProtobufData &other) + : QSharedData(other), + m_testFieldInt(other.m_testFieldInt) + { + } + + QtProtobuf::uint32 m_testFieldInt; +}; + +SimpleUIntMessage::~SimpleUIntMessage() = default; + +static constexpr struct { + QtProtobufPrivate::QProtobufPropertyOrdering::Data data; + const std::array qt_protobuf_SimpleUIntMessage_uint_data; + const char qt_protobuf_SimpleUIntMessage_char_data[58]; +} qt_protobuf_SimpleUIntMessage_metadata { + // data + { + 0, /* = version */ + 1, /* = num fields */ + 2, /* = field number offset */ + 3, /* = property index offset */ + 4, /* = field flags offset */ + 43, /* = message full name length */ + }, + // uint_data + { + // JSON name offsets: + 44, /* = testFieldInt */ + 57, /* = end-of-string-marker */ + // Field numbers: + 1, /* = testFieldInt */ + // Property indices: + 0, /* = testFieldInt */ + // Field flags: + QtProtobufPrivate::NoFlags, /* = testFieldInt */ + }, + // char_data + /* metadata char_data: */ + "qtprotobufnamespace.tests.SimpleUIntMessage\0" /* = full message name */ + /* field char_data: */ + "testFieldInt\0" +}; + +const QtProtobufPrivate::QProtobufPropertyOrdering SimpleUIntMessage::staticPropertyOrdering = { + &qt_protobuf_SimpleUIntMessage_metadata.data +}; + +void SimpleUIntMessage::registerTypes() +{ + qRegisterMetaType(); + qRegisterMetaType(); +} + +SimpleUIntMessage::SimpleUIntMessage() + : QProtobufMessage(&SimpleUIntMessage::staticMetaObject, &SimpleUIntMessage::staticPropertyOrdering), + dptr(new SimpleUIntMessage_QtProtobufData) +{ +} + +SimpleUIntMessage::SimpleUIntMessage(const SimpleUIntMessage &other) + : QProtobufMessage(other), + dptr(other.dptr) +{ +} +SimpleUIntMessage &SimpleUIntMessage::operator =(const SimpleUIntMessage &other) +{ + QProtobufMessage::operator=(other); + dptr = other.dptr; + return *this; +} +SimpleUIntMessage::SimpleUIntMessage(SimpleUIntMessage &&other) noexcept + : QProtobufMessage(std::move(other)), + dptr(std::move(other.dptr)) +{ +} +SimpleUIntMessage &SimpleUIntMessage::operator =(SimpleUIntMessage &&other) noexcept +{ + QProtobufMessage::operator=(std::move(other)); + dptr.swap(other.dptr); + return *this; +} +bool SimpleUIntMessage::operator ==(const SimpleUIntMessage &other) const +{ + return QProtobufMessage::isEqual(*this, other) + && dptr->m_testFieldInt == other.dptr->m_testFieldInt; +} + +bool SimpleUIntMessage::operator !=(const SimpleUIntMessage &other) const +{ + return !this->operator ==(other); +} + +QtProtobuf::uint32 SimpleUIntMessage::testFieldInt() const +{ + return dptr->m_testFieldInt; +} + +void SimpleUIntMessage::setTestFieldInt(const QtProtobuf::uint32 &testFieldInt) +{ + if (dptr->m_testFieldInt != testFieldInt) { + dptr.detach(); + dptr->m_testFieldInt = testFieldInt; + } +} + + +class SimpleInt64Message_QtProtobufData : public QSharedData +{ +public: + SimpleInt64Message_QtProtobufData() + : QSharedData(), + m_testFieldInt(0) + { + } + + SimpleInt64Message_QtProtobufData(const SimpleInt64Message_QtProtobufData &other) + : QSharedData(other), + m_testFieldInt(other.m_testFieldInt) + { + } + + QtProtobuf::int64 m_testFieldInt; +}; + +SimpleInt64Message::~SimpleInt64Message() = default; + +static constexpr struct { + QtProtobufPrivate::QProtobufPropertyOrdering::Data data; + const std::array qt_protobuf_SimpleInt64Message_uint_data; + const char qt_protobuf_SimpleInt64Message_char_data[59]; +} qt_protobuf_SimpleInt64Message_metadata { + // data + { + 0, /* = version */ + 1, /* = num fields */ + 2, /* = field number offset */ + 3, /* = property index offset */ + 4, /* = field flags offset */ + 44, /* = message full name length */ + }, + // uint_data + { + // JSON name offsets: + 45, /* = testFieldInt */ + 58, /* = end-of-string-marker */ + // Field numbers: + 1, /* = testFieldInt */ + // Property indices: + 0, /* = testFieldInt */ + // Field flags: + QtProtobufPrivate::NoFlags, /* = testFieldInt */ + }, + // char_data + /* metadata char_data: */ + "qtprotobufnamespace.tests.SimpleInt64Message\0" /* = full message name */ + /* field char_data: */ + "testFieldInt\0" +}; + +const QtProtobufPrivate::QProtobufPropertyOrdering SimpleInt64Message::staticPropertyOrdering = { + &qt_protobuf_SimpleInt64Message_metadata.data +}; + +void SimpleInt64Message::registerTypes() +{ + qRegisterMetaType(); + qRegisterMetaType(); +} + +SimpleInt64Message::SimpleInt64Message() + : QProtobufMessage(&SimpleInt64Message::staticMetaObject, &SimpleInt64Message::staticPropertyOrdering), + dptr(new SimpleInt64Message_QtProtobufData) +{ +} + +SimpleInt64Message::SimpleInt64Message(const SimpleInt64Message &other) + : QProtobufMessage(other), + dptr(other.dptr) +{ +} +SimpleInt64Message &SimpleInt64Message::operator =(const SimpleInt64Message &other) +{ + QProtobufMessage::operator=(other); + dptr = other.dptr; + return *this; +} +SimpleInt64Message::SimpleInt64Message(SimpleInt64Message &&other) noexcept + : QProtobufMessage(std::move(other)), + dptr(std::move(other.dptr)) +{ +} +SimpleInt64Message &SimpleInt64Message::operator =(SimpleInt64Message &&other) noexcept +{ + QProtobufMessage::operator=(std::move(other)); + dptr.swap(other.dptr); + return *this; +} +bool SimpleInt64Message::operator ==(const SimpleInt64Message &other) const +{ + return QProtobufMessage::isEqual(*this, other) + && dptr->m_testFieldInt == other.dptr->m_testFieldInt; +} + +bool SimpleInt64Message::operator !=(const SimpleInt64Message &other) const +{ + return !this->operator ==(other); +} + +QtProtobuf::int64 SimpleInt64Message::testFieldInt() const +{ + return dptr->m_testFieldInt; +} + +void SimpleInt64Message::setTestFieldInt(const QtProtobuf::int64 &testFieldInt) +{ + if (dptr->m_testFieldInt != testFieldInt) { + dptr.detach(); + dptr->m_testFieldInt = testFieldInt; + } +} + + +class SimpleSInt64Message_QtProtobufData : public QSharedData +{ +public: + SimpleSInt64Message_QtProtobufData() + : QSharedData(), + m_testFieldInt(0) + { + } + + SimpleSInt64Message_QtProtobufData(const SimpleSInt64Message_QtProtobufData &other) + : QSharedData(other), + m_testFieldInt(other.m_testFieldInt) + { + } + + QtProtobuf::sint64 m_testFieldInt; +}; + +SimpleSInt64Message::~SimpleSInt64Message() = default; + +static constexpr struct { + QtProtobufPrivate::QProtobufPropertyOrdering::Data data; + const std::array qt_protobuf_SimpleSInt64Message_uint_data; + const char qt_protobuf_SimpleSInt64Message_char_data[60]; +} qt_protobuf_SimpleSInt64Message_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, /* = testFieldInt */ + 59, /* = end-of-string-marker */ + // Field numbers: + 1, /* = testFieldInt */ + // Property indices: + 0, /* = testFieldInt */ + // Field flags: + QtProtobufPrivate::NoFlags, /* = testFieldInt */ + }, + // char_data + /* metadata char_data: */ + "qtprotobufnamespace.tests.SimpleSInt64Message\0" /* = full message name */ + /* field char_data: */ + "testFieldInt\0" +}; + +const QtProtobufPrivate::QProtobufPropertyOrdering SimpleSInt64Message::staticPropertyOrdering = { + &qt_protobuf_SimpleSInt64Message_metadata.data +}; + +void SimpleSInt64Message::registerTypes() +{ + qRegisterMetaType(); + qRegisterMetaType(); +} + +SimpleSInt64Message::SimpleSInt64Message() + : QProtobufMessage(&SimpleSInt64Message::staticMetaObject, &SimpleSInt64Message::staticPropertyOrdering), + dptr(new SimpleSInt64Message_QtProtobufData) +{ +} + +SimpleSInt64Message::SimpleSInt64Message(const SimpleSInt64Message &other) + : QProtobufMessage(other), + dptr(other.dptr) +{ +} +SimpleSInt64Message &SimpleSInt64Message::operator =(const SimpleSInt64Message &other) +{ + QProtobufMessage::operator=(other); + dptr = other.dptr; + return *this; +} +SimpleSInt64Message::SimpleSInt64Message(SimpleSInt64Message &&other) noexcept + : QProtobufMessage(std::move(other)), + dptr(std::move(other.dptr)) +{ +} +SimpleSInt64Message &SimpleSInt64Message::operator =(SimpleSInt64Message &&other) noexcept +{ + QProtobufMessage::operator=(std::move(other)); + dptr.swap(other.dptr); + return *this; +} +bool SimpleSInt64Message::operator ==(const SimpleSInt64Message &other) const +{ + return QProtobufMessage::isEqual(*this, other) + && dptr->m_testFieldInt == other.dptr->m_testFieldInt; +} + +bool SimpleSInt64Message::operator !=(const SimpleSInt64Message &other) const +{ + return !this->operator ==(other); +} + +QtProtobuf::sint64 SimpleSInt64Message::testFieldInt() const +{ + return dptr->m_testFieldInt; +} + +void SimpleSInt64Message::setTestFieldInt(const QtProtobuf::sint64 &testFieldInt) +{ + if (dptr->m_testFieldInt != testFieldInt) { + dptr.detach(); + dptr->m_testFieldInt = testFieldInt; + } +} + + +class SimpleUInt64Message_QtProtobufData : public QSharedData +{ +public: + SimpleUInt64Message_QtProtobufData() + : QSharedData(), + m_testFieldInt(0) + { + } + + SimpleUInt64Message_QtProtobufData(const SimpleUInt64Message_QtProtobufData &other) + : QSharedData(other), + m_testFieldInt(other.m_testFieldInt) + { + } + + QtProtobuf::uint64 m_testFieldInt; +}; + +SimpleUInt64Message::~SimpleUInt64Message() = default; + +static constexpr struct { + QtProtobufPrivate::QProtobufPropertyOrdering::Data data; + const std::array qt_protobuf_SimpleUInt64Message_uint_data; + const char qt_protobuf_SimpleUInt64Message_char_data[60]; +} qt_protobuf_SimpleUInt64Message_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, /* = testFieldInt */ + 59, /* = end-of-string-marker */ + // Field numbers: + 1, /* = testFieldInt */ + // Property indices: + 0, /* = testFieldInt */ + // Field flags: + QtProtobufPrivate::NoFlags, /* = testFieldInt */ + }, + // char_data + /* metadata char_data: */ + "qtprotobufnamespace.tests.SimpleUInt64Message\0" /* = full message name */ + /* field char_data: */ + "testFieldInt\0" +}; + +const QtProtobufPrivate::QProtobufPropertyOrdering SimpleUInt64Message::staticPropertyOrdering = { + &qt_protobuf_SimpleUInt64Message_metadata.data +}; + +void SimpleUInt64Message::registerTypes() +{ + qRegisterMetaType(); + qRegisterMetaType(); +} + +SimpleUInt64Message::SimpleUInt64Message() + : QProtobufMessage(&SimpleUInt64Message::staticMetaObject, &SimpleUInt64Message::staticPropertyOrdering), + dptr(new SimpleUInt64Message_QtProtobufData) +{ +} + +SimpleUInt64Message::SimpleUInt64Message(const SimpleUInt64Message &other) + : QProtobufMessage(other), + dptr(other.dptr) +{ +} +SimpleUInt64Message &SimpleUInt64Message::operator =(const SimpleUInt64Message &other) +{ + QProtobufMessage::operator=(other); + dptr = other.dptr; + return *this; +} +SimpleUInt64Message::SimpleUInt64Message(SimpleUInt64Message &&other) noexcept + : QProtobufMessage(std::move(other)), + dptr(std::move(other.dptr)) +{ +} +SimpleUInt64Message &SimpleUInt64Message::operator =(SimpleUInt64Message &&other) noexcept +{ + QProtobufMessage::operator=(std::move(other)); + dptr.swap(other.dptr); + return *this; +} +bool SimpleUInt64Message::operator ==(const SimpleUInt64Message &other) const +{ + return QProtobufMessage::isEqual(*this, other) + && dptr->m_testFieldInt == other.dptr->m_testFieldInt; +} + +bool SimpleUInt64Message::operator !=(const SimpleUInt64Message &other) const +{ + return !this->operator ==(other); +} + +QtProtobuf::uint64 SimpleUInt64Message::testFieldInt() const +{ + return dptr->m_testFieldInt; +} + +void SimpleUInt64Message::setTestFieldInt(const QtProtobuf::uint64 &testFieldInt) +{ + if (dptr->m_testFieldInt != testFieldInt) { + dptr.detach(); + dptr->m_testFieldInt = testFieldInt; + } +} + + +class SimpleStringMessage_QtProtobufData : public QSharedData +{ +public: + SimpleStringMessage_QtProtobufData() + : QSharedData() + { + } + + SimpleStringMessage_QtProtobufData(const SimpleStringMessage_QtProtobufData &other) + : QSharedData(other), + m_testFieldString(other.m_testFieldString) + { + } + + QString m_testFieldString; +}; + +SimpleStringMessage::~SimpleStringMessage() = default; + +static constexpr struct { + QtProtobufPrivate::QProtobufPropertyOrdering::Data data; + const std::array 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::staticPropertyOrdering = { + &qt_protobuf_SimpleStringMessage_metadata.data +}; + +void SimpleStringMessage::registerTypes() +{ + qRegisterMetaType(); + qRegisterMetaType(); +} + +SimpleStringMessage::SimpleStringMessage() + : QProtobufMessage(&SimpleStringMessage::staticMetaObject, &SimpleStringMessage::staticPropertyOrdering), + dptr(new SimpleStringMessage_QtProtobufData) +{ +} + +SimpleStringMessage::SimpleStringMessage(const SimpleStringMessage &other) + : QProtobufMessage(other), + dptr(other.dptr) +{ +} +SimpleStringMessage &SimpleStringMessage::operator =(const SimpleStringMessage &other) +{ + QProtobufMessage::operator=(other); + dptr = other.dptr; + return *this; +} +SimpleStringMessage::SimpleStringMessage(SimpleStringMessage &&other) noexcept + : QProtobufMessage(std::move(other)), + dptr(std::move(other.dptr)) +{ +} +SimpleStringMessage &SimpleStringMessage::operator =(SimpleStringMessage &&other) noexcept +{ + QProtobufMessage::operator=(std::move(other)); + dptr.swap(other.dptr); + return *this; +} +bool SimpleStringMessage::operator ==(const SimpleStringMessage &other) const +{ + return QProtobufMessage::isEqual(*this, other) + && dptr->m_testFieldString == other.dptr->m_testFieldString; +} + +bool SimpleStringMessage::operator !=(const SimpleStringMessage &other) const +{ + return !this->operator ==(other); +} + +QString SimpleStringMessage::testFieldString() const +{ + return dptr->m_testFieldString; +} + +void SimpleStringMessage::setTestFieldString(const QString &testFieldString) +{ + if (dptr->m_testFieldString != testFieldString) { + dptr.detach(); + dptr->m_testFieldString = testFieldString; + } +} + + +class SimpleFloatMessage_QtProtobufData : public QSharedData +{ +public: + SimpleFloatMessage_QtProtobufData() + : QSharedData(), + m_testFieldFloat(0.0) + { + } + + SimpleFloatMessage_QtProtobufData(const SimpleFloatMessage_QtProtobufData &other) + : QSharedData(other), + m_testFieldFloat(other.m_testFieldFloat) + { + } + + float m_testFieldFloat; +}; + +SimpleFloatMessage::~SimpleFloatMessage() = default; + +static constexpr struct { + QtProtobufPrivate::QProtobufPropertyOrdering::Data data; + const std::array qt_protobuf_SimpleFloatMessage_uint_data; + const char qt_protobuf_SimpleFloatMessage_char_data[61]; +} qt_protobuf_SimpleFloatMessage_metadata { + // data + { + 0, /* = version */ + 1, /* = num fields */ + 2, /* = field number offset */ + 3, /* = property index offset */ + 4, /* = field flags offset */ + 44, /* = message full name length */ + }, + // uint_data + { + // JSON name offsets: + 45, /* = testFieldFloat */ + 60, /* = end-of-string-marker */ + // Field numbers: + 7, /* = testFieldFloat */ + // Property indices: + 0, /* = testFieldFloat */ + // Field flags: + QtProtobufPrivate::NoFlags, /* = testFieldFloat */ + }, + // char_data + /* metadata char_data: */ + "qtprotobufnamespace.tests.SimpleFloatMessage\0" /* = full message name */ + /* field char_data: */ + "testFieldFloat\0" +}; + +const QtProtobufPrivate::QProtobufPropertyOrdering SimpleFloatMessage::staticPropertyOrdering = { + &qt_protobuf_SimpleFloatMessage_metadata.data +}; + +void SimpleFloatMessage::registerTypes() +{ + qRegisterMetaType(); + qRegisterMetaType(); +} + +SimpleFloatMessage::SimpleFloatMessage() + : QProtobufMessage(&SimpleFloatMessage::staticMetaObject, &SimpleFloatMessage::staticPropertyOrdering), + dptr(new SimpleFloatMessage_QtProtobufData) +{ +} + +SimpleFloatMessage::SimpleFloatMessage(const SimpleFloatMessage &other) + : QProtobufMessage(other), + dptr(other.dptr) +{ +} +SimpleFloatMessage &SimpleFloatMessage::operator =(const SimpleFloatMessage &other) +{ + QProtobufMessage::operator=(other); + dptr = other.dptr; + return *this; +} +SimpleFloatMessage::SimpleFloatMessage(SimpleFloatMessage &&other) noexcept + : QProtobufMessage(std::move(other)), + dptr(std::move(other.dptr)) +{ +} +SimpleFloatMessage &SimpleFloatMessage::operator =(SimpleFloatMessage &&other) noexcept +{ + QProtobufMessage::operator=(std::move(other)); + dptr.swap(other.dptr); + return *this; +} +bool SimpleFloatMessage::operator ==(const SimpleFloatMessage &other) const +{ + return QProtobufMessage::isEqual(*this, other) + && dptr->m_testFieldFloat == other.dptr->m_testFieldFloat; +} + +bool SimpleFloatMessage::operator !=(const SimpleFloatMessage &other) const +{ + return !this->operator ==(other); +} + +float SimpleFloatMessage::testFieldFloat() const +{ + return dptr->m_testFieldFloat; +} + +void SimpleFloatMessage::setTestFieldFloat(const float &testFieldFloat) +{ + if (dptr->m_testFieldFloat != testFieldFloat || + std::signbit(dptr->m_testFieldFloat) != std::signbit(testFieldFloat)) { + dptr.detach(); + dptr->m_testFieldFloat = testFieldFloat; + } +} + + +class SimpleDoubleMessage_QtProtobufData : public QSharedData +{ +public: + SimpleDoubleMessage_QtProtobufData() + : QSharedData(), + m_testFieldDouble(0.0) + { + } + + SimpleDoubleMessage_QtProtobufData(const SimpleDoubleMessage_QtProtobufData &other) + : QSharedData(other), + m_testFieldDouble(other.m_testFieldDouble) + { + } + + double m_testFieldDouble; +}; + +SimpleDoubleMessage::~SimpleDoubleMessage() = default; + +static constexpr struct { + QtProtobufPrivate::QProtobufPropertyOrdering::Data data; + const std::array qt_protobuf_SimpleDoubleMessage_uint_data; + const char qt_protobuf_SimpleDoubleMessage_char_data[63]; +} qt_protobuf_SimpleDoubleMessage_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, /* = testFieldDouble */ + 62, /* = end-of-string-marker */ + // Field numbers: + 8, /* = testFieldDouble */ + // Property indices: + 0, /* = testFieldDouble */ + // Field flags: + QtProtobufPrivate::NoFlags, /* = testFieldDouble */ + }, + // char_data + /* metadata char_data: */ + "qtprotobufnamespace.tests.SimpleDoubleMessage\0" /* = full message name */ + /* field char_data: */ + "testFieldDouble\0" +}; + +const QtProtobufPrivate::QProtobufPropertyOrdering SimpleDoubleMessage::staticPropertyOrdering = { + &qt_protobuf_SimpleDoubleMessage_metadata.data +}; + +void SimpleDoubleMessage::registerTypes() +{ + qRegisterMetaType(); + qRegisterMetaType(); +} + +SimpleDoubleMessage::SimpleDoubleMessage() + : QProtobufMessage(&SimpleDoubleMessage::staticMetaObject, &SimpleDoubleMessage::staticPropertyOrdering), + dptr(new SimpleDoubleMessage_QtProtobufData) +{ +} + +SimpleDoubleMessage::SimpleDoubleMessage(const SimpleDoubleMessage &other) + : QProtobufMessage(other), + dptr(other.dptr) +{ +} +SimpleDoubleMessage &SimpleDoubleMessage::operator =(const SimpleDoubleMessage &other) +{ + QProtobufMessage::operator=(other); + dptr = other.dptr; + return *this; +} +SimpleDoubleMessage::SimpleDoubleMessage(SimpleDoubleMessage &&other) noexcept + : QProtobufMessage(std::move(other)), + dptr(std::move(other.dptr)) +{ +} +SimpleDoubleMessage &SimpleDoubleMessage::operator =(SimpleDoubleMessage &&other) noexcept +{ + QProtobufMessage::operator=(std::move(other)); + dptr.swap(other.dptr); + return *this; +} +bool SimpleDoubleMessage::operator ==(const SimpleDoubleMessage &other) const +{ + return QProtobufMessage::isEqual(*this, other) + && dptr->m_testFieldDouble == other.dptr->m_testFieldDouble; +} + +bool SimpleDoubleMessage::operator !=(const SimpleDoubleMessage &other) const +{ + return !this->operator ==(other); +} + +double SimpleDoubleMessage::testFieldDouble() const +{ + return dptr->m_testFieldDouble; +} + +void SimpleDoubleMessage::setTestFieldDouble(const double &testFieldDouble) +{ + if (dptr->m_testFieldDouble != testFieldDouble || + std::signbit(dptr->m_testFieldDouble) != std::signbit(testFieldDouble)) { + dptr.detach(); + dptr->m_testFieldDouble = testFieldDouble; + } +} + + +class SimpleBytesMessage_QtProtobufData : public QSharedData +{ +public: + SimpleBytesMessage_QtProtobufData() + : QSharedData() + { + } + + SimpleBytesMessage_QtProtobufData(const SimpleBytesMessage_QtProtobufData &other) + : QSharedData(other), + m_testFieldBytes(other.m_testFieldBytes) + { + } + + QByteArray m_testFieldBytes; +}; + +SimpleBytesMessage::~SimpleBytesMessage() = default; + +static constexpr struct { + QtProtobufPrivate::QProtobufPropertyOrdering::Data data; + const std::array qt_protobuf_SimpleBytesMessage_uint_data; + const char qt_protobuf_SimpleBytesMessage_char_data[61]; +} qt_protobuf_SimpleBytesMessage_metadata { + // data + { + 0, /* = version */ + 1, /* = num fields */ + 2, /* = field number offset */ + 3, /* = property index offset */ + 4, /* = field flags offset */ + 44, /* = message full name length */ + }, + // uint_data + { + // JSON name offsets: + 45, /* = testFieldBytes */ + 60, /* = end-of-string-marker */ + // Field numbers: + 1, /* = testFieldBytes */ + // Property indices: + 0, /* = testFieldBytes */ + // Field flags: + QtProtobufPrivate::NoFlags, /* = testFieldBytes */ + }, + // char_data + /* metadata char_data: */ + "qtprotobufnamespace.tests.SimpleBytesMessage\0" /* = full message name */ + /* field char_data: */ + "testFieldBytes\0" +}; + +const QtProtobufPrivate::QProtobufPropertyOrdering SimpleBytesMessage::staticPropertyOrdering = { + &qt_protobuf_SimpleBytesMessage_metadata.data +}; + +void SimpleBytesMessage::registerTypes() +{ + qRegisterMetaType(); + qRegisterMetaType(); +} + +SimpleBytesMessage::SimpleBytesMessage() + : QProtobufMessage(&SimpleBytesMessage::staticMetaObject, &SimpleBytesMessage::staticPropertyOrdering), + dptr(new SimpleBytesMessage_QtProtobufData) +{ +} + +SimpleBytesMessage::SimpleBytesMessage(const SimpleBytesMessage &other) + : QProtobufMessage(other), + dptr(other.dptr) +{ +} +SimpleBytesMessage &SimpleBytesMessage::operator =(const SimpleBytesMessage &other) +{ + QProtobufMessage::operator=(other); + dptr = other.dptr; + return *this; +} +SimpleBytesMessage::SimpleBytesMessage(SimpleBytesMessage &&other) noexcept + : QProtobufMessage(std::move(other)), + dptr(std::move(other.dptr)) +{ +} +SimpleBytesMessage &SimpleBytesMessage::operator =(SimpleBytesMessage &&other) noexcept +{ + QProtobufMessage::operator=(std::move(other)); + dptr.swap(other.dptr); + return *this; +} +bool SimpleBytesMessage::operator ==(const SimpleBytesMessage &other) const +{ + return QProtobufMessage::isEqual(*this, other) + && dptr->m_testFieldBytes == other.dptr->m_testFieldBytes; +} + +bool SimpleBytesMessage::operator !=(const SimpleBytesMessage &other) const +{ + return !this->operator ==(other); +} + +QByteArray SimpleBytesMessage::testFieldBytes() const +{ + return dptr->m_testFieldBytes; +} + +void SimpleBytesMessage::setTestFieldBytes(const QByteArray &testFieldBytes) +{ + if (dptr->m_testFieldBytes != testFieldBytes) { + dptr.detach(); + dptr->m_testFieldBytes = testFieldBytes; + } +} + + +class SimpleFixedInt32Message_QtProtobufData : public QSharedData +{ +public: + SimpleFixedInt32Message_QtProtobufData() + : QSharedData(), + m_testFieldFixedInt32(0) + { + } + + SimpleFixedInt32Message_QtProtobufData(const SimpleFixedInt32Message_QtProtobufData &other) + : QSharedData(other), + m_testFieldFixedInt32(other.m_testFieldFixedInt32) + { + } + + QtProtobuf::fixed32 m_testFieldFixedInt32; +}; + +SimpleFixedInt32Message::~SimpleFixedInt32Message() = default; + +static constexpr struct { + QtProtobufPrivate::QProtobufPropertyOrdering::Data data; + const std::array qt_protobuf_SimpleFixedInt32Message_uint_data; + const char qt_protobuf_SimpleFixedInt32Message_char_data[71]; +} qt_protobuf_SimpleFixedInt32Message_metadata { + // data + { + 0, /* = version */ + 1, /* = num fields */ + 2, /* = field number offset */ + 3, /* = property index offset */ + 4, /* = field flags offset */ + 49, /* = message full name length */ + }, + // uint_data + { + // JSON name offsets: + 50, /* = testFieldFixedInt32 */ + 70, /* = end-of-string-marker */ + // Field numbers: + 1, /* = testFieldFixedInt32 */ + // Property indices: + 0, /* = testFieldFixedInt32 */ + // Field flags: + QtProtobufPrivate::NoFlags, /* = testFieldFixedInt32 */ + }, + // char_data + /* metadata char_data: */ + "qtprotobufnamespace.tests.SimpleFixedInt32Message\0" /* = full message name */ + /* field char_data: */ + "testFieldFixedInt32\0" +}; + +const QtProtobufPrivate::QProtobufPropertyOrdering SimpleFixedInt32Message::staticPropertyOrdering = { + &qt_protobuf_SimpleFixedInt32Message_metadata.data +}; + +void SimpleFixedInt32Message::registerTypes() +{ + qRegisterMetaType(); + qRegisterMetaType(); +} + +SimpleFixedInt32Message::SimpleFixedInt32Message() + : QProtobufMessage(&SimpleFixedInt32Message::staticMetaObject, &SimpleFixedInt32Message::staticPropertyOrdering), + dptr(new SimpleFixedInt32Message_QtProtobufData) +{ +} + +SimpleFixedInt32Message::SimpleFixedInt32Message(const SimpleFixedInt32Message &other) + : QProtobufMessage(other), + dptr(other.dptr) +{ +} +SimpleFixedInt32Message &SimpleFixedInt32Message::operator =(const SimpleFixedInt32Message &other) +{ + QProtobufMessage::operator=(other); + dptr = other.dptr; + return *this; +} +SimpleFixedInt32Message::SimpleFixedInt32Message(SimpleFixedInt32Message &&other) noexcept + : QProtobufMessage(std::move(other)), + dptr(std::move(other.dptr)) +{ +} +SimpleFixedInt32Message &SimpleFixedInt32Message::operator =(SimpleFixedInt32Message &&other) noexcept +{ + QProtobufMessage::operator=(std::move(other)); + dptr.swap(other.dptr); + return *this; +} +bool SimpleFixedInt32Message::operator ==(const SimpleFixedInt32Message &other) const +{ + return QProtobufMessage::isEqual(*this, other) + && dptr->m_testFieldFixedInt32 == other.dptr->m_testFieldFixedInt32; +} + +bool SimpleFixedInt32Message::operator !=(const SimpleFixedInt32Message &other) const +{ + return !this->operator ==(other); +} + +QtProtobuf::fixed32 SimpleFixedInt32Message::testFieldFixedInt32() const +{ + return dptr->m_testFieldFixedInt32; +} + +void SimpleFixedInt32Message::setTestFieldFixedInt32(const QtProtobuf::fixed32 &testFieldFixedInt32) +{ + if (dptr->m_testFieldFixedInt32 != testFieldFixedInt32) { + dptr.detach(); + dptr->m_testFieldFixedInt32 = testFieldFixedInt32; + } +} + + +class SimpleFixedInt64Message_QtProtobufData : public QSharedData +{ +public: + SimpleFixedInt64Message_QtProtobufData() + : QSharedData(), + m_testFieldFixedInt64(0) + { + } + + SimpleFixedInt64Message_QtProtobufData(const SimpleFixedInt64Message_QtProtobufData &other) + : QSharedData(other), + m_testFieldFixedInt64(other.m_testFieldFixedInt64) + { + } + + QtProtobuf::fixed64 m_testFieldFixedInt64; +}; + +SimpleFixedInt64Message::~SimpleFixedInt64Message() = default; + +static constexpr struct { + QtProtobufPrivate::QProtobufPropertyOrdering::Data data; + const std::array qt_protobuf_SimpleFixedInt64Message_uint_data; + const char qt_protobuf_SimpleFixedInt64Message_char_data[71]; +} qt_protobuf_SimpleFixedInt64Message_metadata { + // data + { + 0, /* = version */ + 1, /* = num fields */ + 2, /* = field number offset */ + 3, /* = property index offset */ + 4, /* = field flags offset */ + 49, /* = message full name length */ + }, + // uint_data + { + // JSON name offsets: + 50, /* = testFieldFixedInt64 */ + 70, /* = end-of-string-marker */ + // Field numbers: + 1, /* = testFieldFixedInt64 */ + // Property indices: + 0, /* = testFieldFixedInt64 */ + // Field flags: + QtProtobufPrivate::NoFlags, /* = testFieldFixedInt64 */ + }, + // char_data + /* metadata char_data: */ + "qtprotobufnamespace.tests.SimpleFixedInt64Message\0" /* = full message name */ + /* field char_data: */ + "testFieldFixedInt64\0" +}; + +const QtProtobufPrivate::QProtobufPropertyOrdering SimpleFixedInt64Message::staticPropertyOrdering = { + &qt_protobuf_SimpleFixedInt64Message_metadata.data +}; + +void SimpleFixedInt64Message::registerTypes() +{ + qRegisterMetaType(); + qRegisterMetaType(); +} + +SimpleFixedInt64Message::SimpleFixedInt64Message() + : QProtobufMessage(&SimpleFixedInt64Message::staticMetaObject, &SimpleFixedInt64Message::staticPropertyOrdering), + dptr(new SimpleFixedInt64Message_QtProtobufData) +{ +} + +SimpleFixedInt64Message::SimpleFixedInt64Message(const SimpleFixedInt64Message &other) + : QProtobufMessage(other), + dptr(other.dptr) +{ +} +SimpleFixedInt64Message &SimpleFixedInt64Message::operator =(const SimpleFixedInt64Message &other) +{ + QProtobufMessage::operator=(other); + dptr = other.dptr; + return *this; +} +SimpleFixedInt64Message::SimpleFixedInt64Message(SimpleFixedInt64Message &&other) noexcept + : QProtobufMessage(std::move(other)), + dptr(std::move(other.dptr)) +{ +} +SimpleFixedInt64Message &SimpleFixedInt64Message::operator =(SimpleFixedInt64Message &&other) noexcept +{ + QProtobufMessage::operator=(std::move(other)); + dptr.swap(other.dptr); + return *this; +} +bool SimpleFixedInt64Message::operator ==(const SimpleFixedInt64Message &other) const +{ + return QProtobufMessage::isEqual(*this, other) + && dptr->m_testFieldFixedInt64 == other.dptr->m_testFieldFixedInt64; +} + +bool SimpleFixedInt64Message::operator !=(const SimpleFixedInt64Message &other) const +{ + return !this->operator ==(other); +} + +QtProtobuf::fixed64 SimpleFixedInt64Message::testFieldFixedInt64() const +{ + return dptr->m_testFieldFixedInt64; +} + +void SimpleFixedInt64Message::setTestFieldFixedInt64(const QtProtobuf::fixed64 &testFieldFixedInt64) +{ + if (dptr->m_testFieldFixedInt64 != testFieldFixedInt64) { + dptr.detach(); + dptr->m_testFieldFixedInt64 = testFieldFixedInt64; + } +} + + +class SimpleSFixedInt32Message_QtProtobufData : public QSharedData +{ +public: + SimpleSFixedInt32Message_QtProtobufData() + : QSharedData() + { + } + + SimpleSFixedInt32Message_QtProtobufData(const SimpleSFixedInt32Message_QtProtobufData &other) + : QSharedData(other), + m_testFieldFixedInt32(other.m_testFieldFixedInt32) + { + } + + QtProtobuf::sfixed32 m_testFieldFixedInt32; +}; + +SimpleSFixedInt32Message::~SimpleSFixedInt32Message() = default; + +static constexpr struct { + QtProtobufPrivate::QProtobufPropertyOrdering::Data data; + const std::array qt_protobuf_SimpleSFixedInt32Message_uint_data; + const char qt_protobuf_SimpleSFixedInt32Message_char_data[72]; +} qt_protobuf_SimpleSFixedInt32Message_metadata { + // data + { + 0, /* = version */ + 1, /* = num fields */ + 2, /* = field number offset */ + 3, /* = property index offset */ + 4, /* = field flags offset */ + 50, /* = message full name length */ + }, + // uint_data + { + // JSON name offsets: + 51, /* = testFieldFixedInt32 */ + 71, /* = end-of-string-marker */ + // Field numbers: + 1, /* = testFieldFixedInt32 */ + // Property indices: + 0, /* = testFieldFixedInt32 */ + // Field flags: + QtProtobufPrivate::NoFlags, /* = testFieldFixedInt32 */ + }, + // char_data + /* metadata char_data: */ + "qtprotobufnamespace.tests.SimpleSFixedInt32Message\0" /* = full message name */ + /* field char_data: */ + "testFieldFixedInt32\0" +}; + +const QtProtobufPrivate::QProtobufPropertyOrdering SimpleSFixedInt32Message::staticPropertyOrdering = { + &qt_protobuf_SimpleSFixedInt32Message_metadata.data +}; + +void SimpleSFixedInt32Message::registerTypes() +{ + qRegisterMetaType(); + qRegisterMetaType(); +} + +SimpleSFixedInt32Message::SimpleSFixedInt32Message() + : QProtobufMessage(&SimpleSFixedInt32Message::staticMetaObject, &SimpleSFixedInt32Message::staticPropertyOrdering), + dptr(new SimpleSFixedInt32Message_QtProtobufData) +{ +} + +SimpleSFixedInt32Message::SimpleSFixedInt32Message(const SimpleSFixedInt32Message &other) + : QProtobufMessage(other), + dptr(other.dptr) +{ +} +SimpleSFixedInt32Message &SimpleSFixedInt32Message::operator =(const SimpleSFixedInt32Message &other) +{ + QProtobufMessage::operator=(other); + dptr = other.dptr; + return *this; +} +SimpleSFixedInt32Message::SimpleSFixedInt32Message(SimpleSFixedInt32Message &&other) noexcept + : QProtobufMessage(std::move(other)), + dptr(std::move(other.dptr)) +{ +} +SimpleSFixedInt32Message &SimpleSFixedInt32Message::operator =(SimpleSFixedInt32Message &&other) noexcept +{ + QProtobufMessage::operator=(std::move(other)); + dptr.swap(other.dptr); + return *this; +} +bool SimpleSFixedInt32Message::operator ==(const SimpleSFixedInt32Message &other) const +{ + return QProtobufMessage::isEqual(*this, other) + && dptr->m_testFieldFixedInt32 == other.dptr->m_testFieldFixedInt32; +} + +bool SimpleSFixedInt32Message::operator !=(const SimpleSFixedInt32Message &other) const +{ + return !this->operator ==(other); +} + +QtProtobuf::sfixed32 SimpleSFixedInt32Message::testFieldFixedInt32() const +{ + return dptr->m_testFieldFixedInt32; +} + +void SimpleSFixedInt32Message::setTestFieldFixedInt32(const QtProtobuf::sfixed32 &testFieldFixedInt32) +{ + if (dptr->m_testFieldFixedInt32 != testFieldFixedInt32) { + dptr.detach(); + dptr->m_testFieldFixedInt32 = testFieldFixedInt32; + } +} + + +class SimpleSFixedInt64Message_QtProtobufData : public QSharedData +{ +public: + SimpleSFixedInt64Message_QtProtobufData() + : QSharedData() + { + } + + SimpleSFixedInt64Message_QtProtobufData(const SimpleSFixedInt64Message_QtProtobufData &other) + : QSharedData(other), + m_testFieldFixedInt64(other.m_testFieldFixedInt64) + { + } + + QtProtobuf::sfixed64 m_testFieldFixedInt64; +}; + +SimpleSFixedInt64Message::~SimpleSFixedInt64Message() = default; + +static constexpr struct { + QtProtobufPrivate::QProtobufPropertyOrdering::Data data; + const std::array qt_protobuf_SimpleSFixedInt64Message_uint_data; + const char qt_protobuf_SimpleSFixedInt64Message_char_data[72]; +} qt_protobuf_SimpleSFixedInt64Message_metadata { + // data + { + 0, /* = version */ + 1, /* = num fields */ + 2, /* = field number offset */ + 3, /* = property index offset */ + 4, /* = field flags offset */ + 50, /* = message full name length */ + }, + // uint_data + { + // JSON name offsets: + 51, /* = testFieldFixedInt64 */ + 71, /* = end-of-string-marker */ + // Field numbers: + 1, /* = testFieldFixedInt64 */ + // Property indices: + 0, /* = testFieldFixedInt64 */ + // Field flags: + QtProtobufPrivate::NoFlags, /* = testFieldFixedInt64 */ + }, + // char_data + /* metadata char_data: */ + "qtprotobufnamespace.tests.SimpleSFixedInt64Message\0" /* = full message name */ + /* field char_data: */ + "testFieldFixedInt64\0" +}; + +const QtProtobufPrivate::QProtobufPropertyOrdering SimpleSFixedInt64Message::staticPropertyOrdering = { + &qt_protobuf_SimpleSFixedInt64Message_metadata.data +}; + +void SimpleSFixedInt64Message::registerTypes() +{ + qRegisterMetaType(); + qRegisterMetaType(); +} + +SimpleSFixedInt64Message::SimpleSFixedInt64Message() + : QProtobufMessage(&SimpleSFixedInt64Message::staticMetaObject, &SimpleSFixedInt64Message::staticPropertyOrdering), + dptr(new SimpleSFixedInt64Message_QtProtobufData) +{ +} + +SimpleSFixedInt64Message::SimpleSFixedInt64Message(const SimpleSFixedInt64Message &other) + : QProtobufMessage(other), + dptr(other.dptr) +{ +} +SimpleSFixedInt64Message &SimpleSFixedInt64Message::operator =(const SimpleSFixedInt64Message &other) +{ + QProtobufMessage::operator=(other); + dptr = other.dptr; + return *this; +} +SimpleSFixedInt64Message::SimpleSFixedInt64Message(SimpleSFixedInt64Message &&other) noexcept + : QProtobufMessage(std::move(other)), + dptr(std::move(other.dptr)) +{ +} +SimpleSFixedInt64Message &SimpleSFixedInt64Message::operator =(SimpleSFixedInt64Message &&other) noexcept +{ + QProtobufMessage::operator=(std::move(other)); + dptr.swap(other.dptr); + return *this; +} +bool SimpleSFixedInt64Message::operator ==(const SimpleSFixedInt64Message &other) const +{ + return QProtobufMessage::isEqual(*this, other) + && dptr->m_testFieldFixedInt64 == other.dptr->m_testFieldFixedInt64; +} + +bool SimpleSFixedInt64Message::operator !=(const SimpleSFixedInt64Message &other) const +{ + return !this->operator ==(other); +} + +QtProtobuf::sfixed64 SimpleSFixedInt64Message::testFieldFixedInt64() const +{ + return dptr->m_testFieldFixedInt64; +} + +void SimpleSFixedInt64Message::setTestFieldFixedInt64(const QtProtobuf::sfixed64 &testFieldFixedInt64) +{ + if (dptr->m_testFieldFixedInt64 != testFieldFixedInt64) { + dptr.detach(); + dptr->m_testFieldFixedInt64 = testFieldFixedInt64; + } +} + + +class ComplexMessage_QtProtobufData : public QSharedData +{ +public: + ComplexMessage_QtProtobufData() + : QSharedData(), + m_testFieldInt(0), + m_testComplexField(nullptr) + { + } + + ComplexMessage_QtProtobufData(const ComplexMessage_QtProtobufData &other) + : QSharedData(other), + m_testFieldInt(other.m_testFieldInt), + m_testComplexField(other.m_testComplexField + ? new SimpleStringMessage(*other.m_testComplexField) + : nullptr) + { + } + + QtProtobuf::int32 m_testFieldInt; + QtProtobufPrivate::QProtobufLazyMessagePointer m_testComplexField; +}; + +ComplexMessage::~ComplexMessage() = default; + +static constexpr struct { + QtProtobufPrivate::QProtobufPropertyOrdering::Data data; + const std::array 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::staticPropertyOrdering = { + &qt_protobuf_ComplexMessage_metadata.data +}; + +void ComplexMessage::registerTypes() +{ + qRegisterMetaType(); + qRegisterMetaType(); +} + +ComplexMessage::ComplexMessage() + : QProtobufMessage(&ComplexMessage::staticMetaObject, &ComplexMessage::staticPropertyOrdering), + dptr(new ComplexMessage_QtProtobufData) +{ +} + +ComplexMessage::ComplexMessage(const ComplexMessage &other) + : QProtobufMessage(other), + dptr(other.dptr) +{ +} +ComplexMessage &ComplexMessage::operator =(const ComplexMessage &other) +{ + QProtobufMessage::operator=(other); + dptr = other.dptr; + return *this; +} +ComplexMessage::ComplexMessage(ComplexMessage &&other) noexcept + : QProtobufMessage(std::move(other)), + dptr(std::move(other.dptr)) +{ +} +ComplexMessage &ComplexMessage::operator =(ComplexMessage &&other) noexcept +{ + QProtobufMessage::operator=(std::move(other)); + dptr.swap(other.dptr); + return *this; +} +bool ComplexMessage::operator ==(const ComplexMessage &other) const +{ + return QProtobufMessage::isEqual(*this, other) + && dptr->m_testFieldInt == other.dptr->m_testFieldInt + && (dptr->m_testComplexField == other.dptr->m_testComplexField + || *dptr->m_testComplexField == *other.dptr->m_testComplexField); +} + +bool ComplexMessage::operator !=(const ComplexMessage &other) const +{ + return !this->operator ==(other); +} + +QtProtobuf::int32 ComplexMessage::testFieldInt() const +{ + return dptr->m_testFieldInt; +} + +SimpleStringMessage *ComplexMessage::testComplexField_p() const +{ + return dptr->m_testComplexField ? dptr->m_testComplexField.get() : nullptr; +} + +bool ComplexMessage::hasTestComplexField() const +{ + return dptr->m_testComplexField.operator bool(); +} + +SimpleStringMessage &ComplexMessage::testComplexField() const +{ + return *dptr->m_testComplexField; +} + +void ComplexMessage::clearTestComplexField() +{ + if (dptr->m_testComplexField) { + dptr.detach(); + dptr->m_testComplexField.reset(); + } +} + +void ComplexMessage::setTestFieldInt(const QtProtobuf::int32 &testFieldInt) +{ + if (dptr->m_testFieldInt != testFieldInt) { + dptr.detach(); + dptr->m_testFieldInt = testFieldInt; + } +} + +void ComplexMessage::setTestComplexField_p(SimpleStringMessage *testComplexField) +{ + if (dptr->m_testComplexField.get() != testComplexField) { + dptr.detach(); + dptr->m_testComplexField.reset(testComplexField); + } +} + +void ComplexMessage::setTestComplexField(const SimpleStringMessage &testComplexField) +{ + if (*dptr->m_testComplexField != testComplexField) { + dptr.detach(); + *dptr->m_testComplexField = testComplexField; + } +} + +} // namespace qtprotobufnamespace::tests + +#include "moc_basicmessages.qpb.cpp" diff --git a/tests/auto/protobufgen/data/expected_result/no-exports/basicmessages.qpb.h b/tests/auto/protobufgen/data/expected_result/no-exports/basicmessages.qpb.h new file mode 100644 index 00000000..cd8ed129 --- /dev/null +++ b/tests/auto/protobufgen/data/expected_result/no-exports/basicmessages.qpb.h @@ -0,0 +1,737 @@ +/* This file is autogenerated. DO NOT CHANGE. All changes will be lost */ + +#ifndef QPROTOBUF_BASICMESSAGES_H +#define QPROTOBUF_BASICMESSAGES_H + +#include +#include +#include + +#include +#include + +#include +#include +#include + +#include + + +namespace qtprotobufnamespace::tests { +class EmptyMessage; +using EmptyMessageRepeated = QList; +namespace EmptyMessage_QtProtobufNested { +enum class QtProtobufFieldEnum; +} // namespace EmptyMessage_QtProtobufNested + +class SimpleBoolMessage; +using SimpleBoolMessageRepeated = QList; +namespace SimpleBoolMessage_QtProtobufNested { +enum class QtProtobufFieldEnum; +} // namespace SimpleBoolMessage_QtProtobufNested + +class SimpleIntMessage; +using SimpleIntMessageRepeated = QList; +namespace SimpleIntMessage_QtProtobufNested { +enum class QtProtobufFieldEnum; +} // namespace SimpleIntMessage_QtProtobufNested + +class SimpleSIntMessage; +using SimpleSIntMessageRepeated = QList; +namespace SimpleSIntMessage_QtProtobufNested { +enum class QtProtobufFieldEnum; +} // namespace SimpleSIntMessage_QtProtobufNested + +class SimpleUIntMessage; +using SimpleUIntMessageRepeated = QList; +namespace SimpleUIntMessage_QtProtobufNested { +enum class QtProtobufFieldEnum; +} // namespace SimpleUIntMessage_QtProtobufNested + +class SimpleInt64Message; +using SimpleInt64MessageRepeated = QList; +namespace SimpleInt64Message_QtProtobufNested { +enum class QtProtobufFieldEnum; +} // namespace SimpleInt64Message_QtProtobufNested + +class SimpleSInt64Message; +using SimpleSInt64MessageRepeated = QList; +namespace SimpleSInt64Message_QtProtobufNested { +enum class QtProtobufFieldEnum; +} // namespace SimpleSInt64Message_QtProtobufNested + +class SimpleUInt64Message; +using SimpleUInt64MessageRepeated = QList; +namespace SimpleUInt64Message_QtProtobufNested { +enum class QtProtobufFieldEnum; +} // namespace SimpleUInt64Message_QtProtobufNested + +class SimpleStringMessage; +using SimpleStringMessageRepeated = QList; +namespace SimpleStringMessage_QtProtobufNested { +enum class QtProtobufFieldEnum; +} // namespace SimpleStringMessage_QtProtobufNested + +class SimpleFloatMessage; +using SimpleFloatMessageRepeated = QList; +namespace SimpleFloatMessage_QtProtobufNested { +enum class QtProtobufFieldEnum; +} // namespace SimpleFloatMessage_QtProtobufNested + +class SimpleDoubleMessage; +using SimpleDoubleMessageRepeated = QList; +namespace SimpleDoubleMessage_QtProtobufNested { +enum class QtProtobufFieldEnum; +} // namespace SimpleDoubleMessage_QtProtobufNested + +class SimpleBytesMessage; +using SimpleBytesMessageRepeated = QList; +namespace SimpleBytesMessage_QtProtobufNested { +enum class QtProtobufFieldEnum; +} // namespace SimpleBytesMessage_QtProtobufNested + +class SimpleFixedInt32Message; +using SimpleFixedInt32MessageRepeated = QList; +namespace SimpleFixedInt32Message_QtProtobufNested { +enum class QtProtobufFieldEnum; +} // namespace SimpleFixedInt32Message_QtProtobufNested + +class SimpleFixedInt64Message; +using SimpleFixedInt64MessageRepeated = QList; +namespace SimpleFixedInt64Message_QtProtobufNested { +enum class QtProtobufFieldEnum; +} // namespace SimpleFixedInt64Message_QtProtobufNested + +class SimpleSFixedInt32Message; +using SimpleSFixedInt32MessageRepeated = QList; +namespace SimpleSFixedInt32Message_QtProtobufNested { +enum class QtProtobufFieldEnum; +} // namespace SimpleSFixedInt32Message_QtProtobufNested + +class SimpleSFixedInt64Message; +using SimpleSFixedInt64MessageRepeated = QList; +namespace SimpleSFixedInt64Message_QtProtobufNested { +enum class QtProtobufFieldEnum; +} // namespace SimpleSFixedInt64Message_QtProtobufNested + +class ComplexMessage; +using ComplexMessageRepeated = QList; +namespace ComplexMessage_QtProtobufNested { +enum class QtProtobufFieldEnum; +} // namespace ComplexMessage_QtProtobufNested + + +class EmptyMessage_QtProtobufData; +class EmptyMessage : public QProtobufMessage +{ + Q_GADGET + Q_PROTOBUF_OBJECT + +public: + using QtProtobufFieldEnum = EmptyMessage_QtProtobufNested::QtProtobufFieldEnum; + EmptyMessage(); + ~EmptyMessage(); + EmptyMessage(const EmptyMessage &other); + EmptyMessage &operator =(const EmptyMessage &other); + EmptyMessage(EmptyMessage &&other) noexcept; + EmptyMessage &operator =(EmptyMessage &&other) noexcept; + bool operator ==(const EmptyMessage &other) const; + bool operator !=(const EmptyMessage &other) const; + static void registerTypes(); + +private: + QExplicitlySharedDataPointer dptr; +}; +namespace EmptyMessage_QtProtobufNested { +Q_NAMESPACE + +} // namespace EmptyMessage_QtProtobufNested + +class SimpleBoolMessage_QtProtobufData; +class SimpleBoolMessage : public QProtobufMessage +{ + Q_GADGET + Q_PROTOBUF_OBJECT + Q_PROPERTY(bool testFieldBool READ testFieldBool WRITE setTestFieldBool SCRIPTABLE true) + +public: + using QtProtobufFieldEnum = SimpleBoolMessage_QtProtobufNested::QtProtobufFieldEnum; + SimpleBoolMessage(); + ~SimpleBoolMessage(); + SimpleBoolMessage(const SimpleBoolMessage &other); + SimpleBoolMessage &operator =(const SimpleBoolMessage &other); + SimpleBoolMessage(SimpleBoolMessage &&other) noexcept; + SimpleBoolMessage &operator =(SimpleBoolMessage &&other) noexcept; + bool operator ==(const SimpleBoolMessage &other) const; + bool operator !=(const SimpleBoolMessage &other) const; + + bool testFieldBool() const; + void setTestFieldBool(const bool &testFieldBool); + static void registerTypes(); + +private: + QExplicitlySharedDataPointer dptr; +}; +namespace SimpleBoolMessage_QtProtobufNested { +Q_NAMESPACE + +enum class QtProtobufFieldEnum { + TestFieldBoolProtoFieldNumber = 1, +}; +Q_ENUM_NS(QtProtobufFieldEnum) + +} // namespace SimpleBoolMessage_QtProtobufNested + +class SimpleIntMessage_QtProtobufData; +class SimpleIntMessage : public QProtobufMessage +{ + Q_GADGET + Q_PROTOBUF_OBJECT + Q_PROPERTY(QtProtobuf::int32 testFieldInt READ testFieldInt WRITE setTestFieldInt SCRIPTABLE true) + +public: + using QtProtobufFieldEnum = SimpleIntMessage_QtProtobufNested::QtProtobufFieldEnum; + SimpleIntMessage(); + ~SimpleIntMessage(); + SimpleIntMessage(const SimpleIntMessage &other); + SimpleIntMessage &operator =(const SimpleIntMessage &other); + SimpleIntMessage(SimpleIntMessage &&other) noexcept; + SimpleIntMessage &operator =(SimpleIntMessage &&other) noexcept; + bool operator ==(const SimpleIntMessage &other) const; + bool operator !=(const SimpleIntMessage &other) const; + + QtProtobuf::int32 testFieldInt() const; + void setTestFieldInt(const QtProtobuf::int32 &testFieldInt); + static void registerTypes(); + +private: + QExplicitlySharedDataPointer dptr; +}; +namespace SimpleIntMessage_QtProtobufNested { +Q_NAMESPACE + +enum class QtProtobufFieldEnum { + TestFieldIntProtoFieldNumber = 1, +}; +Q_ENUM_NS(QtProtobufFieldEnum) + +} // namespace SimpleIntMessage_QtProtobufNested + +class SimpleSIntMessage_QtProtobufData; +class SimpleSIntMessage : public QProtobufMessage +{ + Q_GADGET + Q_PROTOBUF_OBJECT + Q_PROPERTY(QtProtobuf::sint32 testFieldInt READ testFieldInt WRITE setTestFieldInt SCRIPTABLE true) + +public: + using QtProtobufFieldEnum = SimpleSIntMessage_QtProtobufNested::QtProtobufFieldEnum; + SimpleSIntMessage(); + ~SimpleSIntMessage(); + SimpleSIntMessage(const SimpleSIntMessage &other); + SimpleSIntMessage &operator =(const SimpleSIntMessage &other); + SimpleSIntMessage(SimpleSIntMessage &&other) noexcept; + SimpleSIntMessage &operator =(SimpleSIntMessage &&other) noexcept; + bool operator ==(const SimpleSIntMessage &other) const; + bool operator !=(const SimpleSIntMessage &other) const; + + QtProtobuf::sint32 testFieldInt() const; + void setTestFieldInt(const QtProtobuf::sint32 &testFieldInt); + static void registerTypes(); + +private: + QExplicitlySharedDataPointer dptr; +}; +namespace SimpleSIntMessage_QtProtobufNested { +Q_NAMESPACE + +enum class QtProtobufFieldEnum { + TestFieldIntProtoFieldNumber = 1, +}; +Q_ENUM_NS(QtProtobufFieldEnum) + +} // namespace SimpleSIntMessage_QtProtobufNested + +class SimpleUIntMessage_QtProtobufData; +class SimpleUIntMessage : public QProtobufMessage +{ + Q_GADGET + Q_PROTOBUF_OBJECT + Q_PROPERTY(QtProtobuf::uint32 testFieldInt READ testFieldInt WRITE setTestFieldInt SCRIPTABLE true) + +public: + using QtProtobufFieldEnum = SimpleUIntMessage_QtProtobufNested::QtProtobufFieldEnum; + SimpleUIntMessage(); + ~SimpleUIntMessage(); + SimpleUIntMessage(const SimpleUIntMessage &other); + SimpleUIntMessage &operator =(const SimpleUIntMessage &other); + SimpleUIntMessage(SimpleUIntMessage &&other) noexcept; + SimpleUIntMessage &operator =(SimpleUIntMessage &&other) noexcept; + bool operator ==(const SimpleUIntMessage &other) const; + bool operator !=(const SimpleUIntMessage &other) const; + + QtProtobuf::uint32 testFieldInt() const; + void setTestFieldInt(const QtProtobuf::uint32 &testFieldInt); + static void registerTypes(); + +private: + QExplicitlySharedDataPointer dptr; +}; +namespace SimpleUIntMessage_QtProtobufNested { +Q_NAMESPACE + +enum class QtProtobufFieldEnum { + TestFieldIntProtoFieldNumber = 1, +}; +Q_ENUM_NS(QtProtobufFieldEnum) + +} // namespace SimpleUIntMessage_QtProtobufNested + +class SimpleInt64Message_QtProtobufData; +class SimpleInt64Message : public QProtobufMessage +{ + Q_GADGET + Q_PROTOBUF_OBJECT + Q_PROPERTY(QtProtobuf::int64 testFieldInt READ testFieldInt WRITE setTestFieldInt SCRIPTABLE false) + +public: + using QtProtobufFieldEnum = SimpleInt64Message_QtProtobufNested::QtProtobufFieldEnum; + SimpleInt64Message(); + ~SimpleInt64Message(); + SimpleInt64Message(const SimpleInt64Message &other); + SimpleInt64Message &operator =(const SimpleInt64Message &other); + SimpleInt64Message(SimpleInt64Message &&other) noexcept; + SimpleInt64Message &operator =(SimpleInt64Message &&other) noexcept; + bool operator ==(const SimpleInt64Message &other) const; + bool operator !=(const SimpleInt64Message &other) const; + + QtProtobuf::int64 testFieldInt() const; + void setTestFieldInt(const QtProtobuf::int64 &testFieldInt); + static void registerTypes(); + +private: + QExplicitlySharedDataPointer dptr; +}; +namespace SimpleInt64Message_QtProtobufNested { +Q_NAMESPACE + +enum class QtProtobufFieldEnum { + TestFieldIntProtoFieldNumber = 1, +}; +Q_ENUM_NS(QtProtobufFieldEnum) + +} // namespace SimpleInt64Message_QtProtobufNested + +class SimpleSInt64Message_QtProtobufData; +class SimpleSInt64Message : public QProtobufMessage +{ + Q_GADGET + Q_PROTOBUF_OBJECT + Q_PROPERTY(QtProtobuf::sint64 testFieldInt READ testFieldInt WRITE setTestFieldInt SCRIPTABLE false) + +public: + using QtProtobufFieldEnum = SimpleSInt64Message_QtProtobufNested::QtProtobufFieldEnum; + SimpleSInt64Message(); + ~SimpleSInt64Message(); + SimpleSInt64Message(const SimpleSInt64Message &other); + SimpleSInt64Message &operator =(const SimpleSInt64Message &other); + SimpleSInt64Message(SimpleSInt64Message &&other) noexcept; + SimpleSInt64Message &operator =(SimpleSInt64Message &&other) noexcept; + bool operator ==(const SimpleSInt64Message &other) const; + bool operator !=(const SimpleSInt64Message &other) const; + + QtProtobuf::sint64 testFieldInt() const; + void setTestFieldInt(const QtProtobuf::sint64 &testFieldInt); + static void registerTypes(); + +private: + QExplicitlySharedDataPointer dptr; +}; +namespace SimpleSInt64Message_QtProtobufNested { +Q_NAMESPACE + +enum class QtProtobufFieldEnum { + TestFieldIntProtoFieldNumber = 1, +}; +Q_ENUM_NS(QtProtobufFieldEnum) + +} // namespace SimpleSInt64Message_QtProtobufNested + +class SimpleUInt64Message_QtProtobufData; +class SimpleUInt64Message : public QProtobufMessage +{ + Q_GADGET + Q_PROTOBUF_OBJECT + Q_PROPERTY(QtProtobuf::uint64 testFieldInt READ testFieldInt WRITE setTestFieldInt SCRIPTABLE true) + +public: + using QtProtobufFieldEnum = SimpleUInt64Message_QtProtobufNested::QtProtobufFieldEnum; + SimpleUInt64Message(); + ~SimpleUInt64Message(); + SimpleUInt64Message(const SimpleUInt64Message &other); + SimpleUInt64Message &operator =(const SimpleUInt64Message &other); + SimpleUInt64Message(SimpleUInt64Message &&other) noexcept; + SimpleUInt64Message &operator =(SimpleUInt64Message &&other) noexcept; + bool operator ==(const SimpleUInt64Message &other) const; + bool operator !=(const SimpleUInt64Message &other) const; + + QtProtobuf::uint64 testFieldInt() const; + void setTestFieldInt(const QtProtobuf::uint64 &testFieldInt); + static void registerTypes(); + +private: + QExplicitlySharedDataPointer dptr; +}; +namespace SimpleUInt64Message_QtProtobufNested { +Q_NAMESPACE + +enum class QtProtobufFieldEnum { + TestFieldIntProtoFieldNumber = 1, +}; +Q_ENUM_NS(QtProtobufFieldEnum) + +} // namespace SimpleUInt64Message_QtProtobufNested + +class SimpleStringMessage_QtProtobufData; +class SimpleStringMessage : public QProtobufMessage +{ + Q_GADGET + Q_PROTOBUF_OBJECT + Q_PROPERTY(QString testFieldString READ testFieldString WRITE setTestFieldString SCRIPTABLE true) + +public: + using QtProtobufFieldEnum = SimpleStringMessage_QtProtobufNested::QtProtobufFieldEnum; + SimpleStringMessage(); + ~SimpleStringMessage(); + SimpleStringMessage(const SimpleStringMessage &other); + SimpleStringMessage &operator =(const SimpleStringMessage &other); + SimpleStringMessage(SimpleStringMessage &&other) noexcept; + SimpleStringMessage &operator =(SimpleStringMessage &&other) noexcept; + bool operator ==(const SimpleStringMessage &other) const; + bool operator !=(const SimpleStringMessage &other) const; + + QString testFieldString() const; + void setTestFieldString(const QString &testFieldString); + static void registerTypes(); + +private: + QExplicitlySharedDataPointer dptr; +}; +namespace SimpleStringMessage_QtProtobufNested { +Q_NAMESPACE + +enum class QtProtobufFieldEnum { + TestFieldStringProtoFieldNumber = 6, +}; +Q_ENUM_NS(QtProtobufFieldEnum) + +} // namespace SimpleStringMessage_QtProtobufNested + +class SimpleFloatMessage_QtProtobufData; +class SimpleFloatMessage : public QProtobufMessage +{ + Q_GADGET + Q_PROTOBUF_OBJECT + Q_PROPERTY(float testFieldFloat READ testFieldFloat WRITE setTestFieldFloat SCRIPTABLE true) + +public: + using QtProtobufFieldEnum = SimpleFloatMessage_QtProtobufNested::QtProtobufFieldEnum; + SimpleFloatMessage(); + ~SimpleFloatMessage(); + SimpleFloatMessage(const SimpleFloatMessage &other); + SimpleFloatMessage &operator =(const SimpleFloatMessage &other); + SimpleFloatMessage(SimpleFloatMessage &&other) noexcept; + SimpleFloatMessage &operator =(SimpleFloatMessage &&other) noexcept; + bool operator ==(const SimpleFloatMessage &other) const; + bool operator !=(const SimpleFloatMessage &other) const; + + float testFieldFloat() const; + void setTestFieldFloat(const float &testFieldFloat); + static void registerTypes(); + +private: + QExplicitlySharedDataPointer dptr; +}; +namespace SimpleFloatMessage_QtProtobufNested { +Q_NAMESPACE + +enum class QtProtobufFieldEnum { + TestFieldFloatProtoFieldNumber = 7, +}; +Q_ENUM_NS(QtProtobufFieldEnum) + +} // namespace SimpleFloatMessage_QtProtobufNested + +class SimpleDoubleMessage_QtProtobufData; +class SimpleDoubleMessage : public QProtobufMessage +{ + Q_GADGET + Q_PROTOBUF_OBJECT + Q_PROPERTY(double testFieldDouble READ testFieldDouble WRITE setTestFieldDouble SCRIPTABLE true) + +public: + using QtProtobufFieldEnum = SimpleDoubleMessage_QtProtobufNested::QtProtobufFieldEnum; + SimpleDoubleMessage(); + ~SimpleDoubleMessage(); + SimpleDoubleMessage(const SimpleDoubleMessage &other); + SimpleDoubleMessage &operator =(const SimpleDoubleMessage &other); + SimpleDoubleMessage(SimpleDoubleMessage &&other) noexcept; + SimpleDoubleMessage &operator =(SimpleDoubleMessage &&other) noexcept; + bool operator ==(const SimpleDoubleMessage &other) const; + bool operator !=(const SimpleDoubleMessage &other) const; + + double testFieldDouble() const; + void setTestFieldDouble(const double &testFieldDouble); + static void registerTypes(); + +private: + QExplicitlySharedDataPointer dptr; +}; +namespace SimpleDoubleMessage_QtProtobufNested { +Q_NAMESPACE + +enum class QtProtobufFieldEnum { + TestFieldDoubleProtoFieldNumber = 8, +}; +Q_ENUM_NS(QtProtobufFieldEnum) + +} // namespace SimpleDoubleMessage_QtProtobufNested + +class SimpleBytesMessage_QtProtobufData; +class SimpleBytesMessage : public QProtobufMessage +{ + Q_GADGET + Q_PROTOBUF_OBJECT + Q_PROPERTY(QByteArray testFieldBytes READ testFieldBytes WRITE setTestFieldBytes SCRIPTABLE true) + +public: + using QtProtobufFieldEnum = SimpleBytesMessage_QtProtobufNested::QtProtobufFieldEnum; + SimpleBytesMessage(); + ~SimpleBytesMessage(); + SimpleBytesMessage(const SimpleBytesMessage &other); + SimpleBytesMessage &operator =(const SimpleBytesMessage &other); + SimpleBytesMessage(SimpleBytesMessage &&other) noexcept; + SimpleBytesMessage &operator =(SimpleBytesMessage &&other) noexcept; + bool operator ==(const SimpleBytesMessage &other) const; + bool operator !=(const SimpleBytesMessage &other) const; + + QByteArray testFieldBytes() const; + void setTestFieldBytes(const QByteArray &testFieldBytes); + static void registerTypes(); + +private: + QExplicitlySharedDataPointer dptr; +}; +namespace SimpleBytesMessage_QtProtobufNested { +Q_NAMESPACE + +enum class QtProtobufFieldEnum { + TestFieldBytesProtoFieldNumber = 1, +}; +Q_ENUM_NS(QtProtobufFieldEnum) + +} // namespace SimpleBytesMessage_QtProtobufNested + +class SimpleFixedInt32Message_QtProtobufData; +class SimpleFixedInt32Message : public QProtobufMessage +{ + Q_GADGET + Q_PROTOBUF_OBJECT + Q_PROPERTY(QtProtobuf::fixed32 testFieldFixedInt32 READ testFieldFixedInt32 WRITE setTestFieldFixedInt32 SCRIPTABLE true) + +public: + using QtProtobufFieldEnum = SimpleFixedInt32Message_QtProtobufNested::QtProtobufFieldEnum; + SimpleFixedInt32Message(); + ~SimpleFixedInt32Message(); + SimpleFixedInt32Message(const SimpleFixedInt32Message &other); + SimpleFixedInt32Message &operator =(const SimpleFixedInt32Message &other); + SimpleFixedInt32Message(SimpleFixedInt32Message &&other) noexcept; + SimpleFixedInt32Message &operator =(SimpleFixedInt32Message &&other) noexcept; + bool operator ==(const SimpleFixedInt32Message &other) const; + bool operator !=(const SimpleFixedInt32Message &other) const; + + QtProtobuf::fixed32 testFieldFixedInt32() const; + void setTestFieldFixedInt32(const QtProtobuf::fixed32 &testFieldFixedInt32); + static void registerTypes(); + +private: + QExplicitlySharedDataPointer dptr; +}; +namespace SimpleFixedInt32Message_QtProtobufNested { +Q_NAMESPACE + +enum class QtProtobufFieldEnum { + TestFieldFixedInt32ProtoFieldNumber = 1, +}; +Q_ENUM_NS(QtProtobufFieldEnum) + +} // namespace SimpleFixedInt32Message_QtProtobufNested + +class SimpleFixedInt64Message_QtProtobufData; +class SimpleFixedInt64Message : public QProtobufMessage +{ + Q_GADGET + Q_PROTOBUF_OBJECT + Q_PROPERTY(QtProtobuf::fixed64 testFieldFixedInt64 READ testFieldFixedInt64 WRITE setTestFieldFixedInt64 SCRIPTABLE false) + +public: + using QtProtobufFieldEnum = SimpleFixedInt64Message_QtProtobufNested::QtProtobufFieldEnum; + SimpleFixedInt64Message(); + ~SimpleFixedInt64Message(); + SimpleFixedInt64Message(const SimpleFixedInt64Message &other); + SimpleFixedInt64Message &operator =(const SimpleFixedInt64Message &other); + SimpleFixedInt64Message(SimpleFixedInt64Message &&other) noexcept; + SimpleFixedInt64Message &operator =(SimpleFixedInt64Message &&other) noexcept; + bool operator ==(const SimpleFixedInt64Message &other) const; + bool operator !=(const SimpleFixedInt64Message &other) const; + + QtProtobuf::fixed64 testFieldFixedInt64() const; + void setTestFieldFixedInt64(const QtProtobuf::fixed64 &testFieldFixedInt64); + static void registerTypes(); + +private: + QExplicitlySharedDataPointer dptr; +}; +namespace SimpleFixedInt64Message_QtProtobufNested { +Q_NAMESPACE + +enum class QtProtobufFieldEnum { + TestFieldFixedInt64ProtoFieldNumber = 1, +}; +Q_ENUM_NS(QtProtobufFieldEnum) + +} // namespace SimpleFixedInt64Message_QtProtobufNested + +class SimpleSFixedInt32Message_QtProtobufData; +class SimpleSFixedInt32Message : public QProtobufMessage +{ + Q_GADGET + Q_PROTOBUF_OBJECT + Q_PROPERTY(QtProtobuf::sfixed32 testFieldFixedInt32 READ testFieldFixedInt32 WRITE setTestFieldFixedInt32 SCRIPTABLE true) + +public: + using QtProtobufFieldEnum = SimpleSFixedInt32Message_QtProtobufNested::QtProtobufFieldEnum; + SimpleSFixedInt32Message(); + ~SimpleSFixedInt32Message(); + SimpleSFixedInt32Message(const SimpleSFixedInt32Message &other); + SimpleSFixedInt32Message &operator =(const SimpleSFixedInt32Message &other); + SimpleSFixedInt32Message(SimpleSFixedInt32Message &&other) noexcept; + SimpleSFixedInt32Message &operator =(SimpleSFixedInt32Message &&other) noexcept; + bool operator ==(const SimpleSFixedInt32Message &other) const; + bool operator !=(const SimpleSFixedInt32Message &other) const; + + QtProtobuf::sfixed32 testFieldFixedInt32() const; + void setTestFieldFixedInt32(const QtProtobuf::sfixed32 &testFieldFixedInt32); + static void registerTypes(); + +private: + QExplicitlySharedDataPointer dptr; +}; +namespace SimpleSFixedInt32Message_QtProtobufNested { +Q_NAMESPACE + +enum class QtProtobufFieldEnum { + TestFieldFixedInt32ProtoFieldNumber = 1, +}; +Q_ENUM_NS(QtProtobufFieldEnum) + +} // namespace SimpleSFixedInt32Message_QtProtobufNested + +class SimpleSFixedInt64Message_QtProtobufData; +class SimpleSFixedInt64Message : public QProtobufMessage +{ + Q_GADGET + Q_PROTOBUF_OBJECT + Q_PROPERTY(QtProtobuf::sfixed64 testFieldFixedInt64 READ testFieldFixedInt64 WRITE setTestFieldFixedInt64 SCRIPTABLE false) + +public: + using QtProtobufFieldEnum = SimpleSFixedInt64Message_QtProtobufNested::QtProtobufFieldEnum; + SimpleSFixedInt64Message(); + ~SimpleSFixedInt64Message(); + SimpleSFixedInt64Message(const SimpleSFixedInt64Message &other); + SimpleSFixedInt64Message &operator =(const SimpleSFixedInt64Message &other); + SimpleSFixedInt64Message(SimpleSFixedInt64Message &&other) noexcept; + SimpleSFixedInt64Message &operator =(SimpleSFixedInt64Message &&other) noexcept; + bool operator ==(const SimpleSFixedInt64Message &other) const; + bool operator !=(const SimpleSFixedInt64Message &other) const; + + QtProtobuf::sfixed64 testFieldFixedInt64() const; + void setTestFieldFixedInt64(const QtProtobuf::sfixed64 &testFieldFixedInt64); + static void registerTypes(); + +private: + QExplicitlySharedDataPointer dptr; +}; +namespace SimpleSFixedInt64Message_QtProtobufNested { +Q_NAMESPACE + +enum class QtProtobufFieldEnum { + TestFieldFixedInt64ProtoFieldNumber = 1, +}; +Q_ENUM_NS(QtProtobufFieldEnum) + +} // namespace SimpleSFixedInt64Message_QtProtobufNested + +class ComplexMessage_QtProtobufData; +class ComplexMessage : public QProtobufMessage +{ + Q_GADGET + Q_PROTOBUF_OBJECT + Q_PROPERTY(QtProtobuf::int32 testFieldInt READ testFieldInt WRITE setTestFieldInt SCRIPTABLE true) + Q_PROPERTY(qtprotobufnamespace::tests::SimpleStringMessage *testComplexField_p READ testComplexField_p WRITE setTestComplexField_p SCRIPTABLE false) + +public: + using QtProtobufFieldEnum = ComplexMessage_QtProtobufNested::QtProtobufFieldEnum; + ComplexMessage(); + ~ComplexMessage(); + ComplexMessage(const ComplexMessage &other); + ComplexMessage &operator =(const ComplexMessage &other); + ComplexMessage(ComplexMessage &&other) noexcept; + ComplexMessage &operator =(ComplexMessage &&other) noexcept; + bool operator ==(const ComplexMessage &other) const; + bool operator !=(const ComplexMessage &other) const; + + QtProtobuf::int32 testFieldInt() const; + + bool hasTestComplexField() const; + SimpleStringMessage &testComplexField() const; + void clearTestComplexField(); + void setTestFieldInt(const QtProtobuf::int32 &testFieldInt); + void setTestComplexField(const SimpleStringMessage &testComplexField); + static void registerTypes(); + +private: + SimpleStringMessage *testComplexField_p() const; + void setTestComplexField_p(SimpleStringMessage *testComplexField); + QExplicitlySharedDataPointer dptr; +}; +namespace ComplexMessage_QtProtobufNested { +Q_NAMESPACE + +enum class QtProtobufFieldEnum { + TestFieldIntProtoFieldNumber = 1, + TestComplexFieldProtoFieldNumber = 2, +}; +Q_ENUM_NS(QtProtobufFieldEnum) + +} // namespace ComplexMessage_QtProtobufNested +} // namespace qtprotobufnamespace::tests + +Q_DECLARE_METATYPE(qtprotobufnamespace::tests::EmptyMessage) +Q_DECLARE_METATYPE(qtprotobufnamespace::tests::SimpleBoolMessage) +Q_DECLARE_METATYPE(qtprotobufnamespace::tests::SimpleIntMessage) +Q_DECLARE_METATYPE(qtprotobufnamespace::tests::SimpleSIntMessage) +Q_DECLARE_METATYPE(qtprotobufnamespace::tests::SimpleUIntMessage) +Q_DECLARE_METATYPE(qtprotobufnamespace::tests::SimpleInt64Message) +Q_DECLARE_METATYPE(qtprotobufnamespace::tests::SimpleSInt64Message) +Q_DECLARE_METATYPE(qtprotobufnamespace::tests::SimpleUInt64Message) +Q_DECLARE_METATYPE(qtprotobufnamespace::tests::SimpleStringMessage) +Q_DECLARE_METATYPE(qtprotobufnamespace::tests::SimpleFloatMessage) +Q_DECLARE_METATYPE(qtprotobufnamespace::tests::SimpleDoubleMessage) +Q_DECLARE_METATYPE(qtprotobufnamespace::tests::SimpleBytesMessage) +Q_DECLARE_METATYPE(qtprotobufnamespace::tests::SimpleFixedInt32Message) +Q_DECLARE_METATYPE(qtprotobufnamespace::tests::SimpleFixedInt64Message) +Q_DECLARE_METATYPE(qtprotobufnamespace::tests::SimpleSFixedInt32Message) +Q_DECLARE_METATYPE(qtprotobufnamespace::tests::SimpleSFixedInt64Message) +Q_DECLARE_METATYPE(qtprotobufnamespace::tests::ComplexMessage) +#endif // QPROTOBUF_BASICMESSAGES_H diff --git a/tests/auto/protobufgen/data/expected_result/no-exports/basicmessages_protobuftyperegistrations.cpp b/tests/auto/protobufgen/data/expected_result/no-exports/basicmessages_protobuftyperegistrations.cpp new file mode 100644 index 00000000..87282948 --- /dev/null +++ b/tests/auto/protobufgen/data/expected_result/no-exports/basicmessages_protobuftyperegistrations.cpp @@ -0,0 +1,24 @@ +#include +#include "basicmessages.qpb.h" + +namespace qtprotobufnamespace::tests { +static QtProtobuf::ProtoTypeRegistrar ProtoTypeRegistrarEmptyMessage(qRegisterProtobufType); +static QtProtobuf::ProtoTypeRegistrar ProtoTypeRegistrarSimpleBoolMessage(qRegisterProtobufType); +static QtProtobuf::ProtoTypeRegistrar ProtoTypeRegistrarSimpleIntMessage(qRegisterProtobufType); +static QtProtobuf::ProtoTypeRegistrar ProtoTypeRegistrarSimpleSIntMessage(qRegisterProtobufType); +static QtProtobuf::ProtoTypeRegistrar ProtoTypeRegistrarSimpleUIntMessage(qRegisterProtobufType); +static QtProtobuf::ProtoTypeRegistrar ProtoTypeRegistrarSimpleInt64Message(qRegisterProtobufType); +static QtProtobuf::ProtoTypeRegistrar ProtoTypeRegistrarSimpleSInt64Message(qRegisterProtobufType); +static QtProtobuf::ProtoTypeRegistrar ProtoTypeRegistrarSimpleUInt64Message(qRegisterProtobufType); +static QtProtobuf::ProtoTypeRegistrar ProtoTypeRegistrarSimpleStringMessage(qRegisterProtobufType); +static QtProtobuf::ProtoTypeRegistrar ProtoTypeRegistrarSimpleFloatMessage(qRegisterProtobufType); +static QtProtobuf::ProtoTypeRegistrar ProtoTypeRegistrarSimpleDoubleMessage(qRegisterProtobufType); +static QtProtobuf::ProtoTypeRegistrar ProtoTypeRegistrarSimpleBytesMessage(qRegisterProtobufType); +static QtProtobuf::ProtoTypeRegistrar ProtoTypeRegistrarSimpleFixedInt32Message(qRegisterProtobufType); +static QtProtobuf::ProtoTypeRegistrar ProtoTypeRegistrarSimpleFixedInt64Message(qRegisterProtobufType); +static QtProtobuf::ProtoTypeRegistrar ProtoTypeRegistrarSimpleSFixedInt32Message(qRegisterProtobufType); +static QtProtobuf::ProtoTypeRegistrar ProtoTypeRegistrarSimpleSFixedInt64Message(qRegisterProtobufType); +static QtProtobuf::ProtoTypeRegistrar ProtoTypeRegistrarComplexMessage(qRegisterProtobufType); +static bool RegisterBasicmessagesProtobufTypes = [](){ qRegisterProtobufTypes(); return true; }(); +} // namespace qtprotobufnamespace::tests + diff --git a/tests/auto/protobufgen/tst_qtprotobufgen.cpp b/tests/auto/protobufgen/tst_qtprotobufgen.cpp index 90a106da..b30abdbc 100644 --- a/tests/auto/protobufgen/tst_qtprotobufgen.cpp +++ b/tests/auto/protobufgen/tst_qtprotobufgen.cpp @@ -245,6 +245,16 @@ void tst_qtprotobufgen::cmakeGeneratedFile_data() << "extranamespace" << "/extra-namespace/" << QString(extension); + + QTest::addRow("custom-exports/basicmessages%s", extension.data()) + << "basicmessages" + << "/custom-exports/" + << QString(extension); + + QTest::addRow("no-exports/basicmessages%s", extension.data()) + << "basicmessages" + << "/no-exports/" + << QString(extension); #ifdef HAVE_QML QTest::addRow("nopackage%s", extension.data()) << "nopackage" @@ -252,6 +262,19 @@ void tst_qtprotobufgen::cmakeGeneratedFile_data() << QString(extension); #endif } + + //Check the generating of cpp export files + QTest::addRow("cpp-exports") + << "tst_qtprotobufgen_gen_exports.qpb.h" + << "/folder/" + << QString(); + + QTest::addRow("custom-cpp-exports") + << "tst_qtprotobufgen_custom_exports_gen_exports.qpb.h" + << "/custom-exports/" + << QString(); + + #ifdef HAVE_QML const QLatin1StringView qmlExtensions[] = {cppExtension,