|
MongoType
MongoDB Collection Data Dump with BSON Types
|
Container class for const references to mongo::BSONObj and mongo::BSONElement. More...
#include <BSONObjectParser.hpp>
Container class for const references to mongo::BSONObj and mongo::BSONElement.
This class wraps the tagged union BSONParserStackItem::Item to store the objects and elements.
Definition at line 51 of file BSONObjectParser.hpp.

Classes | |
| union | Item |
Public Types | |
| enum | ItemType { OBJECT, ARRAY, ELEMENT } |
Public Member Functions | |
| BSONParserStackItem (const BSONObj *object, const string &pkey, int pelementIndex, int pelementCount, int parrayIndex, int parrayCount) | |
| BSONParserStackItem (ItemType ptype, const BSONElement *element, const string &pkey, int pelementIndex, int pelementCount, int parrayIndex, int parrayCount) | |
| ItemType | getType () const |
| const BSONObj & | getObject () const |
| const BSONElement & | getElement () const |
| const BSONElement & | getArray () const |
| const string & | getKey () const |
| int | getElementIndex () const |
| int | getElementCount () const |
| int | getArrayIndex () const |
| int | getArrayCount () const |
| string | toString () const |
Private Member Functions | |
| void | validate (ItemType t) const |
Private Attributes | |
| ItemType | type |
| union mongotype::BSONParserStackItem::Item | item |
| const string & | key |
| int | elementIndex |
| int | elementCount |
| int | arrayIndex |
| int | arrayCount |
The BSON type of the contained object.
| Enumerator | |
|---|---|
| OBJECT |
The contained object is mongo::BSONObj. |
| ARRAY |
The contained object is mongo::BSONElement array. |
| ELEMENT |
The contained object is mongo::BSONElement scalar. |
Definition at line 56 of file BSONObjectParser.hpp.
|
inline |
Construct a BSONParserStackItem containing a pointer to a mongo::BSONObj. The ItemType is implicitly set to OBJECT.
| [in] | object | The pointer to the mongo::BSONObj. |
| [in] | pkey | The BSON key string of the contained mongo::BSONObj. |
| [in] | pelementIndex | The element index of the contained mongo::BSONObj See elementIndex. |
| [in] | pelementCount | The element count. See elementCount. |
| [in] | parrayIndex | The array index of the contained mongo::BSONObj See arrayIndex. |
| [in] | parrayCount | The array count. See arrayCount. |
Definition at line 145 of file BSONObjectParser.hpp.
|
inline |
Construct a BSONParserStackItem containing a pointer to a mongo::BSONElement.
| [in] | ptype | The ItemType of this element. The valid types are: |
| [in] | element | The pointer to the mongo::BSONElement. |
| [in] | pkey | The BSON key string of the contained mongo::BSONObj. |
| [in] | pelementIndex | The element index of the contained mongo::BSONObj See elementIndex. |
| [in] | pelementCount | The element count. See elementCount. |
| [in] | parrayIndex | The array index of the contained mongo::BSONObj See arrayIndex. |
| [in] | parrayCount | The array count. See arrayCount. |
Definition at line 159 of file BSONObjectParser.hpp.
|
inline |
Definition at line 176 of file BSONObjectParser.hpp.
References ARRAY, mongotype::BSONParserStackItem::Item::element, item, and validate().
Referenced by mongotype::BSONDotNotationDump::onArrayStart().


|
inline |
Definition at line 197 of file BSONObjectParser.hpp.
References arrayCount.
Referenced by mongotype::BSONObjectTypeDump::onArrayStart().

|
inline |
Definition at line 193 of file BSONObjectParser.hpp.
References arrayIndex.
Referenced by mongotype::JSONDump::emitComma(), mongotype::BSONDotNotationDump::onObjectEnd(), mongotype::BSONDotNotationDump::onObjectStart(), and mongotype::BSONObjectTypeDump::onObjectStart().

|
inline |
Definition at line 171 of file BSONObjectParser.hpp.
References ELEMENT, mongotype::BSONParserStackItem::Item::element, item, and validate().
Referenced by mongotype::BSONDotNotationDump::onElement(), mongotype::BSONObjectTypeDump::onElement(), and mongotype::JSONDump::onElement().


|
inline |
Definition at line 189 of file BSONObjectParser.hpp.
References elementCount.
|
inline |
Definition at line 185 of file BSONObjectParser.hpp.
References elementIndex.
Referenced by mongotype::JSONDump::emitComma().

|
inline |
Definition at line 181 of file BSONObjectParser.hpp.
References key.
Referenced by mongotype::JSONDump::emitKey().

|
inline |
Definition at line 166 of file BSONObjectParser.hpp.
References item, OBJECT, mongotype::BSONParserStackItem::Item::object, and validate().

|
inline |
Definition at line 162 of file BSONObjectParser.hpp.
References type.
Referenced by mongotype::JSONDump::emitComma(), and mongotype::JSONDump::emitKey().

|
inline |
Definition at line 201 of file BSONObjectParser.hpp.
References ARRAY, arrayCount, arrayIndex, ELEMENT, elementCount, elementIndex, key, OBJECT, and type.
Referenced by mongotype::BSONParserStack::toString().

|
inlineprivate |
Throw an error if the wrong type of fetch from the union occurs.
| t | The ItemType being fetched. |
| std::logic_error | Thrown if the passed type does not match the stored type. |
Definition at line 129 of file BSONObjectParser.hpp.
Referenced by getArray(), getElement(), and getObject().

|
private |
The count of all BSON element(s) within the containing BSON array, or 0 if the BSON element is not contained within a BSON array.
Definition at line 121 of file BSONObjectParser.hpp.
Referenced by getArrayCount(), and toString().
|
private |
The zero based index of BSON element within the containing BSON array, or -1 if the BSON element is not contained within a BSON array.
Definition at line 114 of file BSONObjectParser.hpp.
Referenced by getArrayIndex(), and toString().
|
private |
The count of all the BSON object(s)/array(s)/element(s) within the parent object.
Definition at line 107 of file BSONObjectParser.hpp.
Referenced by getElementCount(), and toString().
|
private |
The zero based index of the BSON object/array/element within the parent object.
Definition at line 102 of file BSONObjectParser.hpp.
Referenced by getElementIndex(), and toString().
|
private |
Referenced by getArray(), getElement(), and getObject().
|
private |
Key name of the BSON object/array/element, or the empty string if this is the root object.
Definition at line 97 of file BSONObjectParser.hpp.
Referenced by getKey(), and toString().
|
private |
The contained BSON object''s type.
Definition at line 66 of file BSONObjectParser.hpp.
Referenced by getType(), toString(), and validate().