Browse Source

Add doxygen description for protobuf types

Alexey Edelev 5 years ago
parent
commit
6c54e692ba

+ 8 - 1
src/grpc/abstractchannel.h

@@ -35,7 +35,14 @@ namespace qtprotobuf {
 
 class AsyncReply;
 class AbstractClient;
+/**
+*  \addtogroup QtGrpc
+*  @{
+*/
 
+/**
+ * @brief The AbstractChannel class
+ */
 class QTGRPCSHARED_EXPORT AbstractChannel
 {
 public:
@@ -102,5 +109,5 @@ protected:
 private:
     Q_DISABLE_COPY(AbstractChannel)
 };
-
+/** @} */
 }

+ 8 - 1
src/grpc/abstractclient.h

@@ -40,9 +40,16 @@
 #include "qtgrpc_global.h"
 
 namespace qtprotobuf {
+/**
+*  \addtogroup QtGrpc
+*  @{
+*/
 
 class AbstractChannel;
 
+/**
+ * @brief The AbstractClient class
+ */
 class QTGRPCSHARED_EXPORT AbstractClient : public QObject
 {
     Q_OBJECT
@@ -132,5 +139,5 @@ private:
     // PIMPL
     class AbstractClientPrivate *d;
 };
-
+/** @} */
 }

+ 19 - 0
src/grpc/abstractcredentials.h

@@ -34,10 +34,17 @@
 #include "qtgrpc_global.h"
 
 namespace qtprotobuf {
+/**
+*  \addtogroup QtGrpc
+*  @{
+*/
 
 class CallCredentials;
 class ChannelCredentials;
 
+/**
+ * @brief The AbstractCredentials class
+ */
 class QTGRPCSHARED_EXPORT AbstractCredentials
 {
 public:
@@ -73,6 +80,9 @@ private:
     CredentialMap mChannelCredentials;
 };
 
+/**
+ * @brief The CallCredentials class
+ */
 class QTGRPCSHARED_EXPORT CallCredentials : public AbstractCredentials
 {
 protected:
@@ -85,6 +95,9 @@ private:
     CallCredentials() = default;
 };
 
+/**
+ * @brief The ChannelCredentials class
+ */
 class QTGRPCSHARED_EXPORT ChannelCredentials : public AbstractCredentials
 {
 protected:
@@ -93,7 +106,9 @@ protected:
         setChannelCredentials(credentialMap);
     }
 };
+/** @} */
 
+//! @private
 template<typename Call, typename Channel,
          typename std::enable_if_t<std::is_base_of<qtprotobuf::CallCredentials, Call>::value
                                    && std::is_base_of<qtprotobuf::ChannelCredentials, Channel>::value, int> = 0>
@@ -103,6 +118,7 @@ AbstractCredentials::AbstractCredentials(const Call &call, const Channel &channe
     mChannelCredentials = channel.mChannelCredentials;
 }
 
+//! @private
 template<typename Call,
          typename std::enable_if_t<std::is_base_of<qtprotobuf::CallCredentials, Call>::value, int> = 0>
 AbstractCredentials::AbstractCredentials(const Call &call)
@@ -110,6 +126,7 @@ AbstractCredentials::AbstractCredentials(const Call &call)
     mCallCredentials = call.mCallCredentials;
 }
 
+//! @private
 template<typename Channel,
          typename std::enable_if_t<std::is_base_of<qtprotobuf::ChannelCredentials, Channel>::value, int> = 0>
 AbstractCredentials::AbstractCredentials(const Channel &channel)
@@ -118,6 +135,7 @@ AbstractCredentials::AbstractCredentials(const Channel &channel)
 }
 }
 
+//! @private
 template<typename Call, typename Channel,
          typename std::enable_if_t<std::is_base_of<qtprotobuf::CallCredentials, Call>::value
                                    && std::is_base_of<qtprotobuf::ChannelCredentials, Channel>::value, int> = 0>
@@ -126,6 +144,7 @@ qtprotobuf::AbstractCredentials operator|(const Call &call, const Channel &chann
     return qtprotobuf::AbstractCredentials(call, channel);
 }
 
+//! @private
 template<typename Call, typename Channel,
          typename std::enable_if_t<std::is_base_of<qtprotobuf::CallCredentials, Call>::value
                                    && std::is_base_of<qtprotobuf::ChannelCredentials, Channel>::value, int> = 0>

+ 8 - 1
src/grpc/asyncreply.h

@@ -35,7 +35,14 @@
 #include "qtgrpc_global.h"
 
 namespace qtprotobuf {
+/**
+*  \addtogroup QtGrpc
+*  @{
+*/
 
+/**
+ * @brief The AsyncReply class
+ */
 class QTGRPCSHARED_EXPORT AsyncReply final : public QObject
 {
     Q_OBJECT
@@ -76,5 +83,5 @@ private:
 
     QMutex m_asyncLock;
 };
-
+/** @} */
 }

+ 8 - 1
src/grpc/http2channel.h

@@ -30,9 +30,16 @@
 #include <QUrl>
 
 namespace qtprotobuf {
+/**
+*  \addtogroup QtGrpc
+*  @{
+*/
 
 class AbstractCredentials;
 
+/**
+ * @brief The Http2Channel class
+ */
 class QTGRPCSHARED_EXPORT Http2Channel final : public AbstractChannel
 {
 public:
@@ -54,5 +61,5 @@ private:
     // PIMPL
     struct Http2ChannelPrivate *d;
 };
-
+/** @} */
 }

+ 8 - 1
src/grpc/insecurecredentials.h

@@ -30,11 +30,18 @@
 #include "qtgrpc_global.h"
 
 namespace qtprotobuf {
+/**
+*  \addtogroup QtGrpc
+*  @{
+*/
 
+/**
+ * @brief The InsecureCredentials class
+ */
 class QTGRPCSHARED_EXPORT InsecureCredentials : public ChannelCredentials
 {
 public:
     InsecureCredentials() : ChannelCredentials(CredentialMap()) {}
 };
-
+/** @} */
 }

+ 8 - 1
src/grpc/sslcredentials.h

@@ -32,7 +32,14 @@
 #include "qtgrpc_global.h"
 
 namespace qtprotobuf {
+/**
+*  \addtogroup QtGrpc
+*  @{
+*/
 
+/**
+ * @brief The SslCredentials class
+ */
 class QTGRPCSHARED_EXPORT SslCredentials : public ChannelCredentials
 {
 public:
@@ -40,5 +47,5 @@ public:
         ChannelCredentials(CredentialMap{{QLatin1String("sslConfig"),
                            QVariant::fromValue<QSslConfiguration>(configuation)}}) {}
 };
-
+/** @} */
 }

+ 30 - 4
src/protobuf/qabstractprotobufserializer.h

@@ -39,17 +39,43 @@
 #include "qtprotobuf_global.h"
 
 namespace qtprotobuf {
+/**
+*  \addtogroup QtProtobuf
+*  @{
+*/
 
+//! @private
+constexpr int NotUsedFieldIndex = -1;
+
+/**
+ * @brief The QAbstractProtobufSerializer class is interface that represents basic functions for serialization/deserialization
+ *
+ * @details This class is used by QProtobufSerializerRegistry to access basic serialization routines.
+ *
+ */
 class QTPROTOBUFSHARED_EXPORT QAbstractProtobufSerializer
 {
 public:
+    /**
+     * @brief Serializer is interface function for serialize method
+     */
     using Serializer = std::function<QByteArray(const QVariant &, int &)>;
+    /**
+     * @brief Deserializer is interface function for deserialize method
+     */
     using Deserializer = std::function<void(SelfcheckIterator &, QVariant &)>;
+
+    /**
+     * @brief SerializationHandlers contains set of objects that required for class serializaion/deserialization
+     */
     struct SerializationHandlers {
-        Serializer serializer;
-        Deserializer deserializer;
-        WireTypes type;
+        Serializer serializer; /**< serializer assigned to class */
+        Deserializer deserializer;/**< deserializer assigned to class */
+        WireTypes type;/**< Serialization WireType */
     };
+    /**
+     * @brief SerializerRegistry is container to store mapping between metatype identifier and serialization handlers.
+     */
     using SerializerRegistry = std::unordered_map<int/*metatypeid*/, SerializationHandlers>;
 
     virtual ~QAbstractProtobufSerializer() = default;
@@ -93,5 +119,5 @@ public:
     QByteArray serializeMapPair(const QVariant &key, const QVariant &value, int fieldIndex) override;
     void deserializeMapPair(QVariant &key, QVariant &value, SelfcheckIterator &it) override;
 };
-
+/** @} */
 }

+ 5 - 0
src/protobuf/qprotobufserializerregistry.h

@@ -38,6 +38,10 @@
 #include "qtprotobuf_global.h"
 
 namespace qtprotobuf {
+/**
+*  \addtogroup QtProtobuf
+*  @{
+*/
 
 /**
  * @brief The QProtobufSerializerRegistry class provides api to register serializers of QObjects
@@ -294,4 +298,5 @@ private:
     }
 };
 
+/** @} */
 }

+ 132 - 8
src/protobuf/qtprotobuftypes.h

@@ -31,6 +31,10 @@
 #include <unordered_map>
 
 namespace qtprotobuf {
+/**
+*  \addtogroup QtProtobuf
+*  @{
+*/
 
 /**
  * @brief The WireTypes enumeration reflects protobuf default wiretypes
@@ -39,19 +43,18 @@ namespace qtprotobuf {
  *
  */
 enum WireTypes {
-    UnknownWireType = -1,
-    Varint = 0,
-    Fixed64 = 1,
-    LengthDelimited = 2,
-    Fixed32 = 5
+    UnknownWireType = -1, //!< Invalid wire type
+    Varint = 0, //!< int32, int64, uint32, uint64, sint32, sint64, bool, enum
+    Fixed64 = 1, //!< fixed64, sfixed64, double
+    LengthDelimited = 2, //!< string, bytes, embedded messages, packed repeated fields
+    StartGroup = 3, //!< groups @deprecated Is deprecated in proto syntax 3. Not supported by QtProtobuf
+    EndGroup = 4, //!< groups @deprecated Is deprecated in proto syntax 3. Not supported by QtProtobuf
+    Fixed32 = 5 //!< fixed32, sfixed32, float
 };
 
 //! @private
 using QProtobufPropertyOrdering = std::unordered_map<int, int>;
 
-//! @private
-constexpr int NotUsedFieldIndex = -1;
-
 /**
  * @private
  *
@@ -71,30 +74,151 @@ struct transparent {
     static QString toString(transparent t) { return QString::number(t._t); }
 };
 
+/**
+ * @brief int32 signed 32-bit integer
+ *
+ * @details int32 is regular signed 32-bit integer that is represented in protobuf as variable size integer
+ * aka WireTypes::Varint without modificators
+ */
 using int32 = transparent<int32_t>;
+
+/**
+ * @brief int64 signed 64-bit integer
+ *
+ * @details int64 is regular signed 64-bit integer that is represented in protobuf as variable size integer
+ * aka WireTypes::Varint without modificators
+ */
 using int64 = transparent<int64_t>;
+
+/**
+ * @brief uint32 unsigned 32-bit integer
+ *
+ * @details uint32 is unsigned 32-bit integer that is represented in protobuf as variable size integer
+ * aka WireTypes::Varint without modificators
+ */
 using uint32 = uint32_t;
+
+/**
+ * @brief uint64 unsigned 64-bit integer
+ *
+ * @details uint64 is unsigned 64-bit integer that is represented in protobuf as variable size integer
+ * aka WireTypes::Varint without modificators
+ */
 using uint64 = uint64_t;
+
+/**
+ * @brief sint32 signed 32-bit ZigZag integer
+ *
+ * @details sint32 is 32-bit integer with forced sign marker that is represented in protobuf as variable size integer
+ * aka WireTypes::Varint. sint32 type serialized using ZigZag convertion to reduce size of negative numbers.
+ *
+ * See https://developers.google.com/protocol-buffers/docs/encoding#signed-integers for details.
+ */
 using sint32 = int32_t;
+
+/**
+ * @brief sint64 signed 64-bit ZigZag integer
+ *
+ * @details sint64 is 64-bit integer with forced sign marker that is represented in protobuf as variable size integer
+ * aka WireTypes::Varint. sint64 type serialized using ZigZag convertion to reduce size of negative numbers.
+ *
+ * See https://developers.google.com/protocol-buffers/docs/encoding#signed-integers for details.
+ */
 using sint64 = int64_t;
+
+/**
+ * @brief fixed32 unsigned 32-bit fixed size integer
+ *
+ * @details fixed32 is unsigned 32-bit integer that is represented in protobuf as fixed size 32-bit field
+ * aka WireTypes::Fixed32
+ */
 using fixed32 = transparent<uint32_t, 1>;
+
+/**
+ * @brief fixed64 unsigned 64-bit fixed size integer
+ *
+ * @details fixed64 is unsigned 64-bit integer that is represented in protobuf as fixed size 64-bit field
+ * aka WireTypes::Fixed64
+ */
 using fixed64 = transparent<uint64_t, 1>;
+
+/**
+ * @brief fixed32 signed 32-bit fixed size integer
+ *
+ * @details fixed32 is signed 32-bit integer that is represented in protobuf as fixed size 32-bit field
+ * aka WireTypes::Fixed32
+ */
 using sfixed32 = transparent<int32_t, 1>;
+
+/**
+ * @brief fixed64 signed 64-bit fixed size integer
+ *
+ * @details fixed64 is signed 64-bit integer that is represented in protobuf as fixed size 64-bit field
+ * aka WireTypes::Fixed64
+ */
 using sfixed64 = transparent<int64_t, 1>;
 
+/**
+ * @brief alias for list of qtprotobuf::int32
+ */
 using int32List = QList<int32>;
+
+/**
+ * @brief alias for list of qtprotobuf::int64
+ */
 using int64List = QList<int64>;
+
+/**
+ * @brief alias for list of qtprotobuf::uint32
+ */
 using uint32List = QList<uint32>;
+
+/**
+ * @brief alias for list of qtprotobuf::uint64
+ */
 using uint64List = QList<uint64>;
+
+/**
+ * @brief alias for list of qtprotobuf::sint32
+ */
 using sint32List = QList<sint32>;
+
+/**
+ * @brief alias for list of qtprotobuf::sint64
+ */
 using sint64List = QList<sint64>;
+
+/**
+ * @brief alias for list of qtprotobuf::fixed32
+ */
 using fixed32List = QList<fixed32>;
+
+/**
+ * @brief alias for list of qtprotobuf::fixed64
+ */
 using fixed64List = QList<fixed64>;
+
+/**
+ * @brief alias for list of qtprotobuf::sfixed32
+ */
 using sfixed32List = QList<sfixed32>;
+
+/**
+ * @brief alias for list of qtprotobuf::sfixed64
+ */
 using sfixed64List = QList<sfixed64>;
 
+/**
+ * @brief alias for list of qtprotobuf::float
+ */
 using FloatList = QList<float>;
+
+/**
+ * @brief alias for list of qtprotobuf::double
+ */
 using DoubleList = QList<double>;
+
+/** @} */
 }
 
 Q_DECLARE_METATYPE(qtprotobuf::int32)