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
caf82be2
Commit
caf82be2
authored
Feb 08, 2015
by
Niels
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added reverse iterators
parent
87c250d8
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
777 additions
and
336 deletions
+777
-336
src/json.hpp
src/json.hpp
+714
-321
src/json.hpp.re2c
src/json.hpp.re2c
+63
-15
No files found.
src/json.hpp
View file @
caf82be2
...
...
@@ -84,6 +84,10 @@ class basic_json
using
iterator
=
basic_json
::
iterator
;
/// a const iterator for a basic_json container
using
const_iterator
=
basic_json
::
const_iterator
;
// a reverse iterator for a basic_json container
using
reverse_iterator
=
std
::
reverse_iterator
<
iterator
>
;
/// a const reverse iterator for a basic_json container
using
const_reverse_iterator
=
std
::
reverse_iterator
<
const_iterator
>
;
///////////////////////////
...
...
@@ -255,6 +259,8 @@ class basic_json
std
::
enable_if
<
not
std
::
is_same
<
V
,
basic_json
::
iterator
>
::
value
and
not
std
::
is_same
<
V
,
basic_json
::
const_iterator
>::
value
and
not
std
::
is_same
<
V
,
basic_json
::
reverse_iterator
>::
value
and
not
std
::
is_same
<
V
,
basic_json
::
const_reverse_iterator
>::
value
and
std
::
is_constructible
<
basic_json
,
typename
V
::
value_type
>::
value
,
int
>::
type
=
0
>
inline
basic_json
(
const
V
&
value
)
...
...
@@ -437,7 +443,7 @@ class basic_json
:
m_type
(
std
::
move
(
other
.
m_type
)),
m_value
(
std
::
move
(
other
.
m_value
))
{
// inval
u
date payload
// inval
i
date payload
other
.
m_type
=
value_t
::
null
;
other
.
m_value
=
{};
}
...
...
@@ -461,23 +467,24 @@ class basic_json
m_value
.
object
=
nullptr
;
break
;
}
case
(
value_t
:
:
array
)
:
{
delete
m_value
.
array
;
m_value
.
array
=
nullptr
;
break
;
}
case
(
value_t
:
:
string
)
:
{
delete
m_value
.
string
;
m_value
.
string
=
nullptr
;
break
;
}
case
(
value_t
:
:
null
)
:
case
(
value_t
:
:
boolean
)
:
case
(
value_t
:
:
number_integer
)
:
case
(
value_t
:
:
number_float
)
:
default:
{
// all other types need no specific destructor
break
;
}
}
...
...
@@ -815,6 +822,38 @@ class basic_json
return
result
;
}
/// returns a reverse iterator to the end of the container
inline
reverse_iterator
rbegin
()
const
noexcept
{
reverse_iterator
result
(
this
);
result
.
set_end
();
return
result
;
}
/// returns a reverse iterator to the beginning of the container
inline
reverse_iterator
rend
()
const
noexcept
{
reverse_iterator
result
(
this
);
result
.
set_begin
();
return
result
;
}
/// returns a const reverse iterator to the end of the container
inline
const_reverse_iterator
crbegin
()
const
noexcept
{
const_reverse_iterator
result
(
this
);
result
.
set_end
();
return
result
;
}
/// returns a const reverse iterator to the beginning of the container
inline
const_reverse_iterator
crend
()
const
noexcept
{
const_reverse_iterator
result
(
this
);
result
.
set_begin
();
return
result
;
}
//////////////
// capacity //
...
...
@@ -839,11 +878,14 @@ class basic_json
{
return
m_value
.
object
->
empty
();
}
}
default:
{
// all other types are nonempty
return
false
;
}
}
}
/// returns the number of elements
inline
size_type
size
()
const
noexcept
...
...
@@ -864,11 +906,14 @@ class basic_json
{
return
m_value
.
object
->
size
();
}
}
default:
{
// all other types have size 1
return
1
;
}
}
}
/// returns the maximum possible number of elements
inline
size_type
max_size
()
const
noexcept
...
...
@@ -889,11 +934,14 @@ class basic_json
{
return
m_value
.
object
->
max_size
();
}
}
default:
{
// all other types have max_size 1
return
1
;
}
}
}
///////////////
...
...
@@ -2626,10 +2674,11 @@ class basic_json
current_re2c
=
buffer_re2c
;
{
{
lexer_char_t
yych
;
unsigned
int
yyaccept
=
0
;
static
const
unsigned
char
yybm
[]
=
{
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
,
...
...
@@ -2665,58 +2714,134 @@ class basic_json
};
yych
=
*
buffer_re2c
;
if
(
yych
<=
':'
)
{
if
(
yych
<=
'!'
)
{
if
(
yych
<=
'\f'
)
{
if
(
yych
<=
0x08
)
goto
json_parser_3
;
if
(
yych
<=
'\n'
)
goto
json_parser_5
;
if
(
yych
<=
':'
)
{
if
(
yych
<=
'!'
)
{
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
<=
'\r'
)
goto
json_parser_5
;
if
(
yych
==
' '
)
goto
json_parser_5
;
}
}
else
{
if
(
yych
<=
'-'
)
{
if
(
yych
<=
'"'
)
{
goto
json_parser_6
;
}
if
(
yych
<=
'+'
)
{
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
;
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
;
}
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
;
}
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
;
}
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
;
}
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
;
}
else
{
if
(
yych
<=
'{'
)
{
goto
json_parser_22
;
}
if
(
yych
==
'}'
)
{
goto
json_parser_24
;
}
goto
json_parser_3
;
}
}
}
json_parser_2:
{
continue
;
}
{
continue
;
}
json_parser_3:
++
buffer_re2c
;
json_parser_4:
{
return
last_token
=
token_type
::
parse_error
;
}
{
return
last_token
=
token_type
::
parse_error
;
}
json_parser_5:
yych
=
*++
buffer_re2c
;
goto
json_parser_60
;
...
...
@@ -2726,251 +2851,519 @@ json_parser_6:
goto
json_parser_51
;
json_parser_7:
++
buffer_re2c
;
{
return
last_token
=
token_type
::
value_separator
;
}
{
return
last_token
=
token_type
::
value_separator
;
}
json_parser_9:
yych
=
*++
buffer_re2c
;
if
(
yych
<=
'/'
)
goto
json_parser_4
;
if
(
yych
<=
'0'
)
goto
json_parser_49
;
if
(
yych
<=
'9'
)
goto
json_parser_40
;
if
(
yych
<=
'/'
)
{
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:
yyaccept
=
1
;
yych
=
*
(
marker
=
++
buffer_re2c
);
if
(
yych
<=
'D'
)
{
if
(
yych
==
'.'
)
goto
json_parser_42
;
}
else
{
if
(
yych
<=
'E'
)
goto
json_parser_43
;
if
(
yych
==
'e'
)
goto
json_parser_43
;
if
(
yych
<=
'D'
)
{
if
(
yych
==
'.'
)
{
goto
json_parser_42
;
}
}
else
{
if
(
yych
<=
'E'
)
{
goto
json_parser_43
;
}
if
(
yych
==
'e'
)
{
goto
json_parser_43
;
}
}
json_parser_11:
{
return
last_token
=
token_type
::
value_number
;
}
{
return
last_token
=
token_type
::
value_number
;
}
json_parser_12:
yyaccept
=
1
;
yych
=
*
(
marker
=
++
buffer_re2c
);
goto
json_parser_41
;
json_parser_13:
++
buffer_re2c
;
{
return
last_token
=
token_type
::
name_separator
;
}
{
return
last_token
=
token_type
::
name_separator
;
}
json_parser_15:
++
buffer_re2c
;
{
return
last_token
=
token_type
::
begin_array
;
}
{
return
last_token
=
token_type
::
begin_array
;
}
json_parser_17:
++
buffer_re2c
;
{
return
last_token
=
token_type
::
end_array
;
}
{
return
last_token
=
token_type
::
end_array
;
}
json_parser_19:
yyaccept
=
0
;
yych
=
*
(
marker
=
++
buffer_re2c
);
if
(
yych
==
'a'
)
goto
json_parser_35
;
if
(
yych
==
'a'
)
{
goto
json_parser_35
;
}
goto
json_parser_4
;
json_parser_20:
yyaccept
=
0
;
yych
=
*
(
marker
=
++
buffer_re2c
);
if
(
yych
==
'u'
)
goto
json_parser_31
;
if
(
yych
==
'u'
)
{
goto
json_parser_31
;
}
goto
json_parser_4
;
json_parser_21:
yyaccept
=
0
;
yych
=
*
(
marker
=
++
buffer_re2c
);
if
(
yych
==
'r'
)
goto
json_parser_26
;
if
(
yych
==
'r'
)
{
goto
json_parser_26
;
}
goto
json_parser_4
;
json_parser_22:
++
buffer_re2c
;
{
return
last_token
=
token_type
::
begin_object
;
}
{
return
last_token
=
token_type
::
begin_object
;
}
json_parser_24:
++
buffer_re2c
;
{
return
last_token
=
token_type
::
end_object
;
}
{
return
last_token
=
token_type
::
end_object
;
}
json_parser_26:
yych
=
*++
buffer_re2c
;
if
(
yych
==
'u'
)
goto
json_parser_28
;
if
(
yych
==
'u'
)
{
goto
json_parser_28
;
}
json_parser_27:
buffer_re2c
=
marker
;
if
(
yyaccept
==
0
)
{
if
(
yyaccept
==
0
)
{
goto
json_parser_4
;
}
else
{
}
else
{
goto
json_parser_11
;
}
json_parser_28:
yych
=
*++
buffer_re2c
;
if
(
yych
!=
'e'
)
goto
json_parser_27
;
if
(
yych
!=
'e'
)
{
goto
json_parser_27
;
}
++
buffer_re2c
;
{
return
last_token
=
token_type
::
literal_true
;
}
{
return
last_token
=
token_type
::
literal_true
;
}
json_parser_31:
yych
=
*++
buffer_re2c
;
if
(
yych
!=
'l'
)
goto
json_parser_27
;
if
(
yych
!=
'l'
)
{
goto
json_parser_27
;
}
yych
=
*++
buffer_re2c
;
if
(
yych
!=
'l'
)
goto
json_parser_27
;
if
(
yych
!=
'l'
)
{
goto
json_parser_27
;
}
++
buffer_re2c
;
{
return
last_token
=
token_type
::
literal_null
;
}
{
return
last_token
=
token_type
::
literal_null
;
}
json_parser_35:
yych
=
*++
buffer_re2c
;
if
(
yych
!=
'l'
)
goto
json_parser_27
;
if
(
yych
!=
'l'
)
{
goto
json_parser_27
;
}
yych
=
*++
buffer_re2c
;
if
(
yych
!=
's'
)
goto
json_parser_27
;
if
(
yych
!=
's'
)
{
goto
json_parser_27
;
}
yych
=
*++
buffer_re2c
;
if
(
yych
!=
'e'
)
goto
json_parser_27
;
if
(
yych
!=
'e'
)
{
goto
json_parser_27
;
}
++
buffer_re2c
;
{
return
last_token
=
token_type
::
literal_false
;
}
{
return
last_token
=
token_type
::
literal_false
;
}
json_parser_40:
yyaccept
=
1
;
marker
=
++
buffer_re2c
;
yych
=
*
buffer_re2c
;
json_parser_41:
if
(
yybm
[
0
+
yych
]
&
32
)
{
if
(
yybm
[
0
+
yych
]
&
32
)
{
goto
json_parser_40
;
}
if
(
yych
<=
'D'
)
{
if
(
yych
!=
'.'
)
goto
json_parser_11
;
}
else
{
if
(
yych
<=
'E'
)
goto
json_parser_43
;
if
(
yych
==
'e'
)
goto
json_parser_43
;
if
(
yych
<=
'D'
)
{
if
(
yych
!=
'.'
)
{
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:
yych
=
*++
buffer_re2c
;
if
(
yych
<=
'/'
)
goto
json_parser_27
;
if
(
yych
<=
'9'
)
goto
json_parser_47
;
if
(
yych
<=
'/'
)
{
goto
json_parser_27
;
}
if
(
yych
<=
'9'
)
{
goto
json_parser_47
;
}
goto
json_parser_27
;
json_parser_43:
yych
=
*++
buffer_re2c
;
if
(
yych
<=
','
)
{
if
(
yych
!=
'+'
)
goto
json_parser_27
;
}
else
{
if
(
yych
<=
'-'
)
goto
json_parser_44
;
if
(
yych
<=
'/'
)
goto
json_parser_27
;
if
(
yych
<=
'9'
)
goto
json_parser_45
;
if
(
yych
<=
','
)
{
if
(
yych
!=
'+'
)
{
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:
yych
=
*++
buffer_re2c
;
if
(
yych
<=
'/'
)
goto
json_parser_27
;
if
(
yych
>=
':'
)
goto
json_parser_27
;
if
(
yych
<=
'/'
)
{
goto
json_parser_27
;
}
if
(
yych
>=
':'
)
{
goto
json_parser_27
;
}
json_parser_45:
++
buffer_re2c
;
yych
=
*
buffer_re2c
;
if
(
yych
<=
'/'
)
goto
json_parser_11
;
if
(
yych
<=
'9'
)
goto
json_parser_45
;
if
(
yych
<=
'/'
)
{
goto
json_parser_11
;
}
if
(
yych
<=
'9'
)
{
goto
json_parser_45
;
}
goto
json_parser_11
;
json_parser_47:
yyaccept
=
1
;
marker
=
++
buffer_re2c
;
yych
=
*
buffer_re2c
;
if
(
yych
<=
'D'
)
{
if
(
yych
<=
'/'
)
goto
json_parser_11
;
if
(
yych
<=
'9'
)
goto
json_parser_47
;
if
(
yych
<=
'D'
)
{
if
(
yych
<=
'/'
)
{
goto
json_parser_11
;
}
else
{
if
(
yych
<=
'E'
)
goto
json_parser_43
;
if
(
yych
==
'e'
)
goto
json_parser_43
;
}
if
(
yych
<=
'9'
)
{
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:
yyaccept
=
1
;
yych
=
*
(
marker
=
++
buffer_re2c
);
if
(
yych
<=
'D'
)
{
if
(
yych
==
'.'
)
goto
json_parser_42
;
if
(
yych
<=
'D'
)
{
if
(
yych
==
'.'
)
{
goto
json_parser_42
;
}
goto
json_parser_11
;
}
else
{
if
(
yych
<=
'E'
)
goto
json_parser_43
;
if
(
yych
==
'e'
)
goto
json_parser_43
;
}
else
{
if
(
yych
<=
'E'
)
{
goto
json_parser_43
;
}
if
(
yych
==
'e'
)
{
goto
json_parser_43
;
}
goto
json_parser_11
;
}
json_parser_50:
++
buffer_re2c
;
yych
=
*
buffer_re2c
;
json_parser_51:
if
(
yybm
[
0
+
yych
]
&
64
)
{
if
(
yybm
[
0
+
yych
]
&
64
)
{
goto
json_parser_50
;
}
if
(
yych
<=
'"'
)
goto
json_parser_53
;
if
(
yych
<=
'"'
)
{
goto
json_parser_53
;
}
++
buffer_re2c
;
yych
=
*
buffer_re2c
;
if
(
yych
<=
'e'
)
{
if
(
yych
<=
'/'
)
{
if
(
yych
==
'"'
)
goto
json_parser_50
;
if
(
yych
<=
'.'
)
goto
json_parser_27
;
if
(
yych
<=
'e'
)
{
if
(
yych
<=
'/'
)
{
if
(
yych
==
'"'
)
{
goto
json_parser_50
;
}
else
{
if
(
yych
<=
'\\'
)
{
if
(
yych
<=
'['
)
goto
json_parser_27
;
}
if
(
yych
<=
'.'
)
{
goto
json_parser_27
;
}
goto
json_parser_50
;
}
else
{
if
(
yych
==
'b'
)
goto
json_parser_50
;
}
else
{
if
(
yych
<=
'\\'
)
{
if
(
yych
<=
'['
)
{
goto
json_parser_27
;
}
goto
json_parser_50
;
}
else
{
if
(
yych
==
'b'
)
{
goto
json_parser_50
;
}
}
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
;
}
}
}
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
<=
't'
)
goto
json_parser_50
;
if
(
yych
<=
'u'
)
goto
json_parser_55
;
}
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:
++
buffer_re2c
;
{
return
last_token
=
token_type
::
value_string
;
}
{
return
last_token
=
token_type
::
value_string
;
}
json_parser_55:
++
buffer_re2c
;
yych
=
*
buffer_re2c
;
if
(
yych
<=
'@'
)
{
if
(
yych
<=
'/'
)
goto
json_parser_27
;
if
(
yych
>=
':'
)
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
;
if
(
yych
<=
'@'
)
{
if
(
yych
<=
'/'
)
{
goto
json_parser_27
;
}
if
(
yych
>=
':'
)
{
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:
++
buffer_re2c
;
yych
=
*
buffer_re2c
;
if
(
yych
<=
'@'
)
{
if
(
yych
<=
'/'
)
goto
json_parser_27
;
if
(
yych
>=
':'
)
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
;
if
(
yych
<=
'@'
)
{
if
(
yych
<=
'/'
)
{
goto
json_parser_27
;
}
if
(
yych
>=
':'
)
{
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:
++
buffer_re2c
;
yych
=
*
buffer_re2c
;
if
(
yych
<=
'@'
)
{
if
(
yych
<=
'/'
)
goto
json_parser_27
;
if
(
yych
>=
':'
)
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
;
if
(
yych
<=
'@'
)
{
if
(
yych
<=
'/'
)
{
goto
json_parser_27
;
}
if
(
yych
>=
':'
)
{
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:
++
buffer_re2c
;
yych
=
*
buffer_re2c
;
if
(
yych
<=
'@'
)
{
if
(
yych
<=
'/'
)
goto
json_parser_27
;
if
(
yych
<=
'9'
)
goto
json_parser_50
;
if
(
yych
<=
'@'
)
{
if
(
yych
<=
'/'
)
{
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
;
}
if
(
yych
<=
'9'
)
{
goto
json_parser_50
;
}
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:
++
buffer_re2c
;
yych
=
*
buffer_re2c
;
json_parser_60:
if
(
yybm
[
0
+
yych
]
&
128
)
{
if
(
yybm
[
0
+
yych
]
&
128
)
{
goto
json_parser_59
;
}
goto
json_parser_2
;
}
}
}
}
...
...
src/json.hpp.re2c
View file @
caf82be2
...
...
@@ -84,6 +84,10 @@ class basic_json
using iterator = basic_json::iterator;
/// a const iterator for a basic_json container
using const_iterator = basic_json::const_iterator;
// a reverse iterator for a basic_json container
using reverse_iterator = std::reverse_iterator<iterator>;
/// a const reverse iterator for a basic_json container
using const_reverse_iterator = std::reverse_iterator<const_iterator>;
///////////////////////////
...
...
@@ -255,6 +259,8 @@ class basic_json
std::enable_if<
not std::is_same<V, basic_json::iterator>::value and
not std::is_same<V, basic_json::const_iterator>::value and
not std::is_same<V, basic_json::reverse_iterator>::value and
not std::is_same<V, basic_json::const_reverse_iterator>::value and
std::is_constructible<basic_json, typename V::value_type>::value, int>::type
= 0>
inline basic_json(const V& value)
...
...
@@ -437,7 +443,7 @@ class basic_json
: m_type(std::move(other.m_type)),
m_value(std::move(other.m_value))
{
// inval
u
date payload
// inval
i
date payload
other.m_type = value_t::null;
other.m_value = {};
}
...
...
@@ -461,23 +467,24 @@ class basic_json
m_value.object = nullptr;
break;
}
case (value_t::array):
{
delete m_value.array;
m_value.array = nullptr;
break;
}
case (value_t::string):
{
delete m_value.string;
m_value.string = nullptr;
break;
}
case (value_t::null):
case (value_t::boolean):
case (value_t::number_integer):
case (value_t::number_float):
default:
{
// all other types need no specific destructor
break;
}
}
...
...
@@ -815,6 +822,38 @@ class basic_json
return result;
}
/// returns a reverse iterator to the end of the container
inline reverse_iterator rbegin() const noexcept
{
reverse_iterator result(this);
result.set_end();
return result;
}
/// returns a reverse iterator to the beginning of the container
inline reverse_iterator rend() const noexcept
{
reverse_iterator result(this);
result.set_begin();
return result;
}
/// returns a const reverse iterator to the end of the container
inline const_reverse_iterator crbegin() const noexcept
{
const_reverse_iterator result(this);
result.set_end();
return result;
}
/// returns a const reverse iterator to the beginning of the container
inline const_reverse_iterator crend() const noexcept
{
const_reverse_iterator result(this);
result.set_begin();
return result;
}
//////////////
// capacity //
...
...
@@ -839,11 +878,14 @@ class basic_json
{
return m_value.object->empty();
}
}
default:
{
// all other types are nonempty
return false;
}
}
}
/// returns the number of elements
inline size_type size() const noexcept
...
...
@@ -864,11 +906,14 @@ class basic_json
{
return m_value.object->size();
}
}
default:
{
// all other types have size 1
return 1;
}
}
}
/// returns the maximum possible number of elements
inline size_type max_size() const noexcept
...
...
@@ -889,11 +934,14 @@ class basic_json
{
return m_value.object->max_size();
}
}
default:
{
// all other types have max_size 1
return 1;
}
}
}
///////////////
...
...
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