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…


This content originally appeared on DEV Community and was authored by sarritesh

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 ?


This content originally appeared on DEV Community and was authored by sarritesh


Print Share Comment Cite Upload Translate Updates
APA

sarritesh | Sciencx (2022-03-24T14:15:17+00:00) Reading key and value from a map field in protobuf message using c++ API call. Retrieved from https://www.scien.cx/2022/03/24/reading-key-and-value-from-a-map-field-in-protobuf-message-using-c-api-call/

MLA
" » Reading key and value from a map field in protobuf message using c++ API call." sarritesh | Sciencx - Thursday March 24, 2022, https://www.scien.cx/2022/03/24/reading-key-and-value-from-a-map-field-in-protobuf-message-using-c-api-call/
HARVARD
sarritesh | Sciencx Thursday March 24, 2022 » Reading key and value from a map field in protobuf message using c++ API call., viewed ,<https://www.scien.cx/2022/03/24/reading-key-and-value-from-a-map-field-in-protobuf-message-using-c-api-call/>
VANCOUVER
sarritesh | Sciencx - » Reading key and value from a map field in protobuf message using c++ API call. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2022/03/24/reading-key-and-value-from-a-map-field-in-protobuf-message-using-c-api-call/
CHICAGO
" » Reading key and value from a map field in protobuf message using c++ API call." sarritesh | Sciencx - Accessed . https://www.scien.cx/2022/03/24/reading-key-and-value-from-a-map-field-in-protobuf-message-using-c-api-call/
IEEE
" » Reading key and value from a map field in protobuf message using c++ API call." sarritesh | Sciencx [Online]. Available: https://www.scien.cx/2022/03/24/reading-key-and-value-from-a-map-field-in-protobuf-message-using-c-api-call/. [Accessed: ]
rf:citation
» Reading key and value from a map field in protobuf message using c++ API call | sarritesh | Sciencx | https://www.scien.cx/2022/03/24/reading-key-and-value-from-a-map-field-in-protobuf-message-using-c-api-call/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.