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
8e9a7119
Commit
8e9a7119
authored
Jun 15, 2015
by
Niels
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
closes #90
parent
13751625
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
0 deletions
+40
-0
json.hpp
src/json.hpp
+12
-0
json.hpp.re2c
src/json.hpp.re2c
+12
-0
unit.cpp
test/unit.cpp
+16
-0
No files found.
src/json.hpp
View file @
8e9a7119
...
...
@@ -825,6 +825,18 @@ class basic_json
return
(
m_type
==
value_t
::
number_integer
)
or
(
m_type
==
value_t
::
number_float
);
}
// return whether value an integer is number
bool
is_number_integer
()
const
noexcept
{
return
m_type
==
value_t
::
number_integer
;
}
// return whether value is a floating-point number
bool
is_number_float
()
const
noexcept
{
return
m_type
==
value_t
::
number_float
;
}
// return whether value is object
bool
is_object
()
const
noexcept
{
...
...
src/json.hpp.re2c
View file @
8e9a7119
...
...
@@ -825,6 +825,18 @@ class basic_json
return (m_type == value_t::number_integer) or (m_type == value_t::number_float);
}
// return whether value an integer is number
bool is_number_integer() const noexcept
{
return m_type == value_t::number_integer;
}
// return whether value is a floating-point number
bool is_number_float() const noexcept
{
return m_type == value_t::number_float;
}
// return whether value is object
bool is_object() const noexcept
{
...
...
test/unit.cpp
View file @
8e9a7119
...
...
@@ -1328,6 +1328,8 @@ TEST_CASE("object inspection")
CHECK
(
not
j
.
is_null
());
CHECK
(
not
j
.
is_boolean
());
CHECK
(
not
j
.
is_number
());
CHECK
(
not
j
.
is_number_integer
());
CHECK
(
not
j
.
is_number_float
());
CHECK
(
j
.
is_object
());
CHECK
(
not
j
.
is_array
());
CHECK
(
not
j
.
is_string
());
...
...
@@ -1340,6 +1342,8 @@ TEST_CASE("object inspection")
CHECK
(
not
j
.
is_null
());
CHECK
(
not
j
.
is_boolean
());
CHECK
(
not
j
.
is_number
());
CHECK
(
not
j
.
is_number_integer
());
CHECK
(
not
j
.
is_number_float
());
CHECK
(
not
j
.
is_object
());
CHECK
(
j
.
is_array
());
CHECK
(
not
j
.
is_string
());
...
...
@@ -1352,6 +1356,8 @@ TEST_CASE("object inspection")
CHECK
(
j
.
is_null
());
CHECK
(
not
j
.
is_boolean
());
CHECK
(
not
j
.
is_number
());
CHECK
(
not
j
.
is_number_integer
());
CHECK
(
not
j
.
is_number_float
());
CHECK
(
not
j
.
is_object
());
CHECK
(
not
j
.
is_array
());
CHECK
(
not
j
.
is_string
());
...
...
@@ -1364,6 +1370,8 @@ TEST_CASE("object inspection")
CHECK
(
not
j
.
is_null
());
CHECK
(
j
.
is_boolean
());
CHECK
(
not
j
.
is_number
());
CHECK
(
not
j
.
is_number_integer
());
CHECK
(
not
j
.
is_number_float
());
CHECK
(
not
j
.
is_object
());
CHECK
(
not
j
.
is_array
());
CHECK
(
not
j
.
is_string
());
...
...
@@ -1376,6 +1384,8 @@ TEST_CASE("object inspection")
CHECK
(
not
j
.
is_null
());
CHECK
(
not
j
.
is_boolean
());
CHECK
(
not
j
.
is_number
());
CHECK
(
not
j
.
is_number_integer
());
CHECK
(
not
j
.
is_number_float
());
CHECK
(
not
j
.
is_object
());
CHECK
(
not
j
.
is_array
());
CHECK
(
j
.
is_string
());
...
...
@@ -1388,6 +1398,8 @@ TEST_CASE("object inspection")
CHECK
(
not
j
.
is_null
());
CHECK
(
not
j
.
is_boolean
());
CHECK
(
j
.
is_number
());
CHECK
(
j
.
is_number_integer
());
CHECK
(
not
j
.
is_number_float
());
CHECK
(
not
j
.
is_object
());
CHECK
(
not
j
.
is_array
());
CHECK
(
not
j
.
is_string
());
...
...
@@ -1400,6 +1412,8 @@ TEST_CASE("object inspection")
CHECK
(
not
j
.
is_null
());
CHECK
(
not
j
.
is_boolean
());
CHECK
(
j
.
is_number
());
CHECK
(
not
j
.
is_number_integer
());
CHECK
(
j
.
is_number_float
());
CHECK
(
not
j
.
is_object
());
CHECK
(
not
j
.
is_array
());
CHECK
(
not
j
.
is_string
());
...
...
@@ -1412,6 +1426,8 @@ TEST_CASE("object inspection")
CHECK
(
not
j
.
is_null
());
CHECK
(
not
j
.
is_boolean
());
CHECK
(
not
j
.
is_number
());
CHECK
(
not
j
.
is_number_integer
());
CHECK
(
not
j
.
is_number_float
());
CHECK
(
not
j
.
is_object
());
CHECK
(
not
j
.
is_array
());
CHECK
(
not
j
.
is_string
());
...
...
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