Browse Source

Qtfy protobuf

- Rename classes according qt-style
- Cleanup some comments
Alexey Edelev 5 years ago
parent
commit
157987123d

+ 1 - 1
src/generator/globalenumssourcegenerator.cpp

@@ -39,7 +39,7 @@ GlobalEnumsSourceGenerator::GlobalEnumsSourceGenerator(const PackagesList &packa
 void GlobalEnumsSourceGenerator::run() {
     mPrinter.Print("#include <globalenums.h>\n"
                    "#include <qprotobufobject.h>\n"
-                   "#include <registrationhelper.h>\n\n"
+                   "#include <qprotobufregistrationhelper.h>\n\n"
                    "#include <QQmlEngine>");
 
     std::vector<std::string> namespaces;

+ 1 - 1
src/generator/protobufsourcegenerator.h

@@ -42,7 +42,7 @@ public:
 
     void run() override {
         printClassHeaderInclude();
-        mPrinter.Print({{"include", "registrationhelper.h"}}, Templates::ExternalIncludeTemplate);
+        mPrinter.Print({{"include", "qprotobufregistrationhelper.h"}}, Templates::ExternalIncludeTemplate);
         printNamespaces();
         printFieldsOrdering();
         printRegisterBody();

+ 1 - 1
src/generator/templates.cpp

@@ -208,7 +208,7 @@ const char *Templates::ClientMethodDefinitionAsync2Template = "\nvoid $classname
                                                               "}\n";
 
 const char *Templates::RegisterSerializersTemplate = "qtprotobuf::QProtobufSerializerRegistry::registerSerializers<$classname$>();\n";
-const char *Templates::RegistratorTemplate = "static qtprotobuf::RegistrationHelper helper(registerTypes);\n";
+const char *Templates::RegistratorTemplate = "static qtprotobuf::QProtobufRegistrationHelper helper(registerTypes);\n";
 const char *Templates::QmlRegisterTypeTemplate = "qmlRegisterType<$namespaces$::$classname$>(\"$package$\", 1, 0, \"$classname$\");\n";
 const char *Templates::QmlRegisterTypeUncreatableTemplate = "qmlRegisterUncreatableType<$namespaces$::$classname$>(\"$package$\", 1, 0, \"$classname$\", \"$namespaces$::$classname$ Could not be created from qml context\");\n";
 

+ 2 - 2
src/protobuf/CMakeLists.txt

@@ -27,8 +27,8 @@ file(GLOB HEADERS
     qprotobufserializerregistry.h
     qqmllistpropertyconstructor.h
     qabstractprotobufserializer.h
-    selfcheckiterator.h
-    registrationhelper.h)
+    qprotobufselfcheckiterator.h
+    qprotobufregistrationhelper.h)
 
 add_library(${TARGET} SHARED ${SOURCES})
 target_compile_definitions(${TARGET} PRIVATE QTPROTOBUF_LIB)

+ 1 - 1
src/protobuf/qabstractprotobufserializer.cpp

@@ -49,7 +49,7 @@ QByteArray QAbstractProtobufSerializer::serializeObjectCommon(const QObject *obj
 
 void QAbstractProtobufSerializer::deserializeObjectCommon(QObject *object, const QByteArray &data, const QProtobufPropertyOrdering &propertyOrdering, const QMetaObject &metaObject)
 {
-    for (SelfcheckIterator it(data); it != data.end();) {
+    for (QProtobufSelfcheckIterator it(data); it != data.end();) {
         deserializeProperty(object, it, propertyOrdering, metaObject);
     }
 }

+ 10 - 10
src/protobuf/qabstractprotobufserializer.h

@@ -34,7 +34,7 @@
 
 #include "qtprotobuftypes.h"
 #include "qtprotobuflogging.h"
-#include "selfcheckiterator.h"
+#include "qprotobufselfcheckiterator.h"
 
 #include "qtprotobuf_global.h"
 
@@ -60,7 +60,7 @@ public:
     /*!
      * \brief Deserializer is interface function for deserialize method
      */
-    using Deserializer = std::function<void(SelfcheckIterator &, QVariant &)>;
+    using Deserializer = std::function<void(QProtobufSelfcheckIterator &, QVariant &)>;
 
     /*!
      * \brief SerializationHandlers contains set of objects that required for class serializaion/deserialization
@@ -77,16 +77,16 @@ public:
 
     virtual ~QAbstractProtobufSerializer() = default;
     virtual QByteArray serializeProperty(const QVariant &propertyValue, int fieldIndex, bool isEnum) = 0;
-    virtual void deserializeProperty(QObject *object, SelfcheckIterator &it, const QProtobufPropertyOrdering &propertyOrdering, const QMetaObject &metaObject) = 0;
+    virtual void deserializeProperty(QObject *object, QProtobufSelfcheckIterator &it, const QProtobufPropertyOrdering &propertyOrdering, const QMetaObject &metaObject) = 0;
 
     virtual QByteArray serializeObject(const QObject *object, const QProtobufPropertyOrdering &propertyOrdering, const QMetaObject &metaObject) = 0;
-    virtual void deserializeObject(QObject *object, SelfcheckIterator &it, const QProtobufPropertyOrdering &propertyOrdering, const QMetaObject &metaObject) = 0;
+    virtual void deserializeObject(QObject *object, QProtobufSelfcheckIterator &it, const QProtobufPropertyOrdering &propertyOrdering, const QMetaObject &metaObject) = 0;
 
     virtual QByteArray serializeListObject(const QObject *object, const QProtobufPropertyOrdering &propertyOrdering, const QMetaObject &metaObject, int fieldIndex) = 0;
-    virtual void deserializeListObject(QObject *object, SelfcheckIterator &it, const QProtobufPropertyOrdering &propertyOrdering, const QMetaObject &metaObject) = 0;
+    virtual void deserializeListObject(QObject *object, QProtobufSelfcheckIterator &it, const QProtobufPropertyOrdering &propertyOrdering, const QMetaObject &metaObject) = 0;
 
     virtual QByteArray serializeMapPair(const QVariant &key, const QVariant &value, int fieldIndex) = 0;
-    virtual void deserializeMapPair(QVariant &key, QVariant &value, SelfcheckIterator &it) = 0;
+    virtual void deserializeMapPair(QVariant &key, QVariant &value, QProtobufSelfcheckIterator &it) = 0;
 
     QByteArray serializeObjectCommon(const QObject *object, const QProtobufPropertyOrdering &propertyOrdering, const QMetaObject &metaObject);
     void deserializeObjectCommon(QObject *object, const QByteArray &array, const QProtobufPropertyOrdering &propertyOrdering, const QMetaObject &metaObject);
@@ -107,16 +107,16 @@ public:
     ~QProtobufSerializer() = default;
 
     QByteArray serializeProperty(const QVariant &propertyValue, int fieldIndex, bool isEnum) override;
-    void deserializeProperty(QObject *object, SelfcheckIterator &it, const QProtobufPropertyOrdering &propertyOrdering, const QMetaObject &metaObject) override;
+    void deserializeProperty(QObject *object, QProtobufSelfcheckIterator &it, const QProtobufPropertyOrdering &propertyOrdering, const QMetaObject &metaObject) override;
 
     QByteArray serializeObject(const QObject *object, const QProtobufPropertyOrdering &propertyOrdering, const QMetaObject &metaObject) override;
-    void deserializeObject(QObject *object, SelfcheckIterator &it, const QProtobufPropertyOrdering &propertyOrdering, const QMetaObject &metaObject) override;
+    void deserializeObject(QObject *object, QProtobufSelfcheckIterator &it, const QProtobufPropertyOrdering &propertyOrdering, const QMetaObject &metaObject) override;
 
     QByteArray serializeListObject(const QObject *object, const QProtobufPropertyOrdering &propertyOrdering, const QMetaObject &metaObject, int fieldIndex) override;
-    void deserializeListObject(QObject *object, SelfcheckIterator &it, const QProtobufPropertyOrdering &propertyOrdering, const QMetaObject &metaObject) override;
+    void deserializeListObject(QObject *object, QProtobufSelfcheckIterator &it, const QProtobufPropertyOrdering &propertyOrdering, const QMetaObject &metaObject) override;
 
     QByteArray serializeMapPair(const QVariant &key, const QVariant &value, int fieldIndex) override;
-    void deserializeMapPair(QVariant &key, QVariant &value, SelfcheckIterator &it) override;
+    void deserializeMapPair(QVariant &key, QVariant &value, QProtobufSelfcheckIterator &it) override;
 };
 /*! \} */
 

+ 7 - 2
src/protobuf/registrationhelper.h → src/protobuf/qprotobufregistrationhelper.h

@@ -26,11 +26,16 @@
 #pragma once
 
 #include <functional>
+
+/*!
+ * \private
+ * This class might be replaced by manual registration calls, because of issues related to static initialization in C++
+ */
 namespace qtprotobuf {
 
-class RegistrationHelper {
+class QProtobufRegistrationHelper {
 public:
-    RegistrationHelper(const std::function<void(void)> &registrator) {
+    QProtobufRegistrationHelper(const std::function<void(void)> &registrator) {
         registrator();
     }
 };

+ 16 - 12
src/protobuf/selfcheckiterator.h → src/protobuf/qprotobufselfcheckiterator.h

@@ -32,14 +32,18 @@
 
 namespace qtprotobuf {
 
-class QTPROTOBUFSHARED_EXPORT SelfcheckIterator
+/*!
+ * \ingroup QtProtobuf
+ * \brief The QProtobufSelfcheckIterator class
+ */
+class QTPROTOBUFSHARED_EXPORT QProtobufSelfcheckIterator
 {
 public:
-    SelfcheckIterator(const QByteArray &container) : m_sizeLeft(container.size())
+    QProtobufSelfcheckIterator(const QByteArray &container) : m_sizeLeft(container.size())
       , m_containerSize(container.size())
       , m_it(container.begin()){}
 
-    SelfcheckIterator(const SelfcheckIterator &other) : m_sizeLeft(other.m_sizeLeft)
+    QProtobufSelfcheckIterator(const QProtobufSelfcheckIterator &other) : m_sizeLeft(other.m_sizeLeft)
       , m_containerSize(other.m_containerSize)
       , m_it(other.m_it) {
         if (m_sizeLeft >= m_containerSize) {
@@ -52,7 +56,7 @@ public:
 
     char operator *() { return *m_it; }
 
-    SelfcheckIterator &operator ++() {
+    QProtobufSelfcheckIterator &operator ++() {
         --m_sizeLeft;
         if (m_sizeLeft < 0) {
             throw std::out_of_range("Container is less than required fields number. Deserialization failed");
@@ -61,7 +65,7 @@ public:
         return *this;
     }
 
-    SelfcheckIterator &operator --() {
+    QProtobufSelfcheckIterator &operator --() {
         ++m_sizeLeft;
         if (m_sizeLeft >= m_containerSize) {
             throw std::out_of_range("Container is less than required fields number. Deserialization failed");
@@ -70,7 +74,7 @@ public:
         return *this;
     }
 
-    SelfcheckIterator &operator +=(int count) {
+    QProtobufSelfcheckIterator &operator +=(int count) {
         m_sizeLeft -= count;
         if (m_sizeLeft < 0) {
             throw std::out_of_range("Container is less than required fields number. Deserialization failed");
@@ -79,7 +83,7 @@ public:
         return *this;
     }
 
-    SelfcheckIterator &operator -=(int count) {
+    QProtobufSelfcheckIterator &operator -=(int count) {
         m_sizeLeft += count;
         if (m_sizeLeft >= m_containerSize) {
             throw std::out_of_range("Container is less than required fields number. Deserialization failed");
@@ -88,7 +92,7 @@ public:
         return *this;
     }
 
-    SelfcheckIterator &operator =(const SelfcheckIterator &other) {
+    QProtobufSelfcheckIterator &operator =(const QProtobufSelfcheckIterator &other) {
         if (this == &other) {
             return *this;
         }
@@ -102,11 +106,11 @@ public:
         return *this;
     }
 
-    bool operator ==(const SelfcheckIterator &other) const {
+    bool operator ==(const QProtobufSelfcheckIterator &other) const {
         return other.m_it == m_it;
     }
 
-    bool operator !=(const SelfcheckIterator &other) const {
+    bool operator !=(const QProtobufSelfcheckIterator &other) const {
         return other.m_it != m_it;
     }
 
@@ -123,8 +127,8 @@ private:
     QByteArray::const_iterator m_it;
 };
 
-inline SelfcheckIterator operator +(const SelfcheckIterator &it, int lenght) {
-    SelfcheckIterator itNew = it;
+inline QProtobufSelfcheckIterator operator +(const QProtobufSelfcheckIterator &it, int lenght) {
+    QProtobufSelfcheckIterator itNew = it;
     return itNew += lenght;
 }
 

+ 9 - 9
src/protobuf/qprotobufserializer.cpp

@@ -90,7 +90,7 @@ QByteArray QProtobufSerializer::serializeProperty(const QVariant &propertyValue,
     return result;
 }
 
-void QProtobufSerializer::deserializeProperty(QObject *object, SelfcheckIterator &it, const QProtobufPropertyOrdering &propertyOrdering, const QMetaObject &metaObject)
+void QProtobufSerializer::deserializeProperty(QObject *object, QProtobufSelfcheckIterator &it, const QProtobufPropertyOrdering &propertyOrdering, const QMetaObject &metaObject)
 {
     //Each iteration we expect iterator is setup to beginning of next chunk
     int fieldNumber = NotUsedFieldIndex;
@@ -133,7 +133,7 @@ QByteArray QProtobufSerializer::serializeObject(const QObject *object, const QPr
     return QProtobufSerializerPrivate::prependLengthDelimitedSize(serializeObjectCommon(object, propertyOrdering, metaObject));
 }
 
-void QProtobufSerializer::deserializeObject(QObject *object, SelfcheckIterator &it, const QProtobufPropertyOrdering &propertyOrdering, const QMetaObject &metaObject)
+void QProtobufSerializer::deserializeObject(QObject *object, QProtobufSelfcheckIterator &it, const QProtobufPropertyOrdering &propertyOrdering, const QMetaObject &metaObject)
 {
     QByteArray array = QProtobufSerializerPrivate::deserializeLengthDelimited(it);
     deserializeObjectCommon(object, array, propertyOrdering, metaObject);
@@ -146,7 +146,7 @@ QByteArray QProtobufSerializer::serializeListObject(const QObject *object, const
     return result;
 }
 
-void QProtobufSerializer::deserializeListObject(QObject *object, SelfcheckIterator &it, const QProtobufPropertyOrdering &propertyOrdering, const QMetaObject &metaObject)
+void QProtobufSerializer::deserializeListObject(QObject *object, QProtobufSelfcheckIterator &it, const QProtobufPropertyOrdering &propertyOrdering, const QMetaObject &metaObject)
 {
     deserializeObject(object, it, propertyOrdering, metaObject);
 }
@@ -158,13 +158,13 @@ QByteArray QProtobufSerializer::serializeMapPair(const QVariant &key, const QVar
     return result;
 }
 
-void QProtobufSerializer::deserializeMapPair(QVariant &key, QVariant &value, SelfcheckIterator &it)
+void QProtobufSerializer::deserializeMapPair(QVariant &key, QVariant &value, QProtobufSelfcheckIterator &it)
 {
     int mapIndex = 0;
     WireTypes type = WireTypes::UnknownWireType;
     unsigned int count = QProtobufSerializerPrivate::deserializeVarintCommon<uint32>(it);
     qProtoDebug() << __func__ << "count:" << count;
-    SelfcheckIterator last = it + count;
+    QProtobufSelfcheckIterator last = it + count;
     while (it != last) {
         QProtobufSerializerPrivate::decodeHeader(it, mapIndex, type);
         if(mapIndex == 1) {
@@ -175,7 +175,7 @@ void QProtobufSerializer::deserializeMapPair(QVariant &key, QVariant &value, Sel
     }
 }
 
-void QProtobufSerializerPrivate::skipVarint(SelfcheckIterator &it)
+void QProtobufSerializerPrivate::skipVarint(QProtobufSelfcheckIterator &it)
 {
     while ((*it) & 0x80) {
         ++it;
@@ -183,14 +183,14 @@ void QProtobufSerializerPrivate::skipVarint(SelfcheckIterator &it)
     ++it;
 }
 
-void QProtobufSerializerPrivate::skipLengthDelimited(SelfcheckIterator &it)
+void QProtobufSerializerPrivate::skipLengthDelimited(QProtobufSelfcheckIterator &it)
 {
     //Get length of lenght-delimited field
     unsigned int length = QProtobufSerializerPrivate::deserializeBasic<uint32>(it).toUInt();
     it += length;
 }
 
-int QProtobufSerializerPrivate::skipSerializedFieldBytes(SelfcheckIterator &it, WireTypes type)
+int QProtobufSerializerPrivate::skipSerializedFieldBytes(QProtobufSelfcheckIterator &it, WireTypes type)
 {
     const auto initialIt = QByteArray::const_iterator(it);
     switch (type) {
@@ -214,7 +214,7 @@ int QProtobufSerializerPrivate::skipSerializedFieldBytes(SelfcheckIterator &it,
     return std::distance(initialIt, QByteArray::const_iterator(it));
 }
 
-void QProtobufSerializerPrivate::deserializeMapField(QVariant &value, SelfcheckIterator &it)
+void QProtobufSerializerPrivate::deserializeMapField(QVariant &value, QProtobufSelfcheckIterator &it)
 {
     QProtobufSerializerRegistry::handler(value.userType()).deserializer(it, value);
 }

+ 22 - 22
src/protobuf/qprotobufserializer_p.h

@@ -26,7 +26,7 @@
 #include <QString>
 #include <QByteArray>
 
-#include "selfcheckiterator.h"
+#include "qprotobufselfcheckiterator.h"
 #include "qtprotobuftypes.h"
 #include "qtprotobuflogging.h"
 #include "qabstractprotobufserializer.h"
@@ -269,7 +269,7 @@ public:
     template <typename V,
               typename std::enable_if_t<std::is_integral<V>::value
                                         && std::is_unsigned<V>::value, int> = 0>
-    static V deserializeVarintCommon(SelfcheckIterator &it) {
+    static V deserializeVarintCommon(QProtobufSelfcheckIterator &it) {
         qProtoDebug() << __func__ << "currentByte:" << QString::number((*it), 16);
 
         V value = 0;
@@ -294,7 +294,7 @@ public:
                                         || std::is_same<V, fixed64>::value
                                         || std::is_same<V, sfixed32>::value
                                         || std::is_same<V, sfixed64>::value, int> = 0>
-    static QVariant deserializeBasic(SelfcheckIterator &it) {
+    static QVariant deserializeBasic(QProtobufSelfcheckIterator &it) {
         qProtoDebug() << __func__ << "currentByte:" << QString::number((*it), 16);
 
         QVariant newPropertyValue(QVariant::fromValue(*(V *)((QByteArray::const_iterator&)it)));
@@ -305,7 +305,7 @@ public:
     template <typename V,
               typename std::enable_if_t<std::is_integral<V>::value
                                         && std::is_unsigned<V>::value, int> = 0>
-    static QVariant deserializeBasic(SelfcheckIterator &it) {
+    static QVariant deserializeBasic(QProtobufSelfcheckIterator &it) {
         qProtoDebug() << __func__ << "currentByte:" << QString::number((*it), 16);
 
         return QVariant::fromValue(deserializeVarintCommon<V>(it));
@@ -314,7 +314,7 @@ public:
     template <typename V,
               typename std::enable_if_t<std::is_integral<V>::value
                                         && std::is_signed<V>::value,int> = 0>
-    static QVariant deserializeBasic(SelfcheckIterator &it) {
+    static QVariant deserializeBasic(QProtobufSelfcheckIterator &it) {
         qProtoDebug() << __func__ << "currentByte:" << QString::number((*it), 16);
         using  UV = typename std::make_unsigned<V>::type;
         UV unsignedValue = deserializeVarintCommon<UV>(it);
@@ -325,7 +325,7 @@ public:
     template <typename V,
               typename std::enable_if_t<std::is_same<int32, V>::value
                                         || std::is_same<int64, V>::value, int> = 0>
-    static QVariant deserializeBasic(SelfcheckIterator &it) {
+    static QVariant deserializeBasic(QProtobufSelfcheckIterator &it) {
         qProtoDebug() << __func__ << "currentByte:" << QString::number((*it), 16);
         using  UV = typename std::make_unsigned<V>::type;
         UV unsignedValue = deserializeVarintCommon<UV>(it);
@@ -336,20 +336,20 @@ public:
     //-----------------QString and QByteArray types deserializers----------------
     template <typename V,
               typename std::enable_if_t<std::is_same<QByteArray, V>::value, int> = 0>
-    static QVariant deserializeBasic(SelfcheckIterator &it) {
+    static QVariant deserializeBasic(QProtobufSelfcheckIterator &it) {
         return QVariant::fromValue(deserializeLengthDelimited(it));
     }
 
     template <typename V,
               typename std::enable_if_t<std::is_same<QString, V>::value, int> = 0>
-    static QVariant deserializeBasic(SelfcheckIterator &it) {
+    static QVariant deserializeBasic(QProtobufSelfcheckIterator &it) {
         return QVariant::fromValue(QString::fromUtf8(deserializeLengthDelimited(it)));
     }
 
     //-------------------------List types deserializers--------------------------
     template <typename V,
               typename std::enable_if_t<std::is_same<V, QByteArray>::value, int> = 0>
-    static void deserializeList(SelfcheckIterator &it, QVariant &previous) {
+    static void deserializeList(QProtobufSelfcheckIterator &it, QVariant &previous) {
         qProtoDebug() << __func__ << "currentByte:" << QString::number((*it), 16);
 
         QByteArrayList list = previous.value<QByteArrayList>();
@@ -359,7 +359,7 @@ public:
 
     template <typename V,
               typename std::enable_if_t<std::is_same<V, QString>::value, int> = 0>
-    static void deserializeList(SelfcheckIterator &it, QVariant &previous) {
+    static void deserializeList(QProtobufSelfcheckIterator &it, QVariant &previous) {
         qProtoDebug() << __func__ << "currentByte:" << QString::number((*it), 16);
 
         QStringList list = previous.value<QStringList>();
@@ -372,12 +372,12 @@ public:
               typename std::enable_if_t<!(std::is_same<V, QString>::value
                                         || std::is_same<V, QByteArray>::value
                                         || std::is_base_of<QObject, V>::value), int> = 0>
-    static void deserializeList(SelfcheckIterator &it, QVariant &previous) {
+    static void deserializeList(QProtobufSelfcheckIterator &it, QVariant &previous) {
         qProtoDebug() << __func__ << "currentByte:" << QString::number((*it), 16);
 
         QList<V> out;
         unsigned int count = deserializeVarintCommon<uint32>(it);
-        SelfcheckIterator lastVarint = it + count;
+        QProtobufSelfcheckIterator lastVarint = it + count;
         while (it != lastVarint) {
             QVariant variant = deserializeBasic<V>(it);
             out.append(variant.value<V>());
@@ -388,7 +388,7 @@ public:
     //###########################################################################
     //                             Common functions
     //###########################################################################
-    static QByteArray deserializeLengthDelimited(SelfcheckIterator &it) {
+    static QByteArray deserializeLengthDelimited(QProtobufSelfcheckIterator &it) {
         qProtoDebug() << __func__ << "currentByte:" << QString::number((*it), 16);
 
         unsigned int length = deserializeVarintCommon<uint32>(it);
@@ -405,7 +405,7 @@ public:
         return result;
     }
 
-    static bool decodeHeader(SelfcheckIterator &it, int &fieldIndex, WireTypes &wireType);
+    static bool decodeHeader(QProtobufSelfcheckIterator &it, int &fieldIndex, WireTypes &wireType);
     static QByteArray encodeHeader(int fieldIndex, WireTypes wireType);
 
     /*!
@@ -422,19 +422,19 @@ public:
 
     // this set of 3 methods is used to skip bytes corresponding to an unexpected property
     // in a serialized message met while the message being deserialized
-    static int skipSerializedFieldBytes(SelfcheckIterator &it, WireTypes type);
+    static int skipSerializedFieldBytes(QProtobufSelfcheckIterator &it, WireTypes type);
 
-    static void deserializeMapField(QVariant &value, SelfcheckIterator &it);
+    static void deserializeMapField(QVariant &value, QProtobufSelfcheckIterator &it);
 
     template <typename T,
               typename std::enable_if_t<!std::is_base_of<QObject, T>::value, int> = 0>
-    static void wrapSerializer(QAbstractProtobufSerializer::SerializerRegistry &handlers, const std::function<QByteArray(const T &, int &)> &s, const std::function<QVariant(SelfcheckIterator &)> &d, WireTypes type)
+    static void wrapSerializer(QAbstractProtobufSerializer::SerializerRegistry &handlers, const std::function<QByteArray(const T &, int &)> &s, const std::function<QVariant(QProtobufSelfcheckIterator &)> &d, WireTypes type)
     {
         handlers[qMetaTypeId<T>()] = {
             [s](const QVariant &value, int &fieldIndex) {
                 return s(value.value<T>(), fieldIndex);
             },
-            [d](SelfcheckIterator &it, QVariant & value){
+            [d](QProtobufSelfcheckIterator &it, QVariant & value){
                 value = d(it);
             },
             type
@@ -443,7 +443,7 @@ public:
 
     template <typename T,
     typename std::enable_if_t<!std::is_base_of<QObject, T>::value, int> = 0>
-    static void wrapSerializer(QAbstractProtobufSerializer::SerializerRegistry &handlers, const std::function<QByteArray(const T &, int &)> &s, const std::function<void(SelfcheckIterator &it, QVariant & value)> &d, WireTypes type)
+    static void wrapSerializer(QAbstractProtobufSerializer::SerializerRegistry &handlers, const std::function<QByteArray(const T &, int &)> &s, const std::function<void(QProtobufSelfcheckIterator &it, QVariant & value)> &d, WireTypes type)
     {
         handlers[qMetaTypeId<T>()] = {
             [s](const QVariant &value, int &fieldIndex) {
@@ -454,8 +454,8 @@ public:
         };
     }
 protected:
-    static void skipVarint(SelfcheckIterator &it);
-    static void skipLengthDelimited(SelfcheckIterator &it);
+    static void skipVarint(QProtobufSelfcheckIterator &it);
+    static void skipLengthDelimited(QProtobufSelfcheckIterator &it);
 };
 
 //###########################################################################
@@ -488,7 +488,7 @@ inline QByteArray QProtobufSerializerPrivate::encodeHeader(int fieldIndex, WireT
  *
  * \return true if both decoded wireType and fieldIndex have "allowed" values and false, otherwise
  */
-inline bool QProtobufSerializerPrivate::decodeHeader(SelfcheckIterator &it, int &fieldIndex, WireTypes &wireType)
+inline bool QProtobufSerializerPrivate::decodeHeader(QProtobufSelfcheckIterator &it, int &fieldIndex, WireTypes &wireType)
 {
     uint32_t header = deserializeVarintCommon<uint32_t>(it);
     wireType = static_cast<WireTypes>(header & 0b00000111);

+ 5 - 5
src/protobuf/qprotobufserializerregistry.h

@@ -32,7 +32,7 @@
 #include <type_traits>
 
 #include "qtprotobuflogging.h"
-#include "selfcheckiterator.h"
+#include "qprotobufselfcheckiterator.h"
 #include "qabstractprotobufserializer.h"
 
 #include "qtprotobuf_global.h"
@@ -231,7 +231,7 @@ private:
      */
     template <typename T,
               typename std::enable_if_t<std::is_base_of<QObject, T>::value, int> = 0>
-    static void deserializeComplexType(SelfcheckIterator &it, QVariant &to) {
+    static void deserializeComplexType(QProtobufSelfcheckIterator &it, QVariant &to) {
         T *value = new T;
         basicSerializer->deserializeObject(value, it, T::propertyOrdering, T::staticMetaObject);
         to = QVariant::fromValue<T *>(value);
@@ -244,7 +244,7 @@ private:
      */
     template <typename V,
               typename std::enable_if_t<std::is_base_of<QObject, V>::value, int> = 0>
-    static void deserializeList(SelfcheckIterator &it, QVariant &previous) {
+    static void deserializeList(QProtobufSelfcheckIterator &it, QVariant &previous) {
         qProtoDebug() << __func__ << "currentByte:" << QString::number((*it), 16);
 
         V *newValue = new V;
@@ -261,7 +261,7 @@ private:
      */
     template <typename K, typename V,
               typename std::enable_if_t<!std::is_base_of<QObject, V>::value, int> = 0>
-    static void deserializeMap(SelfcheckIterator &it, QVariant &previous) {
+    static void deserializeMap(QProtobufSelfcheckIterator &it, QVariant &previous) {
         qProtoDebug() << __func__ << "currentByte:" << QString::number((*it), 16);
 
         QMap<K, V> out = previous.value<QMap<K, V>>();
@@ -281,7 +281,7 @@ private:
      */
     template <typename K, typename V,
               typename std::enable_if_t<std::is_base_of<QObject, V>::value, int> = 0>
-    static void deserializeMap(SelfcheckIterator &it, QVariant &previous) {
+    static void deserializeMap(QProtobufSelfcheckIterator &it, QVariant &previous) {
         qProtoDebug() << __func__ << "currentByte:" << QString::number((*it), 16);
 
         auto out = previous.value<QMap<K, QSharedPointer<V>>>();

+ 2 - 2
src/protobuf/qtprotobuf.cpp

@@ -25,7 +25,7 @@
 
 #include "qtprotobuftypes.h"
 #include "qprotobufobject.h"
-#include "registrationhelper.h"
+#include "qprotobufregistrationhelper.h"
 
 #include <type_traits>
 
@@ -115,5 +115,5 @@ void registerTypes() {
 }
 }
 
-static RegistrationHelper helper(registerTypes);
+static QProtobufRegistrationHelper helper(registerTypes);
 }