37    using initializer_list_t = std::initializer_list<list>;
 
   57    list(T value) : val{value} {}
 
   79    list(initializer_list_t init) : 
list(init, true, true) {}
 
  104    friend ::bsoncxx::v_noabi::builder::document;
 
  105    friend ::bsoncxx::v_noabi::builder::array;
 
  107    list(initializer_list_t init, 
bool type_deduction, 
bool is_array) : val{nullptr} {
 
  108        std::stringstream err_msg{
"cannot construct document"};
 
  109        bool valid_document = 
false;
 
  110        if (type_deduction || !is_array) {
 
  111            valid_document = [&] {
 
  112                if (init.size() % 2 != 0) {
 
  113                    err_msg << 
" : must be list of key-value pairs";
 
  116                for (
size_t i = 0; i < init.size(); i += 2) {
 
  117                    auto t = (begin(init) + i)->val.
view().
type();
 
  119                        err_msg << 
" : all keys must be string type. ";
 
  120                        err_msg << 
"Found type=" << 
to_string(t);
 
  128        if (valid_document) {
 
  130            for (
size_t i = 0; i < init.size(); i += 2) {
 
  131                _core.key_owned(std::string((begin(init) + i)->val.view().get_string().value));
 
  132                _core.append((begin(init) + i + 1)->val);
 
  134            val = types::bson_value::value(_core.extract_document());
 
  135        } 
else if (type_deduction || is_array) {
 
  137            for (
auto&& ele : init)
 
  138                _core.append(ele.val);
 
  139            val = types::bson_value::value(_core.extract_array());
 
 
  150    using initializer_list_t = std::initializer_list<list>;
 
 
  175    using initializer_list_t = std::initializer_list<list>;
 
  193    array(initializer_list_t init) : 
list(init, false, true) {}
 
 
Declares bsoncxx::v_noabi::builder::basic::array.
 
The bsoncxx v_noabi macro guard postlude header.
 
The bsoncxx v_noabi macro guard prelude header.
 
Provides bsoncxx::v_noabi::error_code.
 
Provides bsoncxx::v_noabi::exception.
 
array()
Creates an empty array.
Definition list.hpp:181
 
document()
Creates an empty document.
Definition list.hpp:156
 
list()
Creates an empty document.
Definition list.hpp:43
 
array(initializer_list_t init)
Creates a BSON array.
Definition list.hpp:193
 
array()
Creates an empty array.
Definition list.hpp:181
 
document(initializer_list_t init)
Creates a BSON document.
Definition list.hpp:168
 
document()
Creates an empty document.
Definition list.hpp:156
 
types::bson_value::view view()
Provides a view of the underlying BSON value.
Definition list.hpp:97
 
list(T value)
Creates a bsoncxx::v_noabi::builder::list from a value of type T. T must be a bsoncxx::v_noabi::types...
Definition list.hpp:57
 
operator types::bson_value::view()
Provides a view of the underlying BSON value.
Definition list.hpp:87
 
list()
Creates an empty document.
Definition list.hpp:43
 
list(initializer_list_t init)
Creates a BSON document, if possible. Otherwise, it will create a BSON array. A document is possible ...
Definition list.hpp:79
 
An owning variant type that represents any BSON type.
Definition value.hpp:48
 
bson_value::view view() const noexcept
Get a view over the bson_value owned by this object.
 
A non-owning variant that can contain any BSON type.
Definition view.hpp:55
 
bsoncxx::v_noabi::type type() const
Returns the type of the underlying BSON value stored in this object.
 
view(b_double v) noexcept
Construct a bson_value::view from the provided BSON type.
 
Provides bsoncxx::v_noabi::builder::core.
 
Provides entities for use with "list" BSON builder syntax.
 
Declares entities used to build BSON documents.
 
Declares entities whose ABI stability is NOT guaranteed.
 
@ k_unmatched_key_in_builder
Attempted to view or extract a document when a key was still awaiting a matching value.
Definition error_code.hpp:83
 
std::string to_string(type rhs)
Returns a stringification of the given type.
 
@ k_string
UTF-8 string.
Definition types.hpp:45
 
The top-level namespace within which all bsoncxx library entities are declared.
 
Provides bsoncxx::v_noabi::types::bson_value::value.