[Interest] QCborValue and Qt types

Thiago Macieira thiago.macieira at intel.com
Sun Dec 2 20:20:13 CET 2018

On Sunday, 2 December 2018 10:12:56 PST Andrew Ialacci wrote:
> Hope it’s ok that I barge in :P
> Are there any recommended strategies for serializing custom model objects?
> For example a Person class with name, age, and gender properties. 
> Or would I just write a 
> QByteArray toCBOR() const 
> method on all my model classes and create the CBOR object representation
> manually like with JSON. 

I'm not sure you meant to return a binary to be placed inside a CBOR payload 
or if that is the CBOR serialisation. Either way, I don't think returning 
QByteArray is a good idea. Instead, return QCborValue, such that the value may 
be placed inside a larger object or array if the caller so wishes.

Or if you want to do streaming, just void serialize(QCborStreamWriter &);

Similar for decoding.
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center

More information about the Interest mailing list