Package-level declarations

Types

Link copied to clipboard
data class ArrayBuilder<T>(parent: T, array: CborArray)

Array builder.

Link copied to clipboard
data class Bstr(val value: ByteArray) : DataItem

Byte String (major type 2).

Link copied to clipboard
object Cbor

CBOR support routines.

Link copied to clipboard
class CborArray(val items: MutableList<DataItem>, val indefiniteLength: Boolean = false) : DataItem

Array (major type 4).

Link copied to clipboard
class CborBuilder(item: DataItem)

CBOR data item builder.

Link copied to clipboard
class CborDouble(val value: Double) : DataItem

Single-precision floating point number (major type 7).

Link copied to clipboard
class CborFloat(val value: Float) : DataItem

Single-precision floating point number (major type 7).

Link copied to clipboard
abstract class CborInt(val majorType: MajorType) : DataItem

Base class for Nint and Uint.

Link copied to clipboard
class CborMap(val items: MutableMap<DataItem, DataItem>, val indefiniteLength: Boolean = false) : DataItem

Map (major type 5).

Link copied to clipboard
sealed class DataItem

Abstract base class for CBOR data items.

Link copied to clipboard

Enumeration of options that can be passed to Cbor.toDiagnostics.

Link copied to clipboard
data class IndefLengthBstr(val chunks: List<ByteArray>) : DataItem

Byte String (major type 2), indefinite length.

Link copied to clipboard
data class IndefLengthTstr(val chunks: List<String>) : DataItem

Unicode String (major type 3), indefinite length.

Link copied to clipboard

CBOR major types.

Link copied to clipboard
class MapBuilder<T>(parent: T, map: CborMap)

Map builder.

Link copied to clipboard
class Nint(val value: ULong) : CborInt

Negative Integer (major type 1).

Link copied to clipboard
class RawCbor(val encodedCbor: ByteArray) : DataItem

Data item for raw CBOR.

Link copied to clipboard
class Simple(val value: UInt) : DataItem

Simple (major type 7)

Link copied to clipboard
class Tagged(val tagNumber: Long, val taggedItem: DataItem) : DataItem

Tag (major type 6).

Link copied to clipboard
class Tstr(val value: String) : DataItem

Unicode String (major type 3).

Link copied to clipboard
class Uint(val value: ULong) : CborInt

Unsigned Integer (major type 0).

Functions

Link copied to clipboard
fun <T> ArrayBuilder<T>.addCborArray(builderAction: ArrayBuilder<ArrayBuilder<T>>.() -> Unit)

Adds the DataItem for a CBOR array produced by the given builder action to a CBOR array.

Link copied to clipboard
fun <T> ArrayBuilder<T>.addCborMap(builderAction: MapBuilder<ArrayBuilder<T>>.() -> Unit)

Adds the DataItem for a CBOR map produced by the given builder action to a CBOR array.

Link copied to clipboard

Builds a DataItem for a CBOR array with the given builder action.

Link copied to clipboard
fun buildCborMap(builderAction: MapBuilder<CborBuilder>.() -> Unit): DataItem

Builds a DataItem for a CBOR map with the given builder action.

Link copied to clipboard
fun <T> MapBuilder<T>.putCborArray(key: Long, builderAction: ArrayBuilder<MapBuilder<T>>.() -> Unit)
fun <T> MapBuilder<T>.putCborArray(key: String, builderAction: ArrayBuilder<MapBuilder<T>>.() -> Unit)
fun <T> MapBuilder<T>.putCborArray(key: DataItem, builderAction: ArrayBuilder<MapBuilder<T>>.() -> Unit)

Adds the DataItem for a CBOR array produced by the given builder action to a CBOR map.

Link copied to clipboard
fun <T> MapBuilder<T>.putCborMap(key: Long, builderAction: MapBuilder<MapBuilder<T>>.() -> Unit)
fun <T> MapBuilder<T>.putCborMap(key: String, builderAction: MapBuilder<MapBuilder<T>>.() -> Unit)
fun <T> MapBuilder<T>.putCborMap(key: DataItem, builderAction: MapBuilder<MapBuilder<T>>.() -> Unit)

Adds the DataItem for a CBOR map produced by the given builder action to a CBOR map.

Link copied to clipboard

Extension to get a Simple data item for the value.

Extension to get a CborInt data item for the value.

Extension to get a Bstr data item for the value.

Extension to get a CborDouble data item for the value.

Extension to get a CborFloat data item for the value.

Extension to get a Tstr data item for the value.

Link copied to clipboard

Extension to get a date-time string data item for a point in time.

Extension to get a date-time string data item for a RFC 3339-formatted string representing a point in time.

Link copied to clipboard
fun LocalDate.toDataItemFullDate(): DataItem

Extension to get a full-date data item as specified in RFC 8943.