MongoDB C++ Driver mongocxx-3.11.0
Loading...
Searching...
No Matches
bsoncxx::v_noabi::builder::stream::value_context< base > Class Template Reference

#include <bsoncxx/v_noabi/bsoncxx/builder/stream/value_context.hpp>

Description

template<class base>
class bsoncxx::v_noabi::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 << ...

Public Member Functions

 value_context (core *core)
 Create a value_context given a core builder.
 
 operator single_context ()
 Conversion operator for single_context.
 
array_context< base > operator<< (const open_array_type)
 << operator for opening a new subarray in the core builder.
 
key_context< base > operator<< (const open_document_type)
 << operator for opening a new subdocument in the core builder.
 
template<typename T >
detail::requires_t< base, detail::is_invocable< T, single_context > > 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.
 
template<class T >
detail::requires_not_t< base, detail::is_invocable< T, single_context > > operator<< (T &&t)
 << operator for accepting a real value and appending it to the core builder.
 

Constructor & Destructor Documentation

◆ value_context()

template<class base >
bsoncxx::v_noabi::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

◆ operator single_context()

Conversion operator for single_context.

Implementation of the single_context conversion operator for value_context.

See also

◆ operator<<() [1/4]

template<class base >
array_context< base > bsoncxx::v_noabi::builder::stream::value_context< base >::operator<< ( const open_array_type )
inline

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

The argument must be an open_array_type token (it is otherwise ignored).

◆ operator<<() [2/4]

template<class base >
key_context< base > bsoncxx::v_noabi::builder::stream::value_context< base >::operator<< ( const open_document_type )
inline

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

The argument must be an open_document_type token (it is otherwise ignored).

◆ operator<<() [3/4]

template<class base >
template<typename T >
detail::requires_t< base, detail::is_invocable< T, single_context > > bsoncxx::v_noabi::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

◆ operator<<() [4/4]

template<class base >
template<class T >
detail::requires_not_t< base, detail::is_invocable< T, single_context > > bsoncxx::v_noabi::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

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