20 explicit Symbol(std::string_view sv) : data_{sv} {}
23 friend bool operator==(std::string_view lhs,
const Symbol& rhs) {
return lhs == rhs.data_; }
24 friend bool operator==(
const Symbol& lhs, std::string_view rhs) {
return lhs.data_ == rhs; }
27 explicit operator std::string ()
const {
return std::string{data_}; }
30 explicit operator std::string_view ()
const {
return std::string_view{data_}; }
33 std::string_view
name()
const {
return data_.
name(); }
35 friend struct std::hash<
Symbol>;
43struct std::formatter<
opyn::Symbol> final {
44 constexpr auto parse(std::format_parse_context& ctx)
46 auto it = ctx.begin();
47 if (it != ctx.end() and *it !=
'}') {
48 throw std::format_error{
"Symbol does not accept format specifiers"};
55 auto it = std::ranges::copy(std::string_view{
"Symbol(\""}, ctx.out()).out;
56 it = std::ranges::copy(s.
name(), it).out;
57 return std::ranges::copy(std::string_view{
"\")"}, it).out;
66 return ostream << std::format(
"{}", symbol);
71struct std::hash<
opyn::Symbol> final {
74 return hasher_(symbol.data_);
77 std::hash<osc::StringName> hasher_;
Symbol(std::string_view sv)
Definition symbol.h:20
friend bool operator==(const Symbol &lhs, std::string_view rhs)
Definition symbol.h:24
friend bool operator==(std::string_view lhs, const Symbol &rhs)
Definition symbol.h:23
std::string_view name() const
Returns the name (key, content) of this Symbol.
Definition symbol.h:33
friend bool operator==(const Symbol &, const Symbol &)=default
Definition string_name.h:14
std::string_view name() const
Definition string_name.h:62
Definition component_registry.h:14
std::ostream & operator<<(std::ostream &out, const DataFrame &data_frame)
Writes a pretty-printed representation of data_frame to out.
size_t operator()(const opyn::Symbol &symbol) const noexcept
Definition symbol.h:72