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
7fc4b290
Unverified
Commit
7fc4b290
authored
Jul 17, 2020
by
Niels Lohmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🚸
add static assertion for missing binary function in SAX interface
parent
a10d486e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
12 deletions
+26
-12
include/nlohmann/detail/meta/is_sax.hpp
include/nlohmann/detail/meta/is_sax.hpp
+13
-6
single_include/nlohmann/json.hpp
single_include/nlohmann/json.hpp
+13
-6
No files found.
include/nlohmann/detail/meta/is_sax.hpp
View file @
7fc4b290
...
...
@@ -34,6 +34,10 @@ template<typename T, typename String>
using
string_function_t
=
decltype
(
std
::
declval
<
T
&>
().
string
(
std
::
declval
<
String
&>
()));
template
<
typename
T
,
typename
Binary
>
using
binary_function_t
=
decltype
(
std
::
declval
<
T
&>
().
binary
(
std
::
declval
<
Binary
&>
()));
template
<
typename
T
>
using
start_object_function_t
=
decltype
(
std
::
declval
<
T
&>
().
start_object
(
std
::
declval
<
std
::
size_t
>
()));
...
...
@@ -68,19 +72,18 @@ struct is_sax
using
number_unsigned_t
=
typename
BasicJsonType
::
number_unsigned_t
;
using
number_float_t
=
typename
BasicJsonType
::
number_float_t
;
using
string_t
=
typename
BasicJsonType
::
string_t
;
using
binary_t
=
typename
BasicJsonType
::
binary_t
;
using
exception_t
=
typename
BasicJsonType
::
exception
;
public:
static
constexpr
bool
value
=
is_detected_exact
<
bool
,
null_function_t
,
SAX
>::
value
&&
is_detected_exact
<
bool
,
boolean_function_t
,
SAX
>::
value
&&
is_detected_exact
<
bool
,
number_integer_function_t
,
SAX
,
number_integer_t
>::
value
&&
is_detected_exact
<
bool
,
number_unsigned_function_t
,
SAX
,
number_unsigned_t
>::
value
&&
is_detected_exact
<
bool
,
number_float_function_t
,
SAX
,
number_float_t
,
string_t
>::
value
&&
is_detected_exact
<
bool
,
number_integer_function_t
,
SAX
,
number_integer_t
>::
value
&&
is_detected_exact
<
bool
,
number_unsigned_function_t
,
SAX
,
number_unsigned_t
>::
value
&&
is_detected_exact
<
bool
,
number_float_function_t
,
SAX
,
number_float_t
,
string_t
>::
value
&&
is_detected_exact
<
bool
,
string_function_t
,
SAX
,
string_t
>::
value
&&
is_detected_exact
<
bool
,
binary_function_t
,
SAX
,
binary_t
>::
value
&&
is_detected_exact
<
bool
,
start_object_function_t
,
SAX
>::
value
&&
is_detected_exact
<
bool
,
key_function_t
,
SAX
,
string_t
>::
value
&&
is_detected_exact
<
bool
,
end_object_function_t
,
SAX
>::
value
&&
...
...
@@ -100,6 +103,7 @@ struct is_sax_static_asserts
using
number_unsigned_t
=
typename
BasicJsonType
::
number_unsigned_t
;
using
number_float_t
=
typename
BasicJsonType
::
number_float_t
;
using
string_t
=
typename
BasicJsonType
::
string_t
;
using
binary_t
=
typename
BasicJsonType
::
binary_t
;
using
exception_t
=
typename
BasicJsonType
::
exception
;
public:
...
...
@@ -123,6 +127,9 @@ struct is_sax_static_asserts
static_assert
(
is_detected_exact
<
bool
,
string_function_t
,
SAX
,
string_t
>::
value
,
"Missing/invalid function: bool string(string_t&)"
);
static_assert
(
is_detected_exact
<
bool
,
binary_function_t
,
SAX
,
binary_t
>::
value
,
"Missing/invalid function: bool binary(binary_t&)"
);
static_assert
(
is_detected_exact
<
bool
,
start_object_function_t
,
SAX
>::
value
,
"Missing/invalid function: bool start_object(std::size_t)"
);
static_assert
(
is_detected_exact
<
bool
,
key_function_t
,
SAX
,
string_t
>::
value
,
...
...
single_include/nlohmann/json.hpp
View file @
7fc4b290
...
...
@@ -5774,6 +5774,10 @@ template<typename T, typename String>
using
string_function_t
=
decltype
(
std
::
declval
<
T
&>
().
string
(
std
::
declval
<
String
&>
()));
template
<
typename
T
,
typename
Binary
>
using
binary_function_t
=
decltype
(
std
::
declval
<
T
&>
().
binary
(
std
::
declval
<
Binary
&>
()));
template
<
typename
T
>
using
start_object_function_t
=
decltype
(
std
::
declval
<
T
&>
().
start_object
(
std
::
declval
<
std
::
size_t
>
()));
...
...
@@ -5808,19 +5812,18 @@ struct is_sax
using
number_unsigned_t
=
typename
BasicJsonType
::
number_unsigned_t
;
using
number_float_t
=
typename
BasicJsonType
::
number_float_t
;
using
string_t
=
typename
BasicJsonType
::
string_t
;
using
binary_t
=
typename
BasicJsonType
::
binary_t
;
using
exception_t
=
typename
BasicJsonType
::
exception
;
public:
static
constexpr
bool
value
=
is_detected_exact
<
bool
,
null_function_t
,
SAX
>::
value
&&
is_detected_exact
<
bool
,
boolean_function_t
,
SAX
>::
value
&&
is_detected_exact
<
bool
,
number_integer_function_t
,
SAX
,
number_integer_t
>::
value
&&
is_detected_exact
<
bool
,
number_unsigned_function_t
,
SAX
,
number_unsigned_t
>::
value
&&
is_detected_exact
<
bool
,
number_float_function_t
,
SAX
,
number_float_t
,
string_t
>::
value
&&
is_detected_exact
<
bool
,
number_integer_function_t
,
SAX
,
number_integer_t
>::
value
&&
is_detected_exact
<
bool
,
number_unsigned_function_t
,
SAX
,
number_unsigned_t
>::
value
&&
is_detected_exact
<
bool
,
number_float_function_t
,
SAX
,
number_float_t
,
string_t
>::
value
&&
is_detected_exact
<
bool
,
string_function_t
,
SAX
,
string_t
>::
value
&&
is_detected_exact
<
bool
,
binary_function_t
,
SAX
,
binary_t
>::
value
&&
is_detected_exact
<
bool
,
start_object_function_t
,
SAX
>::
value
&&
is_detected_exact
<
bool
,
key_function_t
,
SAX
,
string_t
>::
value
&&
is_detected_exact
<
bool
,
end_object_function_t
,
SAX
>::
value
&&
...
...
@@ -5840,6 +5843,7 @@ struct is_sax_static_asserts
using
number_unsigned_t
=
typename
BasicJsonType
::
number_unsigned_t
;
using
number_float_t
=
typename
BasicJsonType
::
number_float_t
;
using
string_t
=
typename
BasicJsonType
::
string_t
;
using
binary_t
=
typename
BasicJsonType
::
binary_t
;
using
exception_t
=
typename
BasicJsonType
::
exception
;
public:
...
...
@@ -5863,6 +5867,9 @@ struct is_sax_static_asserts
static_assert
(
is_detected_exact
<
bool
,
string_function_t
,
SAX
,
string_t
>::
value
,
"Missing/invalid function: bool string(string_t&)"
);
static_assert
(
is_detected_exact
<
bool
,
binary_function_t
,
SAX
,
binary_t
>::
value
,
"Missing/invalid function: bool binary(binary_t&)"
);
static_assert
(
is_detected_exact
<
bool
,
start_object_function_t
,
SAX
>::
value
,
"Missing/invalid function: bool start_object(std::size_t)"
);
static_assert
(
is_detected_exact
<
bool
,
key_function_t
,
SAX
,
string_t
>::
value
,
...
...
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