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!
--
You received this message because you are subscribed to the Google Groups
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/protobuf/01bd25db-570e-4e5a-a50e-399e1c434f3fn%40googlegroups.com.