18 #include <bsoncxx/builder/core.hpp>
19 #include <bsoncxx/builder/stream/closed_context.hpp>
20 #include <bsoncxx/builder/stream/value_context.hpp>
21 #include <bsoncxx/stdx/string_view.hpp>
22 #include <bsoncxx/stdx/type_traits.hpp>
24 #include <bsoncxx/config/prelude.hpp>
27 inline namespace v_noabi {
48 template <
class base = closed_context>
68 template <std::
size_t n>
70 _core->
key_view(stdx::string_view{v, n - 1});
71 return value_context<key_context>(_core);
83 BSONCXX_INLINE value_context<key_context>
operator<<(std::string str) {
85 return value_context<key_context>(_core);
97 BSONCXX_INLINE value_context<key_context>
operator<<(stdx::string_view str) {
99 return value_context<key_context>(_core);
110 template <
typename T>
111 BSONCXX_INLINE detail::requires_t<key_context&, detail::is_invocable<T, key_context>>
113 detail::invoke(std::forward<T>(func), *
this);
127 template <
typename T>
128 BSONCXX_INLINE detail::requires_t<bsoncxx::document::value,
129 std::is_same<base, closed_context>,
130 detail::is_alike<T, finalize_type>>
168 BSONCXX_INLINE base unwrap() {
180 #include <bsoncxx/config/postlude.hpp>
A low-level interface for constructing BSON documents and arrays.
Definition: core.hpp:43
core & key_owned(std::string key)
Appends a key passed as an STL string.
core & concatenate(const document::view &view)
Appends the keys from a BSON document into this BSON datum.
document::value extract_document()
Transfers ownership of the underlying document to the caller.
core & close_document()
Closes the current sub-document within this BSON datum.
core & key_view(stdx::string_view key)
Appends a key passed as a non-owning stdx::string_view.
A stream context which expects a key, which can later be followed by value, then more key/value pairs...
Definition: key_context.hpp:49
value_context< key_context > operator<<(const char(&v)[n])
<< operator for accepting a literal key and appending it to the core builder.
Definition: key_context.hpp:69
key_context operator<<(concatenate_doc doc)
<< operator for concatenating another document.
Definition: key_context.hpp:144
base operator<<(const close_document_type)
<< operator for closing a subdocument in the core builder.
Definition: key_context.hpp:154
key_context(core *core)
Create a key_context given a core builder.
Definition: key_context.hpp:57
A stream context which expects a value, which can later be followed by more key/value pairs.
Definition: value_context.hpp:48
The top-level namespace for bsoncxx library entities.
Definition: element.hpp:24
Container to concatenate a document.
Definition: concatenate.hpp:30
The type of a stream manipulator to close a subdocument.
Definition: helpers.hpp:44