|
@@ -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)
|