MongoDB C++ Driver
mongocxx-3.7.0
|
A low-level interface for constructing BSON documents and arrays. More...
#include <core.hpp>
Public Member Functions | |
core (bool is_array) | |
Constructs an empty BSON datum. More... | |
core & | key_view (stdx::string_view key) |
Appends a key passed as a non-owning stdx::string_view. More... | |
core & | key_owned (std::string key) |
Appends a key passed as an STL string. More... | |
core & | open_document () |
Opens a sub-document within this BSON datum. More... | |
core & | open_array () |
Opens a sub-array within this BSON datum. More... | |
core & | close_document () |
Closes the current sub-document within this BSON datum. More... | |
core & | close_array () |
Closes the current sub-array within this BSON datum. More... | |
core & | concatenate (const document::view &view) |
Appends the keys from a BSON document into this BSON datum. More... | |
core & | append (const types::b_double &value) |
Appends a BSON double. More... | |
core & | append (const types::b_string &value) |
Append a BSON UTF-8 string. More... | |
core & | append (const types::b_document &value) |
Appends a BSON document. More... | |
core & | append (const types::b_array &value) |
Appends a BSON array. More... | |
core & | append (const types::b_binary &value) |
Appends a BSON binary datum. More... | |
core & | append (const types::b_undefined &value) |
Appends a BSON undefined. More... | |
core & | append (const types::b_oid &value) |
Appends a BSON ObjectId. More... | |
core & | append (const types::b_bool &value) |
Appends a BSON boolean. More... | |
core & | append (const types::b_date &value) |
Appends a BSON date. More... | |
core & | append (const types::b_null &value) |
Appends a BSON null. More... | |
core & | append (const types::b_regex &value) |
Appends a BSON regex. More... | |
core & | append (const types::b_dbpointer &value) |
Appends a BSON DBPointer. More... | |
core & | append (const types::b_code &value) |
Appends a BSON JavaScript code. More... | |
core & | append (const types::b_symbol &value) |
Appends a BSON symbol. More... | |
core & | append (const types::b_codewscope &value) |
Appends a BSON JavaScript code with scope. More... | |
core & | append (const types::b_int32 &value) |
Appends a BSON 32-bit signed integer. More... | |
core & | append (const types::b_timestamp &value) |
Appends a BSON replication timestamp. More... | |
core & | append (const types::b_int64 &value) |
Appends a BSON 64-bit signed integer. More... | |
core & | append (const types::b_decimal128 &value) |
Appends a BSON Decimal128. More... | |
core & | append (const types::b_minkey &value) |
Appends a BSON min-key. More... | |
core & | append (const types::b_maxkey &value) |
Appends a BSON max-key. More... | |
core & | append (const types::bson_value::view &value) |
Appends a BSON variant value. More... | |
core & | append (std::string str) |
Appends an STL string as a BSON UTF-8 string. More... | |
core & | append (stdx::string_view str) |
Appends a string view as a BSON UTF-8 string. More... | |
template<typename T > | |
core & | append (T *v) |
Appends a char* or const char*. More... | |
core & | append (bool value) |
Appends a native boolean as a BSON boolean. More... | |
core & | append (double value) |
Appends a native double as a BSON double. More... | |
core & | append (std::int32_t value) |
Appends a native int32_t as a BSON 32-bit signed integer. More... | |
core & | append (std::int64_t value) |
Appends a native int64_t as a BSON 64-bit signed integer. More... | |
core & | append (const oid &value) |
Appends an oid as a BSON ObjectId. More... | |
core & | append (decimal128 value) |
Appends a decimal128 object as a BSON Decimal128. More... | |
core & | append (document::view view) |
Appends the given document view. More... | |
core & | append (array::view view) |
Appends the given array view. More... | |
document::view | view_document () const |
Gets a view over the document. More... | |
array::view | view_array () const |
Gets a view over the array. More... | |
document::value | extract_document () |
Transfers ownership of the underlying document to the caller. More... | |
array::value | extract_array () |
Transfers ownership of the underlying document to the caller. More... | |
void | clear () |
Deletes the contents of the underlying BSON datum. More... | |
A low-level interface for constructing BSON documents and arrays.
|
explicit |
Constructs an empty BSON datum.
is_array | True if the top-level BSON datum should be an array. |
core& bsoncxx::builder::core::append | ( | array::view | view | ) |
Appends the given array view.
bsoncxx::exception | if the current BSON datum is a document that is waiting for a key to be appended to start a new key/value pair. |
core& bsoncxx::builder::core::append | ( | bool | value | ) |
Appends a native boolean as a BSON boolean.
bsoncxx::exception | if the current BSON datum is a document that is waiting for a key to be appended to start a new key/value pair. |
Appends an oid as a BSON ObjectId.
bsoncxx::exception | if the current BSON datum is a document that is waiting for a key to be appended to start a new key/value pair. |
core& bsoncxx::builder::core::append | ( | const types::b_array & | value | ) |
Appends a BSON array.
bsoncxx::exception | if the current BSON datum is a document that is waiting for a key to be appended to start a new key/value pair. bsoncxx::exception if the array fails to append. |
core& bsoncxx::builder::core::append | ( | const types::b_binary & | value | ) |
Appends a BSON binary datum.
bsoncxx::exception | if the current BSON datum is a document that is waiting for a key to be appended to start a new key/value pair. bsoncxx::exception if the binary fails to append. |
core& bsoncxx::builder::core::append | ( | const types::b_bool & | value | ) |
Appends a BSON boolean.
bsoncxx::exception | if the current BSON datum is a document that is waiting for a key to be appended to start a new key/value pair. bsoncxx::exception if the boolean fails to append. |
core& bsoncxx::builder::core::append | ( | const types::b_code & | value | ) |
Appends a BSON JavaScript code.
bsoncxx::exception | if the current BSON datum is a document that is waiting for a key to be appended to start a new key/value pair. bsoncxx::exception if the JavaScript code fails to append. |
core& bsoncxx::builder::core::append | ( | const types::b_codewscope & | value | ) |
Appends a BSON JavaScript code with scope.
bsoncxx::exception | if the current BSON datum is a document that is waiting for a key to be appended to start a new key/value pair. bsoncxx::exception if the JavaScript code with scope fails to append. |
core& bsoncxx::builder::core::append | ( | const types::b_date & | value | ) |
Appends a BSON date.
bsoncxx::exception | if the current BSON datum is a document that is waiting for a key to be appended to start a new key/value pair. bsoncxx::exception if the date fails to append. |
core& bsoncxx::builder::core::append | ( | const types::b_dbpointer & | value | ) |
Appends a BSON DBPointer.
bsoncxx::exception | if the current BSON datum is a document that is waiting for a key to be appended to start a new key/value pair. bsoncxx::exception if the DBPointer fails to append. |
core& bsoncxx::builder::core::append | ( | const types::b_decimal128 & | value | ) |
Appends a BSON Decimal128.
bsoncxx::exception | if the current BSON datum is a document that is waiting for a key to be appended to start a new key/value pair. bsoncxx::exception if the Decimal128 fails to append. |
core& bsoncxx::builder::core::append | ( | const types::b_document & | value | ) |
Appends a BSON document.
bsoncxx::exception | if the current BSON datum is a document that is waiting for a key to be appended to start a new key/value pair. bsoncxx::exception if the document fails to append. |
core& bsoncxx::builder::core::append | ( | const types::b_double & | value | ) |
Appends a BSON double.
bsoncxx::exception | if the current BSON datum is a document that is waiting for a key to be appended to start a new key/value pair. bsoncxx::exception if the double fails to append. |
core& bsoncxx::builder::core::append | ( | const types::b_int32 & | value | ) |
Appends a BSON 32-bit signed integer.
bsoncxx::exception | if the current BSON datum is a document that is waiting for a key to be appended to start a new key/value pair. bsoncxx::exception if the 32-bit signed integer fails to append. |
core& bsoncxx::builder::core::append | ( | const types::b_int64 & | value | ) |
Appends a BSON 64-bit signed integer.
bsoncxx::exception | if the current BSON datum is a document that is waiting for a key to be appended to start a new key/value pair. bsoncxx::exception if the 64-bit signed integer fails to append. |
core& bsoncxx::builder::core::append | ( | const types::b_maxkey & | value | ) |
Appends a BSON max-key.
bsoncxx::exception | if the current BSON datum is a document that is waiting for a key to be appended to start a new key/value pair. bsoncxx::exception if the max-key fails to append. |
core& bsoncxx::builder::core::append | ( | const types::b_minkey & | value | ) |
Appends a BSON min-key.
bsoncxx::exception | if the current BSON datum is a document that is waiting for a key to be appended to start a new key/value pair. bsoncxx::exception if the min-key fails to append. |
core& bsoncxx::builder::core::append | ( | const types::b_null & | value | ) |
Appends a BSON null.
bsoncxx::exception | if the current BSON datum is a document that is waiting for a key to be appended to start a new key/value pair. bsoncxx::exception if null fails to append. |
core& bsoncxx::builder::core::append | ( | const types::b_oid & | value | ) |
Appends a BSON ObjectId.
bsoncxx::exception | if the current BSON datum is a document that is waiting for a key to be appended to start a new key/value pair. bsoncxx::exception if the ObjectId fails to append. |
core& bsoncxx::builder::core::append | ( | const types::b_regex & | value | ) |
Appends a BSON regex.
bsoncxx::exception | if the current BSON datum is a document that is waiting for a key to be appended to start a new key/value pair. bsoncxx::exception if the regex fails to append. |
core& bsoncxx::builder::core::append | ( | const types::b_string & | value | ) |
Append a BSON UTF-8 string.
bsoncxx::exception | if the current BSON datum is a document that is waiting for a key to be appended to start a new key/value pair. bsoncxx::exception if the string fails to append. |
core& bsoncxx::builder::core::append | ( | const types::b_symbol & | value | ) |
Appends a BSON symbol.
bsoncxx::exception | if the current BSON datum is a document that is waiting for a key to be appended to start a new key/value pair. bsoncxx::exception if the symbol fails to append. |
core& bsoncxx::builder::core::append | ( | const types::b_timestamp & | value | ) |
Appends a BSON replication timestamp.
bsoncxx::exception | if the current BSON datum is a document that is waiting for a key to be appended to start a new key/value pair. bsoncxx::exception if the timestamp fails to append. |
core& bsoncxx::builder::core::append | ( | const types::b_undefined & | value | ) |
Appends a BSON undefined.
bsoncxx::exception | if the current BSON datum is a document that is waiting for a key to be appended to start a new key/value pair. bsoncxx::exception if undefined fails to append. |
core& bsoncxx::builder::core::append | ( | const types::bson_value::view & | value | ) |
Appends a BSON variant value.
bsoncxx::exception | if the current BSON datum is a document that is waiting for a key to be appended to start a new key/value pair. |
core& bsoncxx::builder::core::append | ( | decimal128 | value | ) |
Appends a decimal128 object as a BSON Decimal128.
bsoncxx::exception | if the current BSON datum is a document that is waiting for a key to be appended to start a new key/value pair. |
core& bsoncxx::builder::core::append | ( | document::view | view | ) |
Appends the given document view.
bsoncxx::exception | if the current BSON datum is a document that is waiting for a key to be appended to start a new key/value pair. |
core& bsoncxx::builder::core::append | ( | double | value | ) |
Appends a native double as a BSON double.
bsoncxx::exception | if the current BSON datum is a document that is waiting for a key to be appended to start a new key/value pair. |
core& bsoncxx::builder::core::append | ( | std::int32_t | value | ) |
Appends a native int32_t as a BSON 32-bit signed integer.
bsoncxx::exception | if the current BSON datum is a document that is waiting for a key to be appended to start a new key/value pair. |
core& bsoncxx::builder::core::append | ( | std::int64_t | value | ) |
Appends a native int64_t as a BSON 64-bit signed integer.
bsoncxx::exception | if the current BSON datum is a document that is waiting for a key to be appended to start a new key/value pair. |
core& bsoncxx::builder::core::append | ( | std::string | str | ) |
Appends an STL string as a BSON UTF-8 string.
bsoncxx::exception | if the current BSON datum is a document that is waiting for a key to be appended to start a new key/value pair. |
core& bsoncxx::builder::core::append | ( | stdx::string_view | str | ) |
Appends a string view as a BSON UTF-8 string.
bsoncxx::exception | if the current BSON datum is a document that is waiting for a key to be appended to start a new key/value pair. |
|
inline |
Appends a char* or const char*.
We disable all other pointer types to prevent the surprising implicit conversion to bool.
bsoncxx::exception | if the current BSON datum is a document that is waiting for a key to be appended to start a new key/value pair. |
void bsoncxx::builder::core::clear | ( | ) |
Deletes the contents of the underlying BSON datum.
After calling clear(), the state of this class will be the same as it was immediately after construction.
core& bsoncxx::builder::core::close_array | ( | ) |
Closes the current sub-array within this BSON datum.
bsoncxx::exception | if the current BSON datum is not an open sub-array. |
core& bsoncxx::builder::core::close_document | ( | ) |
Closes the current sub-document within this BSON datum.
bsoncxx::exception | if the current BSON datum is not an open sub-document. |
core& bsoncxx::builder::core::concatenate | ( | const document::view & | view | ) |
Appends the keys from a BSON document into this BSON datum.
view
are kept. Otherwise (if this BSON datum is an array), the original keys from view
are discarded.bsoncxx::exception | if one of the keys fails to append. |
array::value bsoncxx::builder::core::extract_array | ( | ) |
Transfers ownership of the underlying document to the caller.
bsoncxx::exception | if the precondition is violated. |
document::value bsoncxx::builder::core::extract_document | ( | ) |
Transfers ownership of the underlying document to the caller.
bsoncxx::exception | if the precondition is violated. |
core& bsoncxx::builder::core::key_owned | ( | std::string | key | ) |
Appends a key passed as an STL string.
Transfers ownership of the key to this class.
key | A string key. |
bsoncxx::exception | if the current BSON datum is an array or if the previous value appended to the builder was a key. |
core& bsoncxx::builder::core::key_view | ( | stdx::string_view | key | ) |
Appends a key passed as a non-owning stdx::string_view.
key | A null-terminated array of characters. |
bsoncxx::exception | if the current BSON datum is an array or if the previous value appended to the builder was also a key. |
core& bsoncxx::builder::core::open_array | ( | ) |
Opens a sub-array within this BSON datum.
bsoncxx::exception | if the current BSON datum is a document that is waiting for a key to be appended to start a new key/value pair. |
core& bsoncxx::builder::core::open_document | ( | ) |
Opens a sub-document within this BSON datum.
bsoncxx::exception | if the current BSON datum is a document that is waiting for a key to be appended to start a new key/value pair. |
array::view bsoncxx::builder::core::view_array | ( | ) | const |
Gets a view over the array.
bsoncxx::exception | if the precondition is violated. |
document::view bsoncxx::builder::core::view_document | ( | ) | const |
Gets a view over the document.
bsoncxx::exception | if the precondition is violated. |