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
4232e407
Commit
4232e407
authored
Feb 04, 2017
by
StilesCrisis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up example code
parent
d84d5fe0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
12 deletions
+13
-12
CMakeLists.txt
example/CMakeLists.txt
+1
-0
simplepullreader.cpp
example/simplepullreader/simplepullreader.cpp
+12
-12
No files found.
example/CMakeLists.txt
View file @
4232e407
...
@@ -18,6 +18,7 @@ set(EXAMPLES
...
@@ -18,6 +18,7 @@ set(EXAMPLES
serialize
serialize
simpledom
simpledom
simplereader
simplereader
simplepullreader
simplewriter
simplewriter
tutorial
)
tutorial
)
...
...
example/simplepullreader/simplepullreader.cpp
View file @
4232e407
...
@@ -9,19 +9,19 @@ struct MyHandler {
...
@@ -9,19 +9,19 @@ struct MyHandler {
std
::
string
data
;
std
::
string
data
;
bool
Null
()
{
type
=
"Null"
;
data
.
clear
();
return
true
;
}
bool
Null
()
{
type
=
"Null"
;
data
.
clear
();
return
true
;
}
bool
Bool
(
bool
b
)
{
type
=
"Bool"
;
data
=
b
?
"true"
:
"false"
;
return
true
;
}
bool
Bool
(
bool
b
)
{
type
=
"Bool
:
"
;
data
=
b
?
"true"
:
"false"
;
return
true
;
}
bool
Int
(
int
i
)
{
type
=
"Int"
;
data
=
std
::
to_string
(
i
);
return
true
;
}
bool
Int
(
int
i
)
{
type
=
"Int
:
"
;
data
=
std
::
to_string
(
i
);
return
true
;
}
bool
Uint
(
unsigned
u
)
{
type
=
"Uint"
;
data
=
std
::
to_string
(
u
);
return
true
;
}
bool
Uint
(
unsigned
u
)
{
type
=
"Uint
:
"
;
data
=
std
::
to_string
(
u
);
return
true
;
}
bool
Int64
(
int64_t
i
)
{
type
=
"Int64"
;
data
=
std
::
to_string
(
i
);
return
true
;
}
bool
Int64
(
int64_t
i
)
{
type
=
"Int64
:
"
;
data
=
std
::
to_string
(
i
);
return
true
;
}
bool
Uint64
(
uint64_t
u
)
{
type
=
"Uint64"
;
data
=
std
::
to_string
(
u
);
return
true
;
}
bool
Uint64
(
uint64_t
u
)
{
type
=
"Uint64
:
"
;
data
=
std
::
to_string
(
u
);
return
true
;
}
bool
Double
(
double
d
)
{
type
=
"Double"
;
data
=
std
::
to_string
(
d
);
return
true
;
}
bool
Double
(
double
d
)
{
type
=
"Double
:
"
;
data
=
std
::
to_string
(
d
);
return
true
;
}
bool
RawNumber
(
const
char
*
str
,
SizeType
length
,
bool
)
{
type
=
"Number"
;
data
=
std
::
string
(
str
,
length
);
return
true
;
}
bool
RawNumber
(
const
char
*
str
,
SizeType
length
,
bool
)
{
type
=
"Number
:
"
;
data
=
std
::
string
(
str
,
length
);
return
true
;
}
bool
String
(
const
char
*
str
,
SizeType
length
,
bool
)
{
type
=
"String
"
data
=
std
::
string
(
str
,
length
);
return
true
;
}
bool
String
(
const
char
*
str
,
SizeType
length
,
bool
)
{
type
=
"String
:"
;
data
=
std
::
string
(
str
,
length
);
return
true
;
}
bool
StartObject
()
{
type
=
"StartObject"
;
data
.
clear
();
return
true
;
}
bool
StartObject
()
{
type
=
"StartObject"
;
data
.
clear
();
return
true
;
}
bool
Key
(
const
char
*
str
,
SizeType
length
,
bool
)
{
type
=
"Key
"
data
=
std
::
string
(
str
,
length
);
return
true
;
}
bool
Key
(
const
char
*
str
,
SizeType
length
,
bool
)
{
type
=
"Key
:"
;
data
=
std
::
string
(
str
,
length
);
return
true
;
}
bool
EndObject
(
SizeType
memberCount
)
{
type
=
"EndObject"
;
data
=
std
::
to_string
(
memberCount
);
return
true
;
}
bool
EndObject
(
SizeType
memberCount
)
{
type
=
"EndObject
:
"
;
data
=
std
::
to_string
(
memberCount
);
return
true
;
}
bool
StartArray
()
{
type
=
"StartArray"
;
data
.
clear
();
return
true
;
}
bool
StartArray
()
{
type
=
"StartArray"
;
data
.
clear
();
return
true
;
}
bool
EndArray
(
SizeType
elementCount
)
{
type
=
"EndArray"
;
data
=
std
::
to_string
(
elementCount
);
return
true
;
}
bool
EndArray
(
SizeType
elementCount
)
{
type
=
"EndArray
:
"
;
data
=
std
::
to_string
(
elementCount
);
return
true
;
}
};
};
int
main
()
{
int
main
()
{
...
@@ -33,7 +33,7 @@ int main() {
...
@@ -33,7 +33,7 @@ int main() {
reader
.
IterativeParseInit
();
reader
.
IterativeParseInit
();
while
(
!
reader
.
IterativeParseComplete
())
{
while
(
!
reader
.
IterativeParseComplete
())
{
reader
.
IterativeParseNext
<
kParseDefaultFlags
>
(
ss
,
handler
);
reader
.
IterativeParseNext
<
kParseDefaultFlags
>
(
ss
,
handler
);
cout
<<
handler
.
type
<<
": "
<<
handler
.
data
<<
endl
;
cout
<<
handler
.
type
<<
handler
.
data
<<
endl
;
}
}
return
0
;
return
0
;
...
...
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