libcbor 0.12.0
libcbor is a C library for parsing and generating CBOR, the general-purpose schema-less binary data format.
Loading...
Searching...
No Matches
tags.h File Reference
#include "cbor/cbor_export.h"
#include "cbor/common.h"

Go to the source code of this file.

Functions

cbor_item_tcbor_new_tag (uint64_t value)
 Create a new tag.
 
cbor_item_tcbor_tag_item (const cbor_item_t *tag)
 Get the tagged item (what the tag points to).
 
uint64_t cbor_tag_value (const cbor_item_t *tag)
 Get the tag value.
 
void cbor_tag_set_item (cbor_item_t *tag, cbor_item_t *tagged_item)
 Assign a tag to an item.
 
cbor_item_tcbor_build_tag (uint64_t value, cbor_item_t *item)
 Build a new tag.
 

Function Documentation

◆ cbor_build_tag()

cbor_item_t * cbor_build_tag ( uint64_t value,
cbor_item_t * item )

Build a new tag.

Parameters
itemThe item to tag. Its reference count will be increased by one.
valueThe tag value (number).
Returns
Reference to the new tag item. The item's reference count is initialized to one.
NULL if memory allocation fails.

Definition at line 39 of file tags.c.

◆ cbor_new_tag()

cbor_item_t * cbor_new_tag ( uint64_t value)

Create a new tag.

Parameters
valueThe tag value (number).
Returns
Reference to the new tag. Its reference count is initialized to one and it points to a NULL item.
NULL if memory allocation fails.

Definition at line 10 of file tags.c.

◆ cbor_tag_item()

cbor_item_t * cbor_tag_item ( const cbor_item_t * tag)

Get the tagged item (what the tag points to).

Parameters
tagA CBOR_TYPE_TAG tag.
Returns
Reference to the tagged item.

Increases the reference count of the underlying item. The returned reference must be released using cbor_decref.

Definition at line 23 of file tags.c.

◆ cbor_tag_set_item()

void cbor_tag_set_item ( cbor_item_t * tag,
cbor_item_t * tagged_item )

Assign a tag to an item.

Parameters
tagA CBOR_TYPE_TAG tag.
tagged_itemThe item to tag. Its reference count will be increased by one.

If the tag already points to an item, the pointer will be replaced, without a reference count change on the previous item. TODO: Should we release the reference automatically?

Definition at line 33 of file tags.c.

◆ cbor_tag_value()

uint64_t cbor_tag_value ( const cbor_item_t * tag)

Get the tag value.

Parameters
tagA CBOR_TYPE_TAG tag.
Returns
The tag value (number).

Definition at line 28 of file tags.c.