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
adfa961e
Unverified
Commit
adfa961e
authored
Oct 08, 2018
by
Niels Lohmann
Committed by
GitHub
Oct 08, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1280 from nlohmann/feature/linter
Removed linter warnings
parents
ac38e957
6d34d64b
Changes
29
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
29 changed files
with
340 additions
and
348 deletions
+340
-348
include/nlohmann/adl_serializer.hpp
include/nlohmann/adl_serializer.hpp
+1
-1
include/nlohmann/detail/conversions/from_json.hpp
include/nlohmann/detail/conversions/from_json.hpp
+4
-4
include/nlohmann/detail/conversions/to_chars.hpp
include/nlohmann/detail/conversions/to_chars.hpp
+9
-10
include/nlohmann/detail/conversions/to_json.hpp
include/nlohmann/detail/conversions/to_json.hpp
+5
-5
include/nlohmann/detail/exceptions.hpp
include/nlohmann/detail/exceptions.hpp
+2
-2
include/nlohmann/detail/input/binary_reader.hpp
include/nlohmann/detail/input/binary_reader.hpp
+9
-4
include/nlohmann/detail/input/input_adapters.hpp
include/nlohmann/detail/input/input_adapters.hpp
+10
-5
include/nlohmann/detail/input/json_sax.hpp
include/nlohmann/detail/input/json_sax.hpp
+51
-52
include/nlohmann/detail/input/lexer.hpp
include/nlohmann/detail/input/lexer.hpp
+13
-20
include/nlohmann/detail/input/parser.hpp
include/nlohmann/detail/input/parser.hpp
+4
-7
include/nlohmann/detail/iterators/internal_iterator.hpp
include/nlohmann/detail/iterators/internal_iterator.hpp
+2
-2
include/nlohmann/detail/iterators/iter_impl.hpp
include/nlohmann/detail/iterators/iter_impl.hpp
+2
-2
include/nlohmann/detail/iterators/iteration_proxy.hpp
include/nlohmann/detail/iterators/iteration_proxy.hpp
+2
-5
include/nlohmann/detail/iterators/json_reverse_iterator.hpp
include/nlohmann/detail/iterators/json_reverse_iterator.hpp
+2
-2
include/nlohmann/detail/iterators/primitive_iterator.hpp
include/nlohmann/detail/iterators/primitive_iterator.hpp
+2
-2
include/nlohmann/detail/json_pointer.hpp
include/nlohmann/detail/json_pointer.hpp
+3
-3
include/nlohmann/detail/json_ref.hpp
include/nlohmann/detail/json_ref.hpp
+4
-2
include/nlohmann/detail/meta/cpp_future.hpp
include/nlohmann/detail/meta/cpp_future.hpp
+2
-2
include/nlohmann/detail/meta/detected.hpp
include/nlohmann/detail/meta/detected.hpp
+2
-2
include/nlohmann/detail/meta/is_sax.hpp
include/nlohmann/detail/meta/is_sax.hpp
+2
-2
include/nlohmann/detail/meta/type_traits.hpp
include/nlohmann/detail/meta/type_traits.hpp
+2
-2
include/nlohmann/detail/meta/void_t.hpp
include/nlohmann/detail/meta/void_t.hpp
+2
-2
include/nlohmann/detail/output/binary_writer.hpp
include/nlohmann/detail/output/binary_writer.hpp
+20
-22
include/nlohmann/detail/output/output_adapters.hpp
include/nlohmann/detail/output/output_adapters.hpp
+2
-2
include/nlohmann/detail/output/serializer.hpp
include/nlohmann/detail/output/serializer.hpp
+6
-3
include/nlohmann/detail/value_t.hpp
include/nlohmann/detail/value_t.hpp
+2
-2
include/nlohmann/json.hpp
include/nlohmann/json.hpp
+4
-6
include/nlohmann/json_fwd.hpp
include/nlohmann/json_fwd.hpp
+1
-1
single_include/nlohmann/json.hpp
single_include/nlohmann/json.hpp
+170
-174
No files found.
include/nlohmann/adl_serializer.hpp
View file @
adfa961e
...
@@ -46,4 +46,4 @@ struct adl_serializer
...
@@ -46,4 +46,4 @@ struct adl_serializer
::
nlohmann
::
to_json
(
j
,
std
::
forward
<
ValueType
>
(
val
));
::
nlohmann
::
to_json
(
j
,
std
::
forward
<
ValueType
>
(
val
));
}
}
};
};
}
}
// namespace nlohmann
include/nlohmann/detail/conversions/from_json.hpp
View file @
adfa961e
...
@@ -299,7 +299,7 @@ void from_json(const BasicJsonType& j, std::pair<A1, A2>& p)
...
@@ -299,7 +299,7 @@ void from_json(const BasicJsonType& j, std::pair<A1, A2>& p)
}
}
template
<
typename
BasicJsonType
,
typename
Tuple
,
std
::
size_t
...
Idx
>
template
<
typename
BasicJsonType
,
typename
Tuple
,
std
::
size_t
...
Idx
>
void
from_json_tuple_impl
(
const
BasicJsonType
&
j
,
Tuple
&
t
,
index_sequence
<
Idx
...
>
)
void
from_json_tuple_impl
(
const
BasicJsonType
&
j
,
Tuple
&
t
,
index_sequence
<
Idx
...
>
/*unused*/
)
{
{
t
=
std
::
make_tuple
(
j
.
at
(
Idx
).
template
get
<
typename
std
::
tuple_element
<
Idx
,
Tuple
>
::
type
>
()...);
t
=
std
::
make_tuple
(
j
.
at
(
Idx
).
template
get
<
typename
std
::
tuple_element
<
Idx
,
Tuple
>
::
type
>
()...);
}
}
...
@@ -358,7 +358,7 @@ struct from_json_fn
...
@@ -358,7 +358,7 @@ struct from_json_fn
return
from_json
(
j
,
val
);
return
from_json
(
j
,
val
);
}
}
};
};
}
}
// namespace detail
/// namespace to hold default `from_json` function
/// namespace to hold default `from_json` function
/// to see why this is required:
/// to see why this is required:
...
@@ -366,5 +366,5 @@ struct from_json_fn
...
@@ -366,5 +366,5 @@ struct from_json_fn
namespace
namespace
{
{
constexpr
const
auto
&
from_json
=
detail
::
static_const
<
detail
::
from_json_fn
>::
value
;
constexpr
const
auto
&
from_json
=
detail
::
static_const
<
detail
::
from_json_fn
>::
value
;
}
}
// namespace
}
}
// namespace nlohmann
include/nlohmann/detail/conversions/to_chars.hpp
View file @
adfa961e
...
@@ -47,10 +47,9 @@ struct diyfp // f * 2^e
...
@@ -47,10 +47,9 @@ struct diyfp // f * 2^e
{
{
static
constexpr
int
kPrecision
=
64
;
// = q
static
constexpr
int
kPrecision
=
64
;
// = q
uint64_t
f
;
uint64_t
f
=
0
;
int
e
;
int
e
=
0
;
constexpr
diyfp
()
noexcept
:
f
(
0
),
e
(
0
)
{}
constexpr
diyfp
(
uint64_t
f_
,
int
e_
)
noexcept
:
f
(
f_
),
e
(
e_
)
{}
constexpr
diyfp
(
uint64_t
f_
,
int
e_
)
noexcept
:
f
(
f_
),
e
(
e_
)
{}
/*!
/*!
...
@@ -62,7 +61,7 @@ struct diyfp // f * 2^e
...
@@ -62,7 +61,7 @@ struct diyfp // f * 2^e
assert
(
x
.
e
==
y
.
e
);
assert
(
x
.
e
==
y
.
e
);
assert
(
x
.
f
>=
y
.
f
);
assert
(
x
.
f
>=
y
.
f
);
return
diyfp
(
x
.
f
-
y
.
f
,
x
.
e
)
;
return
{
x
.
f
-
y
.
f
,
x
.
e
}
;
}
}
/*!
/*!
...
@@ -127,7 +126,7 @@ struct diyfp // f * 2^e
...
@@ -127,7 +126,7 @@ struct diyfp // f * 2^e
const
uint64_t
h
=
p3
+
p2_hi
+
p1_hi
+
(
Q
>>
32
);
const
uint64_t
h
=
p3
+
p2_hi
+
p1_hi
+
(
Q
>>
32
);
return
diyfp
(
h
,
x
.
e
+
y
.
e
+
64
)
;
return
{
h
,
x
.
e
+
y
.
e
+
64
}
;
}
}
/*!
/*!
...
@@ -158,7 +157,7 @@ struct diyfp // f * 2^e
...
@@ -158,7 +157,7 @@ struct diyfp // f * 2^e
assert
(
delta
>=
0
);
assert
(
delta
>=
0
);
assert
(((
x
.
f
<<
delta
)
>>
delta
)
==
x
.
f
);
assert
(((
x
.
f
<<
delta
)
>>
delta
)
==
x
.
f
);
return
diyfp
(
x
.
f
<<
delta
,
target_exponent
)
;
return
{
x
.
f
<<
delta
,
target_exponent
}
;
}
}
};
};
...
@@ -461,7 +460,7 @@ inline cached_power get_cached_power_for_binary_exponent(int e)
...
@@ -461,7 +460,7 @@ inline cached_power get_cached_power_for_binary_exponent(int e)
assert
(
e
>=
-
1500
);
assert
(
e
>=
-
1500
);
assert
(
e
<=
1500
);
assert
(
e
<=
1500
);
const
int
f
=
kAlpha
-
e
-
1
;
const
int
f
=
kAlpha
-
e
-
1
;
const
int
k
=
(
f
*
78913
)
/
(
1
<<
18
)
+
(
f
>
0
);
const
int
k
=
(
f
*
78913
)
/
(
1
<<
18
)
+
static_cast
<
int
>
(
f
>
0
);
const
int
index
=
(
-
kCachedPowersMinDecExp
+
k
+
(
kCachedPowersDecStep
-
1
))
/
kCachedPowersDecStep
;
const
int
index
=
(
-
kCachedPowersMinDecExp
+
k
+
(
kCachedPowersDecStep
-
1
))
/
kCachedPowersDecStep
;
assert
(
index
>=
0
);
assert
(
index
>=
0
);
...
@@ -609,7 +608,7 @@ inline void grisu2_digit_gen(char* buffer, int& length, int& decimal_exponent,
...
@@ -609,7 +608,7 @@ inline void grisu2_digit_gen(char* buffer, int& length, int& decimal_exponent,
const
diyfp
one
(
uint64_t
{
1
}
<<
-
M_plus
.
e
,
M_plus
.
e
);
const
diyfp
one
(
uint64_t
{
1
}
<<
-
M_plus
.
e
,
M_plus
.
e
);
uint32_t
p1
=
static_cast
<
uint32_t
>
(
M_plus
.
f
>>
-
one
.
e
);
// p1 = f div 2^-e (Since -e >= 32, p1 fits into a 32-bit int.)
auto
p1
=
static_cast
<
uint32_t
>
(
M_plus
.
f
>>
-
one
.
e
);
// p1 = f div 2^-e (Since -e >= 32, p1 fits into a 32-bit int.)
uint64_t
p2
=
M_plus
.
f
&
(
one
.
f
-
1
);
// p2 = f mod 2^-e
uint64_t
p2
=
M_plus
.
f
&
(
one
.
f
-
1
);
// p2 = f mod 2^-e
// 1)
// 1)
...
@@ -928,7 +927,7 @@ inline char* append_exponent(char* buf, int e)
...
@@ -928,7 +927,7 @@ inline char* append_exponent(char* buf, int e)
*
buf
++
=
'+'
;
*
buf
++
=
'+'
;
}
}
uint32_t
k
=
static_cast
<
uint32_t
>
(
e
);
auto
k
=
static_cast
<
uint32_t
>
(
e
);
if
(
k
<
10
)
if
(
k
<
10
)
{
{
// Always print at least two digits in the exponent.
// Always print at least two digits in the exponent.
...
@@ -1046,7 +1045,7 @@ format. Returns an iterator pointing past-the-end of the decimal representation.
...
@@ -1046,7 +1045,7 @@ format. Returns an iterator pointing past-the-end of the decimal representation.
@note The result is NOT null-terminated.
@note The result is NOT null-terminated.
*/
*/
template
<
typename
FloatType
>
template
<
typename
FloatType
>
char
*
to_chars
(
char
*
first
,
char
*
last
,
FloatType
value
)
char
*
to_chars
(
char
*
first
,
c
onst
c
har
*
last
,
FloatType
value
)
{
{
static_cast
<
void
>
(
last
);
// maybe unused - fix warning
static_cast
<
void
>
(
last
);
// maybe unused - fix warning
assert
(
std
::
isfinite
(
value
));
assert
(
std
::
isfinite
(
value
));
...
...
include/nlohmann/detail/conversions/to_json.hpp
View file @
adfa961e
...
@@ -306,13 +306,13 @@ void to_json(BasicJsonType& j, const std::pair<Args...>& p)
...
@@ -306,13 +306,13 @@ void to_json(BasicJsonType& j, const std::pair<Args...>& p)
// for https://github.com/nlohmann/json/pull/1134
// for https://github.com/nlohmann/json/pull/1134
template
<
typename
BasicJsonType
,
typename
T
,
template
<
typename
BasicJsonType
,
typename
T
,
enable_if_t
<
std
::
is_same
<
T
,
typename
iteration_proxy
<
typename
BasicJsonType
::
iterator
>
::
iteration_proxy_internal
>
::
value
,
int
>
=
0
>
enable_if_t
<
std
::
is_same
<
T
,
typename
iteration_proxy
<
typename
BasicJsonType
::
iterator
>
::
iteration_proxy_internal
>
::
value
,
int
>
=
0
>
void
to_json
(
BasicJsonType
&
j
,
T
b
)
noexcept
void
to_json
(
BasicJsonType
&
j
,
const
T
&
b
)
{
{
j
=
{{
b
.
key
(),
b
.
value
()}};
j
=
{{
b
.
key
(),
b
.
value
()}};
}
}
template
<
typename
BasicJsonType
,
typename
Tuple
,
std
::
size_t
...
Idx
>
template
<
typename
BasicJsonType
,
typename
Tuple
,
std
::
size_t
...
Idx
>
void
to_json_tuple_impl
(
BasicJsonType
&
j
,
const
Tuple
&
t
,
index_sequence
<
Idx
...
>
)
void
to_json_tuple_impl
(
BasicJsonType
&
j
,
const
Tuple
&
t
,
index_sequence
<
Idx
...
>
/*unused*/
)
{
{
j
=
{
std
::
get
<
Idx
>
(
t
)...};
j
=
{
std
::
get
<
Idx
>
(
t
)...};
}
}
...
@@ -332,11 +332,11 @@ struct to_json_fn
...
@@ -332,11 +332,11 @@ struct to_json_fn
return
to_json
(
j
,
std
::
forward
<
T
>
(
val
));
return
to_json
(
j
,
std
::
forward
<
T
>
(
val
));
}
}
};
};
}
}
// namespace detail
/// namespace to hold default `to_json` function
/// namespace to hold default `to_json` function
namespace
namespace
{
{
constexpr
const
auto
&
to_json
=
detail
::
static_const
<
detail
::
to_json_fn
>::
value
;
constexpr
const
auto
&
to_json
=
detail
::
static_const
<
detail
::
to_json_fn
>::
value
;
}
}
// namespace
}
}
// namespace nlohmann
include/nlohmann/detail/exceptions.hpp
View file @
adfa961e
...
@@ -326,5 +326,5 @@ class other_error : public exception
...
@@ -326,5 +326,5 @@ class other_error : public exception
private:
private:
other_error
(
int
id_
,
const
char
*
what_arg
)
:
exception
(
id_
,
what_arg
)
{}
other_error
(
int
id_
,
const
char
*
what_arg
)
:
exception
(
id_
,
what_arg
)
{}
};
};
}
}
// namespace detail
}
}
// namespace nlohmann
include/nlohmann/detail/input/binary_reader.hpp
View file @
adfa961e
...
@@ -392,17 +392,20 @@ class binary_reader
...
@@ -392,17 +392,20 @@ class binary_reader
case
0xF9
:
// Half-Precision Float (two-byte IEEE 754)
case
0xF9
:
// Half-Precision Float (two-byte IEEE 754)
{
{
const
int
byte1
=
get
();
const
int
byte1
_raw
=
get
();
if
(
JSON_UNLIKELY
(
not
unexpect_eof
()))
if
(
JSON_UNLIKELY
(
not
unexpect_eof
()))
{
{
return
false
;
return
false
;
}
}
const
int
byte2
=
get
();
const
int
byte2
_raw
=
get
();
if
(
JSON_UNLIKELY
(
not
unexpect_eof
()))
if
(
JSON_UNLIKELY
(
not
unexpect_eof
()))
{
{
return
false
;
return
false
;
}
}
const
auto
byte1
=
static_cast
<
unsigned
char
>
(
byte1_raw
);
const
auto
byte2
=
static_cast
<
unsigned
char
>
(
byte2_raw
);
// code from RFC 7049, Appendix D, Figure 3:
// code from RFC 7049, Appendix D, Figure 3:
// As half-precision floating-point numbers were only added
// As half-precision floating-point numbers were only added
// to IEEE 754 in 2008, today's programming platforms often
// to IEEE 754 in 2008, today's programming platforms often
...
@@ -1036,6 +1039,7 @@ class binary_reader
...
@@ -1036,6 +1039,7 @@ class binary_reader
}
}
if
(
len
!=
std
::
size_t
(
-
1
))
if
(
len
!=
std
::
size_t
(
-
1
))
{
for
(
std
::
size_t
i
=
0
;
i
<
len
;
++
i
)
for
(
std
::
size_t
i
=
0
;
i
<
len
;
++
i
)
{
{
if
(
JSON_UNLIKELY
(
not
parse_cbor_internal
()))
if
(
JSON_UNLIKELY
(
not
parse_cbor_internal
()))
...
@@ -1043,6 +1047,7 @@ class binary_reader
...
@@ -1043,6 +1047,7 @@ class binary_reader
return
false
;
return
false
;
}
}
}
}
}
else
else
{
{
while
(
get
()
!=
0xFF
)
while
(
get
()
!=
0xFF
)
...
@@ -1693,5 +1698,5 @@ class binary_reader
...
@@ -1693,5 +1698,5 @@ class binary_reader
/// the SAX parser
/// the SAX parser
json_sax_t
*
sax
=
nullptr
;
json_sax_t
*
sax
=
nullptr
;
};
};
}
}
// namespace detail
}
}
// namespace nlohmann
include/nlohmann/detail/input/input_adapters.hpp
View file @
adfa961e
...
@@ -71,6 +71,8 @@ class input_stream_adapter : public input_adapter_protocol
...
@@ -71,6 +71,8 @@ class input_stream_adapter : public input_adapter_protocol
// delete because of pointer members
// delete because of pointer members
input_stream_adapter
(
const
input_stream_adapter
&
)
=
delete
;
input_stream_adapter
(
const
input_stream_adapter
&
)
=
delete
;
input_stream_adapter
&
operator
=
(
input_stream_adapter
&
)
=
delete
;
input_stream_adapter
&
operator
=
(
input_stream_adapter
&
)
=
delete
;
input_stream_adapter
(
input_stream_adapter
&&
)
=
delete
;
input_stream_adapter
&
operator
=
(
input_stream_adapter
&&
)
=
delete
;
// std::istream/std::streambuf use std::char_traits<char>::to_int_type, to
// std::istream/std::streambuf use std::char_traits<char>::to_int_type, to
// ensure that std::char_traits<char>::eof() and the character 0xFF do not
// ensure that std::char_traits<char>::eof() and the character 0xFF do not
...
@@ -97,6 +99,9 @@ class input_buffer_adapter : public input_adapter_protocol
...
@@ -97,6 +99,9 @@ class input_buffer_adapter : public input_adapter_protocol
// delete because of pointer members
// delete because of pointer members
input_buffer_adapter
(
const
input_buffer_adapter
&
)
=
delete
;
input_buffer_adapter
(
const
input_buffer_adapter
&
)
=
delete
;
input_buffer_adapter
&
operator
=
(
input_buffer_adapter
&
)
=
delete
;
input_buffer_adapter
&
operator
=
(
input_buffer_adapter
&
)
=
delete
;
input_buffer_adapter
(
input_buffer_adapter
&&
)
=
delete
;
input_buffer_adapter
&
operator
=
(
input_buffer_adapter
&&
)
=
delete
;
~
input_buffer_adapter
()
override
=
default
;
std
::
char_traits
<
char
>::
int_type
get_character
()
noexcept
override
std
::
char_traits
<
char
>::
int_type
get_character
()
noexcept
override
{
{
...
@@ -131,7 +136,7 @@ struct wide_string_input_helper
...
@@ -131,7 +136,7 @@ struct wide_string_input_helper
else
else
{
{
// get the current character
// get the current character
const
int
wc
=
static_cast
<
int
>
(
str
[
current_wchar
++
]);
const
auto
wc
=
static_cast
<
int
>
(
str
[
current_wchar
++
]);
// UTF-32 to UTF-8 encoding
// UTF-32 to UTF-8 encoding
if
(
wc
<
0x80
)
if
(
wc
<
0x80
)
...
@@ -186,7 +191,7 @@ struct wide_string_input_helper<WideStringType, 2>
...
@@ -186,7 +191,7 @@ struct wide_string_input_helper<WideStringType, 2>
else
else
{
{
// get the current character
// get the current character
const
int
wc
=
static_cast
<
int
>
(
str
[
current_wchar
++
]);
const
auto
wc
=
static_cast
<
int
>
(
str
[
current_wchar
++
]);
// UTF-16 to UTF-8 encoding
// UTF-16 to UTF-8 encoding
if
(
wc
<
0x80
)
if
(
wc
<
0x80
)
...
@@ -211,7 +216,7 @@ struct wide_string_input_helper<WideStringType, 2>
...
@@ -211,7 +216,7 @@ struct wide_string_input_helper<WideStringType, 2>
{
{
if
(
current_wchar
<
str
.
size
())
if
(
current_wchar
<
str
.
size
())
{
{
const
int
wc2
=
static_cast
<
int
>
(
str
[
current_wchar
++
]);
const
auto
wc2
=
static_cast
<
int
>
(
str
[
current_wchar
++
]);
const
int
charcode
=
0x10000
+
(((
wc
&
0x3FF
)
<<
10
)
|
(
wc2
&
0x3FF
));
const
int
charcode
=
0x10000
+
(((
wc
&
0x3FF
)
<<
10
)
|
(
wc2
&
0x3FF
));
utf8_bytes
[
0
]
=
0xf0
|
(
charcode
>>
18
);
utf8_bytes
[
0
]
=
0xf0
|
(
charcode
>>
18
);
utf8_bytes
[
1
]
=
0x80
|
((
charcode
>>
12
)
&
0x3F
);
utf8_bytes
[
1
]
=
0x80
|
((
charcode
>>
12
)
&
0x3F
);
...
@@ -381,5 +386,5 @@ class input_adapter
...
@@ -381,5 +386,5 @@ class input_adapter
/// the actual adapter
/// the actual adapter
input_adapter_t
ia
=
nullptr
;
input_adapter_t
ia
=
nullptr
;
};
};
}
}
// namespace detail
}
}
// namespace nlohmann
include/nlohmann/detail/input/json_sax.hpp
View file @
adfa961e
...
@@ -181,7 +181,7 @@ class json_sax_dom_parser
...
@@ -181,7 +181,7 @@ class json_sax_dom_parser
return
true
;
return
true
;
}
}
bool
number_float
(
number_float_t
val
,
const
string_t
&
)
bool
number_float
(
number_float_t
val
,
const
string_t
&
/*unused*/
)
{
{
handle_value
(
val
);
handle_value
(
val
);
return
true
;
return
true
;
...
@@ -238,7 +238,7 @@ class json_sax_dom_parser
...
@@ -238,7 +238,7 @@ class json_sax_dom_parser
return
true
;
return
true
;
}
}
bool
parse_error
(
std
::
size_t
,
const
std
::
string
&
,
bool
parse_error
(
std
::
size_t
/*unused*/
,
const
std
::
string
&
/*unused*/
,
const
detail
::
exception
&
ex
)
const
detail
::
exception
&
ex
)
{
{
errored
=
true
;
errored
=
true
;
...
@@ -286,20 +286,19 @@ class json_sax_dom_parser
...
@@ -286,20 +286,19 @@ class json_sax_dom_parser
root
=
BasicJsonType
(
std
::
forward
<
Value
>
(
v
));
root
=
BasicJsonType
(
std
::
forward
<
Value
>
(
v
));
return
&
root
;
return
&
root
;
}
}
assert
(
ref_stack
.
back
()
->
is_array
()
or
ref_stack
.
back
()
->
is_object
());
if
(
ref_stack
.
back
()
->
is_array
())
{
ref_stack
.
back
()
->
m_value
.
array
->
emplace_back
(
std
::
forward
<
Value
>
(
v
));
return
&
(
ref_stack
.
back
()
->
m_value
.
array
->
back
());
}
else
else
{
{
assert
(
ref_stack
.
back
()
->
is_array
()
or
ref_stack
.
back
()
->
is_object
());
assert
(
object_element
);
if
(
ref_stack
.
back
()
->
is_array
())
*
object_element
=
BasicJsonType
(
std
::
forward
<
Value
>
(
v
));
{
return
object_element
;
ref_stack
.
back
()
->
m_value
.
array
->
emplace_back
(
std
::
forward
<
Value
>
(
v
));
return
&
(
ref_stack
.
back
()
->
m_value
.
array
->
back
());
}
else
{
assert
(
object_element
);
*
object_element
=
BasicJsonType
(
std
::
forward
<
Value
>
(
v
));
return
object_element
;
}
}
}
}
}
...
@@ -358,7 +357,7 @@ class json_sax_dom_callback_parser
...
@@ -358,7 +357,7 @@ class json_sax_dom_callback_parser
return
true
;
return
true
;
}
}
bool
number_float
(
number_float_t
val
,
const
string_t
&
)
bool
number_float
(
number_float_t
val
,
const
string_t
&
/*unused*/
)
{
{
handle_value
(
val
);
handle_value
(
val
);
return
true
;
return
true
;
...
@@ -496,7 +495,7 @@ class json_sax_dom_callback_parser
...
@@ -496,7 +495,7 @@ class json_sax_dom_callback_parser
return
true
;
return
true
;
}
}
bool
parse_error
(
std
::
size_t
,
const
std
::
string
&
,
bool
parse_error
(
std
::
size_t
/*unused*/
,
const
std
::
string
&
/*unused*/
,
const
detail
::
exception
&
ex
)
const
detail
::
exception
&
ex
)
{
{
errored
=
true
;
errored
=
true
;
...
@@ -574,37 +573,37 @@ class json_sax_dom_callback_parser
...
@@ -574,37 +573,37 @@ class json_sax_dom_callback_parser
root
=
std
::
move
(
value
);
root
=
std
::
move
(
value
);
return
{
true
,
&
root
};
return
{
true
,
&
root
};
}
}
// skip this value if we already decided to skip the parent
// (https://github.com/nlohmann/json/issues/971#issuecomment-413678360)
if
(
not
ref_stack
.
back
())
{
return
{
false
,
nullptr
};
}
// we now only expect arrays and objects
assert
(
ref_stack
.
back
()
->
is_array
()
or
ref_stack
.
back
()
->
is_object
());
if
(
ref_stack
.
back
()
->
is_array
())
{
ref_stack
.
back
()
->
m_value
.
array
->
push_back
(
std
::
move
(
value
));
return
{
true
,
&
(
ref_stack
.
back
()
->
m_value
.
array
->
back
())};
}
else
else
{
{
// skip this value if we already decided to skip the parent
// check if we should store an element for the current key
// (https://github.com/nlohmann/json/issues/971#issuecomment-413678360)
assert
(
not
key_keep_stack
.
empty
());
if
(
not
ref_stack
.
back
())
const
bool
store_element
=
key_keep_stack
.
back
();
{
key_keep_stack
.
pop_back
();
return
{
false
,
nullptr
};
}
assert
(
ref_stack
.
back
()
->
is_array
()
or
ref_stack
.
back
()
->
is_object
());
if
(
not
store_element
)
if
(
ref_stack
.
back
()
->
is_array
())
{
{
ref_stack
.
back
()
->
m_value
.
array
->
push_back
(
std
::
move
(
value
));
return
{
false
,
nullptr
};
return
{
true
,
&
(
ref_stack
.
back
()
->
m_value
.
array
->
back
())};
}
}
else
{
// check if we should store an element for the current key
assert
(
not
key_keep_stack
.
empty
());
const
bool
store_element
=
key_keep_stack
.
back
();
key_keep_stack
.
pop_back
();
if
(
not
store_element
)
{
return
{
false
,
nullptr
};
}
assert
(
object_element
);
assert
(
object_element
);
*
object_element
=
std
::
move
(
value
);
*
object_element
=
std
::
move
(
value
);
return
{
true
,
object_element
};
return
{
true
,
object_element
};
}
}
}
}
}
...
@@ -642,37 +641,37 @@ class json_sax_acceptor
...
@@ -642,37 +641,37 @@ class json_sax_acceptor
return
true
;
return
true
;
}
}
bool
boolean
(
bool
)
bool
boolean
(
bool
/*unused*/
)
{
{
return
true
;
return
true
;
}
}
bool
number_integer
(
number_integer_t
)
bool
number_integer
(
number_integer_t
/*unused*/
)
{
{
return
true
;
return
true
;
}
}
bool
number_unsigned
(
number_unsigned_t
)
bool
number_unsigned
(
number_unsigned_t
/*unused*/
)
{
{
return
true
;
return
true
;
}
}
bool
number_float
(
number_float_t
,
const
string_t
&
)
bool
number_float
(
number_float_t
/*unused*/
,
const
string_t
&
/*unused*/
)
{
{
return
true
;
return
true
;
}
}
bool
string
(
string_t
&
)
bool
string
(
string_t
&
/*unused*/
)
{
{
return
true
;
return
true
;
}
}
bool
start_object
(
std
::
size_t
=
std
::
size_t
(
-
1
))
bool
start_object
(
std
::
size_t
/*unused*/
=
std
::
size_t
(
-
1
))
{
{
return
true
;
return
true
;
}
}
bool
key
(
string_t
&
)
bool
key
(
string_t
&
/*unused*/
)
{
{
return
true
;
return
true
;
}
}
...
@@ -682,7 +681,7 @@ class json_sax_acceptor
...
@@ -682,7 +681,7 @@ class json_sax_acceptor
return
true
;
return
true
;
}
}
bool
start_array
(
std
::
size_t
=
std
::
size_t
(
-
1
))
bool
start_array
(
std
::
size_t
/*unused*/
=
std
::
size_t
(
-
1
))
{
{
return
true
;
return
true
;
}
}
...
@@ -692,11 +691,11 @@ class json_sax_acceptor
...
@@ -692,11 +691,11 @@ class json_sax_acceptor
return
true
;
return
true
;
}
}
bool
parse_error
(
std
::
size_t
,
const
std
::
string
&
,
const
detail
::
exception
&
)
bool
parse_error
(
std
::
size_t
/*unused*/
,
const
std
::
string
&
/*unused*/
,
const
detail
::
exception
&
/*unused*/
)
{
{
return
false
;
return
false
;
}
}
};
};
}
}
// namespace detail
}
}
// namespace nlohmann
include/nlohmann/detail/input/lexer.hpp
View file @
adfa961e
...
@@ -104,7 +104,10 @@ class lexer
...
@@ -104,7 +104,10 @@ class lexer
// delete because of pointer members
// delete because of pointer members
lexer
(
const
lexer
&
)
=
delete
;
lexer
(
const
lexer
&
)
=
delete
;
lexer
(
lexer
&&
)
=
delete
;
lexer
&
operator
=
(
lexer
&
)
=
delete
;
lexer
&
operator
=
(
lexer
&
)
=
delete
;
lexer
&
operator
=
(
lexer
&&
)
=
delete
;
~
lexer
()
=
default
;
private:
private:
/////////////////////
/////////////////////
...
@@ -709,7 +712,7 @@ class lexer
...
@@ -709,7 +712,7 @@ class lexer
locale's decimal point is used instead of `.` to work with the
locale's decimal point is used instead of `.` to work with the
locale-dependent converters.
locale-dependent converters.
*/
*/
token_type
scan_number
()
token_type
scan_number
()
// lgtm [cpp/use-of-goto]
{
{
// reset token_buffer to store the number's bytes
// reset token_buffer to store the number's bytes
reset
();
reset
();
...
@@ -1208,24 +1211,14 @@ scan_number_done:
...
@@ -1208,24 +1211,14 @@ scan_number_done:
{
{
if
(
get
()
==
0xEF
)
if
(
get
()
==
0xEF
)
{
{
if
(
get
()
==
0xBB
and
get
()
==
0xBF
)
// check if we completely parse the BOM
{
return
get
()
==
0xBB
and
get
()
==
0xBF
;
// we completely parsed the BOM
return
true
;
}
else
{
// after reading 0xEF, an unexpected character followed
return
false
;
}
}
else
{
// the first character is not the beginning of the BOM; unget it to
// process is later
unget
();
return
true
;
}
}
// the first character is not the beginning of the BOM; unget it to
// process is later
unget
();
return
true
;
}
}
token_type
scan
()
token_type
scan
()
...
@@ -1329,5 +1322,5 @@ scan_number_done:
...
@@ -1329,5 +1322,5 @@ scan_number_done:
/// the decimal point
/// the decimal point
const
char
decimal_point_char
=
'.'
;
const
char
decimal_point_char
=
'.'
;
};
};
}
}
// namespace detail
}
}
// namespace nlohmann
include/nlohmann/detail/input/parser.hpp
View file @
adfa961e
...
@@ -201,12 +201,9 @@ class parser
...
@@ -201,12 +201,9 @@ class parser
m_lexer
.
get_token_string
(),
m_lexer
.
get_token_string
(),
parse_error
::
create
(
101
,
m_lexer
.
get_position
(),
exception_message
(
token_type
::
value_string
)));
parse_error
::
create
(
101
,
m_lexer
.
get_position
(),
exception_message
(
token_type
::
value_string
)));
}
}
else
if
(
JSON_UNLIKELY
(
not
sax
->
key
(
m_lexer
.
get_string
())))
{
{
if
(
JSON_UNLIKELY
(
not
sax
->
key
(
m_lexer
.
get_string
())))
return
false
;
{
return
false
;
}
}
}
// parse separator (:)
// parse separator (:)
...
@@ -484,5 +481,5 @@ class parser
...
@@ -484,5 +481,5 @@ class parser
/// whether to throw exceptions in case of errors
/// whether to throw exceptions in case of errors
const
bool
allow_exceptions
=
true
;
const
bool
allow_exceptions
=
true
;
};
};
}
}
// namespace detail
}
}
// namespace nlohmann
include/nlohmann/detail/iterators/internal_iterator.hpp
View file @
adfa961e
...
@@ -21,5 +21,5 @@ template<typename BasicJsonType> struct internal_iterator
...
@@ -21,5 +21,5 @@ template<typename BasicJsonType> struct internal_iterator
/// generic iterator for all other types
/// generic iterator for all other types
primitive_iterator_t
primitive_iterator
{};
primitive_iterator_t
primitive_iterator
{};
};
};
}
}
// namespace detail
}
}
// namespace nlohmann
include/nlohmann/detail/iterators/iter_impl.hpp
View file @
adfa961e
...
@@ -610,5 +610,5 @@ class iter_impl
...
@@ -610,5 +610,5 @@ class iter_impl
/// the actual iterator of the associated instance
/// the actual iterator of the associated instance
internal_iterator
<
typename
std
::
remove_const
<
BasicJsonType
>::
type
>
m_it
;
internal_iterator
<
typename
std
::
remove_const
<
BasicJsonType
>::
type
>
m_it
;
};
};
}
}
// namespace detail
}
}
// namespace nlohmann
include/nlohmann/detail/iterators/iteration_proxy.hpp
View file @
adfa961e
...
@@ -39,9 +39,6 @@ template<typename IteratorType> class iteration_proxy
...
@@ -39,9 +39,6 @@ template<typename IteratorType> class iteration_proxy
public:
public:
explicit
iteration_proxy_internal
(
IteratorType
it
)
noexcept
:
anchor
(
it
)
{}
explicit
iteration_proxy_internal
(
IteratorType
it
)
noexcept
:
anchor
(
it
)
{}
iteration_proxy_internal
(
const
iteration_proxy_internal
&
)
=
default
;
iteration_proxy_internal
&
operator
=
(
const
iteration_proxy_internal
&
)
=
default
;
/// dereference operator (needed for range-based for)
/// dereference operator (needed for range-based for)
iteration_proxy_internal
&
operator
*
()
iteration_proxy_internal
&
operator
*
()
{
{
...
@@ -124,5 +121,5 @@ template<typename IteratorType> class iteration_proxy
...
@@ -124,5 +121,5 @@ template<typename IteratorType> class iteration_proxy
return
iteration_proxy_internal
(
container
.
end
());
return
iteration_proxy_internal
(
container
.
end
());
}
}
};
};
}
}
// namespace detail
}
}
// namespace nlohmann
include/nlohmann/detail/iterators/json_reverse_iterator.hpp
View file @
adfa961e
...
@@ -115,5 +115,5 @@ class json_reverse_iterator : public std::reverse_iterator<Base>
...
@@ -115,5 +115,5 @@ class json_reverse_iterator : public std::reverse_iterator<Base>
return
it
.
operator
*
();
return
it
.
operator
*
();
}
}
};
};
}
}
// namespace detail
}
}
// namespace nlohmann
include/nlohmann/detail/iterators/primitive_iterator.hpp
View file @
adfa961e
...
@@ -116,5 +116,5 @@ class primitive_iterator_t
...
@@ -116,5 +116,5 @@ class primitive_iterator_t
return
*
this
;
return
*
this
;
}
}
};
};
}
}
// namespace detail
}
}
// namespace nlohmann
include/nlohmann/detail/json_pointer.hpp
View file @
adfa961e
...
@@ -506,11 +506,11 @@ class json_pointer
...
@@ -506,11 +506,11 @@ class json_pointer
std
::
size_t
slash
=
reference_string
.
find_first_of
(
'/'
,
1
),
std
::
size_t
slash
=
reference_string
.
find_first_of
(
'/'
,
1
),
// set the beginning of the first reference token
// set the beginning of the first reference token
start
=
1
;
start
=
1
;
// we can stop if start ==
string::npos+1 = 0
// we can stop if start ==
0 (if slash == std::string::npos)
start
!=
0
;
start
!=
0
;
// set the beginning of the next reference token
// set the beginning of the next reference token
// (will eventually be 0 if slash == std::string::npos)
// (will eventually be 0 if slash == std::string::npos)
start
=
slash
+
1
,
start
=
(
slash
==
std
::
string
::
npos
)
?
0
:
slash
+
1
,
// find next slash
// find next slash
slash
=
reference_string
.
find_first_of
(
'/'
,
start
))
slash
=
reference_string
.
find_first_of
(
'/'
,
start
))
{
{
...
@@ -693,4 +693,4 @@ class json_pointer
...
@@ -693,4 +693,4 @@ class json_pointer
/// the reference tokens
/// the reference tokens
std
::
vector
<
std
::
string
>
reference_tokens
;
std
::
vector
<
std
::
string
>
reference_tokens
;
};
};
}
}
// namespace nlohmann
include/nlohmann/detail/json_ref.hpp
View file @
adfa961e
...
@@ -34,6 +34,8 @@ class json_ref
...
@@ -34,6 +34,8 @@ class json_ref
json_ref
(
json_ref
&&
)
=
default
;
json_ref
(
json_ref
&&
)
=
default
;
json_ref
(
const
json_ref
&
)
=
delete
;
json_ref
(
const
json_ref
&
)
=
delete
;
json_ref
&
operator
=
(
const
json_ref
&
)
=
delete
;
json_ref
&
operator
=
(
const
json_ref
&
)
=
delete
;
json_ref
&
operator
=
(
json_ref
&&
)
=
delete
;
~
json_ref
()
=
default
;
value_type
moved_or_copied
()
const
value_type
moved_or_copied
()
const
{
{
...
@@ -59,5 +61,5 @@ class json_ref
...
@@ -59,5 +61,5 @@ class json_ref
value_type
*
value_ref
=
nullptr
;
value_type
*
value_ref
=
nullptr
;
const
bool
is_rvalue
;
const
bool
is_rvalue
;
};
};
}
}
// namespace detail
}
}
// namespace nlohmann
include/nlohmann/detail/meta/cpp_future.hpp
View file @
adfa961e
...
@@ -59,5 +59,5 @@ struct static_const
...
@@ -59,5 +59,5 @@ struct static_const
template
<
typename
T
>
template
<
typename
T
>
constexpr
T
static_const
<
T
>::
value
;
constexpr
T
static_const
<
T
>::
value
;
}
}
// namespace detail
}
}
// namespace nlohmann
include/nlohmann/detail/meta/detected.hpp
View file @
adfa961e
...
@@ -52,5 +52,5 @@ using is_detected_exact = std::is_same<Expected, detected_t<Op, Args...>>;
...
@@ -52,5 +52,5 @@ using is_detected_exact = std::is_same<Expected, detected_t<Op, Args...>>;
template
<
class
To
,
template
<
class
...
>
class
Op
,
class
...
Args
>
template
<
class
To
,
template
<
class
...
>
class
Op
,
class
...
Args
>
using
is_detected_convertible
=
using
is_detected_convertible
=
std
::
is_convertible
<
detected_t
<
Op
,
Args
...
>
,
To
>
;
std
::
is_convertible
<
detected_t
<
Op
,
Args
...
>
,
To
>
;
}
}
// namespace detail
}
}
// namespace nlohmann
include/nlohmann/detail/meta/is_sax.hpp
View file @
adfa961e
...
@@ -137,5 +137,5 @@ public:
...
@@ -137,5 +137,5 @@ public:
"Missing/invalid function: bool parse_error(std::size_t, const "
"Missing/invalid function: bool parse_error(std::size_t, const "
"std::string&, const exception&)"
);
"std::string&, const exception&)"
);
};
};
}
}
// namespace detail
}
}
// namespace nlohmann
include/nlohmann/detail/meta/type_traits.hpp
View file @
adfa961e
...
@@ -247,5 +247,5 @@ struct is_compatible_type_impl <
...
@@ -247,5 +247,5 @@ struct is_compatible_type_impl <
template
<
typename
BasicJsonType
,
typename
CompatibleType
>
template
<
typename
BasicJsonType
,
typename
CompatibleType
>
struct
is_compatible_type
struct
is_compatible_type
:
is_compatible_type_impl
<
BasicJsonType
,
CompatibleType
>
{};
:
is_compatible_type_impl
<
BasicJsonType
,
CompatibleType
>
{};
}
}
// namespace detail
}
}
// namespace nlohmann
include/nlohmann/detail/meta/void_t.hpp
View file @
adfa961e
...
@@ -9,5 +9,5 @@ template <typename ...Ts> struct make_void
...
@@ -9,5 +9,5 @@ template <typename ...Ts> struct make_void
using
type
=
void
;
using
type
=
void
;
};
};
template
<
typename
...
Ts
>
using
void_t
=
typename
make_void
<
Ts
...
>::
type
;
template
<
typename
...
Ts
>
using
void_t
=
typename
make_void
<
Ts
...
>::
type
;
}
}
// namespace detail
}
}
// namespace nlohmann
include/nlohmann/detail/output/binary_writer.hpp
View file @
adfa961e
...
@@ -540,9 +540,11 @@ class binary_writer
...
@@ -540,9 +540,11 @@ class binary_writer
case
value_t
:
:
boolean
:
case
value_t
:
:
boolean
:
{
{
if
(
add_prefix
)
if
(
add_prefix
)
{
oa
->
write_character
(
j
.
m_value
.
boolean
oa
->
write_character
(
j
.
m_value
.
boolean
?
static_cast
<
CharType
>
(
'T'
)
?
static_cast
<
CharType
>
(
'T'
)
:
static_cast
<
CharType
>
(
'F'
));
:
static_cast
<
CharType
>
(
'F'
));
}
break
;
break
;
}
}
...
@@ -849,22 +851,20 @@ class binary_writer
...
@@ -849,22 +851,20 @@ class binary_writer
{
{
return
'i'
;
return
'i'
;
}
}
else
if
((
std
::
numeric_limits
<
uint8_t
>::
min
)()
<=
j
.
m_value
.
number_integer
and
j
.
m_value
.
number_integer
<=
(
std
::
numeric_limits
<
uint8_t
>::
max
)())
if
((
std
::
numeric_limits
<
uint8_t
>::
min
)()
<=
j
.
m_value
.
number_integer
and
j
.
m_value
.
number_integer
<=
(
std
::
numeric_limits
<
uint8_t
>::
max
)())
{
{
return
'U'
;
return
'U'
;
}
}
else
if
((
std
::
numeric_limits
<
int16_t
>::
min
)()
<=
j
.
m_value
.
number_integer
and
j
.
m_value
.
number_integer
<=
(
std
::
numeric_limits
<
int16_t
>::
max
)())
if
((
std
::
numeric_limits
<
int16_t
>::
min
)()
<=
j
.
m_value
.
number_integer
and
j
.
m_value
.
number_integer
<=
(
std
::
numeric_limits
<
int16_t
>::
max
)())
{
{
return
'I'
;
return
'I'
;
}
}
else
if
((
std
::
numeric_limits
<
int32_t
>::
min
)()
<=
j
.
m_value
.
number_integer
and
j
.
m_value
.
number_integer
<=
(
std
::
numeric_limits
<
int32_t
>::
max
)())
if
((
std
::
numeric_limits
<
int32_t
>::
min
)()
<=
j
.
m_value
.
number_integer
and
j
.
m_value
.
number_integer
<=
(
std
::
numeric_limits
<
int32_t
>::
max
)())
{
{
return
'l'
;
return
'l'
;
}
}
else
// no check and assume int64_t (see note above)
// no check and assume int64_t (see note above)
{
return
'L'
;
return
'L'
;
}
}
}
case
value_t
:
:
number_unsigned
:
case
value_t
:
:
number_unsigned
:
...
@@ -873,22 +873,20 @@ class binary_writer
...
@@ -873,22 +873,20 @@ class binary_writer
{
{
return
'i'
;
return
'i'
;
}
}
else
if
(
j
.
m_value
.
number_unsigned
<=
(
std
::
numeric_limits
<
uint8_t
>::
max
)())
if
(
j
.
m_value
.
number_unsigned
<=
(
std
::
numeric_limits
<
uint8_t
>::
max
)())
{
{
return
'U'
;
return
'U'
;
}
}
else
if
(
j
.
m_value
.
number_unsigned
<=
(
std
::
numeric_limits
<
int16_t
>::
max
)())
if
(
j
.
m_value
.
number_unsigned
<=
(
std
::
numeric_limits
<
int16_t
>::
max
)())
{
{
return
'I'
;
return
'I'
;
}
}
else
if
(
j
.
m_value
.
number_unsigned
<=
(
std
::
numeric_limits
<
int32_t
>::
max
)())
if
(
j
.
m_value
.
number_unsigned
<=
(
std
::
numeric_limits
<
int32_t
>::
max
)())
{
{
return
'l'
;
return
'l'
;
}
}
else
// no check and assume int64_t (see note above)
// no check and assume int64_t (see note above)
{
return
'L'
;
return
'L'
;
}
}
}
case
value_t
:
:
number_float
:
case
value_t
:
:
number_float
:
...
@@ -908,32 +906,32 @@ class binary_writer
...
@@ -908,32 +906,32 @@ class binary_writer
}
}
}
}
static
constexpr
CharType
get_cbor_float_prefix
(
float
)
static
constexpr
CharType
get_cbor_float_prefix
(
float
/*unused*/
)
{
{
return
static_cast
<
CharType
>
(
0xFA
);
// Single-Precision Float
return
static_cast
<
CharType
>
(
0xFA
);
// Single-Precision Float
}
}
static
constexpr
CharType
get_cbor_float_prefix
(
double
)
static
constexpr
CharType
get_cbor_float_prefix
(
double
/*unused*/
)
{
{
return
static_cast
<
CharType
>
(
0xFB
);
// Double-Precision Float
return
static_cast
<
CharType
>
(
0xFB
);
// Double-Precision Float
}
}
static
constexpr
CharType
get_msgpack_float_prefix
(
float
)
static
constexpr
CharType
get_msgpack_float_prefix
(
float
/*unused*/
)
{
{
return
static_cast
<
CharType
>
(
0xCA
);
// float 32
return
static_cast
<
CharType
>
(
0xCA
);
// float 32
}
}
static
constexpr
CharType
get_msgpack_float_prefix
(
double
)
static
constexpr
CharType
get_msgpack_float_prefix
(
double
/*unused*/
)
{
{
return
static_cast
<
CharType
>
(
0xCB
);
// float 64
return
static_cast
<
CharType
>
(
0xCB
);
// float 64
}
}
static
constexpr
CharType
get_ubjson_float_prefix
(
float
)
static
constexpr
CharType
get_ubjson_float_prefix
(
float
/*unused*/
)
{
{
return
'd'
;
// float 32
return
'd'
;
// float 32
}
}
static
constexpr
CharType
get_ubjson_float_prefix
(
double
)
static
constexpr
CharType
get_ubjson_float_prefix
(
double
/*unused*/
)
{
{
return
'D'
;
// float 64
return
'D'
;
// float 64
}
}
...
@@ -945,5 +943,5 @@ class binary_writer
...
@@ -945,5 +943,5 @@ class binary_writer
/// the output
/// the output
output_adapter_t
<
CharType
>
oa
=
nullptr
;
output_adapter_t
<
CharType
>
oa
=
nullptr
;
};
};
}
}
// namespace detail
}
}
// namespace nlohmann
include/nlohmann/detail/output/output_adapters.hpp
View file @
adfa961e
...
@@ -109,5 +109,5 @@ class output_adapter
...
@@ -109,5 +109,5 @@ class output_adapter
private:
private:
output_adapter_t
<
CharType
>
oa
=
nullptr
;
output_adapter_t
<
CharType
>
oa
=
nullptr
;
};
};
}
}
// namespace detail
}
}
// namespace nlohmann
include/nlohmann/detail/output/serializer.hpp
View file @
adfa961e
...
@@ -53,6 +53,9 @@ class serializer
...
@@ -53,6 +53,9 @@ class serializer
// delete because of pointer members
// delete because of pointer members
serializer
(
const
serializer
&
)
=
delete
;
serializer
(
const
serializer
&
)
=
delete
;
serializer
&
operator
=
(
const
serializer
&
)
=
delete
;
serializer
&
operator
=
(
const
serializer
&
)
=
delete
;
serializer
(
serializer
&&
)
=
delete
;
serializer
&
operator
=
(
serializer
&&
)
=
delete
;
~
serializer
()
=
default
;
/*!
/*!
@brief internal implementation of the serialization function
@brief internal implementation of the serialization function
...
@@ -442,7 +445,7 @@ class serializer
...
@@ -442,7 +445,7 @@ class serializer
return
;
return
;
}
}
const
bool
is_negative
=
not
(
x
>=
0
);
// see issue #755
const
bool
is_negative
=
std
::
is_same
<
NumberType
,
number_integer_t
>::
value
and
not
(
x
>=
0
);
// see issue #755
std
::
size_t
i
=
0
;
std
::
size_t
i
=
0
;
while
(
x
!=
0
)
while
(
x
!=
0
)
...
@@ -627,5 +630,5 @@ class serializer
...
@@ -627,5 +630,5 @@ class serializer
/// the indentation string
/// the indentation string
string_t
indent_string
;
string_t
indent_string
;
};
};
}
}
// namespace detail
}
}
// namespace nlohmann
include/nlohmann/detail/value_t.hpp
View file @
adfa961e
...
@@ -72,5 +72,5 @@ inline bool operator<(const value_t lhs, const value_t rhs) noexcept
...
@@ -72,5 +72,5 @@ inline bool operator<(const value_t lhs, const value_t rhs) noexcept
const
auto
r_index
=
static_cast
<
std
::
size_t
>
(
rhs
);
const
auto
r_index
=
static_cast
<
std
::
size_t
>
(
rhs
);
return
l_index
<
order
.
size
()
and
r_index
<
order
.
size
()
and
order
[
l_index
]
<
order
[
r_index
];
return
l_index
<
order
.
size
()
and
r_index
<
order
.
size
()
and
order
[
l_index
]
<
order
[
r_index
];
}
}
}
}
// namespace detail
}
}
// namespace nlohmann
include/nlohmann/json.hpp
View file @
adfa961e
...
@@ -1866,7 +1866,7 @@ class basic_json
...
@@ -1866,7 +1866,7 @@ class basic_json
@since version 1.0.0
@since version 1.0.0
*/
*/
reference
&
operator
=
(
basic_json
other
)
noexcept
(
basic_json
&
operator
=
(
basic_json
other
)
noexcept
(
std
::
is_nothrow_move_constructible
<
value_t
>::
value
and
std
::
is_nothrow_move_constructible
<
value_t
>::
value
and
std
::
is_nothrow_move_assignable
<
value_t
>::
value
and
std
::
is_nothrow_move_assignable
<
value_t
>::
value
and
std
::
is_nothrow_move_constructible
<
json_value
>::
value
and
std
::
is_nothrow_move_constructible
<
json_value
>::
value
and
...
@@ -7289,11 +7289,9 @@ class basic_json
...
@@ -7289,11 +7289,9 @@ class basic_json
// avoid undefined behavior
// avoid undefined behavior
JSON_THROW
(
out_of_range
::
create
(
401
,
"array index "
+
std
::
to_string
(
idx
)
+
" is out of range"
));
JSON_THROW
(
out_of_range
::
create
(
401
,
"array index "
+
std
::
to_string
(
idx
)
+
" is out of range"
));
}
}
else
{
// default case: insert add offset
// default case: insert add offset
parent
.
insert
(
parent
.
begin
()
+
static_cast
<
difference_type
>
(
idx
),
val
);
parent
.
insert
(
parent
.
begin
()
+
static_cast
<
difference_type
>
(
idx
),
val
);
}
}
}
break
;
break
;
}
}
...
...
include/nlohmann/json_fwd.hpp
View file @
adfa961e
...
@@ -59,6 +59,6 @@ uses the standard template types.
...
@@ -59,6 +59,6 @@ uses the standard template types.
@since version 1.0.0
@since version 1.0.0
*/
*/
using
json
=
basic_json
<>
;
using
json
=
basic_json
<>
;
}
}
// namespace nlohmann
#endif
#endif
single_include/nlohmann/json.hpp
View file @
adfa961e
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