Sonntag, 26. Juni 2011

The Return of Datenwerk Schema

You may remember: A while back I had started on writing a C++ code generator for Datenwerk based on JSON Schema, but then abandoned the task because I felt that C++ was inhibiting the ability to expand generated classes.

Still, I grew bored with having to writing my own project dependent wrappers quickly, so I decided to accept the limitation. The generated classes look quite analogous to the interfaces generated by Protobuf, and it was easy to translate existing code to the new interfaces.

This is how it works now: you write a schema for your data structure using JSON schema, use dwsc to generate C++ classes, and use those classes as thin wrappers for Datenwerk Objects in your project, giving you a reasonable amount of type safety, and enhancing the readability of your code.

The generated interface will do its best to augment incomplete data structures and return default values for missing object keys. You also get access to actual items, so you can attach signals whenever you feel like it.

Keine Kommentare:

Kommentar veröffentlichen