jbson
C++11/1y BSON library
|
View on GitHub
builder provides a simple interface for document construction. More...
#include <builder.hpp>
Public Member Functions | |
builder ()=default | |
Default constructor. More... | |
template<typename Arg1 , typename... ArgN> | |
builder (Arg1 &&arg, ArgN &&...args) | |
Constructor which forwards to emplace. More... | |
template<typename... Args> | |
builder & | emplace (Args &&...args)& |
Constructs a BSON element in place with the supplied args. More... | |
template<typename... Args> | |
builder && | emplace (Args &&...args)&& |
Rvalue overload. Forwards *this as an rvalue reference. Constructs a BSON element in place with the supplied args. More... | |
template<typename Container , typename EContainer > | |
operator basic_document< Container, EContainer > () const & | |
Implicit conversion to basic_document. More... | |
template<typename Container , typename EContainer > | |
operator basic_document< Container, EContainer > ()&& | |
Implicit move-conversion to basic_document. More... | |
template<typename... Args> | |
builder & | operator() (Args &&...args)& |
Forwards to emplace. More... | |
template<typename... Args> | |
builder && | operator() (Args &&...args)&& |
Rvalue overload. Forwards *this as an rvalue reference. Constructs a BSON element in place with the supplied args. More... | |
builder provides a simple interface for document construction.
builder uses basic_element::write_to_container() to construct elements directly to a container, in an easier manner than by doing so manually. builder is implicitly convertible to a basic_document. After conversion, it is still a valid builder object and can be expanded and/or converted again.
builder can also be used on rvalues, propagating itself as an rvalue reference (builder&&) rather than an lvalue reference (builder&). This means that rvalue builders can be implicitly move converted to a document (basic_document<std::vector<char>>), without an explicit cast or std::move(). This is generally only beneficial in this case.
Example of implicit move conversion: To create the JSON object: { "abc": "some string", "def": 123, "xyz": {} }
Definition at line 44 of file builder.hpp.
|
default |
Default constructor.
A default constructed builder can be converted to a valid, empty basic_document.
something | if vector constructor throws |
|
inlineexplicit |
Constructor which forwards to emplace.
Equivalent to builder().emplace(arg, args...)
.
something | if vector constructor throws |
invalid_element_type | When supplied/deduced element_type is invalid. |
incompatible_type_conversion | When data is supplied to a void element_type. When data is not supplied to a non-void element_type. |
Definition at line 66 of file builder.hpp.
|
inline |
Constructs a BSON element in place with the supplied args.
something | if vector constructor throws |
invalid_element_type | When supplied/deduced element_type is invalid. |
incompatible_type_conversion | When data is supplied to a void element_type. When data is not supplied to a non-void element_type. |
Definition at line 98 of file builder.hpp.
|
inline |
Rvalue overload. Forwards *this
as an rvalue reference. Constructs a BSON element in place with the supplied args.
something | if vector constructor throws |
invalid_element_type | When supplied/deduced element_type is invalid. |
incompatible_type_conversion | When data is supplied to a void element_type. When data is not supplied to a non-void element_type. |
Definition at line 144 of file builder.hpp.
|
inline |
Implicit conversion to basic_document.
Constructs a basic_document with copy of internal storage.
Definition at line 153 of file builder.hpp.
|
inline |
Implicit move-conversion to basic_document.
Constructs a basic_document with the internal storage.
Definition at line 170 of file builder.hpp.
|
inline |
Forwards to emplace.
something | if vector constructor throws |
invalid_element_type | When supplied/deduced element_type is invalid. |
incompatible_type_conversion | When data is supplied to a void element_type. When data is not supplied to a non-void element_type. |
Definition at line 81 of file builder.hpp.
|
inline |
Rvalue overload. Forwards *this
as an rvalue reference. Constructs a BSON element in place with the supplied args.
something | if vector constructor throws |
invalid_element_type | When supplied/deduced element_type is invalid. |
incompatible_type_conversion | When data is supplied to a void element_type. When data is not supplied to a non-void element_type. |
Definition at line 127 of file builder.hpp.