Change FilterKeyHandler from struct to class
Also disable copy constructor/assignment operator
This commit is contained in:
parent
05b2ed7532
commit
b010f388d1
@ -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,12 +88,16 @@ 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;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
OutputHandler& outputHandler_;
|
OutputHandler& outputHandler_;
|
||||||
const char* keyString_;
|
const char* keyString_;
|
||||||
const SizeType keyLength_;
|
const SizeType keyLength_;
|
||||||
|
@ -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,12 +89,16 @@ 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;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
OutputHandler& outputHandler_;
|
OutputHandler& outputHandler_;
|
||||||
const char* keyString_;
|
const char* keyString_;
|
||||||
const SizeType keyLength_;
|
const SizeType keyLength_;
|
||||||
@ -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_;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user