MongoDB C++ Driver
mongocxx-3.0.2
|
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... | |
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 << ...
|
inline |
Create a value_context given a core builder.
core | The core builder to orchestrate |
|
inline |
<< operator for accepting a real value and appending it to the core builder.
t | The value to append |
|
inline |
<< operator for opening a new subarray in the core builder.
_ | An open_array_type token |
|
inline |
<< operator for opening a new subdocument in the core builder.
_ | An open_document_type token |
|
inline |
<< operator for accepting a callable of the form void(single_context) and invoking it to perform a value append to the core builder.
func | The callback to invoke |
|
related |
Conversion operator for single_context.
Implementation of the single_context conversion operator for value_context.