QtProtobuf  0.6
Protobuf plugin to generate Qt classes
QtProtobufWellKnownTypes

Google Protobuf Well-Known types library for QtProtobuf.

Google Protobuf Well-Known types library for QtProtobuf.

QtProtobufWellKnownTypes contains follwing Protobuf Well-Known types:

To use well-known type in your project you may include corresponding google .proto file in your interface:

syntax = "proto3";
package somepackage;
import "google/protobuf/empty.proto";
import "google/protobuf/timestamp.proto";
message AnimationMessage {
uint32 animationId = 1;
google.protobuf.Timestamp startTime = 2;
google.protobuf.Timestamp endTime = 3;
}
service AnimationService {
rpc startAnimation(AnimationMessage) returns (google.protobuf.Empty) {}
}
uint32_t uint32
uint32 unsigned 32-bit integer
Definition: qtprotobuftypes.h:120

It's also possible to use some of generated well-known types directly, simply include corresponding header:

#include <google/protobuf/any.qpb.h>
...
google::protobuf::Any someAnyVariable;
someAnyVariable.setType_url("http://somedomain.org/someTypeDescription");
someAnyVariable.setValue(data);
...

In both scenarious you also need to link QtProtobuf WellKnownTypes library by adding following lines to CMakeLists.txt for your target.

target_link_libraries(YourTargetName PRIVATE QtProtobuf::ProtobufWellKnownTypes)