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);
93std::string to_string(
bool v);
95std::string to_string(
const std::string &s);
97std::string to_string(
const std::filesystem::path &p);
144 : value_{right.get()}
148 template <
typename V,
149 typename = std::enable_if<
150 std::is_base_of_v<optional_type, typename V::optional_type> ||
151 std::is_same_v<optional_type, typename V::optional_type>>>
157 template <
typename V,
158 typename = std::enable_if<
159 std::is_base_of_v<optional_type, typename V::optional_type> ||
160 std::is_same_v<optional_type, typename V::optional_type>>>
167 template <
typename V,
168 typename = std::enable_if<std::is_base_of_v<optional_type, V>>>
179 value_ = right.value_;
188 value_ = right.value_;
193 bool has_value() const noexcept {
return value_ !=
nullptr; }
195 operator bool() const noexcept {
return has_value(); }
199 assert(value_ !=
nullptr);
205 assert(value_ !=
nullptr);
211 assert(value_ !=
nullptr);
217 assert(value_ !=
nullptr);
223 T *
get()
const {
return value_; }
249 : regexp{
std::move(r)}
250 , pattern{
std::move(p)}
261 return std::regex_match(v, regexp);
283 : value_{
std::move(v)}
313 if (std::holds_alternative<regex>(value_))
314 return std::regex_match(v, std::get<regex>(value_).regexp);
316 return std::get<T>(value_) == v;
319 template <
typename Ret> std::optional<Ret>
get()
const
321 if (!std::holds_alternative<Ret>(value_))
324 return std::get<Ret>(value_);
329 if (std::holds_alternative<regex>(value_))
330 return std::get<regex>(value_).pattern;
335 const std::variant<T, regex> &
value()
const {
return value_; }
337 bool is_regex()
const {
return std::holds_alternative<regex>(value_); }
353template <>
class fmt::formatter<
clanguml::common::eid_t> {
355 constexpr auto parse(format_parse_context &ctx) {
return ctx.begin(); }
356 template <
typename Context>
359 return fmt::format_to(ctx.out(),
"{}",
id.value());