17 #include <bsoncxx/builder/basic/helpers.hpp>
18 #include <bsoncxx/builder/concatenate.hpp>
19 #include <bsoncxx/builder/core.hpp>
20 #include <bsoncxx/stdx/string_view.hpp>
22 #include <bsoncxx/config/prelude.hpp>
25 BSONCXX_INLINE_NAMESPACE_BEGIN
31 void value_append(core* core, T&& t);
46 template <
typename Arg,
typename... Args>
47 BSONCXX_INLINE
void append(Arg&& a, Args&&... args) {
48 append_(std::forward<Arg>(a));
49 append(std::forward<Args>(args)...);
63 template <
typename K,
typename V>
64 BSONCXX_INLINE
typename std::enable_if<
65 std::is_same<typename std::decay<K>::type, stdx::string_view>::value>::type
66 append_(std::tuple<K, V>&& t) {
67 _core->
key_view(std::forward<K>(std::get<0>(t)));
68 impl::value_append(_core, std::forward<V>(std::get<1>(t)));
74 template <
typename K,
typename V>
75 BSONCXX_INLINE
typename std::enable_if<
76 std::is_same<typename std::decay<K>::type, std::string>::value>::type
77 append_(std::tuple<K, V>&& t) {
78 _core->
key_owned(std::forward<K>(std::get<0>(t)));
79 impl::value_append(_core, std::forward<V>(std::get<1>(t)));
85 template <std::
size_t n,
typename V>
86 BSONCXX_INLINE
void append_(std::tuple<
const char(&)[n], V>&& t) {
87 _core->
key_view(stdx::string_view{std::get<0>(t), n - 1});
88 impl::value_append(_core, std::forward<V>(std::get<1>(t)));
95 void append_(concatenate_doc doc) {
104 BSONCXX_INLINE_NAMESPACE_END
107 #include <bsoncxx/config/postlude.hpp>
A low-level interface for constructing BSON documents and arrays.
Definition: core.hpp:42
void append(Arg &&a, Args &&...args)
Appends multiple basic::kvp key-value pairs.
Definition: sub_document.hpp:47
An internal class of builder::basic.
Definition: sub_document.hpp:38
void key_owned(std::string key)
Appends a key passed as a STL string.
void key_view(stdx::string_view key)
Appends a key passed as a non-owning stdx::string_view.
void append()
Inductive base-case for the variadic append(...)
Definition: sub_document.hpp:56
void concatenate(const document::view &view)
Appends the keys from a BSON document into this BSON datum.
Definition: element.hpp:24