|
@@ -32,56 +32,61 @@
|
|
|
namespace qtprotobuf {
|
|
|
|
|
|
static const char *PreambleTemplate = "/* This file is autogenerated. DO NOT CHANGE. All changes will be lost */\n\n"
|
|
|
- "#pragma once\n"
|
|
|
+ "#pragma once\n\n"
|
|
|
"#include <QObject>\n";
|
|
|
|
|
|
static const char *InternalIncludeTemplate = "#include \"$type_lower$.h\"\n";
|
|
|
static const char *ExternalIncludeTemplate = "#include <$type$>\n";
|
|
|
+static const char *ListModelsIncludeTemplate = "\n#include \"listmodels.h\"\n";
|
|
|
+static const char *UniversalListModelIncludeTemplate = "\n#include <universallistmodel.h>\n";
|
|
|
|
|
|
static const char *NamespaceTemplate = "\nnamespace $namespace$\n"
|
|
|
- "{\n\n";
|
|
|
+ "{\n";
|
|
|
|
|
|
static const char *ClassDefinitionTemplate = "\nclass $classname$ : public QObject\n"
|
|
|
"{\n"
|
|
|
" Q_OBJECT\n";
|
|
|
|
|
|
-static const char *PropertyTemplate = " Q_PROPERTY($type$ $property_name$ READ $property_name$ WRITE set$property_name_cap$ NOTIFY $property_name$Changed)\n";
|
|
|
-static const char *MemberTemplate = " $type$ m_$property_name$;\n";
|
|
|
+static const char *PropertyTemplate = "Q_PROPERTY($type$ $property_name$ READ $property_name$ WRITE set$property_name_cap$ NOTIFY $property_name$Changed)\n";
|
|
|
+static const char *MemberTemplate = "$type$ m_$property_name$;\n";
|
|
|
static const char *PublicBlockTemplate = "\npublic:\n";
|
|
|
-static const char *ConstructorTemplate = " $classname$(QObject *parent = nullptr) : QObject(parent)\n";
|
|
|
-static const char *CopyConstructorTemplate = " $classname$(const $classname$ &other) {\n";
|
|
|
-static const char *CopyFieldTemplate = " m_$property_name$ = other.m_$property_name$;\n";
|
|
|
-static const char *AssignmentOperatorTemplate = " $classname$ &operator =(const $classname$ &other) {\n";
|
|
|
-static const char *EqualOperatorTemplate = " bool operator ==(const $type$ &other) {\n"
|
|
|
- " return ";
|
|
|
+static const char *EnumDefinitionTemplate = "enum $enum$ {\n";
|
|
|
+static const char *EnumFieldTemplate = "$enumvalue$ = $value$,\n";
|
|
|
+static const char *ConstructorTemplate = "$classname$(QObject *parent = nullptr) : QObject(parent)\n";
|
|
|
+static const char *CopyConstructorTemplate = "$classname$(const $classname$ &other) {\n";
|
|
|
+static const char *CopyFieldTemplate = "m_$property_name$ = other.m_$property_name$;\n";
|
|
|
+static const char *AssignmentOperatorTemplate = "$classname$ &operator =(const $classname$ &other) {\n";
|
|
|
+static const char *EqualOperatorTemplate = "bool operator ==(const $type$ &other) {\n"
|
|
|
+ " return ";
|
|
|
static const char *EqualOperatorPropertyTemplate = "m_$property_name$ == other.m_$property_name$";
|
|
|
|
|
|
-static const char *GetterTemplate = " $type$ $property_name$() const {\n"
|
|
|
- " return m_$property_name$;\n"
|
|
|
- " }\n";
|
|
|
+static const char *GetterTemplate = "$type$ $property_name$() const {\n"
|
|
|
+ " return m_$property_name$;\n"
|
|
|
+ "}\n\n";
|
|
|
|
|
|
-static const char *SetterTemplateSimpleType = " void set$property_name_cap$($type$ $property_name$) {\n"
|
|
|
- " if (m_$property_name$ != $property_name$) {\n"
|
|
|
- " m_$property_name$ = $property_name$;\n"
|
|
|
- " $property_name$Changed();\n"
|
|
|
- " }\n"
|
|
|
- " }\n";
|
|
|
+static const char *SetterTemplateSimpleType = "void set$property_name_cap$($type$ $property_name$) {\n"
|
|
|
+ " if (m_$property_name$ != $property_name$) {\n"
|
|
|
+ " m_$property_name$ = $property_name$;\n"
|
|
|
+ " $property_name$Changed();\n"
|
|
|
+ " }\n"
|
|
|
+ "}\n\n";
|
|
|
|
|
|
-static const char *SetterTemplateComplexType = " void set$property_name_cap$(const $type$ &$property_name$) {\n"
|
|
|
- " if (m_$property_name$ != $property_name$) {\n"
|
|
|
- " m_$property_name$ = $property_name$;\n"
|
|
|
- " $property_name$Changed();\n"
|
|
|
- " }\n"
|
|
|
- " }\n";
|
|
|
+static const char *SetterTemplateComplexType = "void set$property_name_cap$(const $type$ &$property_name$) {\n"
|
|
|
+ " if (m_$property_name$ != $property_name$) {\n"
|
|
|
+ " m_$property_name$ = $property_name$;\n"
|
|
|
+ " $property_name$Changed();\n"
|
|
|
+ " }\n"
|
|
|
+ "}\n\n";
|
|
|
|
|
|
static const char *SignalsBlockTemplate = "\nsignals:\n";
|
|
|
-static const char *SignalTemplate = " void $property_name$Changed();\n";
|
|
|
+static const char *SignalTemplate = "void $property_name$Changed();\n";
|
|
|
|
|
|
static const char *EnumTemplate = "$type$";
|
|
|
static const char *ModelClassTemplate = "using $type$Model = UniversalListModel<$type$>;\n";
|
|
|
|
|
|
static const char *SimpleBlockEnclosureTemplate = "}\n\n";
|
|
|
static const char *SemicolonBlockEnclosureTemplate = "};\n";
|
|
|
+static const char *EmptyBlockTemplate = "{}\n\n";
|
|
|
|
|
|
static const std::unordered_map<::google::protobuf::FieldDescriptor::Type, std::string> TypeReflection = {
|
|
|
{::google::protobuf::FieldDescriptor::TYPE_DOUBLE, "qreal"},
|