ipfs-chromium
Loading...
Searching...
No Matches
dag_cbor_value.h
1#ifndef IPFS_DAG_CBOR_VALUE_H_
2#define IPFS_DAG_CBOR_VALUE_H_
3
4#include <ipfs_client/cid.h>
5
6#include <functional>
7#include <memory>
8#include <optional>
9#include <string_view>
10#include <vector>
11
12namespace ipfs {
16 public:
17 virtual std::unique_ptr<DagCborValue> at(std::string_view) const = 0;
18 virtual std::optional<std::uint64_t> as_unsigned() const = 0;
19 virtual std::optional<std::int64_t> as_signed() const = 0;
20 virtual std::optional<double> as_float() const = 0;
21 virtual std::optional<std::string> as_string() const = 0;
22 virtual std::optional<std::vector<std::uint8_t>> as_bytes() const = 0;
23 virtual std::optional<bool> as_bool() const = 0;
24 virtual std::optional<Cid> as_link() const = 0;
25 virtual bool is_map() const = 0;
26 virtual bool is_array() const = 0;
27 using MapElementCallback = std::function<void(std::string_view,DagCborValue const&)>;
28 using ArrayElementCallback = std::function<void(DagCborValue const&)>;
29 virtual void iterate_map(MapElementCallback) const = 0;
30 virtual void iterate_array(ArrayElementCallback) const = 0;
31 std::string html() const;
32 void html(std::ostream&) const;
33 virtual ~DagCborValue() noexcept {}
34};
35}
36
37#endif // IPFS_DAG_CBOR_VALUE_H_
Definition dag_cbor_value.h:15