I am looking at adapting some code to move from JSON/packed data to CBOR. 
However the first question I have is how do I know when a CBOR object is done?  
If I have multiple or partial CBOR objects in a QByteArray how do I handle 
that? What if it's coming in through a QIODevice? With JSON I could just look 
for a } of the same stack level (0) and know the object was done.  How is this 
handled in Qt/CBOR?

Fundamentally I am sending 256-1024 byte objects around which correspond to a 
QVariantMap, so ideally I would like to do:
QCborMap map = QCborValue::fromDevice(socket).toMap();
if (map.size()==0) { /* partial or no object read, retry on next ReadyRead */ }
or 
QCborMap map = QCborValue::fromByteArray(socket, &byteArray).toMap(); /* 
modifies bytearray on successful decode to start at next object */


I am not using indeterminate length objects.


Many thanks.
_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest

Reply via email to