MongoDB C++ Driver  mongocxx-3.0.1
Public Member Functions | Related Functions | List of all members
bsoncxx::builder::stream::value_context< base > Class Template Reference

A stream context which expects a value, which can later be followed by more key/value pairs. More...

#include <value_context.hpp>

Public Member Functions

 value_context (core *core)
 Create a value_context given a core builder. More...
 
template<class T >
std::enable_if<!util::is_functor< T, void(single_context)>::value, base >::type operator<< (T &&t)
 << operator for accepting a real value and appending it to the core builder. More...
 
template<typename T >
std::enable_if< util::is_functor< T, void(single_context)>::value, base >::type operator<< (T &&func)
 << operator for accepting a callable of the form void(single_context) and invoking it to perform a value append to the core builder. More...
 
key_context< base > operator<< (const open_document_type)
 << operator for opening a new subdocument in the core builder. More...
 
array_context< base > operator<< (const open_array_type)
 << operator for opening a new subarray in the core builder. More...
 

Related Functions

(Note that these are not member functions.)

 operator single_context ()
 Conversion operator for single_context. More...
 

Detailed Description

template<class base>
class bsoncxx::builder::stream::value_context< base >

A stream context which expects a value, which can later be followed by more key/value pairs.

The template argument can be used to hold additional information about containing documents or arrays. I.e. value_context<> implies that this document is a sub_document in a document, while array_context would indicated a sub_document in an array. These types can be nested, such that contextual parsing (for key/value pairs) and depth (to prevent an invalid document_close) are enforced by the type system.

When in document context, the first parameter will be in key_context, then in value_context, then in key_context, etc.

I.e. builder << key_context << value_context << key_context << ...

Constructor & Destructor Documentation

template<class base >
bsoncxx::builder::stream::value_context< base >::value_context ( core core)
inline

Create a value_context given a core builder.

Parameters
coreThe core builder to orchestrate

Member Function Documentation

template<class base >
template<class T >
std::enable_if<!util::is_functor<T, void(single_context)>::value, base>::type bsoncxx::builder::stream::value_context< base >::operator<< ( T &&  t)
inline

<< operator for accepting a real value and appending it to the core builder.

Parameters
tThe value to append
template<class base >
array_context<base> bsoncxx::builder::stream::value_context< base >::operator<< ( const open_array_type  )
inline

<< operator for opening a new subarray in the core builder.

Parameters
_An open_array_type token
template<class base >
key_context<base> bsoncxx::builder::stream::value_context< base >::operator<< ( const open_document_type  )
inline

<< operator for opening a new subdocument in the core builder.

Parameters
_An open_document_type token
template<class base >
template<typename T >
std::enable_if<util::is_functor<T, void(single_context)>::value, base>::type bsoncxx::builder::stream::value_context< base >::operator<< ( T &&  func)
inline

<< operator for accepting a callable of the form void(single_context) and invoking it to perform a value append to the core builder.

Parameters
funcThe callback to invoke

Friends And Related Function Documentation

template<class T >
bsoncxx::builder::stream::value_context< T >::operator single_context ( )
related

Conversion operator for single_context.

Implementation of the single_context conversion operator for value_context.


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