12 template <
typename FmtExtender =
void>
30 inline operator std::string()
const
47 return id == other.id;
52 return !(*
this == other);
81 template <
typename FmtExtender>
84 j = entity_id.
value();
87 template <
typename FmtExtender>
93 entity_id = j.get<std::string>();
98 "{} should be hex-encoded string: {}",
99 FmtExtender::ID_LABEL,
104 template <
typename FmtExtender>
107 return FmtExtender::ID_LABEL;
110 template <
typename FmtExtender>
114 schema[
"type"] =
"string";
119 schema[
"format"] =
"hex";
126 static std::string
format(
const std::string& core)
128 return fmt::format(
"m[{}]", core);
137 static std::string
format(
const std::string& core)
139 return fmt::format(
"u[{}]", core);
148 static std::string
format(
const std::string& core)
150 return fmt::format(
"n[{}]", core);
160 template <
typename FmtExtender>
161 static inline std::ostream& operator<<(
164 if constexpr (std::is_same_v<FmtExtender, void>)
166 os << entity_id.
value();
170 os << FmtExtender::format(entity_id.
value());
175 template <
typename FmtExtender>
176 struct hash<
ccf::EntityId<FmtExtender>>
180 return std::hash<std::string>{}(entity_id.
value());
186template <
typename FmtExtender>
187struct formatter<
ccf::EntityId<FmtExtender>>
189 template <
typename ParseContext>
190 constexpr auto parse(ParseContext& ctx)
195 template <
typename FormatContext>
198 std::stringstream ss;
200 return format_to(ctx.out(),
"{}", ss.str());
207 template <
typename FmtExtender>
213 const auto& data = entity_id.
value();
Definition sha256_hash.h:80
ccf::ByteVector SerialisedEntry
Definition serialised_entry.h:8
Definition app_interface.h:14
void fill_json_schema(nlohmann::json &schema, const ClaimsDigest *)
Definition claims_digest.h:64
std::string schema_name(const ClaimsDigest *)
Definition claims_digest.h:59
void from_json(const nlohmann::json &j, ClaimsDigest &hash)
Definition claims_digest.h:54
void to_json(nlohmann::json &j, const ClaimsDigest &hash)
Definition claims_digest.h:49
Definition entity_id.h:14
EntityId(const EntityId &id_)=default
EntityId(const Value &id_)
Definition entity_id.h:27
static constexpr size_t LENGTH
Definition entity_id.h:18
void operator=(const Value &id_)
Definition entity_id.h:40
char const * data() const
Definition entity_id.h:70
size_t size() const
Definition entity_id.h:75
bool operator<(const EntityId &other) const
Definition entity_id.h:55
EntityId(Value &&id_)
Definition entity_id.h:28
const Value & value() const
Definition entity_id.h:65
std::string Value
Definition entity_id.h:19
void operator=(const EntityId &other)
Definition entity_id.h:35
Value & value()
Definition entity_id.h:60
bool operator!=(const EntityId &other) const
Definition entity_id.h:50
bool operator==(const EntityId &other) const
Definition entity_id.h:45
static SerialisedEntry to_serialised(const ccf::EntityId< FmtExtender > &entity_id)
Definition entity_id.h:210
static ccf::EntityId< FmtExtender > from_serialised(const SerialisedEntry &data)
Definition entity_id.h:217
Definition blit_serialiser.h:14
auto format(const ccf::EntityId< FmtExtender > &v, FormatContext &ctx) const
Definition entity_id.h:196
constexpr auto parse(ParseContext &ctx)
Definition entity_id.h:190
size_t operator()(const ccf::EntityId< FmtExtender > &entity_id) const
Definition entity_id.h:178