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

Public Member Functions

 BSONInputArchive (std::istream &stream)
 Construct a BSONInputArchive from an input stream of BSON data. More...
 
bool willSearchYieldValue ()
 Checks if the next invocation of search() will yield a value. More...
 
bool startRootElementIfRoot ()
 Pushes a root element on the node stack if we're in root. More...
 
void finishRootElementIfRootElement ()
 Pops the node stack and iterates to the next BSON view if the top of the stack specifies that we are in a root element.
 
void startNode ()
 Starts a new node, and update the stacks so that we fetch the correct data when calling search().
 
void finishNode ()
 Finishes the most recently started node by popping relevant stacks and, if necessary, iterating to the next root BSON document.
 
void setNextName (const char *name)
 Sets the name for the next node created with startNode. More...
 
void loadValue (std::chrono::system_clock::time_point &val)
 Loads a BSON datetime from the current node and puts it into a std::chrono::system_clock::time_point. More...
 
void loadValue (std::string &val)
 Loads a BSON UTF-8 value from the current node and puts it into a std::string. More...
 
void loadSize (cereal::size_type &size)
 Loads the size for a SizeTag, which is used by Cereal to determine how many elements to put into a container such as a std::vector. More...
 
void loadUnderlyingDataForCurrentNode (UnderlyingBSONDataBase &underlyingData)
 Returns a shared pointer to the underlying data of the current node, loading the size in bytes in a size_t reference argument.
 

Constructor & Destructor Documentation

boson::BSONInputArchive::BSONInputArchive ( std::istream &  stream)
inline

Construct a BSONInputArchive from an input stream of BSON data.

Parameters
streamThe stream from which to read BSON data.

Member Function Documentation

void boson::BSONInputArchive::loadSize ( cereal::size_type &  size)
inline

Loads the size for a SizeTag, which is used by Cereal to determine how many elements to put into a container such as a std::vector.

Parameters
sizeA reference to the size value that will be set to the size of the array at the top of the stack.
void boson::BSONInputArchive::loadValue ( std::chrono::system_clock::time_point &  val)
inline

Loads a BSON datetime from the current node and puts it into a std::chrono::system_clock::time_point.

Parameters
valThe time_point variable into which the datetime will be loaded.
void boson::BSONInputArchive::loadValue ( std::string &  val)
inline

Loads a BSON UTF-8 value from the current node and puts it into a std::string.

Parameters
valThe std::string variable into which the UTF-8 will be loaded.
void boson::BSONInputArchive::setNextName ( const char *  name)
inline

Sets the name for the next node created with startNode.

Parameters
nameThe name of the next node
bool boson::BSONInputArchive::startRootElementIfRoot ( )
inline

Pushes a root element on the node stack if we're in root.

Returns
true if a root element was created, false otherwise.
bool boson::BSONInputArchive::willSearchYieldValue ( )
inline

Checks if the next invocation of search() will yield a value.

Used to check if a particular optional element, embedded document, or embedded array exists.

If search() would indeed return a value, it is cached here so that the logic in search() will not need to be repeated.

Returns
true if the next invocation of search with the current _nextName yields a value, false otherwise.

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