mirror of
https://github.com/ToruNiina/toml11.git
synced 2025-09-19 03:18:09 +08:00
fix: use format_underline for N regions everywhere
This commit is contained in:
28
toml/get.hpp
28
toml/get.hpp
@@ -210,8 +210,9 @@ T get(const value& v)
|
||||
{
|
||||
throw std::out_of_range(detail::format_underline(concat_to_string(
|
||||
"[erorr] toml::get specified container size is ", container.size(),
|
||||
" but there are ", ar.size(), " elements in toml array."),
|
||||
detail::get_region(v), "here"));
|
||||
" but there are ", ar.size(), " elements in toml array."), {
|
||||
{std::addressof(detail::get_region(v)), "here"}
|
||||
}));
|
||||
}
|
||||
std::transform(ar.cbegin(), ar.cend(), container.begin(),
|
||||
[](const value& x){return ::toml::get<value_type>(x);});
|
||||
@@ -233,7 +234,9 @@ T get(const value& v)
|
||||
{
|
||||
throw std::out_of_range(detail::format_underline(concat_to_string(
|
||||
"[erorr] toml::get specified std::pair but there are ", ar.size(),
|
||||
" elements in toml array."), detail::get_region(v), "here"));
|
||||
" elements in toml array."), {
|
||||
{std::addressof(detail::get_region(v)), "here"}
|
||||
}));
|
||||
}
|
||||
return std::make_pair(::toml::get<first_type >(ar.at(0)),
|
||||
::toml::get<second_type>(ar.at(1)));
|
||||
@@ -264,7 +267,9 @@ T get(const value& v)
|
||||
throw std::out_of_range(detail::format_underline(concat_to_string(
|
||||
"[erorr] toml::get specified std::tuple with ",
|
||||
std::tuple_size<T>::value, "elements, but there are ", ar.size(),
|
||||
" elements in toml array."), detail::get_region(v), "here"));
|
||||
" elements in toml array."), {
|
||||
{std::addressof(detail::get_region(v)), "here"}
|
||||
}));
|
||||
}
|
||||
return detail::get_tuple_impl<T>(ar,
|
||||
detail::make_index_sequence<std::tuple_size<T>::value>{});
|
||||
@@ -340,8 +345,9 @@ find(const toml::value& v, const toml::key& ky)
|
||||
if(tab.count(ky) == 0)
|
||||
{
|
||||
throw std::out_of_range(detail::format_underline(concat_to_string(
|
||||
"[error] key \"", ky, "\" not found"), detail::get_region(v),
|
||||
"in this table"));
|
||||
"[error] key \"", ky, "\" not found"), {
|
||||
{std::addressof(detail::get_region(v)), "in this table"}
|
||||
}));
|
||||
}
|
||||
return ::toml::get<T>(tab.at(ky));
|
||||
}
|
||||
@@ -353,8 +359,9 @@ find(toml::value& v, const toml::key& ky)
|
||||
if(tab.count(ky) == 0)
|
||||
{
|
||||
throw std::out_of_range(detail::format_underline(concat_to_string(
|
||||
"[error] key \"", ky, "\" not found"), detail::get_region(v),
|
||||
"in this table"));
|
||||
"[error] key \"", ky, "\" not found"), {
|
||||
{std::addressof(detail::get_region(v)), "in this table"}
|
||||
}));
|
||||
}
|
||||
return ::toml::get<T>(tab.at(ky));
|
||||
}
|
||||
@@ -366,8 +373,9 @@ find(toml::value&& v, const toml::key& ky)
|
||||
if(tab.count(ky) == 0)
|
||||
{
|
||||
throw std::out_of_range(detail::format_underline(concat_to_string(
|
||||
"[error] key \"", ky, "\" not found"), detail::get_region(v),
|
||||
"in this table"));
|
||||
"[error] key \"", ky, "\" not found"), {
|
||||
{std::addressof(detail::get_region(v)), "in this table"}
|
||||
}));
|
||||
}
|
||||
return ::toml::get<T>(std::move(tab[ky]));
|
||||
}
|
||||
|
Reference in New Issue
Block a user