// // json_binder.h // json // // Created by Sam Jaffe on 1/31/16. // Copyright © 2016 Sam Jaffe. All rights reserved. // #ifndef json_parser_h #define json_parser_h #pragma once #include namespace json { class value; namespace binder { template class visitor; } namespace parser { template void parse(binder::visitor&, char const*, options opts = allow_all); template void parse(binder::visitor&& v, std::string const& s, options opts = allow_all) { parse(static_cast&>(v), s.c_str(), opts); } template void parse(binder::visitor&& v, std::istream & in, options opts = allow_all) { if (!in) return; in.seekg(0, std::ios_base::end); size_t end = in.tellg(); std::unique_ptr data{new char[end]}; in.seekg(0); in.read(data.get(), end); parse(static_cast&>(v), data.get(), opts); } } } #endif /* json_parser_h */