Type 6 – Semantic tags¶
Tag are additional metadata that can be used to extend or specialize the meaning or interpretation of the other data items.
For example, one might tag an array of numbers to communicate that it should be interpreted as a vector.
Please consult the official IANA repository of CBOR tags before inventing new ones.
Corresponding cbor_type |
CBOR_TYPE_TAG |
Number of allocations | One plus any manipulations with the data reallocations relative to chunk count |
Storage requirements | sizeof(cbor_item_t) + the tagged item |
-
cbor_item_t *
cbor_new_tag
(uint64_t value)¶ Create a new tag.
- Return
- new tag. Item reference is
NULL
. ReturnsNULL
upon memory allocation failure - Parameters
value
: The tag value. Please consult the tag repository
-
cbor_item_t *
cbor_tag_item
(const cbor_item_t *item)¶ Get the tagged item.
- Return
- incref the tagged item
- Parameters
item[borrow]
: A tag
-
uint64_t
cbor_tag_value
(const cbor_item_t *item)¶ Get tag value.
- Return
- The tag value. Please consult the tag repository
- Parameters
item[borrow]
: A tag
-
void
cbor_tag_set_item
(cbor_item_t *item, cbor_item_t *tagged_item)¶ Set the tagged item.
- Parameters
item[borrow]
: A tagtagged_item[incref]
: The item to tag