diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/common/toml.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tools/common/toml.h b/tools/common/toml.h index e57c28ae..a2c03bf1 100644 --- a/tools/common/toml.h +++ b/tools/common/toml.h @@ -42,7 +42,18 @@ struct TomlValue String, Integer, List, + }; + friend ::std::ostream& operator<<(::std::ostream& os, const Type& e) { + switch(e) + { + case Type::Boolean: os << "boolean"; break; + case Type::String: os << "string"; break; + case Type::Integer: os << "integer"; break; + case Type::List: os << "list"; break; + } + return os; + } struct TypeError: public ::std::exception { @@ -58,6 +69,10 @@ struct TomlValue const char* what() const noexcept override { return "toml type error"; } + friend ::std::ostream& operator<<(::std::ostream& os, const TypeError& e) { + os << "expected " << e.exp << ", got " << e.have; + return os; + } }; Type m_type; |