]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/boost/json/parse.hpp
import quincy beta 17.1.0
[ceph.git] / ceph / src / boost / boost / json / parse.hpp
CommitLineData
20effc67
TL
1//
2// Copyright (c) 2019 Vinnie Falco (vinnie.falco@gmail.com)
3// Copyright (c) 2020 Krystian Stasiowski (sdkrystian@gmail.com)
4//
5// Distributed under the Boost Software License, Version 1.0. (See accompanying
6// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7//
8// Official repository: https://github.com/boostorg/json
9//
10
11#ifndef BOOST_JSON_PARSE_HPP
12#define BOOST_JSON_PARSE_HPP
13
14#include <boost/json/detail/config.hpp>
15#include <boost/json/error.hpp>
16#include <boost/json/parse_options.hpp>
17#include <boost/json/storage_ptr.hpp>
18#include <boost/json/string_view.hpp>
19#include <boost/json/value.hpp>
20
21BOOST_JSON_NS_BEGIN
22
23/** Return parsed JSON as a @ref value.
24
25 This function parses an entire string in one
26 step to produce a complete JSON object, returned
27 as a @ref value. If the buffer does not contain a
28 complete serialized JSON, an error occurs. In this
29 case the returned value will be null, using the
30 default memory resource.
31
32 @par Complexity
33 Linear in `s.size()`.
34
35 @par Exception Safety
36 Strong guarantee.
37 Calls to `memory_resource::allocate` may throw.
38
39 @return A value representing the parsed JSON,
40 or a null if any error occurred.
41
42 @param s The string to parse.
43
44 @param ec Set to the error, if any occurred.
45
46 @param sp The memory resource that the new value and all
47 of its elements will use. If this parameter is omitted,
48 the default memory resource is used.
49
50 @param opt The options for the parser. If this parameter
51 is omitted, the parser will accept only standard JSON.
52
53 @see
54 @ref parse_options,
55 @ref stream_parser.
56*/
57BOOST_JSON_DECL
58value
59parse(
60 string_view s,
61 error_code& ec,
62 storage_ptr sp = {},
63 parse_options const& opt = {});
64
65/** Parse a string of JSON into a @ref value.
66
67 This function parses an entire string in one
68 step to produce a complete JSON object, returned
69 as a @ref value. If the buffer does not contain a
70 complete serialized JSON, an exception is thrown.
71
72 @par Complexity
73 Linear in `s.size()`.
74
75 @par Exception Safety
76 Strong guarantee.
77 Calls to `memory_resource::allocate` may throw.
78
79 @return A value representing the parsed
80 JSON upon success.
81
82 @param s The string to parse.
83
84 @param sp The memory resource that the new value and all
85 of its elements will use. If this parameter is omitted,
86 the default memory resource is used.
87
88 @param opt The options for the parser. If this parameter
89 is omitted, the parser will accept only standard JSON.
90
91 @throw system_error Thrown on failure.
92
93 @see
94 @ref parse_options,
95 @ref stream_parser.
96*/
97BOOST_JSON_DECL
98value
99parse(
100 string_view s,
101 storage_ptr sp = {},
102 parse_options const& opt = {});
103
104BOOST_JSON_NS_END
105
106#endif