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
efcc826e
Unverified
Commit
efcc826e
authored
Jul 06, 2020
by
Niels Lohmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🚨
fix warning
parent
b04dc055
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
26 deletions
+26
-26
Makefile
Makefile
+1
-1
README.md
README.md
+2
-2
test/src/unit-udt_macro.cpp
test/src/unit-udt_macro.cpp
+23
-23
No files found.
Makefile
View file @
efcc826e
...
...
@@ -253,7 +253,7 @@ pedantic_gcc:
-Wmismatched-tags
\
-Wmissing-attributes
\
-Wmissing-braces
\
-Wmissing-declarations
\
-W
no-
missing-declarations
\
-Wmissing-field-initializers
\
-Wmissing-include-dirs
\
-Wmissing-profile
\
...
...
README.md
View file @
efcc826e
...
...
@@ -886,7 +886,7 @@ The `to_json`/`from_json` functions for the `person` struct above can be created
```
cpp
namespace
ns
{
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE
(
person
,
name
,
address
,
age
)
;
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE
(
person
,
name
,
address
,
age
)
}
```
...
...
@@ -901,7 +901,7 @@ namespace ns {
int
postcode
;
public:
NLOHMANN_DEFINE_TYPE_INTRUSIVE
(
address
,
street
,
housenumber
,
postcode
)
;
NLOHMANN_DEFINE_TYPE_INTRUSIVE
(
address
,
street
,
housenumber
,
postcode
)
};
}
```
...
...
test/src/unit-udt_macro.cpp
View file @
efcc826e
...
...
@@ -37,9 +37,9 @@ namespace persons
class
person_with_private_data
{
private:
std
::
string
name
;
std
::
string
name
=
""
;
int
age
=
0
;
json
metadata
;
json
metadata
=
nullptr
;
public:
bool
operator
==
(
const
person_with_private_data
&
rhs
)
const
...
...
@@ -48,21 +48,21 @@ class person_with_private_data
}
person_with_private_data
()
=
default
;
person_with_private_data
(
std
::
string
name
,
int
age
,
json
metadata
)
:
name
(
std
::
move
(
name
))
,
age
(
age
)
,
metadata
(
std
::
move
(
metadata
))
person_with_private_data
(
std
::
string
name
_
,
int
age_
,
json
metadata_
)
:
name
(
std
::
move
(
name
_
))
,
age
(
age
_
)
,
metadata
(
std
::
move
(
metadata
_
))
{}
NLOHMANN_DEFINE_TYPE_INTRUSIVE
(
person_with_private_data
,
age
,
name
,
metadata
)
;
NLOHMANN_DEFINE_TYPE_INTRUSIVE
(
person_with_private_data
,
age
,
name
,
metadata
)
};
class
person_without_private_data_1
{
public:
std
::
string
name
;
int
age
=
0
;
json
metadata
;
std
::
string
name
=
""
;
int
age
=
0
;
json
metadata
=
nullptr
;
bool
operator
==
(
const
person_without_private_data_1
&
rhs
)
const
{
...
...
@@ -70,21 +70,21 @@ class person_without_private_data_1
}
person_without_private_data_1
()
=
default
;
person_without_private_data_1
(
std
::
string
name
,
int
age
,
json
metadata
)
:
name
(
std
::
move
(
name
))
,
age
(
age
)
,
metadata
(
std
::
move
(
metadata
))
person_without_private_data_1
(
std
::
string
name
_
,
int
age_
,
json
metadata_
)
:
name
(
std
::
move
(
name
_
))
,
age
(
age
_
)
,
metadata
(
std
::
move
(
metadata
_
))
{}
NLOHMANN_DEFINE_TYPE_INTRUSIVE
(
person_without_private_data_1
,
age
,
name
,
metadata
)
;
NLOHMANN_DEFINE_TYPE_INTRUSIVE
(
person_without_private_data_1
,
age
,
name
,
metadata
)
};
class
person_without_private_data_2
{
public:
std
::
string
name
;
int
age
=
0
;
json
metadata
;
std
::
string
name
=
""
;
int
age
=
0
;
json
metadata
=
nullptr
;
bool
operator
==
(
const
person_without_private_data_2
&
rhs
)
const
{
...
...
@@ -92,14 +92,14 @@ class person_without_private_data_2
}
person_without_private_data_2
()
=
default
;
person_without_private_data_2
(
std
::
string
name
,
int
age
,
json
metadata
)
:
name
(
std
::
move
(
name
))
,
age
(
age
)
,
metadata
(
std
::
move
(
metadata
))
person_without_private_data_2
(
std
::
string
name
_
,
int
age_
,
json
metadata_
)
:
name
(
std
::
move
(
name
_
))
,
age
(
age
_
)
,
metadata
(
std
::
move
(
metadata
_
))
{}
};
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE
(
person_without_private_data_2
,
age
,
name
,
metadata
)
;
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE
(
person_without_private_data_2
,
age
,
name
,
metadata
)
}
// namespace persons
TEST_CASE_TEMPLATE
(
"Serialization/deserialization via NLOHMANN_DEFINE_TYPE_INTRUSIVE"
,
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