cbor

Members

Classes

CborException
class CborException

Thrown in a case of decoding error.

Functions

decodeCbor
CborValue decodeCbor(R input)

Decodes single value and returns it as CborValue tagged union type. Throws CborException if data is not well-formed. Note, that ubyte[] and string types are slices of input range if ubyte[] was provided.

decodeCborSingle
T decodeCborSingle(R input)

Decodes single cbor value and tries to convert it to requested type. If types doesn't match CborException is thrown. Note, that ubyte[] and string types are slices of input range if ubyte[] was provided.

encodeCbor
size_t encodeCbor(R sink, E value)

Encodes value E into output range sink. Returns number of bytes written to sink.

encodeCborAggregate
size_t encodeCborAggregate(R sink, A aggregate)

Encodes classes and structs. If withFieldName is yes, than value is encoded as map. If withFieldName is no, then value is encoded as an array.

encodeCborArray
size_t encodeCborArray(R sink, E value)

Encodes array of any items or a tuple as cbor array.

encodeCborArray
size_t encodeCborArray(R sink, A aggregate)

Encodes structs and classes as cbor array.

encodeCborArrayHead
size_t encodeCborArrayHead(R sink, ulong arrayLength)

Encode array head with arrayLength elements. arrayLength items must follow.

encodeCborBool
size_t encodeCborBool(R sink, E value)

Encodes boolean.

encodeCborFloat
size_t encodeCborFloat(R sink, E value)

Encodes floating.

encodeCborInt
size_t encodeCborInt(R sink, E value)

Encodes integer.

encodeCborMap
size_t encodeCborMap(R sink, E value)

Encodes asociative array as cbor map.

encodeCborMap
size_t encodeCborMap(R sink, A aggregate)

Encodes structs and classes as cbor map. Note, that decoding of structs and classes from maps is not supported (yet).

encodeCborMapHead
size_t encodeCborMapHead(R sink, ulong mapLength)

Encode map head with mapLength elements. mapLength pairs of items must follow. Keys first, then values.

encodeCborNull
size_t encodeCborNull(R sink, E value)

Encodes null.

encodeCborRaw
size_t encodeCborRaw(R sink, E value)

Encodes range of ubytes.

encodeCborString
size_t encodeCborString(R sink, E value)

Encodes string.

Structs

CborValue
struct CborValue
Undocumented in source.

Meta

Authors

Andrey Penechko.

Some code is based on msgpack-d by Masahiro Nakagawa.

Concise Binary Object Representation (CBOR) for D lang