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
86991d52
Unverified
Commit
86991d52
authored
Mar 05, 2018
by
Niels Lohmann
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into feature/sax2
parents
3ff94553
fdecbf6e
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
5 deletions
+18
-5
.gitignore
.gitignore
+1
-0
Makefile
Makefile
+6
-0
json.hpp
include/nlohmann/json.hpp
+1
-1
json.hpp
single_include/nlohmann/json.hpp
+1
-1
unit-readme.cpp
test/src/unit-readme.cpp
+9
-3
No files found.
.gitignore
View file @
86991d52
...
@@ -10,6 +10,7 @@ fuzz-testing
...
@@ -10,6 +10,7 @@ fuzz-testing
build
build
build_coverage
build_coverage
clang_analyze_build
doc/xml
doc/xml
doc/html
doc/html
...
...
Makefile
View file @
86991d52
...
@@ -259,6 +259,12 @@ fuzzing-stop:
...
@@ -259,6 +259,12 @@ fuzzing-stop:
cppcheck
:
cppcheck
:
cppcheck
--enable
=
warning
--inconclusive
--force
--std
=
c++11
$(AMALGAMATED_FILE)
--error-exitcode
=
1
cppcheck
--enable
=
warning
--inconclusive
--force
--std
=
c++11
$(AMALGAMATED_FILE)
--error-exitcode
=
1
# compile and check with Clang Static Analyzer
clang_analyze
:
rm
-fr
clang_analyze_build
mkdir
clang_analyze_build
cd
clang_analyze_build
;
CCC_CXX
=
/Users/niels/Documents/projects/llvm-clang/local/bin/clang++ /Users/niels/Documents/projects/llvm-clang/local/bin/scan-build cmake ..
/Users/niels/Documents/projects/llvm-clang/local/bin/scan-build
-enable-checker
alpha.core.DynamicTypeChecker,alpha.core.PointerArithm,alpha.core.PointerSub,alpha.cplusplus.DeleteWithNonVirtualDtor,alpha.cplusplus.IteratorRange,alpha.cplusplus.MisusedMovedObject,alpha.security.ArrayBoundV2,alpha.core.Conversion
--use-c
++
=
/Users/niels/Documents/projects/llvm-clang/local/bin/clang++
--view
-analyze-headers
-o
clang_analyze_build/report.html make
-j10
-C
clang_analyze_build
##########################################################################
##########################################################################
# maintainer targets
# maintainer targets
...
...
include/nlohmann/json.hpp
View file @
86991d52
...
@@ -5180,7 +5180,7 @@ class basic_json
...
@@ -5180,7 +5180,7 @@ class basic_json
// passed iterators must belong to objects
// passed iterators must belong to objects
if
(
JSON_UNLIKELY
(
not
first
.
m_object
->
is_object
()
if
(
JSON_UNLIKELY
(
not
first
.
m_object
->
is_object
()
or
not
fir
st
.
m_object
->
is_object
()))
or
not
la
st
.
m_object
->
is_object
()))
{
{
JSON_THROW
(
invalid_iterator
::
create
(
202
,
"iterators first and last must point to objects"
));
JSON_THROW
(
invalid_iterator
::
create
(
202
,
"iterators first and last must point to objects"
));
}
}
...
...
single_include/nlohmann/json.hpp
View file @
86991d52
...
@@ -15091,7 +15091,7 @@ class basic_json
...
@@ -15091,7 +15091,7 @@ class basic_json
// passed iterators must belong to objects
// passed iterators must belong to objects
if
(
JSON_UNLIKELY
(
not
first
.
m_object
->
is_object
()
if
(
JSON_UNLIKELY
(
not
first
.
m_object
->
is_object
()
or
not
fir
st
.
m_object
->
is_object
()))
or
not
la
st
.
m_object
->
is_object
()))
{
{
JSON_THROW
(
invalid_iterator
::
create
(
202
,
"iterators first and last must point to objects"
));
JSON_THROW
(
invalid_iterator
::
create
(
202
,
"iterators first and last must point to objects"
));
}
}
...
...
test/src/unit-readme.cpp
View file @
86991d52
...
@@ -152,6 +152,10 @@ TEST_CASE("README", "[hide]")
...
@@ -152,6 +152,10 @@ TEST_CASE("README", "[hide]")
j
.
push_back
(
1
);
j
.
push_back
(
1
);
j
.
push_back
(
true
);
j
.
push_back
(
true
);
// comparison
bool
x
=
(
j
==
"[
\"
foo
\"
, 1, true]"
_json
);
// true
CHECK
(
x
==
true
);
// iterate the array
// iterate the array
for
(
json
::
iterator
it
=
j
.
begin
();
it
!=
j
.
end
();
++
it
)
for
(
json
::
iterator
it
=
j
.
begin
();
it
!=
j
.
end
();
++
it
)
{
{
...
@@ -168,6 +172,7 @@ TEST_CASE("README", "[hide]")
...
@@ -168,6 +172,7 @@ TEST_CASE("README", "[hide]")
const
std
::
string
tmp
=
j
[
0
];
const
std
::
string
tmp
=
j
[
0
];
j
[
1
]
=
42
;
j
[
1
]
=
42
;
bool
foo
=
j
.
at
(
2
);
bool
foo
=
j
.
at
(
2
);
CHECK
(
foo
==
true
);
// other stuff
// other stuff
j
.
size
();
// 3 entries
j
.
size
();
// 3 entries
...
@@ -175,9 +180,6 @@ TEST_CASE("README", "[hide]")
...
@@ -175,9 +180,6 @@ TEST_CASE("README", "[hide]")
j
.
type
();
// json::value_t::array
j
.
type
();
// json::value_t::array
j
.
clear
();
// the array is empty again
j
.
clear
();
// the array is empty again
// comparison
bool
x
=
(
j
==
"[
\"
foo
\"
, 1, true]"
_json
);
// true
// create an object
// create an object
json
o
;
json
o
;
o
[
"foo"
]
=
23
;
o
[
"foo"
]
=
23
;
...
@@ -257,17 +259,21 @@ TEST_CASE("README", "[hide]")
...
@@ -257,17 +259,21 @@ TEST_CASE("README", "[hide]")
bool
b1
=
true
;
bool
b1
=
true
;
json
jb
=
b1
;
json
jb
=
b1
;
bool
b2
=
jb
;
bool
b2
=
jb
;
CHECK
(
b2
==
true
);
// numbers
// numbers
int
i
=
42
;
int
i
=
42
;
json
jn
=
i
;
json
jn
=
i
;
double
f
=
jn
;
double
f
=
jn
;
CHECK
(
f
==
42
);
// etc.
// etc.
std
::
string
vs
=
js
.
get
<
std
::
string
>
();
std
::
string
vs
=
js
.
get
<
std
::
string
>
();
bool
vb
=
jb
.
get
<
bool
>
();
bool
vb
=
jb
.
get
<
bool
>
();
CHECK
(
vb
==
true
);
int
vi
=
jn
.
get
<
int
>
();
int
vi
=
jn
.
get
<
int
>
();
CHECK
(
vi
==
42
);
// etc.
// etc.
}
}
...
...
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