Mangrove
The C++ Object Document Mapper for MongoDB
Public Member Functions | List of all members
boson::bson_output_streambuf Class Reference

A streambuffer that accepts one or more BSON documents as bytes of BSON data. More...

#include <bson_streambuf.hpp>

+ Inheritance diagram for boson::bson_output_streambuf:

Public Member Functions

 bson_output_streambuf (document_callback cb)
 Constructs a new BSON Output Streambuffer that passes documents to the given callback function. More...
 
int overflow (int ch) override
 This function is called when writing to the stream and the buffer is full. More...
 
virtual int underflow () override
 This function always returns EOF, since one should not write from an output stream. More...
 

Detailed Description

A streambuffer that accepts one or more BSON documents as bytes of BSON data.

When a document is complete, it is passed into the user-provided callback. NOTE: This does not perform any validation on the BSON files, and simply uses their first four bytes to judge the document length.

Constructor & Destructor Documentation

boson::bson_output_streambuf::bson_output_streambuf ( document_callback  cb)

Constructs a new BSON Output Streambuffer that passes documents to the given callback function.

Parameters
cbA function that takes a document::value and returns void.

Member Function Documentation

int boson::bson_output_streambuf::overflow ( int  ch)
override

This function is called when writing to the stream and the buffer is full.

Since we don't define a buffer, this is called with every character.

Parameters
chThe byte of BSON to insert.
Returns
The inserted byte, or EOF if something failed.
virtual int boson::bson_output_streambuf::underflow ( )
overridevirtual

This function always returns EOF, since one should not write from an output stream.

Returns
EOF

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