Json now parses from slurped strings, not mmap

mmap was a debatable choice in the first place, and is annoying under Windows,
so we may as well remove it.
This commit is contained in:
Danny Robson 2011-07-04 16:24:48 +10:00 committed by U-steve\danny
parent fb6f74487b
commit 7cba9b8496
2 changed files with 7 additions and 6 deletions

View File

@ -29,7 +29,6 @@
#include <algorithm>
#include <sstream>
#include <sys/mman.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
@ -236,13 +235,14 @@ struct parse_context {
namespace json {
json::node *
parse (const boost::filesystem::path &path) {
mapped_file file(path);
return parse ((const char *)file.data (),
(const char *)file.data () + file.size ());
}
parse (const boost::filesystem::path &path)
{ return parse ((const char *)slurp (path)); }
json::node *
parse (const std::string &path)
{ return parse (path.c_str (), path.c_str () + path.size ()); }
node *
parse (const char *start,
const char *stop) {

View File

@ -40,6 +40,7 @@ namespace json {
extern node* parse (const boost::filesystem::path &path);
extern node* parse (const char *start, const char *stop);
extern node* parse (const char *start);
extern node* parse (const std::string&);
/// Abstract base for all JSON values
class node {