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
8d6b3d44
Unverified
Commit
8d6b3d44
authored
Feb 25, 2018
by
Niels Lohmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
👌
fixed some compiler warnings
parent
8c7f46f7
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
18 deletions
+22
-18
parser.hpp
include/nlohmann/detail/input/parser.hpp
+5
-3
json.hpp
single_include/nlohmann/json.hpp
+5
-3
unit-class_parser.cpp
test/src/unit-class_parser.cpp
+5
-5
unit-deserialization.cpp
test/src/unit-deserialization.cpp
+7
-7
No files found.
include/nlohmann/detail/input/parser.hpp
View file @
8d6b3d44
...
@@ -96,7 +96,9 @@ class parser
...
@@ -96,7 +96,9 @@ class parser
/// a parse error occurred
/// a parse error occurred
/// the byte position and the last token are reported
/// the byte position and the last token are reported
virtual
bool
parse_error
(
int
position
,
const
std
::
string
&
last_token
)
=
0
;
virtual
bool
parse_error
(
std
::
size_t
position
,
const
std
::
string
&
last_token
)
=
0
;
virtual
~
SAX
()
=
default
;
};
};
using
parser_callback_t
=
using
parser_callback_t
=
...
@@ -585,7 +587,7 @@ class parser
...
@@ -585,7 +587,7 @@ class parser
{
{
case
token_type
:
:
begin_object
:
case
token_type
:
:
begin_object
:
{
{
if
(
not
sax
->
start_object
(
-
1
))
if
(
not
sax
->
start_object
(
std
::
size_t
(
-
1
)
))
{
{
return
false
;
return
false
;
}
}
...
@@ -654,7 +656,7 @@ class parser
...
@@ -654,7 +656,7 @@ class parser
case
token_type
:
:
begin_array
:
case
token_type
:
:
begin_array
:
{
{
if
(
not
sax
->
start_array
(
-
1
))
if
(
not
sax
->
start_array
(
std
::
size_t
(
-
1
)
))
{
{
return
false
;
return
false
;
}
}
...
...
single_include/nlohmann/json.hpp
View file @
8d6b3d44
...
@@ -3219,7 +3219,9 @@ class parser
...
@@ -3219,7 +3219,9 @@ class parser
/// a parse error occurred
/// a parse error occurred
/// the byte position and the last token are reported
/// the byte position and the last token are reported
virtual
bool
parse_error
(
int
position
,
const
std
::
string
&
last_token
)
=
0
;
virtual
bool
parse_error
(
std
::
size_t
position
,
const
std
::
string
&
last_token
)
=
0
;
virtual
~
SAX
()
=
default
;
};
};
using
parser_callback_t
=
using
parser_callback_t
=
...
@@ -3708,7 +3710,7 @@ class parser
...
@@ -3708,7 +3710,7 @@ class parser
{
{
case
token_type
:
:
begin_object
:
case
token_type
:
:
begin_object
:
{
{
if
(
not
sax
->
start_object
(
-
1
))
if
(
not
sax
->
start_object
(
std
::
size_t
(
-
1
)
))
{
{
return
false
;
return
false
;
}
}
...
@@ -3777,7 +3779,7 @@ class parser
...
@@ -3777,7 +3779,7 @@ class parser
case
token_type
:
:
begin_array
:
case
token_type
:
:
begin_array
:
{
{
if
(
not
sax
->
start_array
(
-
1
))
if
(
not
sax
->
start_array
(
std
::
size_t
(
-
1
)
))
{
{
return
false
;
return
false
;
}
}
...
...
test/src/unit-class_parser.cpp
View file @
8d6b3d44
...
@@ -61,7 +61,7 @@ class SaxEventLogger : public nlohmann::json::SAX
...
@@ -61,7 +61,7 @@ class SaxEventLogger : public nlohmann::json::SAX
return
true
;
return
true
;
}
}
bool
number_float
(
json
::
number_float_t
val
,
const
std
::
string
&
s
)
override
bool
number_float
(
json
::
number_float_t
,
const
std
::
string
&
s
)
override
{
{
events
.
push_back
(
"number_float("
+
s
+
")"
);
events
.
push_back
(
"number_float("
+
s
+
")"
);
return
true
;
return
true
;
...
@@ -75,7 +75,7 @@ class SaxEventLogger : public nlohmann::json::SAX
...
@@ -75,7 +75,7 @@ class SaxEventLogger : public nlohmann::json::SAX
bool
start_object
(
std
::
size_t
elements
)
override
bool
start_object
(
std
::
size_t
elements
)
override
{
{
if
(
elements
==
-
1
)
if
(
elements
==
std
::
size_t
(
-
1
)
)
{
{
events
.
push_back
(
"start_object()"
);
events
.
push_back
(
"start_object()"
);
}
}
...
@@ -100,7 +100,7 @@ class SaxEventLogger : public nlohmann::json::SAX
...
@@ -100,7 +100,7 @@ class SaxEventLogger : public nlohmann::json::SAX
bool
start_array
(
std
::
size_t
elements
)
override
bool
start_array
(
std
::
size_t
elements
)
override
{
{
if
(
elements
==
-
1
)
if
(
elements
==
std
::
size_t
(
-
1
)
)
{
{
events
.
push_back
(
"start_array()"
);
events
.
push_back
(
"start_array()"
);
}
}
...
@@ -117,13 +117,13 @@ class SaxEventLogger : public nlohmann::json::SAX
...
@@ -117,13 +117,13 @@ class SaxEventLogger : public nlohmann::json::SAX
return
true
;
return
true
;
}
}
bool
binary
(
const
std
::
vector
<
uint8_t
>&
vec
)
override
bool
binary
(
const
std
::
vector
<
uint8_t
>&
)
override
{
{
events
.
push_back
(
"binary()"
);
events
.
push_back
(
"binary()"
);
return
true
;
return
true
;
}
}
bool
parse_error
(
int
position
,
const
std
::
string
&
last_token
)
override
bool
parse_error
(
std
::
size_t
position
,
const
std
::
string
&
)
override
{
{
errored
=
true
;
errored
=
true
;
events
.
push_back
(
"parse_error("
+
std
::
to_string
(
position
)
+
")"
);
events
.
push_back
(
"parse_error("
+
std
::
to_string
(
position
)
+
")"
);
...
...
test/src/unit-deserialization.cpp
View file @
8d6b3d44
...
@@ -60,7 +60,7 @@ struct SaxEventLogger : public nlohmann::json::SAX
...
@@ -60,7 +60,7 @@ struct SaxEventLogger : public nlohmann::json::SAX
return
true
;
return
true
;
}
}
bool
number_float
(
json
::
number_float_t
val
,
const
std
::
string
&
s
)
override
bool
number_float
(
json
::
number_float_t
,
const
std
::
string
&
s
)
override
{
{
events
.
push_back
(
"number_float("
+
s
+
")"
);
events
.
push_back
(
"number_float("
+
s
+
")"
);
return
true
;
return
true
;
...
@@ -74,7 +74,7 @@ struct SaxEventLogger : public nlohmann::json::SAX
...
@@ -74,7 +74,7 @@ struct SaxEventLogger : public nlohmann::json::SAX
bool
start_object
(
std
::
size_t
elements
)
override
bool
start_object
(
std
::
size_t
elements
)
override
{
{
if
(
elements
==
-
1
)
if
(
elements
==
std
::
size_t
(
-
1
)
)
{
{
events
.
push_back
(
"start_object()"
);
events
.
push_back
(
"start_object()"
);
}
}
...
@@ -99,7 +99,7 @@ struct SaxEventLogger : public nlohmann::json::SAX
...
@@ -99,7 +99,7 @@ struct SaxEventLogger : public nlohmann::json::SAX
bool
start_array
(
std
::
size_t
elements
)
override
bool
start_array
(
std
::
size_t
elements
)
override
{
{
if
(
elements
==
-
1
)
if
(
elements
==
std
::
size_t
(
-
1
)
)
{
{
events
.
push_back
(
"start_array()"
);
events
.
push_back
(
"start_array()"
);
}
}
...
@@ -116,13 +116,13 @@ struct SaxEventLogger : public nlohmann::json::SAX
...
@@ -116,13 +116,13 @@ struct SaxEventLogger : public nlohmann::json::SAX
return
true
;
return
true
;
}
}
bool
binary
(
const
std
::
vector
<
uint8_t
>&
vec
)
override
bool
binary
(
const
std
::
vector
<
uint8_t
>&
)
override
{
{
events
.
push_back
(
"binary()"
);
events
.
push_back
(
"binary()"
);
return
true
;
return
true
;
}
}
bool
parse_error
(
int
position
,
const
std
::
string
&
last_token
)
override
bool
parse_error
(
std
::
size_t
position
,
const
std
::
string
&
)
override
{
{
events
.
push_back
(
"parse_error("
+
std
::
to_string
(
position
)
+
")"
);
events
.
push_back
(
"parse_error("
+
std
::
to_string
(
position
)
+
")"
);
return
false
;
return
false
;
...
@@ -135,7 +135,7 @@ struct SaxEventLoggerExitAfterStartObject : public SaxEventLogger
...
@@ -135,7 +135,7 @@ struct SaxEventLoggerExitAfterStartObject : public SaxEventLogger
{
{
bool
start_object
(
std
::
size_t
elements
)
override
bool
start_object
(
std
::
size_t
elements
)
override
{
{
if
(
elements
==
-
1
)
if
(
elements
==
std
::
size_t
(
-
1
)
)
{
{
events
.
push_back
(
"start_object()"
);
events
.
push_back
(
"start_object()"
);
}
}
...
@@ -160,7 +160,7 @@ struct SaxEventLoggerExitAfterStartArray : public SaxEventLogger
...
@@ -160,7 +160,7 @@ struct SaxEventLoggerExitAfterStartArray : public SaxEventLogger
{
{
bool
start_array
(
std
::
size_t
elements
)
override
bool
start_array
(
std
::
size_t
elements
)
override
{
{
if
(
elements
==
-
1
)
if
(
elements
==
std
::
size_t
(
-
1
)
)
{
{
events
.
push_back
(
"start_array()"
);
events
.
push_back
(
"start_array()"
);
}
}
...
...
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