1Type 3 – UTF-8 strings 2============================= 3 4CBOR strings work in much the same ways as :doc:`type_2`. 5 6================================== ====================================================== 7Corresponding :type:`cbor_type` ``CBOR_TYPE_STRING`` 8Number of allocations (definite) One plus any manipulations with the data 9Number of allocations (indefinite) One plus logarithmically many 10 reallocations relative to chunk count 11Storage requirements (definite) ``sizeof(cbor_item_t) + length(handle)`` 12Storage requirements (indefinite) ``sizeof(cbor_item_t) * (1 + chunk_count) + chunks`` 13================================== ====================================================== 14 15Streaming indefinite strings 16~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 17 18Please refer to :doc:`/streaming`. 19 20UTF-8 encoding validation 21~~~~~~~~~~~~~~~~~~~~~~~~~~~ 22*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. 23 24 25Getting metadata 26~~~~~~~~~~~~~~~~~ 27 28.. doxygenfunction:: cbor_string_length 29.. doxygenfunction:: cbor_string_is_definite 30.. doxygenfunction:: cbor_string_is_indefinite 31.. doxygenfunction:: cbor_string_chunk_count 32 33Reading data 34~~~~~~~~~~~~~ 35 36.. doxygenfunction:: cbor_string_handle 37.. doxygenfunction:: cbor_string_chunks_handle 38 39Creating new items 40~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 41 42.. doxygenfunction:: cbor_new_definite_string 43.. doxygenfunction:: cbor_new_indefinite_string 44 45 46Building items 47~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 48.. doxygenfunction:: cbor_build_string 49 50 51Manipulating existing items 52~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 53 54.. doxygenfunction:: cbor_string_set_handle 55.. doxygenfunction:: cbor_string_add_chunk 56