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
b010f388
Commit
b010f388
authored
Apr 23, 2016
by
Milo Yip
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change FilterKeyHandler from struct to class
Also disable copy constructor/assignment operator
parent
05b2ed75
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
2 deletions
+15
-2
filterkey.cpp
example/filterkey/filterkey.cpp
+6
-1
filterkeydom.cpp
example/filterkeydom/filterkeydom.cpp
+9
-1
No files found.
example/filterkey/filterkey.cpp
View file @
b010f388
...
@@ -15,7 +15,8 @@ using namespace rapidjson;
...
@@ -15,7 +15,8 @@ using namespace rapidjson;
// This handler forwards event into an output handler, with filtering the descendent events of specified key.
// This handler forwards event into an output handler, with filtering the descendent events of specified key.
template
<
typename
OutputHandler
>
template
<
typename
OutputHandler
>
struct
FilterKeyHandler
{
class
FilterKeyHandler
{
public
:
typedef
char
Ch
;
typedef
char
Ch
;
FilterKeyHandler
(
OutputHandler
&
outputHandler
,
const
Ch
*
keyString
,
SizeType
keyLength
)
:
FilterKeyHandler
(
OutputHandler
&
outputHandler
,
const
Ch
*
keyString
,
SizeType
keyLength
)
:
...
@@ -87,6 +88,10 @@ struct FilterKeyHandler {
...
@@ -87,6 +88,10 @@ struct FilterKeyHandler {
return
outputHandler_
.
EndArray
(
elementCount
)
&&
EndValue
();
return
outputHandler_
.
EndArray
(
elementCount
)
&&
EndValue
();
}
}
private
:
FilterKeyHandler
(
const
FilterKeyHandler
&
);
FilterKeyHandler
&
operator
=
(
const
FilterKeyHandler
&
);
bool
EndValue
()
{
bool
EndValue
()
{
if
(
filterValueDepth_
==
1
)
// Just at the end of value after filtered key
if
(
filterValueDepth_
==
1
)
// Just at the end of value after filtered key
filterValueDepth_
=
0
;
filterValueDepth_
=
0
;
...
...
example/filterkeydom/filterkeydom.cpp
View file @
b010f388
...
@@ -16,7 +16,8 @@ using namespace rapidjson;
...
@@ -16,7 +16,8 @@ using namespace rapidjson;
// This handler forwards event into an output handler, with filtering the descendent events of specified key.
// This handler forwards event into an output handler, with filtering the descendent events of specified key.
template
<
typename
OutputHandler
>
template
<
typename
OutputHandler
>
struct
FilterKeyHandler
{
class
FilterKeyHandler
{
public
:
typedef
char
Ch
;
typedef
char
Ch
;
FilterKeyHandler
(
OutputHandler
&
outputHandler
,
const
Ch
*
keyString
,
SizeType
keyLength
)
:
FilterKeyHandler
(
OutputHandler
&
outputHandler
,
const
Ch
*
keyString
,
SizeType
keyLength
)
:
...
@@ -88,6 +89,10 @@ struct FilterKeyHandler {
...
@@ -88,6 +89,10 @@ struct FilterKeyHandler {
return
outputHandler_
.
EndArray
(
elementCount
)
&&
EndValue
();
return
outputHandler_
.
EndArray
(
elementCount
)
&&
EndValue
();
}
}
private
:
FilterKeyHandler
(
const
FilterKeyHandler
&
);
FilterKeyHandler
&
operator
=
(
const
FilterKeyHandler
&
);
bool
EndValue
()
{
bool
EndValue
()
{
if
(
filterValueDepth_
==
1
)
// Just at the end of value after filtered key
if
(
filterValueDepth_
==
1
)
// Just at the end of value after filtered key
filterValueDepth_
=
0
;
filterValueDepth_
=
0
;
...
@@ -122,6 +127,9 @@ public:
...
@@ -122,6 +127,9 @@ public:
const
ParseResult
&
GetParseResult
()
const
{
return
parseResult_
;
}
const
ParseResult
&
GetParseResult
()
const
{
return
parseResult_
;
}
private
:
private
:
FilterKeyReader
(
const
FilterKeyReader
&
);
FilterKeyReader
&
operator
=
(
const
FilterKeyReader
&
);
InputStream
&
is_
;
InputStream
&
is_
;
const
char
*
keyString_
;
const
char
*
keyString_
;
const
SizeType
keyLength_
;
const
SizeType
keyLength_
;
...
...
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