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
00f9296d
Commit
00f9296d
authored
Dec 22, 2015
by
Niels
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some cleanup for #83
parent
67c2d90a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
4 deletions
+26
-4
json.hpp
src/json.hpp
+2
-2
json.hpp.re2c
src/json.hpp.re2c
+2
-2
unit.cpp
test/unit.cpp
+22
-0
No files found.
src/json.hpp
View file @
00f9296d
...
...
@@ -6163,7 +6163,7 @@ class basic_json
{
private
:
/// the container to iterate
basic_json
&
container
;
typename
basic_json
::
reference
container
;
/// the type of the iterator to use while iteration
using
json_iterator
=
decltype
(
std
::
begin
(
container
));
...
...
@@ -6236,7 +6236,7 @@ class basic_json
public
:
/// construct iterator wrapper from a container
iterator_wrapper
(
basic_json
&
cont
)
iterator_wrapper
(
typename
basic_json
::
reference
cont
)
:
container
(
cont
)
{}
...
...
src/json.hpp.re2c
View file @
00f9296d
...
...
@@ -6163,7 +6163,7 @@ class basic_json
{
private:
/// the container to iterate
basic_json&
container;
typename basic_json::reference
container;
/// the type of the iterator to use while iteration
using json_iterator = decltype(std::begin(container));
...
...
@@ -6236,7 +6236,7 @@ class basic_json
public:
/// construct iterator wrapper from a container
iterator_wrapper(
basic_json&
cont)
iterator_wrapper(
typename basic_json::reference
cont)
: container(cont)
{}
...
...
test/unit.cpp
View file @
00f9296d
...
...
@@ -9555,6 +9555,10 @@ TEST_CASE("iterator_wrapper")
{
CHECK
(
i
.
key
()
==
"A"
);
CHECK
(
i
.
value
()
==
json
(
1
));
// change the value
i
.
value
()
=
json
(
11
);
CHECK
(
i
.
value
()
==
json
(
11
));
break
;
}
...
...
@@ -9562,6 +9566,10 @@ TEST_CASE("iterator_wrapper")
{
CHECK
(
i
.
key
()
==
"B"
);
CHECK
(
i
.
value
()
==
json
(
2
));
// change the value
i
.
value
()
=
json
(
22
);
CHECK
(
i
.
value
()
==
json
(
22
));
break
;
}
...
...
@@ -9573,6 +9581,9 @@ TEST_CASE("iterator_wrapper")
}
CHECK
(
counter
==
3
);
// check if values where changed
CHECK
(
j
==
json
({{
"A"
,
11
},
{
"B"
,
22
}}));
}
SECTION
(
"const value"
)
...
...
@@ -9690,6 +9701,10 @@ TEST_CASE("iterator_wrapper")
{
CHECK
(
i
.
key
()
==
"0"
);
CHECK
(
i
.
value
()
==
"A"
);
// change the value
i
.
value
()
=
"AA"
;
CHECK
(
i
.
value
()
==
"AA"
);
break
;
}
...
...
@@ -9697,6 +9712,10 @@ TEST_CASE("iterator_wrapper")
{
CHECK
(
i
.
key
()
==
"1"
);
CHECK
(
i
.
value
()
==
"B"
);
// change the value
i
.
value
()
=
"BB"
;
CHECK
(
i
.
value
()
==
"BB"
);
break
;
}
...
...
@@ -9708,6 +9727,9 @@ TEST_CASE("iterator_wrapper")
}
CHECK
(
counter
==
3
);
// check if values where changed
CHECK
(
j
==
json
({
"AA"
,
"BB"
}));
}
SECTION
(
"const 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