QtProtobuf Namespace

The QtProtobuf namespace contains type aliases and classes needed to support Qt Protobuf. More...

Header: #include <QtProtobuf>
CMake: find_package(Qt6 REQUIRED COMPONENTS Protobuf)
target_link_libraries(mytarget PRIVATE Qt6::Protobuf)
Since: Qt 6.5
Status: Technical Preview

Classes

(since 6.6) class Any

Types

Functions

void qRegisterProtobufQtCoreTypes()
void qRegisterProtobufQtGuiTypes()
void qRegisterProtobufTypes()
bool repeatedValueCompare(const QList<T> &a, const QList<T> &b)
bool repeatedValueCompare(const QHash<K, V> &a, const QHash<K, V> &b)

Detailed Description

Classes

class Any

A helper class to simplify working with the protobuf Any type. More...

Type Documentation

enum class QtProtobuf::WireTypes

The WireTypes enumeration reflects protobuf default wiretypes.

The following table shows the values in the enumeration and their corresponding types:

ConstantValueDescription
QtProtobuf::WireTypes::Unknown-1Invalid wire type
QtProtobuf::WireTypes::Varint0int32, int64, uint32, uint64, sint32, sint64, bool, enum
QtProtobuf::WireTypes::Fixed641fixed64, sfixed64, double
QtProtobuf::WireTypes::LengthDelimited2string, bytes, embedded messages, packed repeated fields
QtProtobuf::WireTypes::StartGroup3groups. Deprecated in proto syntax 3. Not supported by Qt Protobuf.
QtProtobuf::WireTypes::EndGroup4groups. Deprecated in proto syntax 3. Not supported by Qt Protobuf.
QtProtobuf::WireTypes::Fixed325fixed32, sfixed32, float

See also encoding.

[alias] QtProtobuf::boolList

Alias for a list of bool.

[alias] QtProtobuf::doubleList

Alias for a list of double.

[alias] QtProtobuf::fixed32

fixed32 is an unsigned 32-bit integer that is represented in protobuf as a fixed size 32-bit field, an alias for WireTypes::Fixed32.

[alias] QtProtobuf::fixed64

fixed64 is an unsigned 64-bit integer that is represented in protobuf as a fixed size 64-bit field, an alias for WireTypes::Fixed64.

[alias] QtProtobuf::fixed32List

Alias for a list of QtProtobuf::fixed32.

[alias] QtProtobuf::fixed64List

Alias for a list of QtProtobuf::fixed64.

[alias] QtProtobuf::floatList

Alias for a list of float.

[alias] QtProtobuf::int32

int32 is a regular signed 32-bit integer that is represented in protobuf as a variable size integer, an alias for WireTypes::Varint.

[alias] QtProtobuf::int64

int64 is a regular signed 64-bit integer that is represented in protobuf as a variable size integer, an alias for WireTypes::Varint.

[alias] QtProtobuf::int32List

Alias for a list of QtProtobuf::int32.

[alias] QtProtobuf::int64List

Alias for a list of QtProtobuf::int64.

[alias] QtProtobuf::sfixed32

sfixed32 is a signed 32-bit integer that is represented in protobuf as a fixed size 32-bit field, an alias for WireTypes::Fixed32.

[alias] QtProtobuf::sfixed64

sfixed64 is a signed 64-bit integer that is represented in protobuf as a fixed size 64-bit field, an alias for WireTypes::Fixed64.

[alias] QtProtobuf::sfixed32List

Alias for a list of QtProtobuf::sfixed32.

[alias] QtProtobuf::sfixed64List

Alias for a list of QtProtobuf::sfixed64.

[alias] QtProtobuf::sint32

sint32 is a 32-bit integer with forced sign marker that is represented in protobuf as variable size integer, an alias for WireTypes::Varint. sint32 is serialized using ZigZag conversion to reduce size of negative numbers.

See also signed-integers.

[alias] QtProtobuf::sint64

sint64 is a 64-bit integer with forced sign marker that is represented in protobuf as variable size integer, an alias for WireTypes::Varint. sint64 is serialized using ZigZag conversion to reduce size of negative numbers.

See also signed-integers.

[alias] QtProtobuf::sint32List

Alias for a list of QtProtobuf::sint32.

[alias] QtProtobuf::sint64List

Alias for a list of QtProtobuf::sint64.

[alias] QtProtobuf::uint32

uint32 is an unsigned 32-bit integer that is represented in protobuf as variable size integer, an alias for WireTypes::Varint.

[alias] QtProtobuf::uint64

uint64 is an unsigned 64-bit integer that is represented in protobuf as variable size integer, an alias for WireTypes::Varint.

[alias] QtProtobuf::uint32List

Alias for a list of QtProtobuf::uint32.

[alias] QtProtobuf::uint64List

Alias for a list of QtProtobuf::uint64.

Function Documentation

void QtProtobuf::qRegisterProtobufQtCoreTypes()

Registers serializers for the Qt::ProtobufQtCoreTypes library.

void QtProtobuf::qRegisterProtobufQtGuiTypes()

Registers serializers for the Qt::ProtobufQtGuiTypes library.

void qRegisterProtobufTypes()

Calling this function registers all, currently known, protobuf types with the serializer registry.

Note: You should not have to call this function manually, as it is called automatically upon attempting serialization or deserialization of a protobuf message.

template <typename T> bool QtProtobuf::repeatedValueCompare(const QList<T> &a, const QList<T> &b)

Compares two repeated fields (essentially a list) to each other. Returns true if a is equal to b, false otherwise.

These functions are used in the generated code to implement operator==.

template <typename K, typename V> bool QtProtobuf::repeatedValueCompare(const QHash<K, V> &a, const QHash<K, V> &b)

Compares two map fields to each other. Returns true if a is equal to b, false otherwise.

These functions are used in the generated code to implement operator==.