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
2c1b3e51
Commit
2c1b3e51
authored
Dec 29, 2014
by
Niels
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
+ small cleanup
parent
3985226f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
50 deletions
+30
-50
JSON.cc
src/JSON.cc
+30
-50
No files found.
src/JSON.cc
View file @
2c1b3e51
...
@@ -155,9 +155,9 @@ JSON::JSON(list_init_t a) noexcept
...
@@ -155,9 +155,9 @@ JSON::JSON(list_init_t a) noexcept
// is a string
// is a string
for
(
const
auto
&
element
:
a
)
for
(
const
auto
&
element
:
a
)
{
{
if
(
element
.
type
()
!=
value_type
::
array
or
if
(
element
.
_type
!=
value_type
::
array
or
element
.
size
()
!=
2
or
element
.
size
()
!=
2
or
element
[
0
].
type
()
!=
value_type
::
string
)
element
[
0
].
_type
!=
value_type
::
string
)
{
{
// the initializer list describes an array
// the initializer list describes an array
...
@@ -173,7 +173,8 @@ JSON::JSON(list_init_t a) noexcept
...
@@ -173,7 +173,8 @@ JSON::JSON(list_init_t a) noexcept
for
(
const
JSON
&
element
:
a
)
for
(
const
JSON
&
element
:
a
)
{
{
const
std
::
string
k
=
element
[
0
];
const
std
::
string
k
=
element
[
0
];
_value
.
object
->
emplace
(
std
::
make_pair
(
std
::
move
(
k
),
std
::
move
(
element
[
1
])));
_value
.
object
->
emplace
(
std
::
make_pair
(
std
::
move
(
k
),
std
::
move
(
element
[
1
])));
}
}
}
}
...
@@ -746,9 +747,9 @@ void JSON::push_back(list_init_t a)
...
@@ -746,9 +747,9 @@ void JSON::push_back(list_init_t a)
// is a string
// is a string
for
(
const
auto
&
element
:
a
)
for
(
const
auto
&
element
:
a
)
{
{
if
(
element
.
type
()
!=
value_type
::
array
or
if
(
element
.
_type
!=
value_type
::
array
or
element
.
size
()
!=
2
or
element
.
size
()
!=
2
or
element
[
0
].
type
()
!=
value_type
::
string
)
element
[
0
].
_type
!=
value_type
::
string
)
{
{
// the initializer list describes an array
// the initializer list describes an array
is_array
=
true
;
is_array
=
true
;
...
@@ -1345,23 +1346,16 @@ JSON::const_iterator JSON::cend() const noexcept
...
@@ -1345,23 +1346,16 @@ JSON::const_iterator JSON::cend() const noexcept
JSON
::
iterator
::
iterator
(
JSON
*
j
)
:
_object
(
j
)
JSON
::
iterator
::
iterator
(
JSON
*
j
)
:
_object
(
j
)
{
{
if
(
_object
!=
nullptr
)
if
(
_object
!=
nullptr
)
switch
(
_object
->
_type
)
{
if
(
_object
->
_type
==
value_type
::
array
)
{
{
case
(
value_type
:
:
array
)
:
_vi
=
new
array_t
::
iterator
(
_object
->
_value
.
array
->
begin
());
{
}
_vi
=
new
array_t
::
iterator
(
_object
->
_value
.
array
->
begin
());
if
(
_object
->
_type
==
value_type
::
object
)
break
;
{
}
_oi
=
new
object_t
::
iterator
(
_object
->
_value
.
object
->
begin
());
case
(
value_type
:
:
object
)
:
{
_oi
=
new
object_t
::
iterator
(
_object
->
_value
.
object
->
begin
());
break
;
}
default
:
{
break
;
}
}
}
}
}
}
JSON
::
iterator
::
iterator
(
const
JSON
::
iterator
&
o
)
:
_object
(
o
.
_object
)
JSON
::
iterator
::
iterator
(
const
JSON
::
iterator
&
o
)
:
_object
(
o
.
_object
)
...
@@ -1545,23 +1539,16 @@ JSON& JSON::iterator::value() const
...
@@ -1545,23 +1539,16 @@ JSON& JSON::iterator::value() const
JSON
::
const_iterator
::
const_iterator
(
const
JSON
*
j
)
:
_object
(
j
)
JSON
::
const_iterator
::
const_iterator
(
const
JSON
*
j
)
:
_object
(
j
)
{
{
if
(
_object
!=
nullptr
)
if
(
_object
!=
nullptr
)
switch
(
_object
->
_type
)
{
if
(
_object
->
_type
==
value_type
::
array
)
{
{
case
(
value_type
:
:
array
)
:
_vi
=
new
array_t
::
const_iterator
(
_object
->
_value
.
array
->
begin
());
{
}
_vi
=
new
array_t
::
const_iterator
(
_object
->
_value
.
array
->
begin
());
if
(
_object
->
_type
==
value_type
::
object
)
break
;
{
}
_oi
=
new
object_t
::
const_iterator
(
_object
->
_value
.
object
->
begin
());
case
(
value_type
:
:
object
)
:
{
_oi
=
new
object_t
::
const_iterator
(
_object
->
_value
.
object
->
begin
());
break
;
}
default
:
{
break
;
}
}
}
}
}
}
JSON
::
const_iterator
::
const_iterator
(
const
JSON
::
const_iterator
&
o
)
:
_object
(
o
.
_object
)
JSON
::
const_iterator
::
const_iterator
(
const
JSON
::
const_iterator
&
o
)
:
_object
(
o
.
_object
)
...
@@ -1582,23 +1569,16 @@ JSON::const_iterator::const_iterator(const JSON::const_iterator& o) : _object(o.
...
@@ -1582,23 +1569,16 @@ JSON::const_iterator::const_iterator(const JSON::const_iterator& o) : _object(o.
JSON
::
const_iterator
::
const_iterator
(
const
JSON
::
iterator
&
o
)
:
_object
(
o
.
_object
)
JSON
::
const_iterator
::
const_iterator
(
const
JSON
::
iterator
&
o
)
:
_object
(
o
.
_object
)
{
{
if
(
_object
!=
nullptr
)
if
(
_object
!=
nullptr
)
switch
(
_object
->
_type
)
{
if
(
_object
->
_type
==
value_type
::
array
)
{
{
case
(
value_type
:
:
array
)
:
_vi
=
new
array_t
::
const_iterator
(
*
(
o
.
_vi
));
{
_vi
=
new
array_t
::
const_iterator
(
*
(
o
.
_vi
));
break
;
}
case
(
value_type
:
:
object
)
:
{
_oi
=
new
object_t
::
const_iterator
(
*
(
o
.
_oi
));
break
;
}
default
:
{
break
;
}
}
}
if
(
_object
->
_type
==
value_type
::
object
)
{
_oi
=
new
object_t
::
const_iterator
(
*
(
o
.
_oi
));
}
}
}
}
JSON
::
const_iterator
::~
const_iterator
()
JSON
::
const_iterator
::~
const_iterator
()
...
...
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