new tiny wrapper for protobuf c++ api

18 views
Skip to first unread message

Machine Therapist

unread,
Sep 22, 2025, 5:43:17 AM (4 days ago) Sep 22
to Protocol Buffers

hey,

i was playing around with the protobuf c++ api. to me it felt a bit verbose — lots of setters/getters and mutable pointers, not always easy to read.

as a late-night experiment i hacked together a small plugin that generates an extra “sugar” header on top of the usual .pb.h. with that you can write code that looks closer to plain structs:

User userRaw; 
UserWrapped sugar(userRaw); 
 sugar.id = 123; 
sugar.tags.push_back("cpp"); 
sugar.profile.city = "Berlin";

under the hood it’s still protobuf, so it stays compatible and type-safe.

repo: https://github.com/illegal-instruction-co/sugar-proto

this is very new and experimental, and i don’t have deep knowledge of protobuf internals. i’m sure there are things i’ve overlooked. any professional feedback or critique would be super valuable.

thanks!

Reply all
Reply to author
Forward
0 new messages