Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
R
rapidjson
Project
Project
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
rapidjson
Commits
82b5c425
Commit
82b5c425
authored
Feb 12, 2018
by
Milo Yip
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Compile error because of -Werror=effc++ is on
Fix #1170 Also fixed C++03 problem for using nullptr.
parent
672e7dd3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
6 deletions
+12
-6
archiver.h
example/archiver/archiver.h
+1
-1
archivertest.cpp
example/archiver/archivertest.cpp
+11
-5
No files found.
example/archiver/archiver.h
View file @
82b5c425
...
@@ -74,7 +74,7 @@ public:
...
@@ -74,7 +74,7 @@ public:
bool
HasMember
(
const
char
*
name
)
const
;
bool
HasMember
(
const
char
*
name
)
const
;
JsonReader
&
EndObject
();
JsonReader
&
EndObject
();
JsonReader
&
StartArray
(
size_t
*
size
=
nullptr
);
JsonReader
&
StartArray
(
size_t
*
size
=
0
);
JsonReader
&
EndArray
();
JsonReader
&
EndArray
();
JsonReader
&
operator
&
(
bool
&
b
);
JsonReader
&
operator
&
(
bool
&
b
);
...
...
example/archiver/archivertest.cpp
View file @
82b5c425
...
@@ -6,6 +6,11 @@
...
@@ -6,6 +6,11 @@
// Test1: simple object
// Test1: simple object
struct
Student
{
struct
Student
{
Student
()
:
name
(),
age
(),
height
(),
canSwim
()
{}
Student
(
const
std
::
string
name
,
unsigned
age
,
double
height
,
bool
canSwim
)
:
name
(
name
),
age
(
age
),
height
(
height
),
canSwim
(
canSwim
)
{}
std
::
string
name
;
std
::
string
name
;
unsigned
age
;
unsigned
age
;
double
height
;
double
height
;
...
@@ -31,7 +36,7 @@ void test1() {
...
@@ -31,7 +36,7 @@ void test1() {
// Serialize
// Serialize
{
{
Student
s
=
{
"Lua"
,
9
,
150.5
,
true
}
;
Student
s
(
"Lua"
,
9
,
150.5
,
true
)
;
JsonWriter
writer
;
JsonWriter
writer
;
writer
&
s
;
writer
&
s
;
...
@@ -54,6 +59,7 @@ void test1() {
...
@@ -54,6 +59,7 @@ void test1() {
// You can map a JSON array to other data structures as well
// You can map a JSON array to other data structures as well
struct
Group
{
struct
Group
{
Group
()
:
groupName
(),
students
()
{}
std
::
string
groupName
;
std
::
string
groupName
;
std
::
vector
<
Student
>
students
;
std
::
vector
<
Student
>
students
;
};
};
...
@@ -124,7 +130,7 @@ public:
...
@@ -124,7 +130,7 @@ public:
virtual
void
Print
(
std
::
ostream
&
os
)
const
=
0
;
virtual
void
Print
(
std
::
ostream
&
os
)
const
=
0
;
protected
:
protected
:
Shape
()
{}
Shape
()
:
x_
(),
y_
()
{}
Shape
(
double
x
,
double
y
)
:
x_
(
x
),
y_
(
y
)
{}
Shape
(
double
x
,
double
y
)
:
x_
(
x
),
y_
(
y
)
{}
template
<
typename
Archiver
>
template
<
typename
Archiver
>
...
@@ -142,7 +148,7 @@ Archiver& operator&(Archiver& ar, Shape& s) {
...
@@ -142,7 +148,7 @@ Archiver& operator&(Archiver& ar, Shape& s) {
class
Circle
:
public
Shape
{
class
Circle
:
public
Shape
{
public
:
public
:
Circle
()
{}
Circle
()
:
radius_
()
{}
Circle
(
double
x
,
double
y
,
double
radius
)
:
Shape
(
x
,
y
),
radius_
(
radius
)
{}
Circle
(
double
x
,
double
y
,
double
radius
)
:
Shape
(
x
,
y
),
radius_
(
radius
)
{}
~
Circle
()
{}
~
Circle
()
{}
...
@@ -168,7 +174,7 @@ Archiver& operator&(Archiver& ar, Circle& c) {
...
@@ -168,7 +174,7 @@ Archiver& operator&(Archiver& ar, Circle& c) {
class
Box
:
public
Shape
{
class
Box
:
public
Shape
{
public
:
public
:
Box
()
{}
Box
()
:
width_
(),
height_
()
{}
Box
(
double
x
,
double
y
,
double
width
,
double
height
)
:
Shape
(
x
,
y
),
width_
(
width
),
height_
(
height
)
{}
Box
(
double
x
,
double
y
,
double
width
,
double
height
)
:
Shape
(
x
,
y
),
width_
(
width
),
height_
(
height
)
{}
~
Box
()
{}
~
Box
()
{}
...
@@ -195,7 +201,7 @@ Archiver& operator&(Archiver& ar, Box& b) {
...
@@ -195,7 +201,7 @@ Archiver& operator&(Archiver& ar, Box& b) {
class
Canvas
{
class
Canvas
{
public
:
public
:
Canvas
()
{}
Canvas
()
:
shapes_
()
{}
~
Canvas
()
{
Clear
();
}
~
Canvas
()
{
Clear
();
}
void
Clear
()
{
void
Clear
()
{
...
...
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