semlanik / qtprotobuf

Protobuf generator and bindings for Qt framework
https://semlanik.github.io/qtprotobuf
MIT License
170 stars 37 forks source link

Make message generation configurable #275

Closed RBQt closed 2 years ago

RBQt commented 2 years ago

Problem description First of all, thanks for the contribution to the Qt community, u've got urself a real time saving tool right there. The issue: Messages code generation is statically defined, cannot add features to the generated code.

Suggestion/solution Add more granularity to the message generation process by doing the following:

Additional context Some like the following should do:

Message Factory::create(Factory::Features key, Message message, QJsonObject configuration);

where Factory::Features would contain some like the following: enum Features { Constructor, Setter Getter Field ... };

if u're down in having this capability in the project i could propose a quick generic implementation once u hand me the collaborator rights (just hand them to me regardless )

semlanik commented 2 years ago

This is very ambitious suggestion, I would love to see this in the reference protobuf generator. But from qtprotobufgen it will be hard to test the generated code in all possible scenario, and would add code incompatibility in many scenarios. I agree that current generator is far from ideal, but by making it customizable, it only cultivates entropy.

RBQt commented 2 years ago

"But from qtprotobufgen it will be hard to test the generated code in all possible scenario"

Well, the fact that the generated code is customizable by the user defeates the purpose of testing "the generated code in all possible scenario" since there are infinit numbers of scenario. It's the purpose of this request, to be able to model the generated code as it pleases. it would be the user's responsibility to test the output. The project would still have to test the factory configurations which is not an easy thing to do, i'll give you that. But hey, great features comes with great responsibility :)

Closing the issue