This is a project I wanted to do to see if some ideas I had would work in practice. For a while I was thinking of how I could bind C++ class into Roboto (My own scripting language) and the best way I thought of doing so was by “registering” the class and its members, I think most scripting library that offer this feature do it like so. So I built this protoptype to see if the implementation I was thinking about would work. This serializer has multiple flaws and is not completly finished, some part of the code is quite a mess and there’s still multiple compile warning. Nontheless I was able to see how to ameliorate the design and I’m quite confident that when it will be time to add thoses feature to Roboto it should be much more simple. It was also an occasion get used to Unit Tests.
How it work
Let’s say you have some struct like this:
Then you can register them very easily like so:
Once the type has been registered it is very easy to serialize the struct
And of course you can provide your own conversion function