DEV Community

sarritesh
sarritesh

Posted on

Reading key and value from a map field in protobuf message using c++ API call

I have a proto3 file. There is a message in the proto file that contains a map field.

proto3
package abc.xyz.testproto
message abc
{
map mapfield = 1;
}
Suppose as a c++ consumer i want to read this map field, what would be the api call necessary for me to read these key and value from this map field into a string and int field in c++ ?

I tried to look for it here : https://developers.google.com/protocol-buffers/docs/reference/cpp-generated#map-fields but could not find how the code on how to consume the map fields. Can someone help me with it ?

Top comments (0)