24#include <unordered_set>
53 explicit eid_t(int64_t
id);
62 eid_t &operator=(int64_t ast_id);
68 friend
bool operator==(const
eid_t &lhs, const
eid_t &rhs);
69 friend
bool operator==(const
eid_t &lhs, const uint64_t &v);
70 friend
bool operator!=(const
eid_t &lhs, const uint64_t &v);
71 friend
bool operator!=(const
eid_t &lhs, const
eid_t &rhs);
72 friend
bool operator<(const
eid_t &lhs, const
eid_t &rhs);
92std::string
to_string(
const std::string &s);
139 : value_{right.get()}
143 template <
typename V,
144 typename = std::enable_if<
145 std::is_base_of_v<optional_type, typename V::optional_type> ||
146 std::is_same_v<optional_type, typename V::optional_type>>>
152 template <
typename V,
153 typename = std::enable_if<
154 std::is_base_of_v<optional_type, typename V::optional_type> ||
155 std::is_same_v<optional_type, typename V::optional_type>>>
162 template <
typename V,
163 typename = std::enable_if<std::is_base_of_v<optional_type, V>>>
174 value_ = right.value_;
183 value_ = right.value_;
188 bool has_value() const noexcept {
return value_ !=
nullptr; }
190 operator bool() const noexcept {
return has_value(); }
194 assert(value_ !=
nullptr);
200 assert(value_ !=
nullptr);
206 assert(value_ !=
nullptr);
212 assert(value_ !=
nullptr);
218 T *
get()
const {
return value_; }
244 : regexp{
std::move(r)}
245 , pattern{
std::move(p)}
256 return std::regex_match(v, regexp);
278 : value_{
std::move(v)}
308 if (std::holds_alternative<regex>(value_))
309 return std::regex_match(v, std::get<regex>(value_).regexp);
311 return std::get<T>(value_) == v;
314 template <
typename Ret> std::optional<Ret>
get()
const
316 if (!std::holds_alternative<Ret>(value_))
319 return std::get<Ret>(value_);
324 if (std::holds_alternative<regex>(value_))
325 return std::get<regex>(value_).pattern;
330 const std::variant<T, regex> &
value()
const {
return value_; }
332 bool is_regex()
const {
return std::holds_alternative<regex>(value_); }
348template <>
class fmt::formatter<
clanguml::common::eid_t> {
350 constexpr auto parse(format_parse_context &ctx) {
return ctx.begin(); }
351 template <
typename Context>
354 return fmt::format_to(ctx.out(),
"{}",
id.value());