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.

param value

The tag value. Please consult the tag repository

return

new tag. Item reference is NULL. Returns NULL upon memory allocation failure

cbor_item_t *cbor_tag_item(const cbor_item_t *item)

Get the tagged item.

param item[borrow]

A tag

return

incref the tagged item

uint64_t cbor_tag_value(const cbor_item_t *item)

Get tag value.

param item[borrow]

A tag

return

The tag value. Please consult the tag repository

void cbor_tag_set_item(cbor_item_t *item, cbor_item_t *tagged_item)

Set the tagged item.

param item[borrow]

A tag

param tagged_item[incref]

The item to tag