json/tree: reinstate path based parsers
json::tree::node is a fat object, so it's safe to load the source data from within the parsing function
This commit is contained in:
parent
d7204d7cac
commit
73c30561af
@ -247,6 +247,15 @@ MAP(
|
|||||||
#undef INSTANTIATE
|
#undef INSTANTIATE
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
std::unique_ptr<json::tree::node>
|
||||||
|
json::tree::parse (const boost::filesystem::path &src)
|
||||||
|
{
|
||||||
|
const util::mapped_file data (src.string ().c_str ());
|
||||||
|
return parse (data.as_view<char> ());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
void
|
void
|
||||||
json::tree::write (const json::tree::node &node, std::ostream &os)
|
json::tree::write (const json::tree::node &node, std::ostream &os)
|
||||||
|
@ -17,16 +17,20 @@
|
|||||||
#ifndef __UTIL_JSON_TREE_HPP
|
#ifndef __UTIL_JSON_TREE_HPP
|
||||||
#define __UTIL_JSON_TREE_HPP
|
#define __UTIL_JSON_TREE_HPP
|
||||||
|
|
||||||
|
#include "./flat.hpp"
|
||||||
|
#include "./fwd.hpp"
|
||||||
|
|
||||||
|
#include "../iterator.hpp"
|
||||||
|
#include "../view.hpp"
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "../iterator.hpp"
|
#include <boost/filesystem/path.hpp>
|
||||||
#include "../view.hpp"
|
|
||||||
#include "./flat.hpp"
|
|
||||||
#include "./fwd.hpp"
|
|
||||||
|
|
||||||
namespace json { namespace tree {
|
namespace json { namespace tree {
|
||||||
enum type_t {
|
enum type_t {
|
||||||
@ -43,6 +47,9 @@ namespace json { namespace tree {
|
|||||||
std::unique_ptr<node>
|
std::unique_ptr<node>
|
||||||
parse (util::view<T> data);
|
parse (util::view<T> data);
|
||||||
|
|
||||||
|
std::unique_ptr<node>
|
||||||
|
parse (const boost::filesystem::path &);
|
||||||
|
|
||||||
extern void write (const json::tree::node&, std::ostream&);
|
extern void write (const json::tree::node&, std::ostream&);
|
||||||
|
|
||||||
/// Abstract base for all JSON values
|
/// Abstract base for all JSON values
|
||||||
|
Loading…
Reference in New Issue
Block a user