j/tree: add from_path function for clarity

This commit is contained in:
Danny Robson 2016-02-11 14:53:43 +11:00
parent 226e212826
commit ea1dbd253a
2 changed files with 18 additions and 0 deletions

View File

@ -203,6 +203,21 @@ json::tree::parse (const char *first, const char *last)
}
///////////////////////////////////////////////////////////////////////////////
std::unique_ptr<json::tree::node>
json::tree::from_path (const char *path)
{
return json::tree::parse (boost::filesystem::path (path));
}
//-----------------------------------------------------------------------------
std::unique_ptr<json::tree::node>
json::tree::from_path (const std::string &path)
{
return json::tree::from_path (path.c_str ());
}
///////////////////////////////////////////////////////////////////////////////
// Type conversion

View File

@ -44,6 +44,9 @@ namespace json { namespace tree {
extern std::unique_ptr<node> parse (const char *start, const char *stop);
extern std::unique_ptr<node> parse (const std::string&);
extern std::unique_ptr<node> from_path (const char *path);
extern std::unique_ptr<node> from_path (const std::string&);
extern void write (const json::tree::node&, std::ostream&);
/// Abstract base for all JSON values