ipfs-chromium
Loading...
Searching...
No Matches
include
ipfs_client
cid.h
1
#ifndef IPFS_CID_H_
2
#define IPFS_CID_H_
3
4
#include "multi_hash.h"
5
#include "multicodec.h"
6
7
#include <vocab/byte_view.h>
8
9
#include <string>
10
#include <string_view>
11
12
namespace
ipfs {
16
class
Cid
{
17
MultiCodec codec_ = MultiCodec::INVALID;
18
MultiHash
hash_;
19
20
public
:
21
Cid
() =
default
;
22
Cid
(MultiCodec,
MultiHash
);
23
explicit
Cid
(std::string_view);
24
explicit
Cid
(ByteView);
25
bool
ReadStart(ByteView&);
26
27
bool
valid()
const
;
28
MultiCodec codec()
const
{
return
codec_; }
29
MultiHash
const
& multi_hash()
const
{
return
hash_; }
30
ByteView hash()
const
;
31
HashType hash_type()
const
;
32
33
std::string to_string()
const
;
34
bool
operator==(
Cid
const
&)
const
=
default
;
35
36
constexpr
static
std::size_t MinSerializedLength =
37
1
/*cid version*/
+ 1
/*codec*/
+ 1
/*hash type*/
+
38
1
/*hash len, could be zero*/
;
39
};
40
}
// namespace ipfs
41
42
#endif
// IPFS_CID_H_
ipfs::Cid
Definition
cid.h:16
ipfs::MultiHash
Definition
multi_hash.h:17
Generated by
1.9.8