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
cbor.h File Reference
#include "cbor/common.h"
#include "cbor/data.h"
#include "cbor/arrays.h"
#include "cbor/bytestrings.h"
#include "cbor/floats_ctrls.h"
#include "cbor/ints.h"
#include "cbor/maps.h"
#include "cbor/strings.h"
#include "cbor/tags.h"
#include "cbor/callbacks.h"
#include "cbor/cbor_export.h"
#include "cbor/encoding.h"
#include "cbor/serialization.h"
#include "cbor/streaming.h"

Go to the source code of this file.

Functions

cbor_item_tcbor_load (cbor_data source, size_t source_size, struct cbor_load_result *result)
 Loads data item from a buffer.
 
cbor_item_tcbor_copy (cbor_item_t *item)
 Take a deep copy of an item.
 

Function Documentation

◆ cbor_copy()

cbor_item_t * cbor_copy ( cbor_item_t * item)

Take a deep copy of an item.

All items this item points to (array and map members, string chunks, tagged items) will be copied recursively using cbor_copy. The new item doesn't alias or point to any items from the original item. All the reference counts in the new structure are set to one.

Parameters
itemitem to copy
Returns
Reference to the new item. The item's reference count is initialized to one.
NULL if memory allocation fails

Definition at line 155 of file cbor.c.

◆ cbor_load()

cbor_item_t * cbor_load ( cbor_data source,
size_t source_size,
struct cbor_load_result * result )

Loads data item from a buffer.

Parameters
sourceThe buffer
source_size
[out]resultResult indicator. CBOR_ERR_NONE on success
Returns
Decoded CBOR item. The item's reference count is initialized to one.
NULL on failure. In that case, result contains the location and description of the error.

Definition at line 12 of file cbor.c.