[Development] Proposal for an efficient and robust (de)serialization mechanism working with Qt-supported data
Arnaud Clere
arnaud.clere at minmaxmedical.com
Wed Sep 4 09:36:05 CEST 2019
Ok, I will not resist! Thinking twice, QTransmogrifier avoids promising too much and the length is not a problem since it only appears as QTransmogrifier<T> full specializations.
It is just *one* way to transform C++ data to an abstract structured value, that will then be disguised as Cbor, Xml...
So, if you just need to get your data in Xml's disguise it's ok but like with Calvin's transmogrifier, it may not be exactly the Xml you wanted.
See the result of QXmlWriter(&w).bind(person) : <Person><names><string>John</string><string>Doe</string></names><height>1.75</height><age>18</age><phones/><comments>...</comments><children/></Person>
If you need xCard, you will have to write a customized 'bind' or use an xslt afterward.
However, I would really keep 'bind' for the fluent interface methods that associate a part of a value to a name. The context makes it clear we are not binding SQL or function parameters. And it will suggest similarities with C++17 structured binding (just operating on abstract values instead of C++ aggregates):
auto [x,y] = {1,2}; // https://en.cppreference.com/w/cpp/language/structured_binding
QJsonReader("{1,2}")
.sequence()
.bind(x)
.bind(y);
-----Original Message-----
From: Lars Knoll <lars.knoll at qt.io>
>>> transfigure (probably too long)
>> I cannot resist to suggest QTransmogrifier 😊
> You know, I was really tempted to suggest Transmogrifier but thought I would be the only one. I really do think it's a great name! Just a little too long. That said, it is an awesome name and very unique can't can't be mistaken for being anything else.
Great idea. My son would also love that name :)
And it would give me a great excuse to show Calvin and Hobbes strips whenever I have to give a talk about Qt ;-)
More information about the Development
mailing list