MongoType
MongoDB Collection Data Dump with BSON Types
|
Stack of BSONParserStackItem for storing the BSONObjectParser parse context. More...
#include <BSONObjectParser.hpp>
Stack of BSONParserStackItem for storing the BSONObjectParser parse context.
Stores the current state of the parsed BSON objects in a FILO data structure.
Definition at line 237 of file BSONObjectParser.hpp.
Public Member Functions | |
int | depth () const |
const BSONParserStackItem & | item (int index) const |
const BSONParserStackItem & | top () const |
Return the TOS item, leaving it in place. More... | |
void | push (const BSONObj &object, const string &key=string(), int elementIndex=0, int elementCount=1, int arrayIndex=-1, int arrayCount=0) |
Wrap the mongo::BSONObj object in a dynamically allocated BSONParserStackItem and push the resultant BSONParserStackItem to the stack. More... | |
void | push (BSONParserStackItem::ItemType type, const BSONElement &element, const string &key=string(), int elementIndex=0, int elementCount=1, int arrayIndex=-1, int arrayCount=0) |
Wrap the mongo::BSONElement element/array in a dynamically allocated BSONParserStackItem and push the resultant BSONParserStackItem to the stack. More... | |
void | drop () |
Drop the TOS. More... | |
string | toString () const |
Protected Member Functions | |
const BSONParserStackItem * | pop () |
Pop the TOS item. More... | |
void | push (const BSONParserStackItem *item) |
Push the item. More... | |
Private Types | |
typedef std::deque < std::unique_ptr< const BSONParserStackItem > > | Stack |
Private Member Functions | |
void | throwCount (int count) const |
Private Attributes | |
Stack | stack |
|
private |
Definition at line 238 of file BSONObjectParser.hpp.
|
inline |
Definition at line 243 of file BSONObjectParser.hpp.
References stack.
Referenced by mongotype::JSONDump::emitComma(), mongotype::JSONDump::emitKey(), item(), mongotype::JSONDump::onArrayEnd(), mongotype::JSONDump::onObjectEnd(), throwCount(), top(), and toString().
|
inline |
Drop the TOS.
Definition at line 340 of file BSONObjectParser.hpp.
References pop().
Referenced by mongotype::BSONObjectParser::parseElementRecursive(), and mongotype::BSONObjectParser::parseObjectRecursive().
|
inline |
[in] | index | Zero based index of the stack item where zero is the first item pushed. If negative the items are referenced from the top of the stack, ie.:
|
std::logic_error | On stack underflow. |
Definition at line 287 of file BSONObjectParser.hpp.
References depth(), stack, and throwCount().
Referenced by mongotype::JSONDump::emitComma(), mongotype::JSONDump::emitKey(), top(), and toString().
|
inlineprotected |
Pop the TOS item.
std::logic_error | On stack underflow. |
Definition at line 260 of file BSONObjectParser.hpp.
References stack, and throwCount().
Referenced by drop().
|
inlineprotected |
Push the item.
[in] | item | The reference to the item to be stored on the stack. |
Definition at line 272 of file BSONObjectParser.hpp.
References stack.
Referenced by mongotype::BSONObjectParser::parseElementRecursive(), mongotype::BSONObjectParser::parseObjectRecursive(), and push().
|
inline |
Wrap the mongo::BSONObj object in a dynamically allocated BSONParserStackItem and push the resultant BSONParserStackItem to the stack.
[in] | object | The reference to the BSON object to be encapsulated in a BSONParserStackItem object and pushed on the stack. |
[in] | key | The BSON key string of the contained 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 317 of file BSONObjectParser.hpp.
References push().
|
inline |
Wrap the mongo::BSONElement element/array in a dynamically allocated BSONParserStackItem and push the resultant BSONParserStackItem to the stack.
[in] | type | The ItemType of this element. For valid values see BSONParserStackItem::BSONParserStackItem(ItemType ptype, const BSONElement* element, const string& pkey, int pelementIndex, int pelementCount, int parrayIndex, int parrayCount). |
[in] | element | The reference to the BSON element to be encapsulated in a BSONParserStackItem object and pushed on the stack. |
[in] | key | The BSON key string of the contained 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 332 of file BSONObjectParser.hpp.
References push().
|
inlineprivate |
Definition at line 246 of file BSONObjectParser.hpp.
References depth().
Referenced by item(), and pop().
|
inline |
Return the TOS item, leaving it in place.
std::logic_error | On stack underflow. |
Definition at line 303 of file BSONObjectParser.hpp.
References depth(), and item().
Referenced by mongotype::JSONDump::emitComma(), mongotype::JSONDump::emitKey(), mongotype::BSONDotNotationDump::onArrayStart(), mongotype::BSONObjectTypeDump::onArrayStart(), mongotype::BSONDotNotationDump::onElement(), mongotype::BSONObjectTypeDump::onElement(), mongotype::JSONDump::onElement(), mongotype::BSONDotNotationDump::onObjectEnd(), mongotype::BSONDotNotationDump::onObjectStart(), and mongotype::BSONObjectTypeDump::onObjectStart().
|
inline |
Definition at line 344 of file BSONObjectParser.hpp.
References depth(), item(), and mongotype::BSONParserStackItem::toString().
Referenced by mongotype::JSONDump::nextLine().
|
private |