ソースを参照

Wrap RegistrationHelper into qtprotobuf namespace

Viktor Kopp 5 年 前
コミット
08f7c1c132

+ 1 - 1
src/generator/globalenumssourcegenerator.cpp

@@ -95,5 +95,5 @@ void GlobalEnumsSourceGenerator::printRegisterBody(const std::list<const FileDes
 
 void GlobalEnumsSourceGenerator::printRegistrationHelperInvokation()
 {
-    mPrinter.Print({{"classname", mClassName}}, "static RegistrationHelper<$classname$> helper;\n");
+    mPrinter.Print({{"classname", mClassName}}, "static qtprotobuf::RegistrationHelper<$classname$> helper;\n");
 }

+ 1 - 1
src/generator/protobufsourcegenerator.cpp

@@ -110,5 +110,5 @@ void ProtobufSourceGenerator::printFieldsOrdering() {
 
 void ProtobufSourceGenerator::printRegistrationHelperInvokation()
 {
-    mPrinter.Print({{"classname", mClassName}}, "static RegistrationHelper<$classname$> helper;\n");
+    mPrinter.Print({{"classname", mClassName}}, "static qtprotobuf::RegistrationHelper<$classname$> helper;\n");
 }

+ 4 - 0
src/protobuf/qprotobufobject.h

@@ -30,6 +30,8 @@
 #define Q_DECLARE_PROTOBUF_SERIALIZERS(T) QByteArray serialize() const { return qtprotobuf::ProtobufObjectPrivate::serialize<T>(this); } \
     void deserialize(const QByteArray &array) { qtprotobuf::ProtobufObjectPrivate::deserialize<T>(this, array); }
 
+namespace qtprotobuf {
+
 template<typename T>
 class RegistrationHelper {
 public:
@@ -37,3 +39,5 @@ public:
         T::registerTypes();
     }
 };
+
+}