[Development] API review request: CBOR Stream reader and writer

Thiago Macieira thiago.macieira at intel.com
Wed Jan 24 20:45:00 CET 2018


On Wednesday, 24 January 2018 10:49:32 PST Thiago Macieira wrote:
> I've added a CBOR dump tool example, which can help you with understanding
> what you have:

One more difference: since "convert" uses QCborValue, it will normalise a few 
items:

$ ./convert/convert /tmp/test3.cbor        
[
    32("https://example.com/© "),
    0("2018-01-10T06:24:37.000Z")
]
$ ./cbordump/cbordump /tmp/test3.cbor 
[
    32("HTTPS://EXAMPLE.COM/%C2%A9 "),
    1(1515565477)
]

Note how there's information loss if you try to convert this to JSON:
$ ./convert/convert -O json /tmp/test3.cbor
[
    "https://example.com/%C2%A9%20",
    "2018-01-10T06:24:37.000Z"
]
[This was after change https://codereview.qt-project.org/217854 to QJsonValue]

$ ./cbordump/cbordump --annotated /tmp/test3.cbor        
82                                                 # Array length 2
  d8 20                                            # Tag 32 (URI; see Section 
2.4.4.3 [RFC7049])
    78 1b                                          # Text string length 27
      48 54 54 50 53 3a 2f 2f 45 58 41 4d 50 4c    # "HTTPS://EXAMPL"
      45 2e 43 4f 4d 2f 25 43 32 25 41 39 20       # "E.COM/%C2%A9 "
  c1                                               # Tag 1 (Epoch-based date/
time; see Section 2.4.1 [RFC7049])
    1a 5a 55 b1 a5                                 # Unsigned integer 
0x5a55b1a5

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






More information about the Development mailing list