MongoType
MongoDB Collection Data Dump with BSON Types
|
The BSON Parser. More...
#include <BSONObjectParser.hpp>
The BSON Parser.
This class is is used to tear apart a given BSON object and process its data content.
It is intended to be fully extensible as the internal methods are all declared protected.
Usage:
Definition at line 447 of file BSONObjectParser.hpp.
Public Member Functions | |
BSONObjectParser (IBSONObjectVisitor &pvisitor) | |
Construct a BSON Object parser. More... | |
virtual | ~BSONObjectParser () |
virtual void | parse (const BSONObj &object) |
Parse a BSON Object (BSONObj) More... | |
Protected Member Functions | |
virtual void | parseElementRecursive (const BSONElement &element, string &key, int elementIndex=0, int elementCount=1, int arrayIndex=-1, int arrayCount=0) |
Recursively parse a BSONElement. More... | |
virtual void | parseObjectRecursive (const BSONObj &object, string &key, int elementIndex=0, int elementCount=1, int arrayIndex=-1, int arrayCount=0) |
Recursively parse a BSON Object. More... | |
Protected Attributes | |
IBSONObjectVisitor & | visitor |
BSONParserStack | stack |
|
inline |
Construct a BSON Object parser.
[in] | pvisitor | The instance of the IBSONObjectVisitor visitor subclass that will receive the parse events. |
Construct a parser and register the parsing event handler/visitor.
Definition at line 548 of file BSONObjectParser.hpp.
|
inlinevirtual |
Definition at line 549 of file BSONObjectParser.hpp.
|
inlinevirtual |
Parse a BSON Object (BSONObj)
[in] | object | The BSON object to parse. |
Parse the given BSON object and invoke the event handlers of the IBSONObjectVisitor visitor subclass registered by constructor BSONObjectParser::BSONObjectParser(IBSONObjectVisitor& pvisitor).
Definition at line 560 of file BSONObjectParser.hpp.
References mongotype::IBSONObjectVisitor::onParseEnd(), mongotype::IBSONObjectVisitor::onParseStart(), parseObjectRecursive(), and visitor.
Referenced by mongotype::BSONDotNotationDump::render(), mongotype::BSONObjectTypeDump::render(), and mongotype::JSONDump::render().
|
inlineprotectedvirtual |
Recursively parse a BSONElement.
[in] | element | The element to recursively process. |
[in] | key | The BSON key string of the mongo::BSONObj. |
[in] | elementIndex | The element index of the contained mongo::BSONObj See BSONParserStackItem::elementIndex. |
[in] | elementCount | The element count. See BSONParserStackItem::elementCount. |
[in] | arrayIndex | The array index of the contained mongo::BSONObj See BSONParserStackItem::arrayIndex. |
[in] | arrayCount | The array count. See BSONParserStackItem::arrayCount. |
Definition at line 472 of file BSONObjectParser.hpp.
References mongotype::BSONParserStack::drop(), mongotype::IBSONObjectVisitor::onArrayEnd(), mongotype::IBSONObjectVisitor::onArrayStart(), mongotype::IBSONObjectVisitor::onElement(), parseObjectRecursive(), mongotype::BSONParserStack::push(), stack, and visitor.
Referenced by parseObjectRecursive().
|
inlineprotectedvirtual |
Recursively parse a BSON Object.
[in] | object | The BSON object to process. |
[in] | key | The BSON key string of the mongo::BSONObj. |
[in] | elementIndex | The element index of the contained mongo::BSONObj See BSONParserStackItem::elementIndex. |
[in] | elementCount | The element count. See BSONParserStackItem::elementCount. |
[in] | arrayIndex | The array index of the contained mongo::BSONObj See BSONParserStackItem::arrayIndex. |
[in] | arrayCount | The array count. See BSONParserStackItem::arrayCount.
|
Iterate through all the BSONElement(s) contained in the BSONObj and process them via indirect recursion by calling parseElementRecursive().
Definition at line 523 of file BSONObjectParser.hpp.
References mongotype::BSONParserStack::drop(), mongotype::IBSONObjectVisitor::onObjectEnd(), mongotype::IBSONObjectVisitor::onObjectStart(), parseElementRecursive(), mongotype::BSONParserStack::push(), stack, and visitor.
Referenced by parse(), and parseElementRecursive().
|
protected |
Definition at line 454 of file BSONObjectParser.hpp.
Referenced by parseElementRecursive(), and parseObjectRecursive().
|
protected |
Visitor implementation that receives the parse events.
Definition at line 453 of file BSONObjectParser.hpp.
Referenced by parse(), parseElementRecursive(), and parseObjectRecursive().