.. index:: cbor(StringRepresentation)
.. _cbor/1:

.. rst-class:: right

**object**

``cbor(StringRepresentation)``
==============================

* ``StringRepresentation`` - Text representation to be used when decoding CBOR strings. Possible values are ``atom`` (default), ``chars``, and ``codes``.


Concise Binary Object Representation (CBOR) format exporter and importer.

| **Availability:** 
|    ``logtalk_load(cbor(loader))``

| **Author:** Paulo Moura
| **Version:** 0:11:1
| **Date:** 2021-12-06

| **Compilation flags:**
|    ``static, context_switching_calls``


| **Uses:**
|    :ref:`list <list/0>`

| **Remarks:**
|    (none)

| **Inherited public predicates:**
|    (none)

.. contents::
   :local:
   :backlinks: top

Public predicates
-----------------

.. index:: parse/2
.. _cbor/1::parse/2:

``parse/2``
^^^^^^^^^^^

Parses a list of bytes in the CBOR format returning the corresponding term representation. Throws an error when parsing is not possible (usually due to an invalid byte sequence).

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``parse(Bytes,Term)``
| **Mode and number of proofs:**
|    ``parse(@list(byte),-ground)`` - ``one_or_error``


------------

.. index:: generate/2
.. _cbor/1::generate/2:

``generate/2``
^^^^^^^^^^^^^^

Generates a list of bytes in the CBOR format representing the given term. Throws an error when generating is not possible (usually due to a term that have no CBOR corresponding representation).

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``generate(Term,Bytes)``
| **Mode and number of proofs:**
|    ``generate(@ground,-list(byte))`` - ``one_or_error``


------------

Protected predicates
--------------------

(no local declarations; see entity ancestors if any)

Private predicates
------------------

(no local declarations; see entity ancestors if any)

Operators
---------

(none)

