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
9cdd278f
Commit
9cdd278f
authored
May 09, 2015
by
Niels
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
overworked code for pull request #71
parent
aca3f65b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
3 deletions
+20
-3
src/json.hpp
src/json.hpp
+3
-3
src/json.hpp.re2c
src/json.hpp.re2c
+5
-0
test/unit.cpp
test/unit.cpp
+12
-0
No files found.
src/json.hpp
View file @
9cdd278f
...
...
@@ -417,10 +417,10 @@ class basic_json
inline
basic_json
(
const
number_integer_t
&
value
)
:
m_type
(
value_t
::
number_integer
),
m_value
(
value
)
{}
/// create an int number to support enum type (implicit)
inline
basic_json
(
int
int_enum
)
:
m_type
(
value_t
::
number_integer
),
m_value
((
NumberIntegerType
)
int_enum
)
inline
basic_json
(
const
int
int_enum
)
:
m_type
(
value_t
::
number_integer
),
m_value
(
static_cast
<
number_integer_t
>
(
int_enum
)
)
{}
/// create an integer number (implicit)
...
...
src/json.hpp.re2c
View file @
9cdd278f
...
...
@@ -418,6 +418,11 @@ class basic_json
: m_type(value_t::number_integer), m_value(value)
{}
/// create an int number to support enum type (implicit)
inline basic_json(const int int_enum)
: m_type(value_t::number_integer), m_value(static_cast<number_integer_t>(int_enum))
{}
/// create an integer number (implicit)
template<typename T, typename
std::enable_if<
...
...
test/unit.cpp
View file @
9cdd278f
...
...
@@ -8529,4 +8529,16 @@ TEST_CASE("regression tests")
CHECK
(
json
(
json
::
number_float_t
(
INFINITY
))
==
json
());
}
}
SECTION
(
"pull request #71 - handle enum type"
)
{
enum
{
t
=
0
};
json
j
=
json
::
array
();
j
.
push_back
(
t
);
j
.
push_back
(
json
::
object
(
{
{
"game_type"
,
t
}
}));
}
}
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