Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions include/cpptoml.h
Original file line number Diff line number Diff line change
Expand Up @@ -3231,6 +3231,21 @@ inline std::shared_ptr<table> parse_file(const std::string& filename)
return p.parse();
}


/**
* Utility function to parse a file as a TOML file. Returns the root table.
* Throws a parse_exception if the file cannot be opened.
*/
inline std::shared_ptr<table> parse_string(const std::string& toml)
{

std::stringstream data{toml};
parser p{data};
return p.parse();
}



template <class... Ts>
struct value_accept;

Expand Down