Commit b010f388 authored by Milo Yip's avatar Milo Yip

Change FilterKeyHandler from struct to class

Also disable copy constructor/assignment operator
parent 05b2ed75
......@@ -15,7 +15,8 @@ using namespace rapidjson;
// This handler forwards event into an output handler, with filtering the descendent events of specified key.
template <typename OutputHandler>
struct FilterKeyHandler {
class FilterKeyHandler {
public:
typedef char Ch;
FilterKeyHandler(OutputHandler& outputHandler, const Ch* keyString, SizeType keyLength) :
......@@ -87,6 +88,10 @@ struct FilterKeyHandler {
return outputHandler_.EndArray(elementCount) && EndValue();
}
private:
FilterKeyHandler(const FilterKeyHandler&);
FilterKeyHandler& operator=(const FilterKeyHandler&);
bool EndValue() {
if (filterValueDepth_ == 1) // Just at the end of value after filtered key
filterValueDepth_ = 0;
......
......@@ -16,7 +16,8 @@ using namespace rapidjson;
// This handler forwards event into an output handler, with filtering the descendent events of specified key.
template <typename OutputHandler>
struct FilterKeyHandler {
class FilterKeyHandler {
public:
typedef char Ch;
FilterKeyHandler(OutputHandler& outputHandler, const Ch* keyString, SizeType keyLength) :
......@@ -88,6 +89,10 @@ struct FilterKeyHandler {
return outputHandler_.EndArray(elementCount) && EndValue();
}
private:
FilterKeyHandler(const FilterKeyHandler&);
FilterKeyHandler& operator=(const FilterKeyHandler&);
bool EndValue() {
if (filterValueDepth_ == 1) // Just at the end of value after filtered key
filterValueDepth_ = 0;
......@@ -122,6 +127,9 @@ public:
const ParseResult& GetParseResult() const { return parseResult_; }
private:
FilterKeyReader(const FilterKeyReader&);
FilterKeyReader& operator=(const FilterKeyReader&);
InputStream& is_;
const char* keyString_;
const SizeType keyLength_;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment