Long live mutable getters

The functionality is desirable by some users, we re-enable it.
New API addresses the core issue that is partially related to
QTBUG-119912, but has wider concequences in blind use in user
projects. We add the 'mut' prefix to all mutable getters to make
the mutable access explicit. Overload approach leads to unwanted
detaches not only whe is used be moc-generated code, but also
in user projects if developers do not pay enough attention to
const modifiers of their variables/references. We declined to
restore it, dispite it was the better looking API, in favor to
the code safety.

This also reveals the code clashing scenario, when the overload
might happen if the message has both 'a' and 'mutA' fields in
its definition. This scenario is kindly forbidden by our generator,
and sanitized at very early stages. We expect that it won't happen
in user projects, but even if it will, the solution is to rename
the field when generating Qt code. The serialization/deserialization
do not depend on field naming directly. json_name attribute also
will help to workaround this.

The undocumented ALLOW_MUTABLE_GETTER_CONFLICTS option allows clashing
the mutable getter names, but its usage currently limited by our
internal code only. The reason unfixed QTBUG-119912 issue in moc.
Once the issue is fixed, the moc version check should get the proper
version, but not '99' as for now and the ALLOW_MUTABLE_GETTER_CONFLICTS
will become public.

Another design solution is the use of overloaded functions that
return pointers, like it's done it the reference protobuf. But this
kind of API leaves the pointer ownership undefined and decided to
not be used.

[ChangeLog][Protobuf] The generated messages now have the mutable
getters for the fiels of the message type. The getters have 'mut'
prefix and implicily allocate the respective fields if needed, so the
use of intermediate message objects is not required.

Task-number: QTBUG-119913
Change-Id: I09b9ee37e1fbbe37b9c3cb501e92442da8ad3e4b
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
This commit is contained in:
Alexey Edelev 2025-03-14 12:40:54 +01:00
parent 4de7b5f2b5
commit d6586d97a1
56 changed files with 842 additions and 29 deletions

View File

@ -0,0 +1,68 @@
// Copyright (C) 2025 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
\page qtprotobuf-mutable-getters.html
\title Qt Protobuf Mutable Getters
\brief The use of mutable getters in \l {Qt Protobuf}
The generated \l {Qt Protobuf} messages allow access to the fields of a
message type using mutable getters. The getters have the \c{mut} prefix and
return a non-const reference to the field.
\badcode
message Point {
double x = 1;
double y = 2;
}
message Line {
Point start = 1;
Point end = 2;
}
\endcode
The above \c{.proto} scheme generates the following code for the \c{Line}
message:
\code
class Line : public QProtobufMessage
{
const Point &start() const &;
Point &mutStart() &;
...
const Point &end() const &;
Point &mutEnd() &;
...
}
\endcode
For the \c{start} and \c{end} fields, the
\l {The qtprotobufgen Tool} {qtprotobufgen} generator creates additional
mutable getters: \c{mutStart} and \c{mutEnd}.
Use these getters to modify fields directly, without creating intermediate
messages:
\code
Line line;
// Setting the line start point to (5.0, 5.0)
line.mutStart().setX(5.0);
line.mutStart().setY(5.0);
// Setting the line end point to (10.0, 20.0)
line.mutEnd().setX(10.0);
line.mutEnd().setY(20.0);
// Display the Line data
qDebug().nospace() << "start: (" << line.start().x() << "," << line.start().y() << ") "
"end: (" << line.end().x() << "," << line.end().y() << ")";
\endcode
Calling the mutable getters performs any necessary field allocation and
allows you to modify the underlying data directly.
\warning Mutable getters add a \c{mut} prefix to field names. If a message
contains fields named \c{field} and \c{mutField}, a naming conflict occurs.
This scenario is currently unsupported and will result in a generator error.
*/

View File

@ -87,6 +87,7 @@
\li \l {Protobuf Qt Core Types Module} {Protobuf Qt Core Types}
\li \l {Protobuf Qt GUI Types Module} {Protobuf Qt GUI Types}
\li \l {Qt Protobuf Well-Known Types C++ Classes} {Qt Protobuf Well-Known types}
\li \l {Qt Protobuf Mutable Getters} {Qt Protobuf Mutable Getters}
\endlist
\section1 References

View File

@ -9,6 +9,7 @@ macro(_qt_internal_get_protoc_common_options option_args single_args multi_args)
COPY_COMMENTS
GENERATE_PACKAGE_SUBFOLDERS
QML
ALLOW_MUTABLE_GETTER_CONFLICTS
)
set(${single_args}
EXTRA_NAMESPACE
@ -352,6 +353,26 @@ function(qt6_add_protobuf target)
_qt_internal_get_protoc_options(generation_options arg
protoc_option_opt protoc_single_opt protoc_multi_opt)
if(arg_ALLOW_MUTABLE_GETTER_CONFLICTS)
set(moc_target ${QT_CMAKE_EXPORT_NAMESPACE}::moc)
if(TARGET ${moc_target})
_qt_internal_dealias_target(moc_target)
get_target_property(moc_version ${moc_target} _qt_package_version)
else()
message(AUTHOR_WARNING "Unable to determine the moc version. Qt installation might be"
" incomplete.")
set(moc_version 0)
endif()
# TODO: The Q_PROPERTY related issue QTBUG-119912 is not fixed, so we prohibit the use of
# ALLOW_MUTABLE_GETTER_CONFLICTS until then. The property will remain undocumented and for
# the internal use only. Replace '99' with the proper Qt version once the issue in moc is
# fixed.
if(moc_version VERSION_LESS 99 AND NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT)
message(FATAL_ERROR "The use of 'ALLOW_MUTABLE_GETTER_CONFLICTS' is prohibited.")
endif()
endif()
if(arg_QML_URI AND NOT arg_QML)
message(FATAL_ERROR "QML_URI requires the QML option set, "
"but the QML argument is not provided.")

View File

@ -284,6 +284,9 @@ void MessageDeclarationPrinter::printGetters()
if (common::isPureMessage(field)) {
m_printer->Print(propertyMap,
CommonTemplates::GetterMessageDeclarationTemplate());
m_printer
->Print(propertyMap,
CommonTemplates::GetterMessageMutableDeclarationTemplate());
m_printer->Print(propertyMap,
Options::instance().hasQml()
? CommonTemplates::ClearQmlMessageDeclarationTemplate()

View File

@ -426,6 +426,9 @@ void MessageDefinitionPrinter::printGetters()
CommonTemplates::PrivateGetterMessageDefinitionTemplate());
m_printer->Print(propertyMap,
CommonTemplates::GetterMessageDefinitionTemplate());
m_printer->Print(propertyMap,
CommonTemplates::GetterMessageMutableDefinitionTemplate());
m_printer->Print(propertyMap,
CommonTemplates::ClearMessageDefinitionTemplate());
} else {

View File

@ -13,6 +13,7 @@
#include "options.h"
#include <cassert>
#include <sstream>
#include <unordered_set>
#include <google/protobuf/stubs/common.h>
@ -33,16 +34,15 @@ QProtobufGenerator::~QProtobufGenerator() = default;
bool QProtobufGenerator::Generate(const FileDescriptor *file,
[[maybe_unused]] const std::string &parameter,
GeneratorContext *generatorContext,
[[maybe_unused]] std::string *error) const
GeneratorContext *generatorContext, std::string *error) const
{
assert(file != nullptr);
assert(generatorContext != nullptr);
return GenerateMessages(file, generatorContext);
return GenerateMessages(file, generatorContext, error);
}
void QProtobufGenerator::GenerateSources(const FileDescriptor *file,
GeneratorContext *generatorContext) const
GeneratorContext *generatorContext, std::string *) const
{
assert(file != nullptr);
assert(generatorContext != nullptr);
@ -109,10 +109,12 @@ void QProtobufGenerator::GenerateSources(const FileDescriptor *file,
}
void QProtobufGenerator::GenerateHeader(const FileDescriptor *file,
GeneratorContext *generatorContext) const
GeneratorContext *generatorContext,
std::string *error) const
{
assert(file != nullptr);
assert(generatorContext != nullptr);
assert(error != nullptr);
const std::string basename = utils::extractFileBasename(file->name()) +
CommonTemplates::ProtoFileSuffix();
@ -155,7 +157,8 @@ void QProtobufGenerator::GenerateHeader(const FileDescriptor *file,
std::unordered_set<std::string> qtTypesSet;
const auto collectSpecialIncludes = [&](const Descriptor *message) {
std::string mutFieldsClashError;
const auto specialMessageHandling = [&](const Descriptor *message) {
if (message->oneof_decl_count() > 0)
externalIncludes.insert("QtProtobuf/qprotobufoneof.h");
@ -165,26 +168,71 @@ void QProtobufGenerator::GenerateHeader(const FileDescriptor *file,
if (message->full_name() == "google.protobuf.Any")
externalIncludes.insert("QtProtobufWellKnownTypes/qprotobufanysupport.h");
for (int i = 0; i < message->field_count(); ++i) {
const auto *field = message->field(i);
if (field->type() == FieldDescriptor::TYPE_MESSAGE && !field->is_map()
&& !field->is_repeated() && common::isQtType(field)) {
const std::string package{ field->message_type()->file()->package() };
externalIncludes.insert(package + "/"
+ std::string{ field->message_type()->name() });
qtTypesSet.insert(package);
}
// We collect the 'mut'-prefixed names of either message fields or
// the respective mutable getters that will be generated. The name
// strings are scoped in lambda and we cannot hold any kind of
// references so store the copy.
std::unordered_set<std::string> mutPrefixedNames;
common::iterateMessageFields(
message, [&](const FieldDescriptor *field, const PropertyMap &propertyMap) {
if (common::isPureMessage(field)) {
const auto getterNameIt = propertyMap.find("mutable_getter_name");
assert(getterNameIt != propertyMap.end());
if (common::isOptionalField(field))
systemIncludes.insert("optional");
}
const auto propertyNameIt = propertyMap.find("property_name");
assert(propertyNameIt != propertyMap.end());
// Ensure mut prefix doesn't lead to the name clashing
if (mutPrefixedNames.find(getterNameIt->second) != mutPrefixedNames.end()
|| mutPrefixedNames.find(propertyNameIt->second)
!= mutPrefixedNames.end()) {
std::ostringstream e;
e << "Message '" << message->full_name() << "': ";
e << "Field '" << field->name() << "' causes a naming conflict";
e << "with a mutable getter. This may lead to unintended behavior.";
e << "Consider reviewing the guidelines for handling mutable getters: ";
e << "https://doc.qt.io/qt-6/qtprotobuf-mutable-getters.html\n";
mutFieldsClashError = e.str();
}
mutPrefixedNames.insert(getterNameIt->second);
// We only care about field names that potentially clash.
if (utils::startsWith(propertyNameIt->second,
CommonTemplates::MutableGetterPrefix()))
mutPrefixedNames.insert(propertyNameIt->second);
}
// Collect the special includes
if (field->type() == FieldDescriptor::TYPE_MESSAGE && !field->is_map()
&& !field->is_repeated() && common::isQtType(field)) {
const std::string package{ field->message_type()->file()->package() };
externalIncludes.insert(package + "/"
+ std::string{ field->message_type()->name() });
qtTypesSet.insert(package);
}
if (common::isOptionalField(field))
systemIncludes.insert("optional");
});
};
common::iterateMessages(file, [&collectSpecialIncludes](const Descriptor *message){
collectSpecialIncludes(message);
common::iterateNestedMessages(message, collectSpecialIncludes);
common::iterateMessages(file, [&specialMessageHandling](const Descriptor *message) {
specialMessageHandling(message);
common::iterateNestedMessages(message,
[&specialMessageHandling](const Descriptor *message) {
specialMessageHandling(message);
});
});
if (!mutFieldsClashError.empty()) {
if (Options::instance().mutableGetterConflicts()) {
std::clog << mutFieldsClashError << std::endl;
} else {
*error += mutFieldsClashError;
return;
}
}
for (const auto &qtTypeInclude: qtTypesSet) {
std::string qtTypeLower = qtTypeInclude;
std::transform(qtTypeLower.begin(), qtTypeLower.end(),
@ -246,15 +294,20 @@ void QProtobufGenerator::GenerateHeader(const FileDescriptor *file,
}
bool QProtobufGenerator::GenerateMessages(const FileDescriptor *file,
GeneratorContext *generatorContext) const
GeneratorContext *generatorContext,
std::string *error) const
{
assert(file != nullptr);
assert(generatorContext != nullptr);
assert(error != nullptr);
if (file->message_type_count() <= 0 && file->enum_type_count() <= 0)
return true;
GenerateHeader(file, generatorContext);
GenerateSources(file, generatorContext);
GenerateHeader(file, generatorContext, error);
if (!error->empty())
return false;
GenerateSources(file, generatorContext, error);
return true;
}

View File

@ -30,11 +30,14 @@ public:
std::string *error) const override;
private:
bool GenerateMessages(const ::google::protobuf::FileDescriptor *file,
::google::protobuf::compiler::GeneratorContext *generatorContext) const;
::google::protobuf::compiler::GeneratorContext *generatorContext,
std::string *error) const;
void GenerateHeader(const ::google::protobuf::FileDescriptor *file,
::google::protobuf::compiler::GeneratorContext *generatorContext) const;
::google::protobuf::compiler::GeneratorContext *generatorContext,
std::string *error) const;
void GenerateSources(const ::google::protobuf::FileDescriptor *file,
::google::protobuf::compiler::GeneratorContext *generatorContext) const;
::google::protobuf::compiler::GeneratorContext *generatorContext,
std::string *error) const;
};
} // namespace QtProtobuf

View File

@ -472,6 +472,7 @@ const char *CommonTemplates::GetterMessageDeclarationTemplate()
return "$export_macro$bool has$property_name_cap$() const;\n"
"$export_macro$const $getter_type$ &$property_name$() const &;\n";
}
const char *CommonTemplates::GetterMessageDefinitionTemplate()
{
return "bool $classname$::has$property_name_cap$() const\n{\n"
@ -483,6 +484,20 @@ const char *CommonTemplates::GetterMessageDefinitionTemplate()
"}\n\n";
}
const char *CommonTemplates::GetterMessageMutableDeclarationTemplate()
{
return "$export_macro$$getter_type$ &$mutable_getter_name$() &;\n";
}
const char *CommonTemplates::GetterMessageMutableDefinitionTemplate()
{
return "$getter_type$ &$classname$::$mutable_getter_name$() &\n"
"{\n"
" dptr.detach();\n"
" return *dptr->m_$property_name$;\n"
"}\n\n";
}
const char *CommonTemplates::GetterComplexDeclarationTemplate()
{
return "$export_macro$const $getter_type$ &$property_name$() const &;\n";
@ -495,6 +510,7 @@ const char *CommonTemplates::GetterComplexDefinitionTemplate()
" return dptr->m_$property_name$;\n"
"}\n\n";
}
const char *CommonTemplates::PrivateGetterOneofDeclarationTemplate()
{
return "$export_macro$$getter_type$ $property_name$_p() const;\n";
@ -1048,3 +1064,8 @@ const char *CommonTemplates::MocIncludeTemplate()
{
return "#include \"$source_file$\"\n";
}
const char *CommonTemplates::MutableGetterPrefix()
{
return "mut";
}

View File

@ -100,6 +100,8 @@ public:
static const char *ClearMessageDefinitionTemplate();
static const char *GetterMessageDeclarationTemplate();
static const char *GetterMessageDefinitionTemplate();
static const char *GetterMessageMutableDeclarationTemplate();
static const char *GetterMessageMutableDefinitionTemplate();
static const char *GetterComplexDeclarationTemplate();
static const char *GetterComplexDefinitionTemplate();
static const char *PrivateGetterOneofDeclarationTemplate();
@ -187,6 +189,8 @@ public:
static const char *QmlNamedElement();
static const char *MocIncludeTemplate();
static const char *MutableGetterPrefix();
};
} // namespace qtprotoccommon

View File

@ -558,6 +558,9 @@ PropertyMap common::producePropertyMap(const FieldDescriptor *field, const Descr
propertyMap["property_name"] = propertyName;
propertyMap["property_name_cap"] = propertyNameCap;
propertyMap["mutable_getter_name"] = CommonTemplates::MutableGetterPrefix();
propertyMap["mutable_getter_name"] += propertyNameCap;
propertyMap["scriptable"] = scriptable;
propertyMap["export_macro"] = common::buildExportMacro();

View File

@ -16,6 +16,7 @@ static const char FieldEnumGenerationOption[] = "FIELD_ENUM";
static const char ExtraNamespaceGenerationOption[] = "EXTRA_NAMESPACE";
static const char ExportMacroGenerationOption[] = "EXPORT_MACRO";
static const char HeaderGuardOption[] = "HEADER_GUARD";
static const char MutableGetterConflicts[] = "ALLOW_MUTABLE_GETTER_CONFLICTS";
static const char ExportSuffix[] = "_exports.qpb.h";
@ -23,7 +24,8 @@ static constexpr std::string_view HeaderGuardPragma = "pragma";
static constexpr std::string_view HeaderGuardProtoFilename = "filename";
Options::Options()
: m_generateComments(false), m_isFolder(false), m_generateFieldEnum(true), m_generateMacroExportFile(false), m_qml(false)
: m_generateComments(false), m_isFolder(false), m_generateFieldEnum(true),
m_generateMacroExportFile(false), m_qml(false), m_mutableGetterConflicts(false)
{
}
@ -111,6 +113,8 @@ void Options::setFromString(const std::string &options, GeneratorType /*unused*/
} else if (headerGuardValue != HeaderGuardProtoFilename) {
QT_PROTOBUF_DEBUG("Unknown HEADER_GUARD option value");
}
} else if (option == MutableGetterConflicts) {
instance.m_mutableGetterConflicts = true;
}
}
}

View File

@ -46,6 +46,7 @@ public:
const std::string &exportMacroFilename() const { return m_exportMacroFilename; }
bool generateMacroExportFile() const { return m_generateMacroExportFile; }
HeaderGuardType headerGuard() const { return m_headerGuard; }
bool mutableGetterConflicts() const { return m_mutableGetterConflicts; }
private:
bool m_generateComments;
@ -56,6 +57,8 @@ private:
std::string m_exportMacroFilename;
bool m_generateMacroExportFile;
bool m_qml;
bool m_mutableGetterConflicts;
HeaderGuardType m_headerGuard = Options::HeaderGuardType::ProtoFilename;
};

View File

@ -43,6 +43,7 @@ private Q_SLOTS:
void moveOperatorTest();
void rvalueSettersTest();
void rvalueOneOfSettersTest();
void mutableGetterTest();
void invalidMessageConstructorTest();
};
@ -594,6 +595,41 @@ void QtProtobufTypesGenerationTest::rvalueOneOfSettersTest()
}
}
void QtProtobufTypesGenerationTest::mutableGetterTest()
{
ComplexMessage complexMsg;
const auto MutableGetterValue = "Value from mutable getter"_L1;
complexMsg.mutTestComplexField().setTestFieldString(MutableGetterValue);
QCOMPARE_EQ(MutableGetterValue, complexMsg.testComplexField().testFieldString());
const auto InitialFieldValue = "Value from standalone field";
SimpleStringMessage complexFieldValue;
complexFieldValue.setTestFieldString(InitialFieldValue);
complexMsg.setTestComplexField(complexFieldValue);
QCOMPARE_EQ(InitialFieldValue, complexMsg.testComplexField().testFieldString());
// Reset the field and ensure that it didn't affect the copied standalone
// field value.
complexMsg.mutTestComplexField().setTestFieldString(MutableGetterValue);
QCOMPARE_EQ(MutableGetterValue, complexMsg.testComplexField().testFieldString());
QCOMPARE_EQ(InitialFieldValue, complexFieldValue.testFieldString());
// Make a shared copy of the complexMsg
ComplexMessage complexMsgCopy(complexMsg);
QCOMPARE_EQ(MutableGetterValue, complexMsgCopy.testComplexField().testFieldString());
QCOMPARE_EQ(complexMsg.testComplexField().testFieldString(),
complexMsgCopy.testComplexField().testFieldString());
// Ensure that mutable getter detaches and the new value is not applied to
// to a shared copy.
const auto NewMutableGetterValue = "New value from mutable getter"_L1;
complexMsg.mutTestComplexField().setTestFieldString(NewMutableGetterValue);
QCOMPARE_EQ(MutableGetterValue, complexMsgCopy.testComplexField().testFieldString());
QCOMPARE_EQ(NewMutableGetterValue, complexMsg.testComplexField().testFieldString());
}
void QtProtobufTypesGenerationTest::invalidMessageConstructorTest()
{
QProtobufMessagePointer message(QProtobufMessage::constructByName(

View File

@ -11,6 +11,7 @@ qt6_add_protobuf(tst_protobuf_syntax_qtprotobuf_gen
PROTO_FILES
../../shared/data/proto/syntax.proto
OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/qt_protobuf_generated"
ALLOW_MUTABLE_GETTER_CONFLICTS
)
qt_autogen_tools_initial_setup(tst_protobuf_syntax_qtprotobuf_gen)

View File

@ -7,6 +7,7 @@
#include <QMetaProperty>
#include <QSignalSpy>
#include <QTest>
#include <QDebug>
#include <qtprotobuftestscommon.h>
@ -21,6 +22,8 @@ private Q_SLOTS:
void reservedEnumTest();
void lowerCaseEnumTest();
void upperCaseEnumTest();
void mutableGetterConflicts();
};
using namespace qtprotobufnamespace::tests;
@ -119,5 +122,27 @@ void QtProtobufSyntaxTest::upperCaseEnumTest()
QCOMPARE(simpleEnum.key(2), "EnumValue2");
}
void QtProtobufSyntaxTest::mutableGetterConflicts()
{
NameClashingMutableGetters msg;
// Set 'data' field for the 'field' field using the mutable getter
msg.mutField().setData(1);
// Set 'data' field for the 'mutField' field using the mutable getter
msg.mutMutField().setData(2);
// Access the immutable 'field' field
QVERIFY(msg.field().data() == 1);
// Access the mutable 'field' field
QVERIFY(msg.mutField().data() == 1);
// Access the immutable 'mutField' field
QVERIFY(std::as_const(msg).mutField().data() == 2);
// Ensure we use the correct value in serialization
QVERIFY(!msg.property("mutField_p").isNull());
QVERIFY(msg.property("mutField_p").value<MutFieldMessage *>()->data() == 2);
}
QTEST_MAIN(QtProtobufSyntaxTest)
#include "tst_protobuf_syntax.moc"

View File

@ -3518,6 +3518,12 @@ const ScalarTypes &MessageTypes::field1() const &
return *dptr->m_field1;
}
ScalarTypes &MessageTypes::mutField1() &
{
dptr.detach();
return *dptr->m_field1;
}
void MessageTypes::clearField1()
{
if (dptr->m_field1) {
@ -3548,6 +3554,12 @@ const ScalarTypes &MessageTypes::field3() const &
return *dptr->m_field3;
}
ScalarTypes &MessageTypes::mutField3() &
{
dptr.detach();
return *dptr->m_field3;
}
void MessageTypes::clearField3()
{
if (dptr->m_field3) {
@ -3916,6 +3928,12 @@ const MessageTypes &NestedMessage::field2() const &
return *dptr->m_field2;
}
MessageTypes &NestedMessage::mutField2() &
{
dptr.detach();
return *dptr->m_field2;
}
void NestedMessage::clearField2()
{
if (dptr->m_field2) {
@ -4068,6 +4086,12 @@ const MessageNestedTypes_QtProtobufNested::NestedMessage &MessageNestedTypes::fi
return *dptr->m_field1;
}
MessageNestedTypes_QtProtobufNested::NestedMessage &MessageNestedTypes::mutField1() &
{
dptr.detach();
return *dptr->m_field1;
}
void MessageNestedTypes::clearField1()
{
if (dptr->m_field1) {

View File

@ -1117,12 +1117,14 @@ public:
QPB_CUSTOM_EXPORT_NAME_EXPORT bool hasField1() const;
QPB_CUSTOM_EXPORT_NAME_EXPORT const ScalarTypes &field1() const &;
QPB_CUSTOM_EXPORT_NAME_EXPORT ScalarTypes &mutField1() &;
QPB_CUSTOM_EXPORT_NAME_EXPORT void clearField1();
QPB_CUSTOM_EXPORT_NAME_EXPORT const QList<ScalarTypes> &field2() const &;
QPB_CUSTOM_EXPORT_NAME_EXPORT bool hasField3() const;
QPB_CUSTOM_EXPORT_NAME_EXPORT const ScalarTypes &field3() const &;
QPB_CUSTOM_EXPORT_NAME_EXPORT ScalarTypes &mutField3() &;
QPB_CUSTOM_EXPORT_NAME_EXPORT void clearField3();
QPB_CUSTOM_EXPORT_NAME_EXPORT EnumTypes_QtProtobufNested::NestedEnum field4() const;
@ -1232,6 +1234,7 @@ public:
QPB_CUSTOM_EXPORT_NAME_EXPORT bool hasField1() const;
QPB_CUSTOM_EXPORT_NAME_EXPORT const MessageNestedTypes_QtProtobufNested::NestedMessage &field1() const &;
QPB_CUSTOM_EXPORT_NAME_EXPORT MessageNestedTypes_QtProtobufNested::NestedMessage &mutField1() &;
QPB_CUSTOM_EXPORT_NAME_EXPORT void clearField1();
QPB_CUSTOM_EXPORT_NAME_EXPORT void setField1(const MessageNestedTypes_QtProtobufNested::NestedMessage &field1);
QPB_CUSTOM_EXPORT_NAME_EXPORT void setField1(MessageNestedTypes_QtProtobufNested::NestedMessage &&field1);
@ -1291,6 +1294,7 @@ public:
QPB_CUSTOM_EXPORT_NAME_EXPORT bool hasField2() const;
QPB_CUSTOM_EXPORT_NAME_EXPORT const MessageTypes &field2() const &;
QPB_CUSTOM_EXPORT_NAME_EXPORT MessageTypes &mutField2() &;
QPB_CUSTOM_EXPORT_NAME_EXPORT void clearField2();
QPB_CUSTOM_EXPORT_NAME_EXPORT void setField1(QtProtobuf::int32 field1);
QPB_CUSTOM_EXPORT_NAME_EXPORT void setField2(const MessageTypes &field2);

View File

@ -3518,6 +3518,12 @@ const ScalarTypes &MessageTypes::field1() const &
return *dptr->m_field1;
}
ScalarTypes &MessageTypes::mutField1() &
{
dptr.detach();
return *dptr->m_field1;
}
void MessageTypes::clearField1()
{
if (dptr->m_field1) {
@ -3548,6 +3554,12 @@ const ScalarTypes &MessageTypes::field3() const &
return *dptr->m_field3;
}
ScalarTypes &MessageTypes::mutField3() &
{
dptr.detach();
return *dptr->m_field3;
}
void MessageTypes::clearField3()
{
if (dptr->m_field3) {
@ -3916,6 +3928,12 @@ const MessageTypes &NestedMessage::field2() const &
return *dptr->m_field2;
}
MessageTypes &NestedMessage::mutField2() &
{
dptr.detach();
return *dptr->m_field2;
}
void NestedMessage::clearField2()
{
if (dptr->m_field2) {
@ -4068,6 +4086,12 @@ const MessageNestedTypes_QtProtobufNested::NestedMessage &MessageNestedTypes::fi
return *dptr->m_field1;
}
MessageNestedTypes_QtProtobufNested::NestedMessage &MessageNestedTypes::mutField1() &
{
dptr.detach();
return *dptr->m_field1;
}
void MessageNestedTypes::clearField1()
{
if (dptr->m_field1) {

View File

@ -1117,12 +1117,14 @@ public:
QPB_TST_QTPROTOBUFGEN_EXTRA_NAMESPACE_EXPORT bool hasField1() const;
QPB_TST_QTPROTOBUFGEN_EXTRA_NAMESPACE_EXPORT const ScalarTypes &field1() const &;
QPB_TST_QTPROTOBUFGEN_EXTRA_NAMESPACE_EXPORT ScalarTypes &mutField1() &;
QPB_TST_QTPROTOBUFGEN_EXTRA_NAMESPACE_EXPORT void clearField1();
QPB_TST_QTPROTOBUFGEN_EXTRA_NAMESPACE_EXPORT const QList<ScalarTypes> &field2() const &;
QPB_TST_QTPROTOBUFGEN_EXTRA_NAMESPACE_EXPORT bool hasField3() const;
QPB_TST_QTPROTOBUFGEN_EXTRA_NAMESPACE_EXPORT const ScalarTypes &field3() const &;
QPB_TST_QTPROTOBUFGEN_EXTRA_NAMESPACE_EXPORT ScalarTypes &mutField3() &;
QPB_TST_QTPROTOBUFGEN_EXTRA_NAMESPACE_EXPORT void clearField3();
QPB_TST_QTPROTOBUFGEN_EXTRA_NAMESPACE_EXPORT EnumTypes_QtProtobufNested::NestedEnum field4() const;
@ -1232,6 +1234,7 @@ public:
QPB_TST_QTPROTOBUFGEN_EXTRA_NAMESPACE_EXPORT bool hasField1() const;
QPB_TST_QTPROTOBUFGEN_EXTRA_NAMESPACE_EXPORT const MessageNestedTypes_QtProtobufNested::NestedMessage &field1() const &;
QPB_TST_QTPROTOBUFGEN_EXTRA_NAMESPACE_EXPORT MessageNestedTypes_QtProtobufNested::NestedMessage &mutField1() &;
QPB_TST_QTPROTOBUFGEN_EXTRA_NAMESPACE_EXPORT void clearField1();
QPB_TST_QTPROTOBUFGEN_EXTRA_NAMESPACE_EXPORT void setField1(const MessageNestedTypes_QtProtobufNested::NestedMessage &field1);
QPB_TST_QTPROTOBUFGEN_EXTRA_NAMESPACE_EXPORT void setField1(MessageNestedTypes_QtProtobufNested::NestedMessage &&field1);
@ -1291,6 +1294,7 @@ public:
QPB_TST_QTPROTOBUFGEN_EXTRA_NAMESPACE_EXPORT bool hasField2() const;
QPB_TST_QTPROTOBUFGEN_EXTRA_NAMESPACE_EXPORT const MessageTypes &field2() const &;
QPB_TST_QTPROTOBUFGEN_EXTRA_NAMESPACE_EXPORT MessageTypes &mutField2() &;
QPB_TST_QTPROTOBUFGEN_EXTRA_NAMESPACE_EXPORT void clearField2();
QPB_TST_QTPROTOBUFGEN_EXTRA_NAMESPACE_EXPORT void setField1(QtProtobuf::int32 field1);
QPB_TST_QTPROTOBUFGEN_EXTRA_NAMESPACE_EXPORT void setField2(const MessageTypes &field2);

View File

@ -3518,6 +3518,12 @@ const ScalarTypes &MessageTypes::field1() const &
return *dptr->m_field1;
}
ScalarTypes &MessageTypes::mutField1() &
{
dptr.detach();
return *dptr->m_field1;
}
void MessageTypes::clearField1()
{
if (dptr->m_field1) {
@ -3548,6 +3554,12 @@ const ScalarTypes &MessageTypes::field3() const &
return *dptr->m_field3;
}
ScalarTypes &MessageTypes::mutField3() &
{
dptr.detach();
return *dptr->m_field3;
}
void MessageTypes::clearField3()
{
if (dptr->m_field3) {
@ -3916,6 +3928,12 @@ const MessageTypes &NestedMessage::field2() const &
return *dptr->m_field2;
}
MessageTypes &NestedMessage::mutField2() &
{
dptr.detach();
return *dptr->m_field2;
}
void NestedMessage::clearField2()
{
if (dptr->m_field2) {
@ -4068,6 +4086,12 @@ const MessageNestedTypes_QtProtobufNested::NestedMessage &MessageNestedTypes::fi
return *dptr->m_field1;
}
MessageNestedTypes_QtProtobufNested::NestedMessage &MessageNestedTypes::mutField1() &
{
dptr.detach();
return *dptr->m_field1;
}
void MessageNestedTypes::clearField1()
{
if (dptr->m_field1) {

View File

@ -1117,12 +1117,14 @@ public:
QPB_TST_QTPROTOBUFGEN_GENERATE_PACKAGE_SUBFOLDERS_EXPORT bool hasField1() const;
QPB_TST_QTPROTOBUFGEN_GENERATE_PACKAGE_SUBFOLDERS_EXPORT const ScalarTypes &field1() const &;
QPB_TST_QTPROTOBUFGEN_GENERATE_PACKAGE_SUBFOLDERS_EXPORT ScalarTypes &mutField1() &;
QPB_TST_QTPROTOBUFGEN_GENERATE_PACKAGE_SUBFOLDERS_EXPORT void clearField1();
QPB_TST_QTPROTOBUFGEN_GENERATE_PACKAGE_SUBFOLDERS_EXPORT const QList<ScalarTypes> &field2() const &;
QPB_TST_QTPROTOBUFGEN_GENERATE_PACKAGE_SUBFOLDERS_EXPORT bool hasField3() const;
QPB_TST_QTPROTOBUFGEN_GENERATE_PACKAGE_SUBFOLDERS_EXPORT const ScalarTypes &field3() const &;
QPB_TST_QTPROTOBUFGEN_GENERATE_PACKAGE_SUBFOLDERS_EXPORT ScalarTypes &mutField3() &;
QPB_TST_QTPROTOBUFGEN_GENERATE_PACKAGE_SUBFOLDERS_EXPORT void clearField3();
QPB_TST_QTPROTOBUFGEN_GENERATE_PACKAGE_SUBFOLDERS_EXPORT EnumTypes_QtProtobufNested::NestedEnum field4() const;
@ -1232,6 +1234,7 @@ public:
QPB_TST_QTPROTOBUFGEN_GENERATE_PACKAGE_SUBFOLDERS_EXPORT bool hasField1() const;
QPB_TST_QTPROTOBUFGEN_GENERATE_PACKAGE_SUBFOLDERS_EXPORT const MessageNestedTypes_QtProtobufNested::NestedMessage &field1() const &;
QPB_TST_QTPROTOBUFGEN_GENERATE_PACKAGE_SUBFOLDERS_EXPORT MessageNestedTypes_QtProtobufNested::NestedMessage &mutField1() &;
QPB_TST_QTPROTOBUFGEN_GENERATE_PACKAGE_SUBFOLDERS_EXPORT void clearField1();
QPB_TST_QTPROTOBUFGEN_GENERATE_PACKAGE_SUBFOLDERS_EXPORT void setField1(const MessageNestedTypes_QtProtobufNested::NestedMessage &field1);
QPB_TST_QTPROTOBUFGEN_GENERATE_PACKAGE_SUBFOLDERS_EXPORT void setField1(MessageNestedTypes_QtProtobufNested::NestedMessage &&field1);
@ -1291,6 +1294,7 @@ public:
QPB_TST_QTPROTOBUFGEN_GENERATE_PACKAGE_SUBFOLDERS_EXPORT bool hasField2() const;
QPB_TST_QTPROTOBUFGEN_GENERATE_PACKAGE_SUBFOLDERS_EXPORT const MessageTypes &field2() const &;
QPB_TST_QTPROTOBUFGEN_GENERATE_PACKAGE_SUBFOLDERS_EXPORT MessageTypes &mutField2() &;
QPB_TST_QTPROTOBUFGEN_GENERATE_PACKAGE_SUBFOLDERS_EXPORT void clearField2();
QPB_TST_QTPROTOBUFGEN_GENERATE_PACKAGE_SUBFOLDERS_EXPORT void setField1(QtProtobuf::int32 field1);
QPB_TST_QTPROTOBUFGEN_GENERATE_PACKAGE_SUBFOLDERS_EXPORT void setField2(const MessageTypes &field2);

View File

@ -3518,6 +3518,12 @@ const ScalarTypes &MessageTypes::field1() const &
return *dptr->m_field1;
}
ScalarTypes &MessageTypes::mutField1() &
{
dptr.detach();
return *dptr->m_field1;
}
void MessageTypes::clearField1()
{
if (dptr->m_field1) {
@ -3548,6 +3554,12 @@ const ScalarTypes &MessageTypes::field3() const &
return *dptr->m_field3;
}
ScalarTypes &MessageTypes::mutField3() &
{
dptr.detach();
return *dptr->m_field3;
}
void MessageTypes::clearField3()
{
if (dptr->m_field3) {
@ -3916,6 +3928,12 @@ const MessageTypes &NestedMessage::field2() const &
return *dptr->m_field2;
}
MessageTypes &NestedMessage::mutField2() &
{
dptr.detach();
return *dptr->m_field2;
}
void NestedMessage::clearField2()
{
if (dptr->m_field2) {
@ -4068,6 +4086,12 @@ const MessageNestedTypes_QtProtobufNested::NestedMessage &MessageNestedTypes::fi
return *dptr->m_field1;
}
MessageNestedTypes_QtProtobufNested::NestedMessage &MessageNestedTypes::mutField1() &
{
dptr.detach();
return *dptr->m_field1;
}
void MessageNestedTypes::clearField1()
{
if (dptr->m_field1) {

View File

@ -1117,12 +1117,14 @@ public:
QPB_TST_QTPROTOBUFGEN_NO_OPTIONS_EXPORT bool hasField1() const;
QPB_TST_QTPROTOBUFGEN_NO_OPTIONS_EXPORT const ScalarTypes &field1() const &;
QPB_TST_QTPROTOBUFGEN_NO_OPTIONS_EXPORT ScalarTypes &mutField1() &;
QPB_TST_QTPROTOBUFGEN_NO_OPTIONS_EXPORT void clearField1();
QPB_TST_QTPROTOBUFGEN_NO_OPTIONS_EXPORT const QList<ScalarTypes> &field2() const &;
QPB_TST_QTPROTOBUFGEN_NO_OPTIONS_EXPORT bool hasField3() const;
QPB_TST_QTPROTOBUFGEN_NO_OPTIONS_EXPORT const ScalarTypes &field3() const &;
QPB_TST_QTPROTOBUFGEN_NO_OPTIONS_EXPORT ScalarTypes &mutField3() &;
QPB_TST_QTPROTOBUFGEN_NO_OPTIONS_EXPORT void clearField3();
QPB_TST_QTPROTOBUFGEN_NO_OPTIONS_EXPORT EnumTypes_QtProtobufNested::NestedEnum field4() const;
@ -1232,6 +1234,7 @@ public:
QPB_TST_QTPROTOBUFGEN_NO_OPTIONS_EXPORT bool hasField1() const;
QPB_TST_QTPROTOBUFGEN_NO_OPTIONS_EXPORT const MessageNestedTypes_QtProtobufNested::NestedMessage &field1() const &;
QPB_TST_QTPROTOBUFGEN_NO_OPTIONS_EXPORT MessageNestedTypes_QtProtobufNested::NestedMessage &mutField1() &;
QPB_TST_QTPROTOBUFGEN_NO_OPTIONS_EXPORT void clearField1();
QPB_TST_QTPROTOBUFGEN_NO_OPTIONS_EXPORT void setField1(const MessageNestedTypes_QtProtobufNested::NestedMessage &field1);
QPB_TST_QTPROTOBUFGEN_NO_OPTIONS_EXPORT void setField1(MessageNestedTypes_QtProtobufNested::NestedMessage &&field1);
@ -1291,6 +1294,7 @@ public:
QPB_TST_QTPROTOBUFGEN_NO_OPTIONS_EXPORT bool hasField2() const;
QPB_TST_QTPROTOBUFGEN_NO_OPTIONS_EXPORT const MessageTypes &field2() const &;
QPB_TST_QTPROTOBUFGEN_NO_OPTIONS_EXPORT MessageTypes &mutField2() &;
QPB_TST_QTPROTOBUFGEN_NO_OPTIONS_EXPORT void clearField2();
QPB_TST_QTPROTOBUFGEN_NO_OPTIONS_EXPORT void setField1(QtProtobuf::int32 field1);
QPB_TST_QTPROTOBUFGEN_NO_OPTIONS_EXPORT void setField2(const MessageTypes &field2);

View File

@ -3518,6 +3518,12 @@ const ScalarTypes &MessageTypes::field1() const &
return *dptr->m_field1;
}
ScalarTypes &MessageTypes::mutField1() &
{
dptr.detach();
return *dptr->m_field1;
}
void MessageTypes::clearField1()
{
if (dptr->m_field1) {
@ -3548,6 +3554,12 @@ const ScalarTypes &MessageTypes::field3() const &
return *dptr->m_field3;
}
ScalarTypes &MessageTypes::mutField3() &
{
dptr.detach();
return *dptr->m_field3;
}
void MessageTypes::clearField3()
{
if (dptr->m_field3) {
@ -3916,6 +3928,12 @@ const MessageTypes &NestedMessage::field2() const &
return *dptr->m_field2;
}
MessageTypes &NestedMessage::mutField2() &
{
dptr.detach();
return *dptr->m_field2;
}
void NestedMessage::clearField2()
{
if (dptr->m_field2) {
@ -4068,6 +4086,12 @@ const MessageNestedTypes_QtProtobufNested::NestedMessage &MessageNestedTypes::fi
return *dptr->m_field1;
}
MessageNestedTypes_QtProtobufNested::NestedMessage &MessageNestedTypes::mutField1() &
{
dptr.detach();
return *dptr->m_field1;
}
void MessageNestedTypes::clearField1()
{
if (dptr->m_field1) {

View File

@ -1141,12 +1141,14 @@ public:
QPB_TST_QTPROTOBUFGEN_QML_EXPORT bool hasField1() const;
QPB_TST_QTPROTOBUFGEN_QML_EXPORT const ScalarTypes &field1() const &;
QPB_TST_QTPROTOBUFGEN_QML_EXPORT ScalarTypes &mutField1() &;
Q_INVOKABLE QPB_TST_QTPROTOBUFGEN_QML_EXPORT void clearField1();
QPB_TST_QTPROTOBUFGEN_QML_EXPORT const QList<ScalarTypes> &field2() const &;
QPB_TST_QTPROTOBUFGEN_QML_EXPORT bool hasField3() const;
QPB_TST_QTPROTOBUFGEN_QML_EXPORT const ScalarTypes &field3() const &;
QPB_TST_QTPROTOBUFGEN_QML_EXPORT ScalarTypes &mutField3() &;
Q_INVOKABLE QPB_TST_QTPROTOBUFGEN_QML_EXPORT void clearField3();
QPB_TST_QTPROTOBUFGEN_QML_EXPORT EnumTypes_QtProtobufNested::NestedEnum field4() const;
@ -1259,6 +1261,7 @@ public:
QPB_TST_QTPROTOBUFGEN_QML_EXPORT bool hasField1() const;
QPB_TST_QTPROTOBUFGEN_QML_EXPORT const MessageNestedTypes_QtProtobufNested::NestedMessage &field1() const &;
QPB_TST_QTPROTOBUFGEN_QML_EXPORT MessageNestedTypes_QtProtobufNested::NestedMessage &mutField1() &;
Q_INVOKABLE QPB_TST_QTPROTOBUFGEN_QML_EXPORT void clearField1();
QPB_TST_QTPROTOBUFGEN_QML_EXPORT void setField1(const MessageNestedTypes_QtProtobufNested::NestedMessage &field1);
QPB_TST_QTPROTOBUFGEN_QML_EXPORT void setField1(MessageNestedTypes_QtProtobufNested::NestedMessage &&field1);
@ -1321,6 +1324,7 @@ public:
QPB_TST_QTPROTOBUFGEN_QML_EXPORT bool hasField2() const;
QPB_TST_QTPROTOBUFGEN_QML_EXPORT const MessageTypes &field2() const &;
QPB_TST_QTPROTOBUFGEN_QML_EXPORT MessageTypes &mutField2() &;
Q_INVOKABLE QPB_TST_QTPROTOBUFGEN_QML_EXPORT void clearField2();
QPB_TST_QTPROTOBUFGEN_QML_EXPORT void setField1(QtProtobuf::int32 field1);
QPB_TST_QTPROTOBUFGEN_QML_EXPORT void setField2(const MessageTypes &field2);

View File

@ -3518,6 +3518,12 @@ const ScalarTypes &MessageTypes::field1() const &
return *dptr->m_field1;
}
ScalarTypes &MessageTypes::mutField1() &
{
dptr.detach();
return *dptr->m_field1;
}
void MessageTypes::clearField1()
{
if (dptr->m_field1) {
@ -3548,6 +3554,12 @@ const ScalarTypes &MessageTypes::field3() const &
return *dptr->m_field3;
}
ScalarTypes &MessageTypes::mutField3() &
{
dptr.detach();
return *dptr->m_field3;
}
void MessageTypes::clearField3()
{
if (dptr->m_field3) {
@ -3916,6 +3928,12 @@ const MessageTypes &NestedMessage::field2() const &
return *dptr->m_field2;
}
MessageTypes &NestedMessage::mutField2() &
{
dptr.detach();
return *dptr->m_field2;
}
void NestedMessage::clearField2()
{
if (dptr->m_field2) {
@ -4068,6 +4086,12 @@ const MessageNestedTypes_QtProtobufNested::NestedMessage &MessageNestedTypes::fi
return *dptr->m_field1;
}
MessageNestedTypes_QtProtobufNested::NestedMessage &MessageNestedTypes::mutField1() &
{
dptr.detach();
return *dptr->m_field1;
}
void MessageNestedTypes::clearField1()
{
if (dptr->m_field1) {

View File

@ -1141,12 +1141,14 @@ public:
QPB_TST_QTPROTOBUFGEN_QML_URI_EXPORT bool hasField1() const;
QPB_TST_QTPROTOBUFGEN_QML_URI_EXPORT const ScalarTypes &field1() const &;
QPB_TST_QTPROTOBUFGEN_QML_URI_EXPORT ScalarTypes &mutField1() &;
Q_INVOKABLE QPB_TST_QTPROTOBUFGEN_QML_URI_EXPORT void clearField1();
QPB_TST_QTPROTOBUFGEN_QML_URI_EXPORT const QList<ScalarTypes> &field2() const &;
QPB_TST_QTPROTOBUFGEN_QML_URI_EXPORT bool hasField3() const;
QPB_TST_QTPROTOBUFGEN_QML_URI_EXPORT const ScalarTypes &field3() const &;
QPB_TST_QTPROTOBUFGEN_QML_URI_EXPORT ScalarTypes &mutField3() &;
Q_INVOKABLE QPB_TST_QTPROTOBUFGEN_QML_URI_EXPORT void clearField3();
QPB_TST_QTPROTOBUFGEN_QML_URI_EXPORT EnumTypes_QtProtobufNested::NestedEnum field4() const;
@ -1259,6 +1261,7 @@ public:
QPB_TST_QTPROTOBUFGEN_QML_URI_EXPORT bool hasField1() const;
QPB_TST_QTPROTOBUFGEN_QML_URI_EXPORT const MessageNestedTypes_QtProtobufNested::NestedMessage &field1() const &;
QPB_TST_QTPROTOBUFGEN_QML_URI_EXPORT MessageNestedTypes_QtProtobufNested::NestedMessage &mutField1() &;
Q_INVOKABLE QPB_TST_QTPROTOBUFGEN_QML_URI_EXPORT void clearField1();
QPB_TST_QTPROTOBUFGEN_QML_URI_EXPORT void setField1(const MessageNestedTypes_QtProtobufNested::NestedMessage &field1);
QPB_TST_QTPROTOBUFGEN_QML_URI_EXPORT void setField1(MessageNestedTypes_QtProtobufNested::NestedMessage &&field1);
@ -1321,6 +1324,7 @@ public:
QPB_TST_QTPROTOBUFGEN_QML_URI_EXPORT bool hasField2() const;
QPB_TST_QTPROTOBUFGEN_QML_URI_EXPORT const MessageTypes &field2() const &;
QPB_TST_QTPROTOBUFGEN_QML_URI_EXPORT MessageTypes &mutField2() &;
Q_INVOKABLE QPB_TST_QTPROTOBUFGEN_QML_URI_EXPORT void clearField2();
QPB_TST_QTPROTOBUFGEN_QML_URI_EXPORT void setField1(QtProtobuf::int32 field1);
QPB_TST_QTPROTOBUFGEN_QML_URI_EXPORT void setField2(const MessageTypes &field2);

View File

@ -3518,6 +3518,12 @@ const ScalarTypes &MessageTypes::field1() const &
return *dptr->m_field1;
}
ScalarTypes &MessageTypes::mutField1() &
{
dptr.detach();
return *dptr->m_field1;
}
void MessageTypes::clearField1()
{
if (dptr->m_field1) {
@ -3548,6 +3554,12 @@ const ScalarTypes &MessageTypes::field3() const &
return *dptr->m_field3;
}
ScalarTypes &MessageTypes::mutField3() &
{
dptr.detach();
return *dptr->m_field3;
}
void MessageTypes::clearField3()
{
if (dptr->m_field3) {
@ -3916,6 +3928,12 @@ const MessageTypes &NestedMessage::field2() const &
return *dptr->m_field2;
}
MessageTypes &NestedMessage::mutField2() &
{
dptr.detach();
return *dptr->m_field2;
}
void NestedMessage::clearField2()
{
if (dptr->m_field2) {
@ -4068,6 +4086,12 @@ const MessageNestedTypes_QtProtobufNested::NestedMessage &MessageNestedTypes::fi
return *dptr->m_field1;
}
MessageNestedTypes_QtProtobufNested::NestedMessage &MessageNestedTypes::mutField1() &
{
dptr.detach();
return *dptr->m_field1;
}
void MessageNestedTypes::clearField1()
{
if (dptr->m_field1) {

View File

@ -1115,12 +1115,14 @@ public:
bool hasField1() const;
const ScalarTypes &field1() const &;
ScalarTypes &mutField1() &;
void clearField1();
const QList<ScalarTypes> &field2() const &;
bool hasField3() const;
const ScalarTypes &field3() const &;
ScalarTypes &mutField3() &;
void clearField3();
EnumTypes_QtProtobufNested::NestedEnum field4() const;
@ -1230,6 +1232,7 @@ public:
bool hasField1() const;
const MessageNestedTypes_QtProtobufNested::NestedMessage &field1() const &;
MessageNestedTypes_QtProtobufNested::NestedMessage &mutField1() &;
void clearField1();
void setField1(const MessageNestedTypes_QtProtobufNested::NestedMessage &field1);
void setField1(MessageNestedTypes_QtProtobufNested::NestedMessage &&field1);
@ -1289,6 +1292,7 @@ public:
bool hasField2() const;
const MessageTypes &field2() const &;
MessageTypes &mutField2() &;
void clearField2();
void setField1(QtProtobuf::int32 field1);
void setField2(const MessageTypes &field2);

View File

@ -3518,6 +3518,12 @@ const ScalarTypes &MessageTypes::field1() const &
return *dptr->m_field1;
}
ScalarTypes &MessageTypes::mutField1() &
{
dptr.detach();
return *dptr->m_field1;
}
void MessageTypes::clearField1()
{
if (dptr->m_field1) {
@ -3548,6 +3554,12 @@ const ScalarTypes &MessageTypes::field3() const &
return *dptr->m_field3;
}
ScalarTypes &MessageTypes::mutField3() &
{
dptr.detach();
return *dptr->m_field3;
}
void MessageTypes::clearField3()
{
if (dptr->m_field3) {
@ -3916,6 +3928,12 @@ const MessageTypes &NestedMessage::field2() const &
return *dptr->m_field2;
}
MessageTypes &NestedMessage::mutField2() &
{
dptr.detach();
return *dptr->m_field2;
}
void NestedMessage::clearField2()
{
if (dptr->m_field2) {
@ -4068,6 +4086,12 @@ const MessageNestedTypes_QtProtobufNested::NestedMessage &MessageNestedTypes::fi
return *dptr->m_field1;
}
MessageNestedTypes_QtProtobufNested::NestedMessage &MessageNestedTypes::mutField1() &
{
dptr.detach();
return *dptr->m_field1;
}
void MessageNestedTypes::clearField1()
{
if (dptr->m_field1) {

View File

@ -1117,12 +1117,14 @@ public:
QPB_TST_QTPROTOBUFGEN_GEN_EXPORT bool hasField1() const;
QPB_TST_QTPROTOBUFGEN_GEN_EXPORT const ScalarTypes &field1() const &;
QPB_TST_QTPROTOBUFGEN_GEN_EXPORT ScalarTypes &mutField1() &;
QPB_TST_QTPROTOBUFGEN_GEN_EXPORT void clearField1();
QPB_TST_QTPROTOBUFGEN_GEN_EXPORT const QList<ScalarTypes> &field2() const &;
QPB_TST_QTPROTOBUFGEN_GEN_EXPORT bool hasField3() const;
QPB_TST_QTPROTOBUFGEN_GEN_EXPORT const ScalarTypes &field3() const &;
QPB_TST_QTPROTOBUFGEN_GEN_EXPORT ScalarTypes &mutField3() &;
QPB_TST_QTPROTOBUFGEN_GEN_EXPORT void clearField3();
QPB_TST_QTPROTOBUFGEN_GEN_EXPORT EnumTypes_QtProtobufNested::NestedEnum field4() const;
@ -1232,6 +1234,7 @@ public:
QPB_TST_QTPROTOBUFGEN_GEN_EXPORT bool hasField1() const;
QPB_TST_QTPROTOBUFGEN_GEN_EXPORT const MessageNestedTypes_QtProtobufNested::NestedMessage &field1() const &;
QPB_TST_QTPROTOBUFGEN_GEN_EXPORT MessageNestedTypes_QtProtobufNested::NestedMessage &mutField1() &;
QPB_TST_QTPROTOBUFGEN_GEN_EXPORT void clearField1();
QPB_TST_QTPROTOBUFGEN_GEN_EXPORT void setField1(const MessageNestedTypes_QtProtobufNested::NestedMessage &field1);
QPB_TST_QTPROTOBUFGEN_GEN_EXPORT void setField1(MessageNestedTypes_QtProtobufNested::NestedMessage &&field1);
@ -1291,6 +1294,7 @@ public:
QPB_TST_QTPROTOBUFGEN_GEN_EXPORT bool hasField2() const;
QPB_TST_QTPROTOBUFGEN_GEN_EXPORT const MessageTypes &field2() const &;
QPB_TST_QTPROTOBUFGEN_GEN_EXPORT MessageTypes &mutField2() &;
QPB_TST_QTPROTOBUFGEN_GEN_EXPORT void clearField2();
QPB_TST_QTPROTOBUFGEN_GEN_EXPORT void setField1(QtProtobuf::int32 field1);
QPB_TST_QTPROTOBUFGEN_GEN_EXPORT void setField2(const MessageTypes &field2);

View File

@ -3518,6 +3518,12 @@ const ScalarTypes &MessageTypes::field1() const &
return *dptr->m_field1;
}
ScalarTypes &MessageTypes::mutField1() &
{
dptr.detach();
return *dptr->m_field1;
}
void MessageTypes::clearField1()
{
if (dptr->m_field1) {
@ -3548,6 +3554,12 @@ const ScalarTypes &MessageTypes::field3() const &
return *dptr->m_field3;
}
ScalarTypes &MessageTypes::mutField3() &
{
dptr.detach();
return *dptr->m_field3;
}
void MessageTypes::clearField3()
{
if (dptr->m_field3) {
@ -3916,6 +3928,12 @@ const MessageTypes &NestedMessage::field2() const &
return *dptr->m_field2;
}
MessageTypes &NestedMessage::mutField2() &
{
dptr.detach();
return *dptr->m_field2;
}
void NestedMessage::clearField2()
{
if (dptr->m_field2) {
@ -4068,6 +4086,12 @@ const MessageNestedTypes_QtProtobufNested::NestedMessage &MessageNestedTypes::fi
return *dptr->m_field1;
}
MessageNestedTypes_QtProtobufNested::NestedMessage &MessageNestedTypes::mutField1() &
{
dptr.detach();
return *dptr->m_field1;
}
void MessageNestedTypes::clearField1()
{
if (dptr->m_field1) {

View File

@ -1117,12 +1117,14 @@ public:
QPB_EXPORT_MACRO_WITH_FILE_EXPORT bool hasField1() const;
QPB_EXPORT_MACRO_WITH_FILE_EXPORT const ScalarTypes &field1() const &;
QPB_EXPORT_MACRO_WITH_FILE_EXPORT ScalarTypes &mutField1() &;
QPB_EXPORT_MACRO_WITH_FILE_EXPORT void clearField1();
QPB_EXPORT_MACRO_WITH_FILE_EXPORT const QList<ScalarTypes> &field2() const &;
QPB_EXPORT_MACRO_WITH_FILE_EXPORT bool hasField3() const;
QPB_EXPORT_MACRO_WITH_FILE_EXPORT const ScalarTypes &field3() const &;
QPB_EXPORT_MACRO_WITH_FILE_EXPORT ScalarTypes &mutField3() &;
QPB_EXPORT_MACRO_WITH_FILE_EXPORT void clearField3();
QPB_EXPORT_MACRO_WITH_FILE_EXPORT EnumTypes_QtProtobufNested::NestedEnum field4() const;
@ -1232,6 +1234,7 @@ public:
QPB_EXPORT_MACRO_WITH_FILE_EXPORT bool hasField1() const;
QPB_EXPORT_MACRO_WITH_FILE_EXPORT const MessageNestedTypes_QtProtobufNested::NestedMessage &field1() const &;
QPB_EXPORT_MACRO_WITH_FILE_EXPORT MessageNestedTypes_QtProtobufNested::NestedMessage &mutField1() &;
QPB_EXPORT_MACRO_WITH_FILE_EXPORT void clearField1();
QPB_EXPORT_MACRO_WITH_FILE_EXPORT void setField1(const MessageNestedTypes_QtProtobufNested::NestedMessage &field1);
QPB_EXPORT_MACRO_WITH_FILE_EXPORT void setField1(MessageNestedTypes_QtProtobufNested::NestedMessage &&field1);
@ -1291,6 +1294,7 @@ public:
QPB_EXPORT_MACRO_WITH_FILE_EXPORT bool hasField2() const;
QPB_EXPORT_MACRO_WITH_FILE_EXPORT const MessageTypes &field2() const &;
QPB_EXPORT_MACRO_WITH_FILE_EXPORT MessageTypes &mutField2() &;
QPB_EXPORT_MACRO_WITH_FILE_EXPORT void clearField2();
QPB_EXPORT_MACRO_WITH_FILE_EXPORT void setField1(QtProtobuf::int32 field1);
QPB_EXPORT_MACRO_WITH_FILE_EXPORT void setField2(const MessageTypes &field2);

View File

@ -3518,6 +3518,12 @@ const ScalarTypes &MessageTypes::field1() const &
return *dptr->m_field1;
}
ScalarTypes &MessageTypes::mutField1() &
{
dptr.detach();
return *dptr->m_field1;
}
void MessageTypes::clearField1()
{
if (dptr->m_field1) {
@ -3548,6 +3554,12 @@ const ScalarTypes &MessageTypes::field3() const &
return *dptr->m_field3;
}
ScalarTypes &MessageTypes::mutField3() &
{
dptr.detach();
return *dptr->m_field3;
}
void MessageTypes::clearField3()
{
if (dptr->m_field3) {
@ -3916,6 +3928,12 @@ const MessageTypes &NestedMessage::field2() const &
return *dptr->m_field2;
}
MessageTypes &NestedMessage::mutField2() &
{
dptr.detach();
return *dptr->m_field2;
}
void NestedMessage::clearField2()
{
if (dptr->m_field2) {
@ -4068,6 +4086,12 @@ const MessageNestedTypes_QtProtobufNested::NestedMessage &MessageNestedTypes::fi
return *dptr->m_field1;
}
MessageNestedTypes_QtProtobufNested::NestedMessage &MessageNestedTypes::mutField1() &
{
dptr.detach();
return *dptr->m_field1;
}
void MessageNestedTypes::clearField1()
{
if (dptr->m_field1) {

View File

@ -1117,12 +1117,14 @@ public:
QPB_EXPORT_MACRO_WITH_FILE_EXPORT bool hasField1() const;
QPB_EXPORT_MACRO_WITH_FILE_EXPORT const ScalarTypes &field1() const &;
QPB_EXPORT_MACRO_WITH_FILE_EXPORT ScalarTypes &mutField1() &;
QPB_EXPORT_MACRO_WITH_FILE_EXPORT void clearField1();
QPB_EXPORT_MACRO_WITH_FILE_EXPORT const QList<ScalarTypes> &field2() const &;
QPB_EXPORT_MACRO_WITH_FILE_EXPORT bool hasField3() const;
QPB_EXPORT_MACRO_WITH_FILE_EXPORT const ScalarTypes &field3() const &;
QPB_EXPORT_MACRO_WITH_FILE_EXPORT ScalarTypes &mutField3() &;
QPB_EXPORT_MACRO_WITH_FILE_EXPORT void clearField3();
QPB_EXPORT_MACRO_WITH_FILE_EXPORT EnumTypes_QtProtobufNested::NestedEnum field4() const;
@ -1232,6 +1234,7 @@ public:
QPB_EXPORT_MACRO_WITH_FILE_EXPORT bool hasField1() const;
QPB_EXPORT_MACRO_WITH_FILE_EXPORT const MessageNestedTypes_QtProtobufNested::NestedMessage &field1() const &;
QPB_EXPORT_MACRO_WITH_FILE_EXPORT MessageNestedTypes_QtProtobufNested::NestedMessage &mutField1() &;
QPB_EXPORT_MACRO_WITH_FILE_EXPORT void clearField1();
QPB_EXPORT_MACRO_WITH_FILE_EXPORT void setField1(const MessageNestedTypes_QtProtobufNested::NestedMessage &field1);
QPB_EXPORT_MACRO_WITH_FILE_EXPORT void setField1(MessageNestedTypes_QtProtobufNested::NestedMessage &&field1);
@ -1291,6 +1294,7 @@ public:
QPB_EXPORT_MACRO_WITH_FILE_EXPORT bool hasField2() const;
QPB_EXPORT_MACRO_WITH_FILE_EXPORT const MessageTypes &field2() const &;
QPB_EXPORT_MACRO_WITH_FILE_EXPORT MessageTypes &mutField2() &;
QPB_EXPORT_MACRO_WITH_FILE_EXPORT void clearField2();
QPB_EXPORT_MACRO_WITH_FILE_EXPORT void setField1(QtProtobuf::int32 field1);
QPB_EXPORT_MACRO_WITH_FILE_EXPORT void setField2(const MessageTypes &field2);

View File

@ -3518,6 +3518,12 @@ const ScalarTypes &MessageTypes::field1() const &
return *dptr->m_field1;
}
ScalarTypes &MessageTypes::mutField1() &
{
dptr.detach();
return *dptr->m_field1;
}
void MessageTypes::clearField1()
{
if (dptr->m_field1) {
@ -3548,6 +3554,12 @@ const ScalarTypes &MessageTypes::field3() const &
return *dptr->m_field3;
}
ScalarTypes &MessageTypes::mutField3() &
{
dptr.detach();
return *dptr->m_field3;
}
void MessageTypes::clearField3()
{
if (dptr->m_field3) {
@ -3916,6 +3928,12 @@ const MessageTypes &NestedMessage::field2() const &
return *dptr->m_field2;
}
MessageTypes &NestedMessage::mutField2() &
{
dptr.detach();
return *dptr->m_field2;
}
void NestedMessage::clearField2()
{
if (dptr->m_field2) {
@ -4068,6 +4086,12 @@ const MessageNestedTypes_QtProtobufNested::NestedMessage &MessageNestedTypes::fi
return *dptr->m_field1;
}
MessageNestedTypes_QtProtobufNested::NestedMessage &MessageNestedTypes::mutField1() &
{
dptr.detach();
return *dptr->m_field1;
}
void MessageNestedTypes::clearField1()
{
if (dptr->m_field1) {

View File

@ -1117,12 +1117,14 @@ public:
QPB_EXPORT_MACRO_WITH_FILE_EXPORT bool hasField1() const;
QPB_EXPORT_MACRO_WITH_FILE_EXPORT const ScalarTypes &field1() const &;
QPB_EXPORT_MACRO_WITH_FILE_EXPORT ScalarTypes &mutField1() &;
QPB_EXPORT_MACRO_WITH_FILE_EXPORT void clearField1();
QPB_EXPORT_MACRO_WITH_FILE_EXPORT const QList<ScalarTypes> &field2() const &;
QPB_EXPORT_MACRO_WITH_FILE_EXPORT bool hasField3() const;
QPB_EXPORT_MACRO_WITH_FILE_EXPORT const ScalarTypes &field3() const &;
QPB_EXPORT_MACRO_WITH_FILE_EXPORT ScalarTypes &mutField3() &;
QPB_EXPORT_MACRO_WITH_FILE_EXPORT void clearField3();
QPB_EXPORT_MACRO_WITH_FILE_EXPORT EnumTypes_QtProtobufNested::NestedEnum field4() const;
@ -1232,6 +1234,7 @@ public:
QPB_EXPORT_MACRO_WITH_FILE_EXPORT bool hasField1() const;
QPB_EXPORT_MACRO_WITH_FILE_EXPORT const MessageNestedTypes_QtProtobufNested::NestedMessage &field1() const &;
QPB_EXPORT_MACRO_WITH_FILE_EXPORT MessageNestedTypes_QtProtobufNested::NestedMessage &mutField1() &;
QPB_EXPORT_MACRO_WITH_FILE_EXPORT void clearField1();
QPB_EXPORT_MACRO_WITH_FILE_EXPORT void setField1(const MessageNestedTypes_QtProtobufNested::NestedMessage &field1);
QPB_EXPORT_MACRO_WITH_FILE_EXPORT void setField1(MessageNestedTypes_QtProtobufNested::NestedMessage &&field1);
@ -1291,6 +1294,7 @@ public:
QPB_EXPORT_MACRO_WITH_FILE_EXPORT bool hasField2() const;
QPB_EXPORT_MACRO_WITH_FILE_EXPORT const MessageTypes &field2() const &;
QPB_EXPORT_MACRO_WITH_FILE_EXPORT MessageTypes &mutField2() &;
QPB_EXPORT_MACRO_WITH_FILE_EXPORT void clearField2();
QPB_EXPORT_MACRO_WITH_FILE_EXPORT void setField1(QtProtobuf::int32 field1);
QPB_EXPORT_MACRO_WITH_FILE_EXPORT void setField2(const MessageTypes &field2);

View File

@ -3518,6 +3518,12 @@ const ScalarTypes &MessageTypes::field1() const &
return *dptr->m_field1;
}
ScalarTypes &MessageTypes::mutField1() &
{
dptr.detach();
return *dptr->m_field1;
}
void MessageTypes::clearField1()
{
if (dptr->m_field1) {
@ -3548,6 +3554,12 @@ const ScalarTypes &MessageTypes::field3() const &
return *dptr->m_field3;
}
ScalarTypes &MessageTypes::mutField3() &
{
dptr.detach();
return *dptr->m_field3;
}
void MessageTypes::clearField3()
{
if (dptr->m_field3) {
@ -3916,6 +3928,12 @@ const MessageTypes &NestedMessage::field2() const &
return *dptr->m_field2;
}
MessageTypes &NestedMessage::mutField2() &
{
dptr.detach();
return *dptr->m_field2;
}
void NestedMessage::clearField2()
{
if (dptr->m_field2) {
@ -4068,6 +4086,12 @@ const MessageNestedTypes_QtProtobufNested::NestedMessage &MessageNestedTypes::fi
return *dptr->m_field1;
}
MessageNestedTypes_QtProtobufNested::NestedMessage &MessageNestedTypes::mutField1() &
{
dptr.detach();
return *dptr->m_field1;
}
void MessageNestedTypes::clearField1()
{
if (dptr->m_field1) {

View File

@ -1115,12 +1115,14 @@ public:
bool hasField1() const;
const ScalarTypes &field1() const &;
ScalarTypes &mutField1() &;
void clearField1();
const QList<ScalarTypes> &field2() const &;
bool hasField3() const;
const ScalarTypes &field3() const &;
ScalarTypes &mutField3() &;
void clearField3();
EnumTypes_QtProtobufNested::NestedEnum field4() const;
@ -1230,6 +1232,7 @@ public:
bool hasField1() const;
const MessageNestedTypes_QtProtobufNested::NestedMessage &field1() const &;
MessageNestedTypes_QtProtobufNested::NestedMessage &mutField1() &;
void clearField1();
void setField1(const MessageNestedTypes_QtProtobufNested::NestedMessage &field1);
void setField1(MessageNestedTypes_QtProtobufNested::NestedMessage &&field1);
@ -1289,6 +1292,7 @@ public:
bool hasField2() const;
const MessageTypes &field2() const &;
MessageTypes &mutField2() &;
void clearField2();
void setField1(QtProtobuf::int32 field1);
void setField2(const MessageTypes &field2);

View File

@ -3518,6 +3518,12 @@ const ScalarTypes &MessageTypes::field1() const &
return *dptr->m_field1;
}
ScalarTypes &MessageTypes::mutField1() &
{
dptr.detach();
return *dptr->m_field1;
}
void MessageTypes::clearField1()
{
if (dptr->m_field1) {
@ -3548,6 +3554,12 @@ const ScalarTypes &MessageTypes::field3() const &
return *dptr->m_field3;
}
ScalarTypes &MessageTypes::mutField3() &
{
dptr.detach();
return *dptr->m_field3;
}
void MessageTypes::clearField3()
{
if (dptr->m_field3) {
@ -3916,6 +3928,12 @@ const MessageTypes &NestedMessage::field2() const &
return *dptr->m_field2;
}
MessageTypes &NestedMessage::mutField2() &
{
dptr.detach();
return *dptr->m_field2;
}
void NestedMessage::clearField2()
{
if (dptr->m_field2) {
@ -4068,6 +4086,12 @@ const MessageNestedTypes_QtProtobufNested::NestedMessage &MessageNestedTypes::fi
return *dptr->m_field1;
}
MessageNestedTypes_QtProtobufNested::NestedMessage &MessageNestedTypes::mutField1() &
{
dptr.detach();
return *dptr->m_field1;
}
void MessageNestedTypes::clearField1()
{
if (dptr->m_field1) {

View File

@ -1115,12 +1115,14 @@ public:
bool hasField1() const;
const ScalarTypes &field1() const &;
ScalarTypes &mutField1() &;
void clearField1();
const QList<ScalarTypes> &field2() const &;
bool hasField3() const;
const ScalarTypes &field3() const &;
ScalarTypes &mutField3() &;
void clearField3();
EnumTypes_QtProtobufNested::NestedEnum field4() const;
@ -1230,6 +1232,7 @@ public:
bool hasField1() const;
const MessageNestedTypes_QtProtobufNested::NestedMessage &field1() const &;
MessageNestedTypes_QtProtobufNested::NestedMessage &mutField1() &;
void clearField1();
void setField1(const MessageNestedTypes_QtProtobufNested::NestedMessage &field1);
void setField1(MessageNestedTypes_QtProtobufNested::NestedMessage &&field1);
@ -1289,6 +1292,7 @@ public:
bool hasField2() const;
const MessageTypes &field2() const &;
MessageTypes &mutField2() &;
void clearField2();
void setField1(QtProtobuf::int32 field1);
void setField2(const MessageTypes &field2);

View File

@ -3518,6 +3518,12 @@ const ScalarTypes &MessageTypes::field1() const &
return *dptr->m_field1;
}
ScalarTypes &MessageTypes::mutField1() &
{
dptr.detach();
return *dptr->m_field1;
}
void MessageTypes::clearField1()
{
if (dptr->m_field1) {
@ -3548,6 +3554,12 @@ const ScalarTypes &MessageTypes::field3() const &
return *dptr->m_field3;
}
ScalarTypes &MessageTypes::mutField3() &
{
dptr.detach();
return *dptr->m_field3;
}
void MessageTypes::clearField3()
{
if (dptr->m_field3) {
@ -3916,6 +3928,12 @@ const MessageTypes &NestedMessage::field2() const &
return *dptr->m_field2;
}
MessageTypes &NestedMessage::mutField2() &
{
dptr.detach();
return *dptr->m_field2;
}
void NestedMessage::clearField2()
{
if (dptr->m_field2) {
@ -4068,6 +4086,12 @@ const MessageNestedTypes_QtProtobufNested::NestedMessage &MessageNestedTypes::fi
return *dptr->m_field1;
}
MessageNestedTypes_QtProtobufNested::NestedMessage &MessageNestedTypes::mutField1() &
{
dptr.detach();
return *dptr->m_field1;
}
void MessageNestedTypes::clearField1()
{
if (dptr->m_field1) {

View File

@ -1115,12 +1115,14 @@ public:
bool hasField1() const;
const ScalarTypes &field1() const &;
ScalarTypes &mutField1() &;
void clearField1();
const QList<ScalarTypes> &field2() const &;
bool hasField3() const;
const ScalarTypes &field3() const &;
ScalarTypes &mutField3() &;
void clearField3();
EnumTypes_QtProtobufNested::NestedEnum field4() const;
@ -1230,6 +1232,7 @@ public:
bool hasField1() const;
const MessageNestedTypes_QtProtobufNested::NestedMessage &field1() const &;
MessageNestedTypes_QtProtobufNested::NestedMessage &mutField1() &;
void clearField1();
void setField1(const MessageNestedTypes_QtProtobufNested::NestedMessage &field1);
void setField1(MessageNestedTypes_QtProtobufNested::NestedMessage &&field1);
@ -1289,6 +1292,7 @@ public:
bool hasField2() const;
const MessageTypes &field2() const &;
MessageTypes &mutField2() &;
void clearField2();
void setField1(QtProtobuf::int32 field1);
void setField2(const MessageTypes &field2);

View File

@ -3518,6 +3518,12 @@ const ScalarTypes &MessageTypes::field1() const &
return *dptr->m_field1;
}
ScalarTypes &MessageTypes::mutField1() &
{
dptr.detach();
return *dptr->m_field1;
}
void MessageTypes::clearField1()
{
if (dptr->m_field1) {
@ -3548,6 +3554,12 @@ const ScalarTypes &MessageTypes::field3() const &
return *dptr->m_field3;
}
ScalarTypes &MessageTypes::mutField3() &
{
dptr.detach();
return *dptr->m_field3;
}
void MessageTypes::clearField3()
{
if (dptr->m_field3) {
@ -3916,6 +3928,12 @@ const MessageTypes &NestedMessage::field2() const &
return *dptr->m_field2;
}
MessageTypes &NestedMessage::mutField2() &
{
dptr.detach();
return *dptr->m_field2;
}
void NestedMessage::clearField2()
{
if (dptr->m_field2) {
@ -4068,6 +4086,12 @@ const MessageNestedTypes_QtProtobufNested::NestedMessage &MessageNestedTypes::fi
return *dptr->m_field1;
}
MessageNestedTypes_QtProtobufNested::NestedMessage &MessageNestedTypes::mutField1() &
{
dptr.detach();
return *dptr->m_field1;
}
void MessageNestedTypes::clearField1()
{
if (dptr->m_field1) {

View File

@ -1139,12 +1139,14 @@ public:
bool hasField1() const;
const ScalarTypes &field1() const &;
ScalarTypes &mutField1() &;
Q_INVOKABLE void clearField1();
const QList<ScalarTypes> &field2() const &;
bool hasField3() const;
const ScalarTypes &field3() const &;
ScalarTypes &mutField3() &;
Q_INVOKABLE void clearField3();
EnumTypes_QtProtobufNested::NestedEnum field4() const;
@ -1257,6 +1259,7 @@ public:
bool hasField1() const;
const MessageNestedTypes_QtProtobufNested::NestedMessage &field1() const &;
MessageNestedTypes_QtProtobufNested::NestedMessage &mutField1() &;
Q_INVOKABLE void clearField1();
void setField1(const MessageNestedTypes_QtProtobufNested::NestedMessage &field1);
void setField1(MessageNestedTypes_QtProtobufNested::NestedMessage &&field1);
@ -1319,6 +1322,7 @@ public:
bool hasField2() const;
const MessageTypes &field2() const &;
MessageTypes &mutField2() &;
Q_INVOKABLE void clearField2();
void setField1(QtProtobuf::int32 field1);
void setField2(const MessageTypes &field2);

View File

@ -3518,6 +3518,12 @@ const ScalarTypes &MessageTypes::field1() const &
return *dptr->m_field1;
}
ScalarTypes &MessageTypes::mutField1() &
{
dptr.detach();
return *dptr->m_field1;
}
void MessageTypes::clearField1()
{
if (dptr->m_field1) {
@ -3548,6 +3554,12 @@ const ScalarTypes &MessageTypes::field3() const &
return *dptr->m_field3;
}
ScalarTypes &MessageTypes::mutField3() &
{
dptr.detach();
return *dptr->m_field3;
}
void MessageTypes::clearField3()
{
if (dptr->m_field3) {
@ -3916,6 +3928,12 @@ const MessageTypes &NestedMessage::field2() const &
return *dptr->m_field2;
}
MessageTypes &NestedMessage::mutField2() &
{
dptr.detach();
return *dptr->m_field2;
}
void NestedMessage::clearField2()
{
if (dptr->m_field2) {
@ -4068,6 +4086,12 @@ const MessageNestedTypes_QtProtobufNested::NestedMessage &MessageNestedTypes::fi
return *dptr->m_field1;
}
MessageNestedTypes_QtProtobufNested::NestedMessage &MessageNestedTypes::mutField1() &
{
dptr.detach();
return *dptr->m_field1;
}
void MessageNestedTypes::clearField1()
{
if (dptr->m_field1) {

View File

@ -1139,12 +1139,14 @@ public:
bool hasField1() const;
const ScalarTypes &field1() const &;
ScalarTypes &mutField1() &;
Q_INVOKABLE void clearField1();
const QList<ScalarTypes> &field2() const &;
bool hasField3() const;
const ScalarTypes &field3() const &;
ScalarTypes &mutField3() &;
Q_INVOKABLE void clearField3();
EnumTypes_QtProtobufNested::NestedEnum field4() const;
@ -1257,6 +1259,7 @@ public:
bool hasField1() const;
const MessageNestedTypes_QtProtobufNested::NestedMessage &field1() const &;
MessageNestedTypes_QtProtobufNested::NestedMessage &mutField1() &;
Q_INVOKABLE void clearField1();
void setField1(const MessageNestedTypes_QtProtobufNested::NestedMessage &field1);
void setField1(MessageNestedTypes_QtProtobufNested::NestedMessage &&field1);
@ -1319,6 +1322,7 @@ public:
bool hasField2() const;
const MessageTypes &field2() const &;
MessageTypes &mutField2() &;
Q_INVOKABLE void clearField2();
void setField1(QtProtobuf::int32 field1);
void setField2(const MessageTypes &field2);

View File

@ -3518,6 +3518,12 @@ const ScalarTypes &MessageTypes::field1() const &
return *dptr->m_field1;
}
ScalarTypes &MessageTypes::mutField1() &
{
dptr.detach();
return *dptr->m_field1;
}
void MessageTypes::clearField1()
{
if (dptr->m_field1) {
@ -3548,6 +3554,12 @@ const ScalarTypes &MessageTypes::field3() const &
return *dptr->m_field3;
}
ScalarTypes &MessageTypes::mutField3() &
{
dptr.detach();
return *dptr->m_field3;
}
void MessageTypes::clearField3()
{
if (dptr->m_field3) {
@ -3916,6 +3928,12 @@ const MessageTypes &NestedMessage::field2() const &
return *dptr->m_field2;
}
MessageTypes &NestedMessage::mutField2() &
{
dptr.detach();
return *dptr->m_field2;
}
void NestedMessage::clearField2()
{
if (dptr->m_field2) {
@ -4068,6 +4086,12 @@ const MessageNestedTypes_QtProtobufNested::NestedMessage &MessageNestedTypes::fi
return *dptr->m_field1;
}
MessageNestedTypes_QtProtobufNested::NestedMessage &MessageNestedTypes::mutField1() &
{
dptr.detach();
return *dptr->m_field1;
}
void MessageNestedTypes::clearField1()
{
if (dptr->m_field1) {

View File

@ -1141,12 +1141,14 @@ public:
QPB_TST_QTPROTOBUFGEN_GEN_EXPORT bool hasField1() const;
QPB_TST_QTPROTOBUFGEN_GEN_EXPORT const ScalarTypes &field1() const &;
QPB_TST_QTPROTOBUFGEN_GEN_EXPORT ScalarTypes &mutField1() &;
Q_INVOKABLE QPB_TST_QTPROTOBUFGEN_GEN_EXPORT void clearField1();
QPB_TST_QTPROTOBUFGEN_GEN_EXPORT const QList<ScalarTypes> &field2() const &;
QPB_TST_QTPROTOBUFGEN_GEN_EXPORT bool hasField3() const;
QPB_TST_QTPROTOBUFGEN_GEN_EXPORT const ScalarTypes &field3() const &;
QPB_TST_QTPROTOBUFGEN_GEN_EXPORT ScalarTypes &mutField3() &;
Q_INVOKABLE QPB_TST_QTPROTOBUFGEN_GEN_EXPORT void clearField3();
QPB_TST_QTPROTOBUFGEN_GEN_EXPORT EnumTypes_QtProtobufNested::NestedEnum field4() const;
@ -1259,6 +1261,7 @@ public:
QPB_TST_QTPROTOBUFGEN_GEN_EXPORT bool hasField1() const;
QPB_TST_QTPROTOBUFGEN_GEN_EXPORT const MessageNestedTypes_QtProtobufNested::NestedMessage &field1() const &;
QPB_TST_QTPROTOBUFGEN_GEN_EXPORT MessageNestedTypes_QtProtobufNested::NestedMessage &mutField1() &;
Q_INVOKABLE QPB_TST_QTPROTOBUFGEN_GEN_EXPORT void clearField1();
QPB_TST_QTPROTOBUFGEN_GEN_EXPORT void setField1(const MessageNestedTypes_QtProtobufNested::NestedMessage &field1);
QPB_TST_QTPROTOBUFGEN_GEN_EXPORT void setField1(MessageNestedTypes_QtProtobufNested::NestedMessage &&field1);
@ -1321,6 +1324,7 @@ public:
QPB_TST_QTPROTOBUFGEN_GEN_EXPORT bool hasField2() const;
QPB_TST_QTPROTOBUFGEN_GEN_EXPORT const MessageTypes &field2() const &;
QPB_TST_QTPROTOBUFGEN_GEN_EXPORT MessageTypes &mutField2() &;
Q_INVOKABLE QPB_TST_QTPROTOBUFGEN_GEN_EXPORT void clearField2();
QPB_TST_QTPROTOBUFGEN_GEN_EXPORT void setField1(QtProtobuf::int32 field1);
QPB_TST_QTPROTOBUFGEN_GEN_EXPORT void setField2(const MessageTypes &field2);

View File

@ -3518,6 +3518,12 @@ const ScalarTypes &MessageTypes::field1() const &
return *dptr->m_field1;
}
ScalarTypes &MessageTypes::mutField1() &
{
dptr.detach();
return *dptr->m_field1;
}
void MessageTypes::clearField1()
{
if (dptr->m_field1) {
@ -3548,6 +3554,12 @@ const ScalarTypes &MessageTypes::field3() const &
return *dptr->m_field3;
}
ScalarTypes &MessageTypes::mutField3() &
{
dptr.detach();
return *dptr->m_field3;
}
void MessageTypes::clearField3()
{
if (dptr->m_field3) {
@ -3916,6 +3928,12 @@ const MessageTypes &NestedMessage::field2() const &
return *dptr->m_field2;
}
MessageTypes &NestedMessage::mutField2() &
{
dptr.detach();
return *dptr->m_field2;
}
void NestedMessage::clearField2()
{
if (dptr->m_field2) {
@ -4068,6 +4086,12 @@ const MessageNestedTypes_QtProtobufNested::NestedMessage &MessageNestedTypes::fi
return *dptr->m_field1;
}
MessageNestedTypes_QtProtobufNested::NestedMessage &MessageNestedTypes::mutField1() &
{
dptr.detach();
return *dptr->m_field1;
}
void MessageNestedTypes::clearField1()
{
if (dptr->m_field1) {

View File

@ -1141,12 +1141,14 @@ public:
QPB_TST_QTPROTOBUFGEN_GEN_EXPORT bool hasField1() const;
QPB_TST_QTPROTOBUFGEN_GEN_EXPORT const ScalarTypes &field1() const &;
QPB_TST_QTPROTOBUFGEN_GEN_EXPORT ScalarTypes &mutField1() &;
Q_INVOKABLE QPB_TST_QTPROTOBUFGEN_GEN_EXPORT void clearField1();
QPB_TST_QTPROTOBUFGEN_GEN_EXPORT const QList<ScalarTypes> &field2() const &;
QPB_TST_QTPROTOBUFGEN_GEN_EXPORT bool hasField3() const;
QPB_TST_QTPROTOBUFGEN_GEN_EXPORT const ScalarTypes &field3() const &;
QPB_TST_QTPROTOBUFGEN_GEN_EXPORT ScalarTypes &mutField3() &;
Q_INVOKABLE QPB_TST_QTPROTOBUFGEN_GEN_EXPORT void clearField3();
QPB_TST_QTPROTOBUFGEN_GEN_EXPORT EnumTypes_QtProtobufNested::NestedEnum field4() const;
@ -1259,6 +1261,7 @@ public:
QPB_TST_QTPROTOBUFGEN_GEN_EXPORT bool hasField1() const;
QPB_TST_QTPROTOBUFGEN_GEN_EXPORT const MessageNestedTypes_QtProtobufNested::NestedMessage &field1() const &;
QPB_TST_QTPROTOBUFGEN_GEN_EXPORT MessageNestedTypes_QtProtobufNested::NestedMessage &mutField1() &;
Q_INVOKABLE QPB_TST_QTPROTOBUFGEN_GEN_EXPORT void clearField1();
QPB_TST_QTPROTOBUFGEN_GEN_EXPORT void setField1(const MessageNestedTypes_QtProtobufNested::NestedMessage &field1);
QPB_TST_QTPROTOBUFGEN_GEN_EXPORT void setField1(MessageNestedTypes_QtProtobufNested::NestedMessage &&field1);
@ -1321,6 +1324,7 @@ public:
QPB_TST_QTPROTOBUFGEN_GEN_EXPORT bool hasField2() const;
QPB_TST_QTPROTOBUFGEN_GEN_EXPORT const MessageTypes &field2() const &;
QPB_TST_QTPROTOBUFGEN_GEN_EXPORT MessageTypes &mutField2() &;
Q_INVOKABLE QPB_TST_QTPROTOBUFGEN_GEN_EXPORT void clearField2();
QPB_TST_QTPROTOBUFGEN_GEN_EXPORT void setField1(QtProtobuf::int32 field1);
QPB_TST_QTPROTOBUFGEN_GEN_EXPORT void setField2(const MessageTypes &field2);

View File

@ -0,0 +1,13 @@
// Copyright (C) 2025 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
syntax = "proto3";
package qt.protobuf;
message MessageType {
}
message MessageHoder {
MessageType mutField = 1;
MessageType field = 2;
}

View File

@ -74,6 +74,8 @@ private Q_SLOTS:
void cmdLineGenerated();
void cmdLineInvalidExportMacro_data();
void cmdLineInvalidExportMacro();
void cmdLineMutableGetterConflicts();
#endif
void cleanupTestCase();
@ -266,6 +268,31 @@ void qtprotobufgenTest::cmdLineInvalidExportMacro()
QVERIFY2(process.exitStatus() == QProcess::NormalExit, msgProcessCrashed(process).constData());
QVERIFY2(process.exitCode() == result, msgProcessFailed(process).constData());
}
void qtprotobufgenTest::cmdLineMutableGetterConflicts()
{
static constexpr QLatin1StringView directory("invalid_export_macro");
QDir outputDirectory(cmdLineGeneratedPath());
if (!outputDirectory.exists(directory))
outputDirectory.mkdir(directory);
outputDirectory.cd(directory);
QProcess process;
process.setWorkingDirectory(cmdLineGeneratedPath());
process.startCommand(ProtocPath + QString(" ") + PluginKey + QtprotobufgenPath
+ OutKey + outputDirectory.absolutePath()
+ IncludeKey + expectedResultPath()
+ " " + expectedResultPath()
+ "/qtprotobufgen_mutable_getter_clashing.proto");
QVERIFY2(process.waitForStarted(), msgProcessStartFailed(process).constData());
if (!process.waitForFinished()) {
process.kill();
QFAIL(msgProcessTimeout(process).constData());
}
QVERIFY2(process.exitStatus() == QProcess::NormalExit, msgProcessCrashed(process).constData());
QVERIFY2(process.exitCode() == 1, msgProcessFailed(process).constData());
}
#endif // QT_CONFIG(process)
void qtprotobufgenTest::cleanupTestCase()

View File

@ -23,6 +23,7 @@ qt_add_protobuf(tst_protobuf_syntax_qml_gen
../../shared/data/proto/syntax.proto
QML
OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/qt_protobuf_generated"
ALLOW_MUTABLE_GETTER_CONFLICTS
)
qt_add_qml_module(tst_protobuf_syntax_qml
@ -43,4 +44,3 @@ qt_autogen_tools_initial_setup(tst_protobuf_syntax_qml_genplugin)
if(QT_BUILD_STANDALONE_TESTS)
qt_import_qml_plugins(tst_protobuf_syntax_qml)
endif()

View File

@ -21,6 +21,7 @@ TestCase {
property messageReserved msgReserved;
property priorMessageUnderscoreField underScoreMsg;
property lowerCaseMessageName lowerCaseMsg;
property nameClashingMutableGetters mutableGettersMsg;
function initTestCase() {
underscore_name.testField = -7
@ -105,4 +106,14 @@ TestCase {
function test_enumValues(data) {
compare(data.field, data.answer)
}
function test_mutableGetters() {
mutableGettersMsg.field.data = 1;
mutableGettersMsg.mutField.data = 2;
compare(Number(mutableGettersMsg.field.data), 1);
expectFailContinue("", "Property getter of 'mutField' accesses non-const getter,"+
" which clashes to mutable getter of 'field'. See QTBUG-119912.")
compare(Number(mutableGettersMsg.mutField.data), 2);
}
}

View File

@ -144,3 +144,12 @@ message NameClashingMap {
int32 Field1_Entry = 2;
int32 Field2Entry = 3;
}
message MutFieldMessage {
int32 data = 1;
}
message NameClashingMutableGetters {
MutFieldMessage field = 1;
MutFieldMessage mutField = 2;
}