MongoType
MongoDB Collection Data Dump with BSON Types
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
mongotype::BSONObjectTypeDump Class Reference

Human readable BSON Object Dump. More...

#include <BSONObjectTypeDump.hpp>

Details:

Human readable BSON Object Dump.

Provides an std::ostream comparable output operator for dumping a human readable text version of the given BSON object. BSONObjectTypeDump implements interface IBSONObjectVisitor and uses the BSON object parsing events to output the BSON object's text representation.

See Also
IBSONObjectVisitor, BSONObjectParser

Definition at line 51 of file BSONObjectTypeDump.hpp.

Inheritance diagram for mongotype::BSONObjectTypeDump:
Collaboration diagram for mongotype::BSONObjectTypeDump:

Public Member Functions

 BSONObjectTypeDump (Parameters &pparams, string &pinitialToken, const char *pindentStr=" ")
 Construct a BSON object dumper. More...
 
virtual ~BSONObjectTypeDump ()
 
virtual void setOutputStream (std::ostream &os)
 
virtual void begin (const char *prefix)
 
virtual void end (const char *suffix)
 
virtual void render (const BSONObj &object, int docIndex, int docCount)
 
- Public Member Functions inherited from mongotype::IBSONRenderer
virtual ~IBSONRenderer ()
 

Protected Member Functions

virtual void onParseStart ()
 Parser Construction Event. More...
 
virtual void onParseEnd ()
 Parser Destruction Event. More...
 
virtual void onObjectStart (const BSONParserStack &stack)
 BSON Object Precursor Event. More...
 
virtual void onObjectEnd (const BSONParserStack &stack)
 BSON Object Successor Event. More...
 
virtual void onArrayStart (const BSONParserStack &stack)
 BSON Array Precursor Event. More...
 
virtual void onArrayEnd (const BSONParserStack &stack)
 BSON Array Successor Event. More...
 
virtual void onElement (const BSONParserStack &stack)
 BSON Element Event. More...
 
- Protected Member Functions inherited from mongotype::IBSONObjectVisitor
virtual ~IBSONObjectVisitor ()
 

Private Member Functions

string istr ()
 

Private Attributes

Parametersparams
 
string indentStr
 
string initialToken
 
int level
 
function< ostream &()> getOStream
 

Constructor & Destructor Documentation

mongotype::BSONObjectTypeDump::BSONObjectTypeDump ( Parameters pparams,
string &  pinitialToken,
const char *  pindentStr = " " 
)
inline

Construct a BSON object dumper.

Parameters
[in]pparamsThe command line parameters.
[in]pinitialTokenThe string the prefixes all output lines.
[in]pindentStrThe string used to indent the text output. The indent text is prepended to the output lines once for each indent level.

Definition at line 112 of file BSONObjectTypeDump.hpp.

virtual mongotype::BSONObjectTypeDump::~BSONObjectTypeDump ( )
inlinevirtual

Definition at line 115 of file BSONObjectTypeDump.hpp.

Member Function Documentation

virtual void mongotype::BSONObjectTypeDump::begin ( const char *  prefix)
inlinevirtual

Implements mongotype::IBSONRenderer.

Definition at line 127 of file BSONObjectTypeDump.hpp.

References getOStream.

virtual void mongotype::BSONObjectTypeDump::end ( const char *  suffix)
inlinevirtual

Implements mongotype::IBSONRenderer.

Definition at line 136 of file BSONObjectTypeDump.hpp.

References getOStream.

string mongotype::BSONObjectTypeDump::istr ( )
inlineprivate

Definition at line 58 of file BSONObjectTypeDump.hpp.

References indentStr, and level.

Referenced by onElement(), onObjectEnd(), and onObjectStart().

Here is the caller graph for this function:

virtual void mongotype::BSONObjectTypeDump::onArrayEnd ( const BSONParserStack stack)
inlineprotectedvirtual

BSON Array Successor Event.

Parameters
[in]stackThe BSONParserStack object containing the current parse context.

Invoked once per each non-terminal BSON array after parsing the contained BSON elements.

Implements mongotype::IBSONObjectVisitor.

Definition at line 94 of file BSONObjectTypeDump.hpp.

References level.

virtual void mongotype::BSONObjectTypeDump::onArrayStart ( const BSONParserStack stack)
inlineprotectedvirtual

BSON Array Precursor Event.

Parameters
[in]stackThe BSONParserStack object containing the current parse context.

Invoked once per each non-terminal BSON array before parsing the contained BSON elements.

Implements mongotype::IBSONObjectVisitor.

Definition at line 89 of file BSONObjectTypeDump.hpp.

References mongotype::BSONParserStackItem::getArrayCount(), getOStream, level, and mongotype::BSONParserStack::top().

Here is the call graph for this function:

virtual void mongotype::BSONObjectTypeDump::onElement ( const BSONParserStack stack)
inlineprotectedvirtual

BSON Element Event.

Parameters
[in]stackThe BSONParserStack object containing the current parse context.

Invoked once per each terminal BSON element that is not a BSON object or a BSON array.

Implements mongotype::IBSONObjectVisitor.

Definition at line 98 of file BSONObjectTypeDump.hpp.

References mongotype::BSONParserStackItem::getElement(), getOStream, istr(), params, and mongotype::BSONParserStack::top().

Here is the call graph for this function:

virtual void mongotype::BSONObjectTypeDump::onObjectEnd ( const BSONParserStack stack)
inlineprotectedvirtual

BSON Object Successor Event.

Parameters
[in]stackThe BSONParserStack object containing the current parse context.

Invoked once per each non-terminal BSON object after parsing the contained BSON elements.

Implements mongotype::IBSONObjectVisitor.

Definition at line 83 of file BSONObjectTypeDump.hpp.

References getOStream, istr(), and level.

Here is the call graph for this function:

virtual void mongotype::BSONObjectTypeDump::onObjectStart ( const BSONParserStack stack)
inlineprotectedvirtual

BSON Object Precursor Event.

Parameters
[in]stackThe BSONParserStack object containing the current parse context.

Invoked once per each non-terminal BSON object before parsing the contained BSON elements.

Implements mongotype::IBSONObjectVisitor.

Definition at line 74 of file BSONObjectTypeDump.hpp.

References mongotype::BSONParserStackItem::getArrayIndex(), getOStream, istr(), level, and mongotype::BSONParserStack::top().

Here is the call graph for this function:

virtual void mongotype::BSONObjectTypeDump::onParseEnd ( )
inlineprotectedvirtual

Parser Destruction Event.

Invoked once each parse after all other events. Used to destroy the parse state.

Implements mongotype::IBSONObjectVisitor.

Definition at line 72 of file BSONObjectTypeDump.hpp.

virtual void mongotype::BSONObjectTypeDump::onParseStart ( )
inlineprotectedvirtual

Parser Construction Event.

Invoked once each parse before all other events. Used to construct the parse state.

Implements mongotype::IBSONObjectVisitor.

Definition at line 68 of file BSONObjectTypeDump.hpp.

References level.

virtual void mongotype::BSONObjectTypeDump::render ( const BSONObj &  object,
int  docIndex,
int  docCount 
)
inlinevirtual

Implements mongotype::IBSONRenderer.

Definition at line 142 of file BSONObjectTypeDump.hpp.

References getOStream, initialToken, and mongotype::BSONObjectParser::parse().

Here is the call graph for this function:

virtual void mongotype::BSONObjectTypeDump::setOutputStream ( std::ostream &  os)
inlinevirtual

Implements mongotype::IBSONRenderer.

Definition at line 120 of file BSONObjectTypeDump.hpp.

References getOStream.

Member Data Documentation

function<ostream&()> mongotype::BSONObjectTypeDump::getOStream
private
string mongotype::BSONObjectTypeDump::indentStr
private

Definition at line 53 of file BSONObjectTypeDump.hpp.

Referenced by istr().

string mongotype::BSONObjectTypeDump::initialToken
private

Definition at line 54 of file BSONObjectTypeDump.hpp.

Referenced by render().

int mongotype::BSONObjectTypeDump::level
private
Parameters& mongotype::BSONObjectTypeDump::params
private

Definition at line 52 of file BSONObjectTypeDump.hpp.

Referenced by onElement().


The documentation for this class was generated from the following file: