Skip to content

Commit

Permalink
Add tomlconfig::get_values ()
Browse files Browse the repository at this point in the history
  • Loading branch information
pwojcikdev committed Jan 16, 2024
1 parent b088482 commit fc3d406
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions nano/lib/tomlconfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,19 @@ class tomlconfig : public nano::configbase
return *this;
}

template <typename T>
std::vector<std::pair<std::string, T>> get_values ()
{
std::vector<std::pair<std::string, T>> result;
for (auto & entry : *tree)
{
T target{};
get_config (true, entry.first, target, target);
result.push_back ({ entry.first, target });
}
return result;
}

protected:
template <typename T, typename = std::enable_if_t<nano::is_lexical_castable<T>::value>>
tomlconfig & get_config (bool optional, std::string const & key, T & target, T default_value = T ())
Expand Down

0 comments on commit fc3d406

Please sign in to comment.