|
JSON Voorhees
Killer JSON for C++
|
Copyright (c) 2012-2020 by Travis Gockel. More...
#include <jsonv/config.hpp>#include <optional>#include <string_view>#include <jsonv/value.hpp>#include <cstddef>#include <stdexcept>
Include dependency graph for parse.hpp:
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Classes | |
| class | jsonv::parse_error |
| An error encountered when parsing. More... | |
| class | jsonv::parse_options |
| Configuration for various parsing options. More... | |
| struct | jsonv::parse_options::k |
Macros | |
| #define | JSONV_PARSE_MAX_STRUCTURE_DEPTH 128 |
See jsonv::parse_options::k::max_structure_depth. | |
Functions | |
| JSONV_PUBLIC std::ostream & | jsonv::operator<< (std::ostream &os, const parse_error &p) |
Get a string representation of a parse_error. | |
| JSONV_PUBLIC std::string | jsonv::to_string (const parse_error &p) |
Get a string representation of a parse_error. | |
| JSONV_PUBLIC value | jsonv::parse (std::string_view input, const parse_options &parse_options, const extract_options &extract_options) |
| Construct a JSON value from the given input. | |
| JSONV_PUBLIC value | jsonv::parse (std::string_view input) |
| Construct a JSON value from the given input. | |
| JSONV_PUBLIC value | jsonv::parse (std::string_view input, const parse_options &parse_options) |
| Construct a JSON value from the given input. | |
| JSONV_PUBLIC value | jsonv::parse (std::string_view input, const extract_options &extract_options) |
| Construct a JSON value from the given input. | |
| JSONV_PUBLIC value | jsonv::parse (std::istream &input, const parse_options &parse_options, const extract_options &extract_options) |
| Reads a JSON value from the input stream. | |
| JSONV_PUBLIC value | jsonv::parse (std::istream &input) |
| Reads a JSON value from the input stream. | |
| JSONV_PUBLIC value | jsonv::parse (std::istream &input, const parse_options &parse_options) |
| Reads a JSON value from the input stream. | |
| JSONV_PUBLIC value | jsonv::parse (std::istream &input, const extract_options &extract_options) |
| Reads a JSON value from the input stream. | |
| JSONV_PUBLIC value | jsonv::parse (const char *begin, const char *end, const parse_options &parse_options, const extract_options &extract_options) |
Read a JSON value from the string bound by [begin, end). | |
| JSONV_PUBLIC value | jsonv::parse (const char *begin, const char *end, const parse_options &parse_options) |
Read a JSON value from the string bound by [begin, end). | |
| JSONV_PUBLIC value | jsonv::parse (const char *begin, const char *end, const extract_options &extract_options) |
Read a JSON value from the string bound by [begin, end). | |
| JSONV_PUBLIC value | jsonv::parse (const char *begin, const char *end) |
Read a JSON value from the string bound by [begin, end). | |
Copyright (c) 2012-2020 by Travis Gockel.
All rights reserved.
This program is free software: you can redistribute it and/or modify it under the terms of the Apache License as published by the Apache Software Foundation, either version 2 of the License, or (at your option) any later version.
Definition in file parse.hpp.
| #define JSONV_PARSE_MAX_STRUCTURE_DEPTH 128 |
| JSONV_PUBLIC value jsonv::parse | ( | std::istream & | input | ) |
Reads a JSON value from the input stream.
For example, to parse JSON from a file:
parse_options controls parsing – the indexing of source text into an AST – and is parse_options::create_default() where not given. extract_options controls extraction – transforming the AST into a jsonv::value – and is extract_options::create_default() where not given.
An integer literal beyond the range of 64 bits is read as the nearest double, so it is a kind::decimal. One from 2^63 through 2^64-1 keeps its bits and reads back as a negative kind::integer (see ast_node::integer::value).
| parse_error | if the source text is invalid JSON. This is thrown for errors like unterminated strings, arrays, or stray literals. Errors of this category are described as an offset into input. |
| extraction_error | if the AST can not be transformed into a jsonv::value. This is thrown for errors like an object with duplicate keys (note that replace, the default extract_options::on_duplicate_key, does not throw for this case). |
| std::invalid_argument | if a number literal has no finite double to round to, such as 1e400. |
Here is the call graph for this function:| JSONV_PUBLIC value jsonv::parse | ( | std::istream & | input, |
| const extract_options & | extract_options | ||
| ) |
Reads a JSON value from the input stream.
For example, to parse JSON from a file:
parse_options controls parsing – the indexing of source text into an AST – and is parse_options::create_default() where not given. extract_options controls extraction – transforming the AST into a jsonv::value – and is extract_options::create_default() where not given.
An integer literal beyond the range of 64 bits is read as the nearest double, so it is a kind::decimal. One from 2^63 through 2^64-1 keeps its bits and reads back as a negative kind::integer (see ast_node::integer::value).
| parse_error | if the source text is invalid JSON. This is thrown for errors like unterminated strings, arrays, or stray literals. Errors of this category are described as an offset into input. |
| extraction_error | if the AST can not be transformed into a jsonv::value. This is thrown for errors like an object with duplicate keys (note that replace, the default extract_options::on_duplicate_key, does not throw for this case). |
| std::invalid_argument | if a number literal has no finite double to round to, such as 1e400. |
Here is the call graph for this function:| JSONV_PUBLIC value jsonv::parse | ( | std::istream & | input, |
| const parse_options & | parse_options | ||
| ) |
Reads a JSON value from the input stream.
For example, to parse JSON from a file:
parse_options controls parsing – the indexing of source text into an AST – and is parse_options::create_default() where not given. extract_options controls extraction – transforming the AST into a jsonv::value – and is extract_options::create_default() where not given.
An integer literal beyond the range of 64 bits is read as the nearest double, so it is a kind::decimal. One from 2^63 through 2^64-1 keeps its bits and reads back as a negative kind::integer (see ast_node::integer::value).
| parse_error | if the source text is invalid JSON. This is thrown for errors like unterminated strings, arrays, or stray literals. Errors of this category are described as an offset into input. |
| extraction_error | if the AST can not be transformed into a jsonv::value. This is thrown for errors like an object with duplicate keys (note that replace, the default extract_options::on_duplicate_key, does not throw for this case). |
| std::invalid_argument | if a number literal has no finite double to round to, such as 1e400. |
Here is the call graph for this function:| JSONV_PUBLIC value jsonv::parse | ( | std::istream & | input, |
| const parse_options & | parse_options, | ||
| const extract_options & | extract_options | ||
| ) |
Reads a JSON value from the input stream.
For example, to parse JSON from a file:
parse_options controls parsing – the indexing of source text into an AST – and is parse_options::create_default() where not given. extract_options controls extraction – transforming the AST into a jsonv::value – and is extract_options::create_default() where not given.
An integer literal beyond the range of 64 bits is read as the nearest double, so it is a kind::decimal. One from 2^63 through 2^64-1 keeps its bits and reads back as a negative kind::integer (see ast_node::integer::value).
| parse_error | if the source text is invalid JSON. This is thrown for errors like unterminated strings, arrays, or stray literals. Errors of this category are described as an offset into input. |
| extraction_error | if the AST can not be transformed into a jsonv::value. This is thrown for errors like an object with duplicate keys (note that replace, the default extract_options::on_duplicate_key, does not throw for this case). |
| std::invalid_argument | if a number literal has no finite double to round to, such as 1e400. |
Here is the call graph for this function:| JSONV_PUBLIC value jsonv::parse | ( | std::string_view | input | ) |
Construct a JSON value from the given input.
parse_options controls parsing – the indexing of source text into an AST – and is parse_options::create_default() where not given. extract_options controls extraction – transforming the AST into a jsonv::value – and is extract_options::create_default() where not given.
An integer literal beyond the range of 64 bits is read as the nearest double, so it is a kind::decimal. One from 2^63 through 2^64-1 keeps its bits and reads back as a negative kind::integer (see ast_node::integer::value).
| parse_error | if the source text is invalid JSON. This is thrown for errors like unterminated strings, arrays, or stray literals. Errors of this category are described as an offset into input. |
| extraction_error | if the AST can not be transformed into a jsonv::value. This is thrown for errors like an object with duplicate keys (note that replace, the default extract_options::on_duplicate_key, does not throw for this case). |
| std::invalid_argument | if a number literal has no finite double to round to, such as 1e400. |
Here is the call graph for this function:| JSONV_PUBLIC value jsonv::parse | ( | std::string_view | input, |
| const extract_options & | extract_options | ||
| ) |
Construct a JSON value from the given input.
parse_options controls parsing – the indexing of source text into an AST – and is parse_options::create_default() where not given. extract_options controls extraction – transforming the AST into a jsonv::value – and is extract_options::create_default() where not given.
An integer literal beyond the range of 64 bits is read as the nearest double, so it is a kind::decimal. One from 2^63 through 2^64-1 keeps its bits and reads back as a negative kind::integer (see ast_node::integer::value).
| parse_error | if the source text is invalid JSON. This is thrown for errors like unterminated strings, arrays, or stray literals. Errors of this category are described as an offset into input. |
| extraction_error | if the AST can not be transformed into a jsonv::value. This is thrown for errors like an object with duplicate keys (note that replace, the default extract_options::on_duplicate_key, does not throw for this case). |
| std::invalid_argument | if a number literal has no finite double to round to, such as 1e400. |
Here is the call graph for this function:| JSONV_PUBLIC value jsonv::parse | ( | std::string_view | input, |
| const parse_options & | parse_options | ||
| ) |
Construct a JSON value from the given input.
parse_options controls parsing – the indexing of source text into an AST – and is parse_options::create_default() where not given. extract_options controls extraction – transforming the AST into a jsonv::value – and is extract_options::create_default() where not given.
An integer literal beyond the range of 64 bits is read as the nearest double, so it is a kind::decimal. One from 2^63 through 2^64-1 keeps its bits and reads back as a negative kind::integer (see ast_node::integer::value).
| parse_error | if the source text is invalid JSON. This is thrown for errors like unterminated strings, arrays, or stray literals. Errors of this category are described as an offset into input. |
| extraction_error | if the AST can not be transformed into a jsonv::value. This is thrown for errors like an object with duplicate keys (note that replace, the default extract_options::on_duplicate_key, does not throw for this case). |
| std::invalid_argument | if a number literal has no finite double to round to, such as 1e400. |
Here is the call graph for this function:| JSONV_PUBLIC value jsonv::parse | ( | std::string_view | input, |
| const parse_options & | parse_options, | ||
| const extract_options & | extract_options | ||
| ) |
Construct a JSON value from the given input.
parse_options controls parsing – the indexing of source text into an AST – and is parse_options::create_default() where not given. extract_options controls extraction – transforming the AST into a jsonv::value – and is extract_options::create_default() where not given.
An integer literal beyond the range of 64 bits is read as the nearest double, so it is a kind::decimal. One from 2^63 through 2^64-1 keeps its bits and reads back as a negative kind::integer (see ast_node::integer::value).
| parse_error | if the source text is invalid JSON. This is thrown for errors like unterminated strings, arrays, or stray literals. Errors of this category are described as an offset into input. |
| extraction_error | if the AST can not be transformed into a jsonv::value. This is thrown for errors like an object with duplicate keys (note that replace, the default extract_options::on_duplicate_key, does not throw for this case). |
| std::invalid_argument | if a number literal has no finite double to round to, such as 1e400. |
Here is the call graph for this function: