MongoDB C++ Driver mongocxx-3.11.0
|
#include <bsoncxx/v_noabi/bsoncxx/builder/stream/key_context.hpp>
A stream context which expects a key, which can later be followed by value, then 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 | |
key_context (core *core) | |
Create a key_context given a core builder. | |
operator key_context<> () | |
Conversion operator which provides a rooted document given any stream currently in a nested key_context. | |
key_context | operator<< (concatenate_doc doc) |
<< operator for concatenating another document. | |
template<std::size_t n> | |
value_context< key_context > | operator<< (const char(&v)[n]) |
<< operator for accepting a literal key and appending it to the core builder. | |
base | operator<< (const close_document_type) |
<< operator for closing a subdocument in the core builder. | |
value_context< key_context > | operator<< (std::string str) |
<< operator for accepting a std::string key and appending it to the core builder. | |
value_context< key_context > | operator<< (stdx::string_view str) |
<< operator for accepting a stdx::string_view key and appending it to the core builder. | |
template<typename T > | |
detail::requires_t< bsoncxx::v_noabi::document::value, std::is_same< base, closed_context >, detail::is_alike< T, finalize_type > > | operator<< (T &&) |
<< operator for finalizing the stream. | |
template<typename T > | |
detail::requires_t< key_context &, detail::is_invocable< T, key_context > > | operator<< (T &&func) |
<< operator for accepting a callable of the form void(key_context) and invoking it to perform 1 or more key, value appends to the core builder. | |
|
inline |
Create a key_context given a core builder.
core | The core builder to orchestrate |
|
inline |
Conversion operator which provides a rooted document given any stream currently in a nested key_context.
|
inline |
<< operator for concatenating another document.
This operation concatenates all of the keys and values from the passed document into the current stream.
doc | A document to concatenate |
|
inline |
<< operator for accepting a literal key and appending it to the core builder.
v | The key to append |
bsoncxx::v_noabi::exception | if the previous value appended to the builder was also a key. |
|
inline |
<< operator for closing a subdocument in the core builder.
The argument must be a close_document_type token (it is otherwise ignored).
|
inline |
<< operator for accepting a std::string key and appending it to the core builder.
str | The key to append |
bsoncxx::v_noabi::exception | if the previous value appended to the builder was also a key. |
|
inline |
<< operator for accepting a stdx::string_view key and appending it to the core builder.
str | The key to append |
bsoncxx::v_noabi::exception | if the previous value appended to the builder was also a key. |
|
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).
|
inline |
<< operator for accepting a callable of the form void(key_context) and invoking it to perform 1 or more key, value appends to the core builder.
func | The callback to invoke |