[Interest] QCborValue and Qt types
Andrew Ialacci
andrew at dkai.dk
Sun Dec 2 19:12:56 CET 2018
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.
Sent from my iPhone
> On Dec 1, 2018, at 6:43 PM, Thiago Macieira <thiago.macieira at intel.com> wrote:
>
>> On Saturday, 1 December 2018 03:54:35 PST Konstantin Shegunov wrote:
>> Hello,
>> I'm evaluating Qt's (5.12) cbor implementation for a network transmission
>> protocol. I saw that few Qt types were tagged already (I imagine as a proof
>> of concept/preview). Are there plans to extend these to include more types
>> (e.g. QImage) or should I just stick to writing them as binary buffers?
>> As a follow-up what is the suggested way to pass *custom* types to QCbor*,
>> are they to be streamed through QVariant?
>
> Yes and no. See the attached draft spec (tag numbers are outdated) for a few
> types I had been thinking of and already have an implementation for. Which
> also reminds me I needed to send them to the CBOR IETF group for review.
>
> I was thinking of sticking at first to QtCore types, so QImage will not be
> included. I'm not even sure how we could add support for types in other
> libraries; possibly you'll need to register a serialisation and
> deserialisation function like qRegisterStreamOperators does.
>
> And also note that we'll never get actual matching to Qt types. Like in the
> attached geometry proposal, there's one type for size, not one for size and
> one for size-float. This is important if you look at classes that are
> identical but of different generations, like QVector4D and QQuaternion, or
> worse functionally identical ones like QPixmap, QBitmap and QImage. We won't
> get a standard tag that distinguishes them, since that distinction is not
> useful outside of Qt. I'm open to ideas on how we can address that.
>
> --
> Thiago Macieira - thiago.macieira (AT) intel.com
> Software Architect - Intel Open Source Technology Center
> <cbor-tags-geometry.rst>
> <cbor-tag-bitarray.rst>
> _______________________________________________
> Interest mailing list
> Interest at lists.qt-project.org
> https://lists.qt-project.org/listinfo/interest
More information about the Interest
mailing list