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:
parent
fb6f74487b
commit
7cba9b8496
12
json.cpp.rl
12
json.cpp.rl
@ -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) {
|
||||
|
1
json.hpp
1
json.hpp
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user