17 using Value = std::unique_ptr<ValueImpl>;
21 using Bytes = std::span<const uint8_t>;
32 std::vector<std::pair<Value, Value>>
items;
42 std::variant<Unsigned, Signed, Bytes, String, Array, Map, Tagged, Simple>;
52 size_t index, std::string_view context = {})
const;
54 const Value& key, std::string_view context = {})
const;
56 uint64_t tag, std::string_view context = {})
const;
59 [[nodiscard]]
Bytes as_bytes(std::string_view context = {})
const;
62 [[nodiscard]]
size_t size()
const;
70 std::span<const uint8_t> raw, std::string_view context = {});
std::variant< Unsigned, Signed, Bytes, String, Array, Map, Tagged, Simple > Type
Definition cbor.h:42
int64_t Signed
Definition cbor.h:20
Value make_signed(int64_t value)
Definition cbor.cpp:283
Value make_unsigned(uint64_t value)
Definition cbor.cpp:279
std::string_view String
Definition cbor.h:22
std::string print_value(const Value &value, size_t indent)
Definition cbor.cpp:314
std::runtime_error CBORDecodeError
Definition cbor.h:44
Value make_string(std::string_view data)
Definition cbor.cpp:287
uint64_t Unsigned
Definition cbor.h:19
std::span< const uint8_t > Bytes
Definition cbor.h:21
Value parse_value(std::span< const uint8_t > raw, std::string_view context)
Definition cbor.cpp:292
std::unique_ptr< ValueImpl > Value
Definition cbor.h:17
uint8_t Simple
Definition cbor.h:23
std::vector< Value > items
Definition cbor.h:27
std::vector< std::pair< Value, Value > > items
Definition cbor.h:32
Value item
Definition cbor.h:38
uint64_t tag
Definition cbor.h:37
const Value & map_at(const Value &key, std::string_view context={}) const
Definition cbor.cpp:339
Simple as_simple(std::string_view context={}) const
Definition cbor.cpp:476
Type value
Definition cbor.h:49
Bytes as_bytes(std::string_view context={}) const
Definition cbor.cpp:456
ValueImpl(Type value_)
Definition cbor.h:48
Unsigned as_unsigned(std::string_view context={}) const
Definition cbor.cpp:436
Signed as_signed(std::string_view context={}) const
Definition cbor.cpp:446
const Value & array_at(size_t index, std::string_view context={}) const
Definition cbor.cpp:321
const Value & tag_at(uint64_t tag, std::string_view context={}) const
Definition cbor.cpp:418
String as_string(std::string_view context={}) const
Definition cbor.cpp:466
size_t size() const
Definition cbor.cpp:403