Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
json
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
json
Commits
5ff4d7b7
Unverified
Commit
5ff4d7b7
authored
May 28, 2020
by
Niels Lohmann
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' of
https://github.com/nlohmann/json
into develop
parents
fcda998e
9ec0e4c2
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
5 deletions
+29
-5
README.md
README.md
+1
-1
input_adapters.hpp
include/nlohmann/detail/input/input_adapters.hpp
+3
-2
json.hpp
single_include/nlohmann/json.hpp
+3
-2
unit-regression.cpp
test/src/unit-regression.cpp
+22
-0
No files found.
README.md
View file @
5ff4d7b7
...
@@ -148,7 +148,7 @@ Example:
...
@@ -148,7 +148,7 @@ Example:
include
(
FetchContent
)
include
(
FetchContent
)
FetchContent_Declare
(
json
FetchContent_Declare
(
json
GIT_REPOSITORY https://github.com/nlohmann/json
GIT_REPOSITORY https://github.com/nlohmann/json
.git
GIT_TAG v3.7.3
)
GIT_TAG v3.7.3
)
FetchContent_GetProperties
(
json
)
FetchContent_GetProperties
(
json
)
...
...
include/nlohmann/detail/input/input_adapters.hpp
View file @
5ff4d7b7
...
@@ -331,13 +331,14 @@ inline input_stream_adapter input_adapter(std::istream&& stream)
...
@@ -331,13 +331,14 @@ inline input_stream_adapter input_adapter(std::istream&& stream)
return
input_stream_adapter
(
stream
);
return
input_stream_adapter
(
stream
);
}
}
template
<
typename
CharT
,
template
<
typename
CharT
,
typename
SizeT
,
typename
std
::
enable_if
<
typename
std
::
enable_if
<
std
::
is_pointer
<
CharT
>::
value
and
std
::
is_pointer
<
CharT
>::
value
and
std
::
is_integral
<
typename
std
::
remove_pointer
<
CharT
>::
type
>::
value
and
std
::
is_integral
<
typename
std
::
remove_pointer
<
CharT
>::
type
>::
value
and
not
std
::
is_same
<
SizeT
,
bool
>::
value
and
sizeof
(
typename
std
::
remove_pointer
<
CharT
>::
type
)
==
1
,
sizeof
(
typename
std
::
remove_pointer
<
CharT
>::
type
)
==
1
,
int
>::
type
=
0
>
int
>::
type
=
0
>
input_buffer_adapter
input_adapter
(
CharT
b
,
std
::
size_t
l
)
input_buffer_adapter
input_adapter
(
CharT
b
,
SizeT
l
)
{
{
return
input_buffer_adapter
(
reinterpret_cast
<
const
char
*>
(
b
),
l
);
return
input_buffer_adapter
(
reinterpret_cast
<
const
char
*>
(
b
),
l
);
}
}
...
...
single_include/nlohmann/json.hpp
View file @
5ff4d7b7
...
@@ -4753,13 +4753,14 @@ inline input_stream_adapter input_adapter(std::istream&& stream)
...
@@ -4753,13 +4753,14 @@ inline input_stream_adapter input_adapter(std::istream&& stream)
return
input_stream_adapter
(
stream
);
return
input_stream_adapter
(
stream
);
}
}
template
<
typename
CharT
,
template
<
typename
CharT
,
typename
SizeT
,
typename
std
::
enable_if
<
typename
std
::
enable_if
<
std
::
is_pointer
<
CharT
>::
value
and
std
::
is_pointer
<
CharT
>::
value
and
std
::
is_integral
<
typename
std
::
remove_pointer
<
CharT
>::
type
>::
value
and
std
::
is_integral
<
typename
std
::
remove_pointer
<
CharT
>::
type
>::
value
and
not
std
::
is_same
<
SizeT
,
bool
>::
value
and
sizeof
(
typename
std
::
remove_pointer
<
CharT
>::
type
)
==
1
,
sizeof
(
typename
std
::
remove_pointer
<
CharT
>::
type
)
==
1
,
int
>::
type
=
0
>
int
>::
type
=
0
>
input_buffer_adapter
input_adapter
(
CharT
b
,
std
::
size_t
l
)
input_buffer_adapter
input_adapter
(
CharT
b
,
SizeT
l
)
{
{
return
input_buffer_adapter
(
reinterpret_cast
<
const
char
*>
(
b
),
l
);
return
input_buffer_adapter
(
reinterpret_cast
<
const
char
*>
(
b
),
l
);
}
}
...
...
test/src/unit-regression.cpp
View file @
5ff4d7b7
...
@@ -1890,6 +1890,28 @@ TEST_CASE("regression tests")
...
@@ -1890,6 +1890,28 @@ TEST_CASE("regression tests")
json
j
=
val
;
json
j
=
val
;
}
}
SECTION
(
"issue #1715 - json::from_cbor does not respect allow_exceptions = false when input is string literal"
)
{
SECTION
(
"string literal"
)
{
json
cbor
=
json
::
from_cbor
(
"B"
,
true
,
false
);
CHECK
(
cbor
.
is_discarded
());
}
SECTION
(
"string array"
)
{
const
char
input
[]
=
{
'B'
,
0x00
};
json
cbor
=
json
::
from_cbor
(
input
,
true
,
false
);
CHECK
(
cbor
.
is_discarded
());
}
SECTION
(
"std::string"
)
{
json
cbor
=
json
::
from_cbor
(
std
::
string
(
"B"
),
true
,
false
);
CHECK
(
cbor
.
is_discarded
());
}
}
SECTION
(
"issue #1805 - A pair<T1, T2> is json constructible only if T1 and T2 are json constructible"
)
SECTION
(
"issue #1805 - A pair<T1, T2> is json constructible only if T1 and T2 are json constructible"
)
{
{
static_assert
(
!
std
::
is_constructible
<
json
,
std
::
pair
<
std
::
string
,
NotSerializableData
>>::
value
,
""
);
static_assert
(
!
std
::
is_constructible
<
json
,
std
::
pair
<
std
::
string
,
NotSerializableData
>>::
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