diff options
Diffstat (limited to 'tools/minicargo/toml.h')
-rw-r--r-- | tools/minicargo/toml.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tools/minicargo/toml.h b/tools/minicargo/toml.h index 1c8f90d5..17517ca3 100644 --- a/tools/minicargo/toml.h +++ b/tools/minicargo/toml.h @@ -2,6 +2,7 @@ #include <fstream> #include <vector> +#include <string> #include <unordered_map> class TomlFileIter; @@ -91,6 +92,24 @@ struct TomlValue } return m_int_value != 0; } + + friend ::std::ostream& operator<<(::std::ostream& os, const TomlValue& x) { + switch(x.m_type) + { + case Type::Boolean: os << (x.m_int_value != 0 ? "true" : "false"); break; + case Type::Integer: os << x.m_int_value; break; + case Type::List: + os << "["; + for(auto& e : x.m_sub_values) + os << e << ","; + os << "]"; + break; + case Type::String: + os << "\"" << x.m_str_value << "\""; + break; + } + return os; + } }; struct TomlKeyValue |