mirror of
https://github.com/ToruNiina/toml11.git
synced 2025-01-05 23:31:06 +00:00
add a function to show a better error message
This commit is contained in:
parent
8078c719fe
commit
8dfe187d59
@ -15,6 +15,12 @@
|
||||
namespace toml
|
||||
{
|
||||
|
||||
namespace detail
|
||||
{
|
||||
std::string // forward decl
|
||||
format_error_for_value(const value&, const std::string&, const std::string&);
|
||||
}// detail
|
||||
|
||||
template<typename T>
|
||||
struct value_traits
|
||||
{
|
||||
@ -555,6 +561,9 @@ class value
|
||||
return detail::format_underline(msg, *(this->region_info_), com);
|
||||
}
|
||||
|
||||
friend std::string detail::format_error_for_value(
|
||||
const value&, const std::string&, const std::string&);
|
||||
|
||||
template<value_t T>
|
||||
struct switch_cast;
|
||||
|
||||
@ -583,6 +592,16 @@ class value
|
||||
};
|
||||
};
|
||||
|
||||
namespace detail
|
||||
{
|
||||
inline std::string format_error_for_value(
|
||||
const value& v, const std::string& m, const std::string& c)
|
||||
{
|
||||
return v.format_error(m, c);
|
||||
}
|
||||
}// detail
|
||||
|
||||
|
||||
template<> struct value::switch_cast<value_t::Boolean>
|
||||
{
|
||||
static Boolean& invoke(value& v) {return v.boolean_;}
|
||||
|
Loading…
Reference in New Issue
Block a user