Type 3 – UTF-8 strings¶
CBOR strings work in much the same ways as Type 2 – Byte strings.
Corresponding cbor_type |
CBOR_TYPE_STRING |
Number of allocations (definite) | One plus any manipulations with the data |
Number of allocations (indefinite) | One plus logarithmically many reallocations relative to chunk count |
Storage requirements (definite) | sizeof(cbor_item_t) + length(handle) |
Storage requirements (indefinite) | sizeof(cbor_item_t) * (1 + chunk_count) + chunks |
Streaming indefinite strings¶
Please refer to Streaming & indefinite items.
UTF-8 encoding validation¶
libcbor considers UTF-8 encoding validity to be a part of the well-formedness notion of CBOR and therefore invalid UTF-8 strings will be rejected by the parser. Strings created by the user are not checked.
Getting metadata¶
Warning
doxygenfunction: Cannot find file: /tmp/B.5qzRfz/BUILD/libcbor-0.5.0/doc/build/doxygen/xml/index.xml
Warning
doxygenfunction: Cannot find file: /tmp/B.5qzRfz/BUILD/libcbor-0.5.0/doc/build/doxygen/xml/index.xml
Warning
doxygenfunction: Cannot find file: /tmp/B.5qzRfz/BUILD/libcbor-0.5.0/doc/build/doxygen/xml/index.xml
Warning
doxygenfunction: Cannot find file: /tmp/B.5qzRfz/BUILD/libcbor-0.5.0/doc/build/doxygen/xml/index.xml
Reading data¶
Warning
doxygenfunction: Cannot find file: /tmp/B.5qzRfz/BUILD/libcbor-0.5.0/doc/build/doxygen/xml/index.xml
Warning
doxygenfunction: Cannot find file: /tmp/B.5qzRfz/BUILD/libcbor-0.5.0/doc/build/doxygen/xml/index.xml
Creating new items¶
Warning
doxygenfunction: Cannot find file: /tmp/B.5qzRfz/BUILD/libcbor-0.5.0/doc/build/doxygen/xml/index.xml
Warning
doxygenfunction: Cannot find file: /tmp/B.5qzRfz/BUILD/libcbor-0.5.0/doc/build/doxygen/xml/index.xml
Building items¶
Warning
doxygenfunction: Cannot find file: /tmp/B.5qzRfz/BUILD/libcbor-0.5.0/doc/build/doxygen/xml/index.xml
Manipulating existing items¶
Warning
doxygenfunction: Cannot find file: /tmp/B.5qzRfz/BUILD/libcbor-0.5.0/doc/build/doxygen/xml/index.xml
Warning
doxygenfunction: Cannot find file: /tmp/B.5qzRfz/BUILD/libcbor-0.5.0/doc/build/doxygen/xml/index.xml