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
48392cfa
Commit
48392cfa
authored
Feb 09, 2015
by
Niels
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some bug fixing
parent
fe64ed5f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
482 additions
and
809 deletions
+482
-809
src/json.hpp
src/json.hpp
+384
-720
src/json.hpp.re2c
src/json.hpp.re2c
+78
-69
test/unit.cpp
test/unit.cpp
+20
-20
No files found.
src/json.hpp
View file @
48392cfa
...
@@ -1604,11 +1604,65 @@ class basic_json
...
@@ -1604,11 +1604,65 @@ class basic_json
json_value
m_value
=
{};
json_value
m_value
=
{};
p
ublic
:
p
rivate
:
///////////////
///////////////
// iterators //
// iterators //
///////////////
///////////////
/// values of a generic iterator type of non-container JSON values
enum
class
generic_iterator_value
{
/// the iterator was not initialized
uninitialized
,
/// the iterator points to the only value
begin
,
/// the iterator points past the only value
end
,
/// the iterator points to an invalid value
invalid
};
/// an iterator value
union
internal_iterator
{
/// iterator for JSON objects
typename
object_t
::
iterator
object_iterator
;
/// iterator for JSON arrays
typename
array_t
::
iterator
array_iterator
;
/// generic iteraotr for all other value types
generic_iterator_value
generic_iterator
;
/// default constructor
internal_iterator
()
:
generic_iterator
(
generic_iterator_value
::
uninitialized
)
{}
/// constructor for object iterators
internal_iterator
(
typename
object_t
::
iterator
v
)
:
object_iterator
(
v
)
{}
/// constructor for array iterators
internal_iterator
(
typename
array_t
::
iterator
v
)
:
array_iterator
(
v
)
{}
/// constructor for generic iterators
internal_iterator
(
generic_iterator_value
v
)
:
generic_iterator
(
v
)
{}
};
/// a const iterator value
union
internal_const_iterator
{
/// iterator for JSON objects
typename
object_t
::
const_iterator
object_iterator
;
/// iterator for JSON arrays
typename
array_t
::
const_iterator
array_iterator
;
/// generic iteraotr for all other value types
generic_iterator_value
generic_iterator
;
/// default constructor
internal_const_iterator
()
:
generic_iterator
(
generic_iterator_value
::
uninitialized
)
{}
/// constructor for object iterators
internal_const_iterator
(
typename
object_t
::
iterator
v
)
:
object_iterator
(
v
)
{}
/// constructor for array iterators
internal_const_iterator
(
typename
array_t
::
iterator
v
)
:
array_iterator
(
v
)
{}
/// constructor for generic iterators
internal_const_iterator
(
generic_iterator_value
v
)
:
generic_iterator
(
v
)
{}
};
public:
/// a bidirectional iterator for the basic_json class
/// a bidirectional iterator for the basic_json class
class
iterator
:
public
std
::
iterator
<
std
::
bidirectional_iterator_tag
,
basic_json
>
class
iterator
:
public
std
::
iterator
<
std
::
bidirectional_iterator_tag
,
basic_json
>
{
{
...
@@ -1624,39 +1678,6 @@ class basic_json
...
@@ -1624,39 +1678,6 @@ class basic_json
/// the category of the iterator
/// the category of the iterator
using
iterator_category
=
std
::
bidirectional_iterator_tag
;
using
iterator_category
=
std
::
bidirectional_iterator_tag
;
/// values of a generic iterator type of non-container JSON values
enum
class
generic_iterator_value
{
/// the iterator was not initialized
uninitialized
,
/// the iterator points to the only value
begin
,
/// the iterator points past the only value
end
,
/// the iterator points to an invalid value
invalid
};
/// an iterator value
union
internal_iterator
{
/// iterator for JSON objects
typename
object_t
::
iterator
object_iterator
;
/// iterator for JSON arrays
typename
array_t
::
iterator
array_iterator
;
/// generic iteraotr for all other value types
generic_iterator_value
generic_iterator
;
/// default constructor
internal_iterator
()
:
generic_iterator
(
generic_iterator_value
::
uninitialized
)
{}
/// constructor for object iterators
internal_iterator
(
typename
object_t
::
iterator
v
)
:
object_iterator
(
v
)
{}
/// constructor for array iterators
internal_iterator
(
typename
array_t
::
iterator
v
)
:
array_iterator
(
v
)
{}
/// constructor for generic iterators
internal_iterator
(
generic_iterator_value
v
)
:
generic_iterator
(
v
)
{}
};
/// constructor for a given JSON instance
/// constructor for a given JSON instance
inline
iterator
(
pointer
object
)
:
m_object
(
object
)
inline
iterator
(
pointer
object
)
:
m_object
(
object
)
{
{
...
@@ -2015,39 +2036,6 @@ class basic_json
...
@@ -2015,39 +2036,6 @@ class basic_json
/// the category of the iterator
/// the category of the iterator
using
iterator_category
=
std
::
bidirectional_iterator_tag
;
using
iterator_category
=
std
::
bidirectional_iterator_tag
;
/// values of a generic iterator type of non-container JSON values
enum
class
generic_iterator_value
{
/// the iterator was not initialized
uninitialized
,
/// the iterator points to the only value
begin
,
/// the iterator points past the only value
end
,
/// the iterator points to an invalid value
invalid
};
/// an iterator value
union
internal_const_iterator
{
/// iterator for JSON objects
typename
object_t
::
const_iterator
object_iterator
;
/// iterator for JSON arrays
typename
array_t
::
const_iterator
array_iterator
;
/// generic iteraotr for all other value types
generic_iterator_value
generic_iterator
;
/// default constructor
internal_const_iterator
()
:
generic_iterator
(
generic_iterator_value
::
uninitialized
)
{}
/// constructor for object iterators
internal_const_iterator
(
typename
object_t
::
iterator
v
)
:
object_iterator
(
v
)
{}
/// constructor for array iterators
internal_const_iterator
(
typename
array_t
::
iterator
v
)
:
array_iterator
(
v
)
{}
/// constructor for generic iterators
internal_const_iterator
(
generic_iterator_value
v
)
:
generic_iterator
(
v
)
{}
};
/// constructor for a given JSON instance
/// constructor for a given JSON instance
inline
const_iterator
(
pointer
object
)
:
m_object
(
object
)
inline
const_iterator
(
pointer
object
)
:
m_object
(
object
)
{
{
...
@@ -2072,8 +2060,29 @@ class basic_json
...
@@ -2072,8 +2060,29 @@ class basic_json
}
}
/// copy constructor given a nonconst iterator
/// copy constructor given a nonconst iterator
inline
const_iterator
(
const
iterator
&
other
)
:
m_object
(
other
.
m_object
),
m_it
(
other
.
m_it
)
inline
const_iterator
(
const
iterator
&
other
)
:
m_object
(
other
.
m_object
)
{}
{
switch
(
m_object
->
m_type
)
{
case
(
basic_json
:
:
value_t
::
object
)
:
{
m_it
.
object_iterator
=
other
.
m_it
.
object_iterator
;
break
;
}
case
(
basic_json
:
:
value_t
::
array
)
:
{
m_it
.
array_iterator
=
other
.
m_it
.
array_iterator
;
break
;
}
default:
{
m_it
.
generic_iterator
=
other
.
m_it
.
generic_iterator
;
break
;
}
}
}
/// copy assignment
/// copy assignment
inline
const_iterator
operator
=
(
const
const_iterator
&
other
)
noexcept
inline
const_iterator
operator
=
(
const
const_iterator
&
other
)
noexcept
...
@@ -2618,704 +2627,359 @@ class basic_json
...
@@ -2618,704 +2627,359 @@ class basic_json
const
lexer_char_t
*
marker
;
const
lexer_char_t
*
marker
;
// set up RE2C
// set up RE2C
for
(;;)
for
(;;)
{
{
// set current to the begin of the buffer
// set current to the begin of the buffer
current_re2c
=
buffer_re2c
;
current_re2c
=
buffer_re2c
;
{
lexer_char_t
yych
;
unsigned
int
yyaccept
=
0
;
static
const
unsigned
char
yybm
[]
=
{
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
192
,
192
,
64
,
64
,
192
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
192
,
64
,
0
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
96
,
96
,
96
,
96
,
96
,
96
,
96
,
96
,
96
,
96
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
0
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
};
{
yych
=
*
buffer_re2c
;
lexer_char_t
yych
;
if
(
yych
<=
':'
)
{
unsigned
int
yyaccept
=
0
;
if
(
yych
<=
'!'
)
{
static
const
unsigned
char
yybm
[]
=
if
(
yych
<=
'\f'
)
{
{
if
(
yych
<=
0x08
)
goto
json_parser_3
;
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
if
(
yych
<=
'\n'
)
goto
json_parser_5
;
64
,
192
,
192
,
64
,
64
,
192
,
64
,
64
,
goto
json_parser_3
;
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
}
else
{
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
if
(
yych
<=
'\r'
)
goto
json_parser_5
;
192
,
64
,
0
,
64
,
64
,
64
,
64
,
64
,
if
(
yych
==
' '
)
goto
json_parser_5
;
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
goto
json_parser_3
;
96
,
96
,
96
,
96
,
96
,
96
,
96
,
96
,
}
96
,
96
,
64
,
64
,
64
,
64
,
64
,
64
,
}
else
{
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
if
(
yych
<=
'-'
)
{
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
if
(
yych
<=
'"'
)
goto
json_parser_6
;
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
if
(
yych
<=
'+'
)
goto
json_parser_3
;
64
,
64
,
64
,
64
,
0
,
64
,
64
,
64
,
if
(
yych
<=
','
)
goto
json_parser_7
;
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
goto
json_parser_9
;
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
}
else
{
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
if
(
yych
<=
'/'
)
goto
json_parser_3
;
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
if
(
yych
<=
'0'
)
goto
json_parser_10
;
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
if
(
yych
<=
'9'
)
goto
json_parser_12
;
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
goto
json_parser_13
;
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
}
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
}
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
}
else
{
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
if
(
yych
<=
'm'
)
{
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
if
(
yych
<=
'\\'
)
{
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
if
(
yych
==
'['
)
goto
json_parser_15
;
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
goto
json_parser_3
;
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
}
else
{
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
if
(
yych
<=
']'
)
goto
json_parser_17
;
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
if
(
yych
==
'f'
)
goto
json_parser_19
;
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
goto
json_parser_3
;
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
}
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
}
else
{
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
if
(
yych
<=
'z'
)
{
};
if
(
yych
<=
'n'
)
goto
json_parser_20
;
if
(
yych
==
't'
)
goto
json_parser_21
;
yych
=
*
buffer_re2c
;
goto
json_parser_3
;
if
(
yych
<=
':'
)
}
else
{
{
if
(
yych
<=
'{'
)
goto
json_parser_22
;
if
(
yych
<=
'!'
)
if
(
yych
==
'}'
)
goto
json_parser_24
;
{
goto
json_parser_3
;
if
(
yych
<=
'\f'
)
}
{
}
if
(
yych
<=
0x08
)
}
{
goto
json_parser_3
;
}
if
(
yych
<=
'\n'
)
{
goto
json_parser_5
;
}
goto
json_parser_3
;
}
else
{
if
(
yych
<=
'\r'
)
{
goto
json_parser_5
;
}
if
(
yych
==
' '
)
{
goto
json_parser_5
;
}
goto
json_parser_3
;
}
}
else
{
if
(
yych
<=
'-'
)
{
if
(
yych
<=
'"'
)
{
goto
json_parser_6
;
}
if
(
yych
<=
'+'
)
{
goto
json_parser_3
;
}
if
(
yych
<=
','
)
{
goto
json_parser_7
;
}
goto
json_parser_9
;
}
else
{
if
(
yych
<=
'/'
)
{
goto
json_parser_3
;
}
if
(
yych
<=
'0'
)
{
goto
json_parser_10
;
}
if
(
yych
<=
'9'
)
{
goto
json_parser_12
;
}
goto
json_parser_13
;
}
}
}
else
{
if
(
yych
<=
'm'
)
{
if
(
yych
<=
'\\'
)
{
if
(
yych
==
'['
)
{
goto
json_parser_15
;
}
goto
json_parser_3
;
}
else
{
if
(
yych
<=
']'
)
{
goto
json_parser_17
;
}
if
(
yych
==
'f'
)
{
goto
json_parser_19
;
}
goto
json_parser_3
;
}
}
else
{
if
(
yych
<=
'z'
)
{
if
(
yych
<=
'n'
)
{
goto
json_parser_20
;
}
if
(
yych
==
't'
)
{
goto
json_parser_21
;
}
goto
json_parser_3
;
}
else
{
if
(
yych
<=
'{'
)
{
goto
json_parser_22
;
}
if
(
yych
==
'}'
)
{
goto
json_parser_24
;
}
goto
json_parser_3
;
}
}
}
json_parser_2:
json_parser_2:
{
{
continue
;
}
continue
;
}
json_parser_3:
json_parser_3:
++
buffer_re2c
;
++
buffer_re2c
;
json_parser_4:
json_parser_4:
{
{
return
last_token
=
token_type
::
parse_error
;
}
return
last_token
=
token_type
::
parse_error
;
}
json_parser_5:
json_parser_5:
yych
=
*++
buffer_re2c
;
yych
=
*++
buffer_re2c
;
goto
json_parser_60
;
goto
json_parser_60
;
json_parser_6:
json_parser_6:
yyaccept
=
0
;
yyaccept
=
0
;
yych
=
*
(
marker
=
++
buffer_re2c
);
yych
=
*
(
marker
=
++
buffer_re2c
);
goto
json_parser_51
;
goto
json_parser_51
;
json_parser_7:
json_parser_7:
++
buffer_re2c
;
++
buffer_re2c
;
{
{
return
last_token
=
token_type
::
value_separator
;
}
return
last_token
=
token_type
::
value_separator
;
}
json_parser_9:
json_parser_9:
yych
=
*++
buffer_re2c
;
yych
=
*++
buffer_re2c
;
if
(
yych
<=
'/'
)
if
(
yych
<=
'/'
)
goto
json_parser_4
;
{
if
(
yych
<=
'0'
)
goto
json_parser_49
;
goto
json_parser_4
;
if
(
yych
<=
'9'
)
goto
json_parser_40
;
}
goto
json_parser_4
;
if
(
yych
<=
'0'
)
{
goto
json_parser_49
;
}
if
(
yych
<=
'9'
)
{
goto
json_parser_40
;
}
goto
json_parser_4
;
json_parser_10:
json_parser_10:
yyaccept
=
1
;
yyaccept
=
1
;
yych
=
*
(
marker
=
++
buffer_re2c
);
yych
=
*
(
marker
=
++
buffer_re2c
);
if
(
yych
<=
'D'
)
if
(
yych
<=
'D'
)
{
{
if
(
yych
==
'.'
)
goto
json_parser_42
;
if
(
yych
==
'.'
)
}
else
{
{
if
(
yych
<=
'E'
)
goto
json_parser_43
;
goto
json_parser_42
;
if
(
yych
==
'e'
)
goto
json_parser_43
;
}
}
}
else
{
if
(
yych
<=
'E'
)
{
goto
json_parser_43
;
}
if
(
yych
==
'e'
)
{
goto
json_parser_43
;
}
}
json_parser_11:
json_parser_11:
{
{
return
last_token
=
token_type
::
value_number
;
}
return
last_token
=
token_type
::
value_number
;
}
json_parser_12:
json_parser_12:
yyaccept
=
1
;
yyaccept
=
1
;
yych
=
*
(
marker
=
++
buffer_re2c
);
yych
=
*
(
marker
=
++
buffer_re2c
);
goto
json_parser_41
;
goto
json_parser_41
;
json_parser_13:
json_parser_13:
++
buffer_re2c
;
++
buffer_re2c
;
{
{
return
last_token
=
token_type
::
name_separator
;
}
return
last_token
=
token_type
::
name_separator
;
}
json_parser_15:
json_parser_15:
++
buffer_re2c
;
++
buffer_re2c
;
{
{
return
last_token
=
token_type
::
begin_array
;
}
return
last_token
=
token_type
::
begin_array
;
}
json_parser_17:
json_parser_17:
++
buffer_re2c
;
++
buffer_re2c
;
{
{
return
last_token
=
token_type
::
end_array
;
}
return
last_token
=
token_type
::
end_array
;
}
json_parser_19:
json_parser_19:
yyaccept
=
0
;
yyaccept
=
0
;
yych
=
*
(
marker
=
++
buffer_re2c
);
yych
=
*
(
marker
=
++
buffer_re2c
);
if
(
yych
==
'a'
)
if
(
yych
==
'a'
)
goto
json_parser_35
;
{
goto
json_parser_4
;
goto
json_parser_35
;
}
goto
json_parser_4
;
json_parser_20:
json_parser_20:
yyaccept
=
0
;
yyaccept
=
0
;
yych
=
*
(
marker
=
++
buffer_re2c
);
yych
=
*
(
marker
=
++
buffer_re2c
);
if
(
yych
==
'u'
)
if
(
yych
==
'u'
)
goto
json_parser_31
;
{
goto
json_parser_4
;
goto
json_parser_31
;
}
goto
json_parser_4
;
json_parser_21:
json_parser_21:
yyaccept
=
0
;
yyaccept
=
0
;
yych
=
*
(
marker
=
++
buffer_re2c
);
yych
=
*
(
marker
=
++
buffer_re2c
);
if
(
yych
==
'r'
)
if
(
yych
==
'r'
)
goto
json_parser_26
;
{
goto
json_parser_4
;
goto
json_parser_26
;
}
goto
json_parser_4
;
json_parser_22:
json_parser_22:
++
buffer_re2c
;
++
buffer_re2c
;
{
{
return
last_token
=
token_type
::
begin_object
;
}
return
last_token
=
token_type
::
begin_object
;
}
json_parser_24:
json_parser_24:
++
buffer_re2c
;
++
buffer_re2c
;
{
{
return
last_token
=
token_type
::
end_object
;
}
return
last_token
=
token_type
::
end_object
;
}
json_parser_26:
json_parser_26:
yych
=
*++
buffer_re2c
;
yych
=
*++
buffer_re2c
;
if
(
yych
==
'u'
)
if
(
yych
==
'u'
)
goto
json_parser_28
;
{
goto
json_parser_28
;
}
json_parser_27:
json_parser_27:
buffer_re2c
=
marker
;
buffer_re2c
=
marker
;
if
(
yyaccept
==
0
)
if
(
yyaccept
==
0
)
{
{
goto
json_parser_4
;
goto
json_parser_4
;
}
else
{
}
goto
json_parser_11
;
else
}
{
goto
json_parser_11
;
}
json_parser_28:
json_parser_28:
yych
=
*++
buffer_re2c
;
yych
=
*++
buffer_re2c
;
if
(
yych
!=
'e'
)
if
(
yych
!=
'e'
)
goto
json_parser_27
;
{
++
buffer_re2c
;
goto
json_parser_27
;
{
return
last_token
=
token_type
::
literal_true
;
}
}
++
buffer_re2c
;
{
return
last_token
=
token_type
::
literal_true
;
}
json_parser_31:
json_parser_31:
yych
=
*++
buffer_re2c
;
yych
=
*++
buffer_re2c
;
if
(
yych
!=
'l'
)
if
(
yych
!=
'l'
)
goto
json_parser_27
;
{
yych
=
*++
buffer_re2c
;
goto
json_parser_27
;
if
(
yych
!=
'l'
)
goto
json_parser_27
;
}
++
buffer_re2c
;
yych
=
*++
buffer_re2c
;
{
return
last_token
=
token_type
::
literal_null
;
}
if
(
yych
!=
'l'
)
{
goto
json_parser_27
;
}
++
buffer_re2c
;
{
return
last_token
=
token_type
::
literal_null
;
}
json_parser_35:
json_parser_35:
yych
=
*++
buffer_re2c
;
yych
=
*++
buffer_re2c
;
if
(
yych
!=
'l'
)
if
(
yych
!=
'l'
)
goto
json_parser_27
;
{
yych
=
*++
buffer_re2c
;
goto
json_parser_27
;
if
(
yych
!=
's'
)
goto
json_parser_27
;
}
yych
=
*++
buffer_re2c
;
yych
=
*++
buffer_re2c
;
if
(
yych
!=
'e'
)
goto
json_parser_27
;
if
(
yych
!=
's'
)
++
buffer_re2c
;
{
{
return
last_token
=
token_type
::
literal_false
;
}
goto
json_parser_27
;
}
yych
=
*++
buffer_re2c
;
if
(
yych
!=
'e'
)
{
goto
json_parser_27
;
}
++
buffer_re2c
;
{
return
last_token
=
token_type
::
literal_false
;
}
json_parser_40:
json_parser_40:
yyaccept
=
1
;
yyaccept
=
1
;
marker
=
++
buffer_re2c
;
marker
=
++
buffer_re2c
;
yych
=
*
buffer_re2c
;
yych
=
*
buffer_re2c
;
json_parser_41:
json_parser_41:
if
(
yybm
[
0
+
yych
]
&
32
)
if
(
yybm
[
0
+
yych
]
&
32
)
{
{
goto
json_parser_40
;
goto
json_parser_40
;
}
}
if
(
yych
<=
'D'
)
{
if
(
yych
<=
'D'
)
if
(
yych
!=
'.'
)
goto
json_parser_11
;
{
}
else
{
if
(
yych
!=
'.'
)
if
(
yych
<=
'E'
)
goto
json_parser_43
;
{
if
(
yych
==
'e'
)
goto
json_parser_43
;
goto
json_parser_11
;
goto
json_parser_11
;
}
}
}
else
{
if
(
yych
<=
'E'
)
{
goto
json_parser_43
;
}
if
(
yych
==
'e'
)
{
goto
json_parser_43
;
}
goto
json_parser_11
;
}
json_parser_42:
json_parser_42:
yych
=
*++
buffer_re2c
;
yych
=
*++
buffer_re2c
;
if
(
yych
<=
'/'
)
if
(
yych
<=
'/'
)
goto
json_parser_27
;
{
if
(
yych
<=
'9'
)
goto
json_parser_47
;
goto
json_parser_27
;
goto
json_parser_27
;
}
if
(
yych
<=
'9'
)
{
goto
json_parser_47
;
}
goto
json_parser_27
;
json_parser_43:
json_parser_43:
yych
=
*++
buffer_re2c
;
yych
=
*++
buffer_re2c
;
if
(
yych
<=
','
)
if
(
yych
<=
','
)
{
{
if
(
yych
!=
'+'
)
goto
json_parser_27
;
if
(
yych
!=
'+'
)
}
else
{
{
if
(
yych
<=
'-'
)
goto
json_parser_44
;
goto
json_parser_27
;
if
(
yych
<=
'/'
)
goto
json_parser_27
;
}
if
(
yych
<=
'9'
)
goto
json_parser_45
;
}
goto
json_parser_27
;
else
}
{
if
(
yych
<=
'-'
)
{
goto
json_parser_44
;
}
if
(
yych
<=
'/'
)
{
goto
json_parser_27
;
}
if
(
yych
<=
'9'
)
{
goto
json_parser_45
;
}
goto
json_parser_27
;
}
json_parser_44:
json_parser_44:
yych
=
*++
buffer_re2c
;
yych
=
*++
buffer_re2c
;
if
(
yych
<=
'/'
)
if
(
yych
<=
'/'
)
goto
json_parser_27
;
{
if
(
yych
>=
':'
)
goto
json_parser_27
;
goto
json_parser_27
;
}
if
(
yych
>=
':'
)
{
goto
json_parser_27
;
}
json_parser_45:
json_parser_45:
++
buffer_re2c
;
++
buffer_re2c
;
yych
=
*
buffer_re2c
;
yych
=
*
buffer_re2c
;
if
(
yych
<=
'/'
)
if
(
yych
<=
'/'
)
goto
json_parser_11
;
{
if
(
yych
<=
'9'
)
goto
json_parser_45
;
goto
json_parser_11
;
goto
json_parser_11
;
}
if
(
yych
<=
'9'
)
{
goto
json_parser_45
;
}
goto
json_parser_11
;
json_parser_47:
json_parser_47:
yyaccept
=
1
;
yyaccept
=
1
;
marker
=
++
buffer_re2c
;
marker
=
++
buffer_re2c
;
yych
=
*
buffer_re2c
;
yych
=
*
buffer_re2c
;
if
(
yych
<=
'D'
)
if
(
yych
<=
'D'
)
{
{
if
(
yych
<=
'/'
)
goto
json_parser_11
;
if
(
yych
<=
'/'
)
if
(
yych
<=
'9'
)
goto
json_parser_47
;
{
goto
json_parser_11
;
goto
json_parser_11
;
}
else
{
}
if
(
yych
<=
'E'
)
goto
json_parser_43
;
if
(
yych
<=
'9'
)
if
(
yych
==
'e'
)
goto
json_parser_43
;
{
goto
json_parser_11
;
goto
json_parser_47
;
}
}
goto
json_parser_11
;
}
else
{
if
(
yych
<=
'E'
)
{
goto
json_parser_43
;
}
if
(
yych
==
'e'
)
{
goto
json_parser_43
;
}
goto
json_parser_11
;
}
json_parser_49:
json_parser_49:
yyaccept
=
1
;
yyaccept
=
1
;
yych
=
*
(
marker
=
++
buffer_re2c
);
yych
=
*
(
marker
=
++
buffer_re2c
);
if
(
yych
<=
'D'
)
if
(
yych
<=
'D'
)
{
{
if
(
yych
==
'.'
)
goto
json_parser_42
;
if
(
yych
==
'.'
)
goto
json_parser_11
;
{
}
else
{
goto
json_parser_42
;
if
(
yych
<=
'E'
)
goto
json_parser_43
;
}
if
(
yych
==
'e'
)
goto
json_parser_43
;
goto
json_parser_11
;
goto
json_parser_11
;
}
}
else
{
if
(
yych
<=
'E'
)
{
goto
json_parser_43
;
}
if
(
yych
==
'e'
)
{
goto
json_parser_43
;
}
goto
json_parser_11
;
}
json_parser_50:
json_parser_50:
++
buffer_re2c
;
++
buffer_re2c
;
yych
=
*
buffer_re2c
;
yych
=
*
buffer_re2c
;
json_parser_51:
json_parser_51:
if
(
yybm
[
0
+
yych
]
&
64
)
if
(
yybm
[
0
+
yych
]
&
64
)
{
{
goto
json_parser_50
;
goto
json_parser_50
;
}
}
if
(
yych
<=
'"'
)
goto
json_parser_53
;
if
(
yych
<=
'"'
)
++
buffer_re2c
;
{
yych
=
*
buffer_re2c
;
goto
json_parser_53
;
if
(
yych
<=
'e'
)
{
}
if
(
yych
<=
'/'
)
{
++
buffer_re2c
;
if
(
yych
==
'"'
)
goto
json_parser_50
;
yych
=
*
buffer_re2c
;
if
(
yych
<=
'.'
)
goto
json_parser_27
;
if
(
yych
<=
'e'
)
goto
json_parser_50
;
{
}
else
{
if
(
yych
<=
'/'
)
if
(
yych
<=
'\\'
)
{
{
if
(
yych
<=
'['
)
goto
json_parser_27
;
if
(
yych
==
'"'
)
goto
json_parser_50
;
{
}
else
{
goto
json_parser_50
;
if
(
yych
==
'b'
)
goto
json_parser_50
;
}
goto
json_parser_27
;
if
(
yych
<=
'.'
)
}
{
}
goto
json_parser_27
;
}
else
{
}
if
(
yych
<=
'q'
)
{
goto
json_parser_50
;
if
(
yych
<=
'f'
)
goto
json_parser_50
;
}
if
(
yych
==
'n'
)
goto
json_parser_50
;
else
goto
json_parser_27
;
{
}
else
{
if
(
yych
<=
'\\'
)
if
(
yych
<=
's'
)
{
{
if
(
yych
<=
'r'
)
goto
json_parser_50
;
if
(
yych
<=
'['
)
goto
json_parser_27
;
{
}
else
{
goto
json_parser_27
;
if
(
yych
<=
't'
)
goto
json_parser_50
;
}
if
(
yych
<=
'u'
)
goto
json_parser_55
;
goto
json_parser_50
;
goto
json_parser_27
;
}
}
else
}
{
}
if
(
yych
==
'b'
)
{
goto
json_parser_50
;
}
goto
json_parser_27
;
}
}
}
else
{
if
(
yych
<=
'q'
)
{
if
(
yych
<=
'f'
)
{
goto
json_parser_50
;
}
if
(
yych
==
'n'
)
{
goto
json_parser_50
;
}
goto
json_parser_27
;
}
else
{
if
(
yych
<=
's'
)
{
if
(
yych
<=
'r'
)
{
goto
json_parser_50
;
}
goto
json_parser_27
;
}
else
{
if
(
yych
<=
't'
)
{
goto
json_parser_50
;
}
if
(
yych
<=
'u'
)
{
goto
json_parser_55
;
}
goto
json_parser_27
;
}
}
}
json_parser_53:
json_parser_53:
++
buffer_re2c
;
++
buffer_re2c
;
{
{
return
last_token
=
token_type
::
value_string
;
}
return
last_token
=
token_type
::
value_string
;
}
json_parser_55:
json_parser_55:
++
buffer_re2c
;
++
buffer_re2c
;
yych
=
*
buffer_re2c
;
yych
=
*
buffer_re2c
;
if
(
yych
<=
'@'
)
if
(
yych
<=
'@'
)
{
{
if
(
yych
<=
'/'
)
goto
json_parser_27
;
if
(
yych
<=
'/'
)
if
(
yych
>=
':'
)
goto
json_parser_27
;
{
}
else
{
goto
json_parser_27
;
if
(
yych
<=
'F'
)
goto
json_parser_56
;
}
if
(
yych
<=
'`'
)
goto
json_parser_27
;
if
(
yych
>=
':'
)
if
(
yych
>=
'g'
)
goto
json_parser_27
;
{
}
goto
json_parser_27
;
}
}
else
{
if
(
yych
<=
'F'
)
{
goto
json_parser_56
;
}
if
(
yych
<=
'`'
)
{
goto
json_parser_27
;
}
if
(
yych
>=
'g'
)
{
goto
json_parser_27
;
}
}
json_parser_56:
json_parser_56:
++
buffer_re2c
;
++
buffer_re2c
;
yych
=
*
buffer_re2c
;
yych
=
*
buffer_re2c
;
if
(
yych
<=
'@'
)
if
(
yych
<=
'@'
)
{
{
if
(
yych
<=
'/'
)
goto
json_parser_27
;
if
(
yych
<=
'/'
)
if
(
yych
>=
':'
)
goto
json_parser_27
;
{
}
else
{
goto
json_parser_27
;
if
(
yych
<=
'F'
)
goto
json_parser_57
;
}
if
(
yych
<=
'`'
)
goto
json_parser_27
;
if
(
yych
>=
':'
)
if
(
yych
>=
'g'
)
goto
json_parser_27
;
{
}
goto
json_parser_27
;
}
}
else
{
if
(
yych
<=
'F'
)
{
goto
json_parser_57
;
}
if
(
yych
<=
'`'
)
{
goto
json_parser_27
;
}
if
(
yych
>=
'g'
)
{
goto
json_parser_27
;
}
}
json_parser_57:
json_parser_57:
++
buffer_re2c
;
++
buffer_re2c
;
yych
=
*
buffer_re2c
;
yych
=
*
buffer_re2c
;
if
(
yych
<=
'@'
)
if
(
yych
<=
'@'
)
{
{
if
(
yych
<=
'/'
)
goto
json_parser_27
;
if
(
yych
<=
'/'
)
if
(
yych
>=
':'
)
goto
json_parser_27
;
{
}
else
{
goto
json_parser_27
;
if
(
yych
<=
'F'
)
goto
json_parser_58
;
}
if
(
yych
<=
'`'
)
goto
json_parser_27
;
if
(
yych
>=
':'
)
if
(
yych
>=
'g'
)
goto
json_parser_27
;
{
}
goto
json_parser_27
;
}
}
else
{
if
(
yych
<=
'F'
)
{
goto
json_parser_58
;
}
if
(
yych
<=
'`'
)
{
goto
json_parser_27
;
}
if
(
yych
>=
'g'
)
{
goto
json_parser_27
;
}
}
json_parser_58:
json_parser_58:
++
buffer_re2c
;
++
buffer_re2c
;
yych
=
*
buffer_re2c
;
yych
=
*
buffer_re2c
;
if
(
yych
<=
'@'
)
if
(
yych
<=
'@'
)
{
{
if
(
yych
<=
'/'
)
goto
json_parser_27
;
if
(
yych
<=
'/'
)
if
(
yych
<=
'9'
)
goto
json_parser_50
;
{
goto
json_parser_27
;
goto
json_parser_27
;
}
else
{
}
if
(
yych
<=
'F'
)
goto
json_parser_50
;
if
(
yych
<=
'9'
)
if
(
yych
<=
'`'
)
goto
json_parser_27
;
{
if
(
yych
<=
'f'
)
goto
json_parser_50
;
goto
json_parser_50
;
goto
json_parser_27
;
}
}
goto
json_parser_27
;
}
else
{
if
(
yych
<=
'F'
)
{
goto
json_parser_50
;
}
if
(
yych
<=
'`'
)
{
goto
json_parser_27
;
}
if
(
yych
<=
'f'
)
{
goto
json_parser_50
;
}
goto
json_parser_27
;
}
json_parser_59:
json_parser_59:
++
buffer_re2c
;
++
buffer_re2c
;
yych
=
*
buffer_re2c
;
yych
=
*
buffer_re2c
;
json_parser_60:
json_parser_60:
if
(
yybm
[
0
+
yych
]
&
128
)
if
(
yybm
[
0
+
yych
]
&
128
)
{
{
goto
json_parser_59
;
goto
json_parser_59
;
}
}
goto
json_parser_2
;
goto
json_parser_2
;
}
}
}
}
}
}
...
...
src/json.hpp.re2c
View file @
48392cfa
...
@@ -1604,11 +1604,65 @@ class basic_json
...
@@ -1604,11 +1604,65 @@ class basic_json
json_value m_value = {};
json_value m_value = {};
p
ublic
:
p
rivate
:
///////////////
///////////////
// iterators //
// iterators //
///////////////
///////////////
/// values of a generic iterator type of non-container JSON values
enum class generic_iterator_value
{
/// the iterator was not initialized
uninitialized,
/// the iterator points to the only value
begin,
/// the iterator points past the only value
end,
/// the iterator points to an invalid value
invalid
};
/// an iterator value
union internal_iterator
{
/// iterator for JSON objects
typename object_t::iterator object_iterator;
/// iterator for JSON arrays
typename array_t::iterator array_iterator;
/// generic iteraotr for all other value types
generic_iterator_value generic_iterator;
/// default constructor
internal_iterator() : generic_iterator(generic_iterator_value::uninitialized) {}
/// constructor for object iterators
internal_iterator(typename object_t::iterator v) : object_iterator(v) {}
/// constructor for array iterators
internal_iterator(typename array_t::iterator v) : array_iterator(v) {}
/// constructor for generic iterators
internal_iterator(generic_iterator_value v) : generic_iterator(v) {}
};
/// a const iterator value
union internal_const_iterator
{
/// iterator for JSON objects
typename object_t::const_iterator object_iterator;
/// iterator for JSON arrays
typename array_t::const_iterator array_iterator;
/// generic iteraotr for all other value types
generic_iterator_value generic_iterator;
/// default constructor
internal_const_iterator() : generic_iterator(generic_iterator_value::uninitialized) {}
/// constructor for object iterators
internal_const_iterator(typename object_t::iterator v) : object_iterator(v) {}
/// constructor for array iterators
internal_const_iterator(typename array_t::iterator v) : array_iterator(v) {}
/// constructor for generic iterators
internal_const_iterator(generic_iterator_value v) : generic_iterator(v) {}
};
public:
/// a bidirectional iterator for the basic_json class
/// a bidirectional iterator for the basic_json class
class iterator : public std::iterator<std::bidirectional_iterator_tag, basic_json>
class iterator : public std::iterator<std::bidirectional_iterator_tag, basic_json>
{
{
...
@@ -1624,39 +1678,6 @@ class basic_json
...
@@ -1624,39 +1678,6 @@ class basic_json
/// the category of the iterator
/// the category of the iterator
using iterator_category = std::bidirectional_iterator_tag;
using iterator_category = std::bidirectional_iterator_tag;
/// values of a generic iterator type of non-container JSON values
enum class generic_iterator_value
{
/// the iterator was not initialized
uninitialized,
/// the iterator points to the only value
begin,
/// the iterator points past the only value
end,
/// the iterator points to an invalid value
invalid
};
/// an iterator value
union internal_iterator
{
/// iterator for JSON objects
typename object_t::iterator object_iterator;
/// iterator for JSON arrays
typename array_t::iterator array_iterator;
/// generic iteraotr for all other value types
generic_iterator_value generic_iterator;
/// default constructor
internal_iterator() : generic_iterator(generic_iterator_value::uninitialized) {}
/// constructor for object iterators
internal_iterator(typename object_t::iterator v) : object_iterator(v) {}
/// constructor for array iterators
internal_iterator(typename array_t::iterator v) : array_iterator(v) {}
/// constructor for generic iterators
internal_iterator(generic_iterator_value v) : generic_iterator(v) {}
};
/// constructor for a given JSON instance
/// constructor for a given JSON instance
inline iterator(pointer object) : m_object(object)
inline iterator(pointer object) : m_object(object)
{
{
...
@@ -2015,39 +2036,6 @@ class basic_json
...
@@ -2015,39 +2036,6 @@ class basic_json
/// the category of the iterator
/// the category of the iterator
using iterator_category = std::bidirectional_iterator_tag;
using iterator_category = std::bidirectional_iterator_tag;
/// values of a generic iterator type of non-container JSON values
enum class generic_iterator_value
{
/// the iterator was not initialized
uninitialized,
/// the iterator points to the only value
begin,
/// the iterator points past the only value
end,
/// the iterator points to an invalid value
invalid
};
/// an iterator value
union internal_const_iterator
{
/// iterator for JSON objects
typename object_t::const_iterator object_iterator;
/// iterator for JSON arrays
typename array_t::const_iterator array_iterator;
/// generic iteraotr for all other value types
generic_iterator_value generic_iterator;
/// default constructor
internal_const_iterator() : generic_iterator(generic_iterator_value::uninitialized) {}
/// constructor for object iterators
internal_const_iterator(typename object_t::iterator v) : object_iterator(v) {}
/// constructor for array iterators
internal_const_iterator(typename array_t::iterator v) : array_iterator(v) {}
/// constructor for generic iterators
internal_const_iterator(generic_iterator_value v) : generic_iterator(v) {}
};
/// constructor for a given JSON instance
/// constructor for a given JSON instance
inline const_iterator(pointer object) : m_object(object)
inline const_iterator(pointer object) : m_object(object)
{
{
...
@@ -2072,8 +2060,29 @@ class basic_json
...
@@ -2072,8 +2060,29 @@ class basic_json
}
}
/// copy constructor given a nonconst iterator
/// copy constructor given a nonconst iterator
inline const_iterator(const iterator& other) : m_object(other.m_object), m_it(other.m_it)
inline const_iterator(const iterator& other) : m_object(other.m_object)
{}
{
switch (m_object->m_type)
{
case (basic_json::value_t::object):
{
m_it.object_iterator = other.m_it.object_iterator;
break;
}
case (basic_json::value_t::array):
{
m_it.array_iterator = other.m_it.array_iterator;
break;
}
default:
{
m_it.generic_iterator = other.m_it.generic_iterator;
break;
}
}
}
/// copy assignment
/// copy assignment
inline const_iterator operator=(const const_iterator& other) noexcept
inline const_iterator operator=(const const_iterator& other) noexcept
...
...
test/unit.cpp
View file @
48392cfa
...
@@ -2285,7 +2285,7 @@ TEST_CASE("iterators")
...
@@ -2285,7 +2285,7 @@ TEST_CASE("iterators")
SECTION
(
"json + begin/end"
)
SECTION
(
"json + begin/end"
)
{
{
auto
it
=
j
.
begin
();
json
::
iterator
it
=
j
.
begin
();
CHECK
(
it
!=
j
.
end
());
CHECK
(
it
!=
j
.
end
());
CHECK
(
*
it
==
j
);
CHECK
(
*
it
==
j
);
...
@@ -2310,7 +2310,7 @@ TEST_CASE("iterators")
...
@@ -2310,7 +2310,7 @@ TEST_CASE("iterators")
SECTION
(
"const json + begin/end"
)
SECTION
(
"const json + begin/end"
)
{
{
auto
it
=
j_const
.
begin
();
json
::
const_iterator
it
=
j_const
.
begin
();
CHECK
(
it
!=
j_const
.
end
());
CHECK
(
it
!=
j_const
.
end
());
CHECK
(
*
it
==
j_const
);
CHECK
(
*
it
==
j_const
);
...
@@ -2335,7 +2335,7 @@ TEST_CASE("iterators")
...
@@ -2335,7 +2335,7 @@ TEST_CASE("iterators")
SECTION
(
"json + cbegin/cend"
)
SECTION
(
"json + cbegin/cend"
)
{
{
auto
it
=
j
.
cbegin
();
json
::
const_iterator
it
=
j
.
cbegin
();
CHECK
(
it
!=
j
.
cend
());
CHECK
(
it
!=
j
.
cend
());
CHECK
(
*
it
==
j
);
CHECK
(
*
it
==
j
);
...
@@ -2360,7 +2360,7 @@ TEST_CASE("iterators")
...
@@ -2360,7 +2360,7 @@ TEST_CASE("iterators")
SECTION
(
"const json + cbegin/cend"
)
SECTION
(
"const json + cbegin/cend"
)
{
{
auto
it
=
j_const
.
cbegin
();
json
::
const_iterator
it
=
j_const
.
cbegin
();
CHECK
(
it
!=
j_const
.
cend
());
CHECK
(
it
!=
j_const
.
cend
());
CHECK
(
*
it
==
j_const
);
CHECK
(
*
it
==
j_const
);
...
@@ -2391,7 +2391,7 @@ TEST_CASE("iterators")
...
@@ -2391,7 +2391,7 @@ TEST_CASE("iterators")
SECTION
(
"json + begin/end"
)
SECTION
(
"json + begin/end"
)
{
{
auto
it
=
j
.
begin
();
json
::
iterator
it
=
j
.
begin
();
CHECK
(
it
!=
j
.
end
());
CHECK
(
it
!=
j
.
end
());
CHECK
(
*
it
==
j
);
CHECK
(
*
it
==
j
);
...
@@ -2416,7 +2416,7 @@ TEST_CASE("iterators")
...
@@ -2416,7 +2416,7 @@ TEST_CASE("iterators")
SECTION
(
"const json + begin/end"
)
SECTION
(
"const json + begin/end"
)
{
{
auto
it
=
j_const
.
begin
();
json
::
const_iterator
it
=
j_const
.
begin
();
CHECK
(
it
!=
j_const
.
end
());
CHECK
(
it
!=
j_const
.
end
());
CHECK
(
*
it
==
j_const
);
CHECK
(
*
it
==
j_const
);
...
@@ -2441,7 +2441,7 @@ TEST_CASE("iterators")
...
@@ -2441,7 +2441,7 @@ TEST_CASE("iterators")
SECTION
(
"json + cbegin/cend"
)
SECTION
(
"json + cbegin/cend"
)
{
{
auto
it
=
j
.
cbegin
();
json
::
const_iterator
it
=
j
.
cbegin
();
CHECK
(
it
!=
j
.
cend
());
CHECK
(
it
!=
j
.
cend
());
CHECK
(
*
it
==
j
);
CHECK
(
*
it
==
j
);
...
@@ -2466,7 +2466,7 @@ TEST_CASE("iterators")
...
@@ -2466,7 +2466,7 @@ TEST_CASE("iterators")
SECTION
(
"const json + cbegin/cend"
)
SECTION
(
"const json + cbegin/cend"
)
{
{
auto
it
=
j_const
.
cbegin
();
json
::
const_iterator
it
=
j_const
.
cbegin
();
CHECK
(
it
!=
j_const
.
cend
());
CHECK
(
it
!=
j_const
.
cend
());
CHECK
(
*
it
==
j_const
);
CHECK
(
*
it
==
j_const
);
...
@@ -2509,7 +2509,7 @@ TEST_CASE("iterators")
...
@@ -2509,7 +2509,7 @@ TEST_CASE("iterators")
SECTION
(
"json + begin/end"
)
SECTION
(
"json + begin/end"
)
{
{
auto
it
=
j
.
begin
();
json
::
iterator
it
=
j
.
begin
();
CHECK
(
it
!=
j
.
end
());
CHECK
(
it
!=
j
.
end
());
CHECK
(
*
it
==
j
);
CHECK
(
*
it
==
j
);
...
@@ -2534,7 +2534,7 @@ TEST_CASE("iterators")
...
@@ -2534,7 +2534,7 @@ TEST_CASE("iterators")
SECTION
(
"const json + begin/end"
)
SECTION
(
"const json + begin/end"
)
{
{
auto
it
=
j_const
.
begin
();
json
::
const_iterator
it
=
j_const
.
begin
();
CHECK
(
it
!=
j_const
.
end
());
CHECK
(
it
!=
j_const
.
end
());
CHECK
(
*
it
==
j_const
);
CHECK
(
*
it
==
j_const
);
...
@@ -2559,7 +2559,7 @@ TEST_CASE("iterators")
...
@@ -2559,7 +2559,7 @@ TEST_CASE("iterators")
SECTION
(
"json + cbegin/cend"
)
SECTION
(
"json + cbegin/cend"
)
{
{
auto
it
=
j
.
cbegin
();
json
::
const_iterator
it
=
j
.
cbegin
();
CHECK
(
it
!=
j
.
cend
());
CHECK
(
it
!=
j
.
cend
());
CHECK
(
*
it
==
j
);
CHECK
(
*
it
==
j
);
...
@@ -2584,7 +2584,7 @@ TEST_CASE("iterators")
...
@@ -2584,7 +2584,7 @@ TEST_CASE("iterators")
SECTION
(
"const json + cbegin/cend"
)
SECTION
(
"const json + cbegin/cend"
)
{
{
auto
it
=
j_const
.
cbegin
();
json
::
const_iterator
it
=
j_const
.
cbegin
();
CHECK
(
it
!=
j_const
.
cend
());
CHECK
(
it
!=
j_const
.
cend
());
CHECK
(
*
it
==
j_const
);
CHECK
(
*
it
==
j_const
);
...
@@ -2615,7 +2615,7 @@ TEST_CASE("iterators")
...
@@ -2615,7 +2615,7 @@ TEST_CASE("iterators")
SECTION
(
"json + begin/end"
)
SECTION
(
"json + begin/end"
)
{
{
auto
it
=
j
.
begin
();
json
::
iterator
it
=
j
.
begin
();
CHECK
(
it
!=
j
.
end
());
CHECK
(
it
!=
j
.
end
());
CHECK
(
*
it
==
j
);
CHECK
(
*
it
==
j
);
...
@@ -2640,7 +2640,7 @@ TEST_CASE("iterators")
...
@@ -2640,7 +2640,7 @@ TEST_CASE("iterators")
SECTION
(
"const json + begin/end"
)
SECTION
(
"const json + begin/end"
)
{
{
auto
it
=
j_const
.
begin
();
json
::
const_iterator
it
=
j_const
.
begin
();
CHECK
(
it
!=
j_const
.
end
());
CHECK
(
it
!=
j_const
.
end
());
CHECK
(
*
it
==
j_const
);
CHECK
(
*
it
==
j_const
);
...
@@ -2665,7 +2665,7 @@ TEST_CASE("iterators")
...
@@ -2665,7 +2665,7 @@ TEST_CASE("iterators")
SECTION
(
"json + cbegin/cend"
)
SECTION
(
"json + cbegin/cend"
)
{
{
auto
it
=
j
.
cbegin
();
json
::
const_iterator
it
=
j
.
cbegin
();
CHECK
(
it
!=
j
.
cend
());
CHECK
(
it
!=
j
.
cend
());
CHECK
(
*
it
==
j
);
CHECK
(
*
it
==
j
);
...
@@ -2690,7 +2690,7 @@ TEST_CASE("iterators")
...
@@ -2690,7 +2690,7 @@ TEST_CASE("iterators")
SECTION
(
"const json + cbegin/cend"
)
SECTION
(
"const json + cbegin/cend"
)
{
{
auto
it
=
j_const
.
cbegin
();
json
::
const_iterator
it
=
j_const
.
cbegin
();
CHECK
(
it
!=
j_const
.
cend
());
CHECK
(
it
!=
j_const
.
cend
());
CHECK
(
*
it
==
j_const
);
CHECK
(
*
it
==
j_const
);
...
@@ -2721,25 +2721,25 @@ TEST_CASE("iterators")
...
@@ -2721,25 +2721,25 @@ TEST_CASE("iterators")
SECTION
(
"json + begin/end"
)
SECTION
(
"json + begin/end"
)
{
{
auto
it
=
j
.
begin
();
json
::
iterator
it
=
j
.
begin
();
CHECK
(
it
==
j
.
end
());
CHECK
(
it
==
j
.
end
());
}
}
SECTION
(
"const json + begin/end"
)
SECTION
(
"const json + begin/end"
)
{
{
auto
it
=
j_const
.
begin
();
json
::
const_iterator
it
=
j_const
.
begin
();
CHECK
(
it
==
j_const
.
end
());
CHECK
(
it
==
j_const
.
end
());
}
}
SECTION
(
"json + cbegin/cend"
)
SECTION
(
"json + cbegin/cend"
)
{
{
auto
it
=
j
.
cbegin
();
json
::
const_iterator
it
=
j
.
cbegin
();
CHECK
(
it
==
j
.
cend
());
CHECK
(
it
==
j
.
cend
());
}
}
SECTION
(
"const json + cbegin/cend"
)
SECTION
(
"const json + cbegin/cend"
)
{
{
auto
it
=
j_const
.
cbegin
();
json
::
const_iterator
it
=
j_const
.
cbegin
();
CHECK
(
it
==
j_const
.
cend
());
CHECK
(
it
==
j_const
.
cend
());
}
}
}
}
...
...
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