MongoDB C++ Driver mongocxx-3.10.1
Loading...
Searching...
No Matches
Public Member Functions | Related Symbols | List of all members
bsoncxx::v_noabi::builder::stream::array_context< base > Class Template Reference

A stream context which expects any number of values. More...

#include <array_context.hpp>

Public Member Functions

 array_context (core *core)
 Create an array_context given a core builder.
 
template<class T >
detail::requires_not_t< array_context &, detail::is_invocable< T, array_context<> >, detail::is_invocable< T, single_context >, detail::is_alike< T, finalize_type > > operator<< (T &&t)
 << operator for accepting a real value and appending it to the core builder.
 
template<typename Func >
detail::requires_t< array_context &, detail::disjunction< detail::is_invocable< Func, array_context >, detail::is_invocable< Func, single_context > > > operator<< (Func &&func)
 << operator for accepting a callable of the form void(array_context) or void(single_context) and invoking it to perform 1 or more value appends to the core builder.
 
template<typename T >
detail::requires_t< bsoncxx::v_noabi::array::value, std::is_same< base, closed_context >, detail::is_alike< T, finalize_type > > operator<< (T &&)
 << operator for finalizing the stream.
 
key_context< array_contextoperator<< (const open_document_type)
 << operator for opening a new subdocument in the core builder.
 
array_context operator<< (concatenate_array array)
 << operator for concatenating another array.
 
array_context< array_contextoperator<< (const open_array_type)
 << operator for opening a new subarray in the core builder.
 
base operator<< (const close_array_type)
 << operator for closing a subarray in the core builder.
 
 operator array_context ()
 Conversion operator which provides a rooted array context given any stream currently in a nested array_context.
 

Related Symbols

(Note that these are not member symbols.)

 operator single_context ()
 Conversion operator for single_context.
 

Detailed Description

template<class base>
class bsoncxx::v_noabi::builder::stream::array_context< base >

A stream context which expects any number of values.

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

I.e. builder << array_context << array_context << ...;

This builds a bson array with successively higher index keys

Constructor & Destructor Documentation

◆ array_context()

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

Create an array_context given a core builder.

Parameters
coreThe core builder to orchestrate

Member Function Documentation

◆ operator<<() [1/7]

template<class base >
array_context bsoncxx::v_noabi::builder::stream::array_context< base >::operator<< ( concatenate_array  array)
inline

<< operator for concatenating another array.

This operation concatenates all of the values from the passed document into the current stream. Keys are adjusted to match the existing array.

Parameters
arrayAn array to concatenate

◆ operator<<() [2/7]

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

<< operator for closing a subarray in the core builder.

The argument must be a close_array_type token (it is otherwise ignored).

◆ operator<<() [3/7]

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

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

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

◆ operator<<() [4/7]

template<class base >
key_context< array_context > bsoncxx::v_noabi::builder::stream::array_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<<() [5/7]

template<class base >
template<typename Func >
detail::requires_t< array_context &, detail::disjunction< detail::is_invocable< Func, array_context >, detail::is_invocable< Func, single_context > > > bsoncxx::v_noabi::builder::stream::array_context< base >::operator<< ( Func &&  func)
inline

<< operator for accepting a callable of the form void(array_context) or void(single_context) and invoking it to perform 1 or more value appends to the core builder.

Parameters
funcThe callback to invoke

◆ operator<<() [6/7]

template<class base >
template<typename T >
detail::requires_t< bsoncxx::v_noabi::array::value, std::is_same< base, closed_context >, detail::is_alike< T, finalize_type > > bsoncxx::v_noabi::builder::stream::array_context< base >::operator<< ( T &&  )
inline

<< operator for finalizing the stream.

This operation finishes all processing necessary to fully encode the bson bytes and returns an owning value.

The argument must be a finalize_type token (it is otherwise ignored).

Returns
A value type which holds the complete bson document.

◆ operator<<() [7/7]

template<class base >
template<class T >
detail::requires_not_t< array_context &, detail::is_invocable< T, array_context<> >, detail::is_invocable< T, single_context >, detail::is_alike< T, finalize_type > > bsoncxx::v_noabi::builder::stream::array_context< base >::operator<< ( T &&  t)
inline

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

Parameters
tThe value to append

Friends And Related Symbol Documentation

◆ operator single_context()

template<class T >
bsoncxx::v_noabi::builder::stream::array_context< T >::operator single_context
related

Conversion operator for single_context.

Implementation of the single_context conversion operator for array_context.


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