Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
json
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
json
Commits
282bafae
Unverified
Commit
282bafae
authored
7 years ago
by
Niels Lohmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed compilation error
parent
abac6a0e
develop
bon8
coverity_scan
feature/optional
gcc_warning_flags
icpc
issue2228
issue2615
issue2932
issue3232_use_catch
master
release/3.10.2
release/3.10.3
release/3.10.4
release/3.10.5
string_view
string_view2
update_doctest
3.6.1
3.3.0
3.2.0
v3.10.5
v3.10.4
v3.10.3
v3.10.2
v3.10.1
v3.10.0
v3.9.1
v3.9.0
v3.8.0
v3.7.3
v3.7.2
v3.7.1
v3.7.0
v3.6.1
v3.6.0
v3.5.0
v3.4.0
v3.3.0
v3.2.0
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
18 deletions
+26
-18
include/nlohmann/detail/input/json_sax.hpp
include/nlohmann/detail/input/json_sax.hpp
+13
-9
single_include/nlohmann/json.hpp
single_include/nlohmann/json.hpp
+13
-9
No files found.
include/nlohmann/detail/input/json_sax.hpp
View file @
282bafae
...
@@ -21,6 +21,8 @@ struct json_sax
...
@@ -21,6 +21,8 @@ struct json_sax
using
number_unsigned_t
=
typename
BasicJsonType
::
number_unsigned_t
;
using
number_unsigned_t
=
typename
BasicJsonType
::
number_unsigned_t
;
/// type for floating-point numbers
/// type for floating-point numbers
using
number_float_t
=
typename
BasicJsonType
::
number_float_t
;
using
number_float_t
=
typename
BasicJsonType
::
number_float_t
;
/// type for strings
using
string_t
=
typename
BasicJsonType
::
string_t
;
/// constant to indicate that no size limit is given for array or object
/// constant to indicate that no size limit is given for array or object
static
constexpr
auto
no_limit
=
std
::
size_t
(
-
1
);
static
constexpr
auto
no_limit
=
std
::
size_t
(
-
1
);
...
@@ -58,14 +60,14 @@ struct json_sax
...
@@ -58,14 +60,14 @@ struct json_sax
@param[in] s raw token value
@param[in] s raw token value
@return whether parsing should proceed
@return whether parsing should proceed
*/
*/
virtual
bool
number_float
(
number_float_t
val
,
const
st
d
::
string
&
s
)
=
0
;
virtual
bool
number_float
(
number_float_t
val
,
const
st
ring_t
&
s
)
=
0
;
/*!
/*!
@brief a string was read
@brief a string was read
@param[in] val string value
@param[in] val string value
@return whether parsing should proceed
@return whether parsing should proceed
*/
*/
virtual
bool
string
(
st
d
::
string
&&
val
)
=
0
;
virtual
bool
string
(
st
ring_t
&&
val
)
=
0
;
/*!
/*!
@brief the beginning of an object was read
@brief the beginning of an object was read
...
@@ -80,7 +82,7 @@ struct json_sax
...
@@ -80,7 +82,7 @@ struct json_sax
@param[in] val object key
@param[in] val object key
@return whether parsing should proceed
@return whether parsing should proceed
*/
*/
virtual
bool
key
(
st
d
::
string
&&
val
)
=
0
;
virtual
bool
key
(
st
ring_t
&&
val
)
=
0
;
/*!
/*!
@brief the end of an object was read
@brief the end of an object was read
...
@@ -135,6 +137,7 @@ class json_sax_dom_parser : public json_sax<BasicJsonType>
...
@@ -135,6 +137,7 @@ class json_sax_dom_parser : public json_sax<BasicJsonType>
using
number_integer_t
=
typename
BasicJsonType
::
number_integer_t
;
using
number_integer_t
=
typename
BasicJsonType
::
number_integer_t
;
using
number_unsigned_t
=
typename
BasicJsonType
::
number_unsigned_t
;
using
number_unsigned_t
=
typename
BasicJsonType
::
number_unsigned_t
;
using
number_float_t
=
typename
BasicJsonType
::
number_float_t
;
using
number_float_t
=
typename
BasicJsonType
::
number_float_t
;
using
string_t
=
typename
BasicJsonType
::
string_t
;
json_sax_dom_parser
(
BasicJsonType
&
r
,
const
bool
allow_exceptions_
=
true
)
json_sax_dom_parser
(
BasicJsonType
&
r
,
const
bool
allow_exceptions_
=
true
)
:
root
(
r
),
allow_exceptions
(
allow_exceptions_
)
:
root
(
r
),
allow_exceptions
(
allow_exceptions_
)
...
@@ -164,13 +167,13 @@ class json_sax_dom_parser : public json_sax<BasicJsonType>
...
@@ -164,13 +167,13 @@ class json_sax_dom_parser : public json_sax<BasicJsonType>
return
true
;
return
true
;
}
}
bool
number_float
(
number_float_t
val
,
const
st
d
::
string
&
)
override
bool
number_float
(
number_float_t
val
,
const
st
ring_t
&
)
override
{
{
handle_value
(
val
);
handle_value
(
val
);
return
true
;
return
true
;
}
}
bool
string
(
st
d
::
string
&&
val
)
override
bool
string
(
st
ring_t
&&
val
)
override
{
{
handle_value
(
val
);
handle_value
(
val
);
return
true
;
return
true
;
...
@@ -189,7 +192,7 @@ class json_sax_dom_parser : public json_sax<BasicJsonType>
...
@@ -189,7 +192,7 @@ class json_sax_dom_parser : public json_sax<BasicJsonType>
return
true
;
return
true
;
}
}
bool
key
(
st
d
::
string
&&
val
)
override
bool
key
(
st
ring_t
&&
val
)
override
{
{
// add null at given key and store the reference for later
// add null at given key and store the reference for later
object_element
=
&
(
ref_stack
.
back
()
->
m_value
.
object
->
operator
[](
val
));
object_element
=
&
(
ref_stack
.
back
()
->
m_value
.
object
->
operator
[](
val
));
...
@@ -308,6 +311,7 @@ class json_sax_acceptor : public json_sax<BasicJsonType>
...
@@ -308,6 +311,7 @@ class json_sax_acceptor : public json_sax<BasicJsonType>
using
number_integer_t
=
typename
BasicJsonType
::
number_integer_t
;
using
number_integer_t
=
typename
BasicJsonType
::
number_integer_t
;
using
number_unsigned_t
=
typename
BasicJsonType
::
number_unsigned_t
;
using
number_unsigned_t
=
typename
BasicJsonType
::
number_unsigned_t
;
using
number_float_t
=
typename
BasicJsonType
::
number_float_t
;
using
number_float_t
=
typename
BasicJsonType
::
number_float_t
;
using
string_t
=
typename
BasicJsonType
::
string_t
;
bool
null
()
override
bool
null
()
override
{
{
...
@@ -329,12 +333,12 @@ class json_sax_acceptor : public json_sax<BasicJsonType>
...
@@ -329,12 +333,12 @@ class json_sax_acceptor : public json_sax<BasicJsonType>
return
true
;
return
true
;
}
}
bool
number_float
(
number_float_t
,
const
st
d
::
string
&
)
override
bool
number_float
(
number_float_t
,
const
st
ring_t
&
)
override
{
{
return
true
;
return
true
;
}
}
bool
string
(
st
d
::
string
&&
)
override
bool
string
(
st
ring_t
&&
)
override
{
{
return
true
;
return
true
;
}
}
...
@@ -344,7 +348,7 @@ class json_sax_acceptor : public json_sax<BasicJsonType>
...
@@ -344,7 +348,7 @@ class json_sax_acceptor : public json_sax<BasicJsonType>
return
true
;
return
true
;
}
}
bool
key
(
st
d
::
string
&&
)
override
bool
key
(
st
ring_t
&&
)
override
{
{
return
true
;
return
true
;
}
}
...
...
This diff is collapsed.
Click to expand it.
single_include/nlohmann/json.hpp
View file @
282bafae
...
@@ -3157,6 +3157,8 @@ struct json_sax
...
@@ -3157,6 +3157,8 @@ struct json_sax
using
number_unsigned_t
=
typename
BasicJsonType
::
number_unsigned_t
;
using
number_unsigned_t
=
typename
BasicJsonType
::
number_unsigned_t
;
/// type for floating-point numbers
/// type for floating-point numbers
using
number_float_t
=
typename
BasicJsonType
::
number_float_t
;
using
number_float_t
=
typename
BasicJsonType
::
number_float_t
;
/// type for strings
using
string_t
=
typename
BasicJsonType
::
string_t
;
/// constant to indicate that no size limit is given for array or object
/// constant to indicate that no size limit is given for array or object
static
constexpr
auto
no_limit
=
std
::
size_t
(
-
1
);
static
constexpr
auto
no_limit
=
std
::
size_t
(
-
1
);
...
@@ -3194,14 +3196,14 @@ struct json_sax
...
@@ -3194,14 +3196,14 @@ struct json_sax
@param[in] s raw token value
@param[in] s raw token value
@return whether parsing should proceed
@return whether parsing should proceed
*/
*/
virtual
bool
number_float
(
number_float_t
val
,
const
st
d
::
string
&
s
)
=
0
;
virtual
bool
number_float
(
number_float_t
val
,
const
st
ring_t
&
s
)
=
0
;
/*!
/*!
@brief a string was read
@brief a string was read
@param[in] val string value
@param[in] val string value
@return whether parsing should proceed
@return whether parsing should proceed
*/
*/
virtual
bool
string
(
st
d
::
string
&&
val
)
=
0
;
virtual
bool
string
(
st
ring_t
&&
val
)
=
0
;
/*!
/*!
@brief the beginning of an object was read
@brief the beginning of an object was read
...
@@ -3216,7 +3218,7 @@ struct json_sax
...
@@ -3216,7 +3218,7 @@ struct json_sax
@param[in] val object key
@param[in] val object key
@return whether parsing should proceed
@return whether parsing should proceed
*/
*/
virtual
bool
key
(
st
d
::
string
&&
val
)
=
0
;
virtual
bool
key
(
st
ring_t
&&
val
)
=
0
;
/*!
/*!
@brief the end of an object was read
@brief the end of an object was read
...
@@ -3271,6 +3273,7 @@ class json_sax_dom_parser : public json_sax<BasicJsonType>
...
@@ -3271,6 +3273,7 @@ class json_sax_dom_parser : public json_sax<BasicJsonType>
using
number_integer_t
=
typename
BasicJsonType
::
number_integer_t
;
using
number_integer_t
=
typename
BasicJsonType
::
number_integer_t
;
using
number_unsigned_t
=
typename
BasicJsonType
::
number_unsigned_t
;
using
number_unsigned_t
=
typename
BasicJsonType
::
number_unsigned_t
;
using
number_float_t
=
typename
BasicJsonType
::
number_float_t
;
using
number_float_t
=
typename
BasicJsonType
::
number_float_t
;
using
string_t
=
typename
BasicJsonType
::
string_t
;
json_sax_dom_parser
(
BasicJsonType
&
r
,
const
bool
allow_exceptions_
=
true
)
json_sax_dom_parser
(
BasicJsonType
&
r
,
const
bool
allow_exceptions_
=
true
)
:
root
(
r
),
allow_exceptions
(
allow_exceptions_
)
:
root
(
r
),
allow_exceptions
(
allow_exceptions_
)
...
@@ -3300,13 +3303,13 @@ class json_sax_dom_parser : public json_sax<BasicJsonType>
...
@@ -3300,13 +3303,13 @@ class json_sax_dom_parser : public json_sax<BasicJsonType>
return
true
;
return
true
;
}
}
bool
number_float
(
number_float_t
val
,
const
st
d
::
string
&
)
override
bool
number_float
(
number_float_t
val
,
const
st
ring_t
&
)
override
{
{
handle_value
(
val
);
handle_value
(
val
);
return
true
;
return
true
;
}
}
bool
string
(
st
d
::
string
&&
val
)
override
bool
string
(
st
ring_t
&&
val
)
override
{
{
handle_value
(
val
);
handle_value
(
val
);
return
true
;
return
true
;
...
@@ -3325,7 +3328,7 @@ class json_sax_dom_parser : public json_sax<BasicJsonType>
...
@@ -3325,7 +3328,7 @@ class json_sax_dom_parser : public json_sax<BasicJsonType>
return
true
;
return
true
;
}
}
bool
key
(
st
d
::
string
&&
val
)
override
bool
key
(
st
ring_t
&&
val
)
override
{
{
// add null at given key and store the reference for later
// add null at given key and store the reference for later
object_element
=
&
(
ref_stack
.
back
()
->
m_value
.
object
->
operator
[](
val
));
object_element
=
&
(
ref_stack
.
back
()
->
m_value
.
object
->
operator
[](
val
));
...
@@ -3444,6 +3447,7 @@ class json_sax_acceptor : public json_sax<BasicJsonType>
...
@@ -3444,6 +3447,7 @@ class json_sax_acceptor : public json_sax<BasicJsonType>
using
number_integer_t
=
typename
BasicJsonType
::
number_integer_t
;
using
number_integer_t
=
typename
BasicJsonType
::
number_integer_t
;
using
number_unsigned_t
=
typename
BasicJsonType
::
number_unsigned_t
;
using
number_unsigned_t
=
typename
BasicJsonType
::
number_unsigned_t
;
using
number_float_t
=
typename
BasicJsonType
::
number_float_t
;
using
number_float_t
=
typename
BasicJsonType
::
number_float_t
;
using
string_t
=
typename
BasicJsonType
::
string_t
;
bool
null
()
override
bool
null
()
override
{
{
...
@@ -3465,12 +3469,12 @@ class json_sax_acceptor : public json_sax<BasicJsonType>
...
@@ -3465,12 +3469,12 @@ class json_sax_acceptor : public json_sax<BasicJsonType>
return
true
;
return
true
;
}
}
bool
number_float
(
number_float_t
,
const
st
d
::
string
&
)
override
bool
number_float
(
number_float_t
,
const
st
ring_t
&
)
override
{
{
return
true
;
return
true
;
}
}
bool
string
(
st
d
::
string
&&
)
override
bool
string
(
st
ring_t
&&
)
override
{
{
return
true
;
return
true
;
}
}
...
@@ -3480,7 +3484,7 @@ class json_sax_acceptor : public json_sax<BasicJsonType>
...
@@ -3480,7 +3484,7 @@ class json_sax_acceptor : public json_sax<BasicJsonType>
return
true
;
return
true
;
}
}
bool
key
(
st
d
::
string
&&
)
override
bool
key
(
st
ring_t
&&
)
override
{
{
return
true
;
return
true
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment