#include <bsoncxx/v_noabi/bsoncxx/document/element.hpp>
A variant view type that accesses values in serialized BSON documents.
Element functions as a variant type, where the kind of the element can be interrogated by calling type(), the key can be extracted by calling key() and a specific value can be extracted through get_X() accessors.
Public Member Functions | |
| element ()=default | |
| Construct an invalid element. | |
| element (v1::element::view const &v) | |
| Construct with the bsoncxx::v1 equivalent. | |
| v_noabi::types::bson_value::value | get_owning_value () const |
| Getter for a types::bson_value::value variant wrapper of the value portion of the element. The returned object will make a copy of the buffer from this object. | |
| v_noabi::types::bson_value::view | get_value () const |
| Getter for a types::bson_value::view variant wrapper of the value portion of the element. | |
| v1::stdx::string_view | key () const |
| Getter for the element's key. | |
| std::uint32_t | keylen () const |
| Getter for the element's key length. | |
| std::uint32_t | length () const |
| Getter for length of the raw bson bytes the element points to. | |
| std::uint32_t | offset () const |
| Getter for the offset into the raw bson bytes the element points to. | |
| operator bool () const | |
| Conversion operator to bool which is true for valid elements and false for invalid elements. | |
| operator v1::element::view () const | |
| Convert to the bsoncxx::v1 equivalent. | |
| v_noabi::array::element | operator[] (std::uint32_t i) const |
| If this element is an array, indexes into this BSON array. If the index is out-of-bounds, an invalid array::element will be returned. As BSON represents arrays as documents, the runtime of operator[] is linear in the length of the array. | |
| element | operator[] (v1::stdx::string_view key) const |
| If this element is a document, finds the first element of the document with the provided key. If there is no such element, an invalid document::element will be returned. The runtime of operator[] is linear in the length of the document. | |
| std::uint8_t const * | raw () const |
| Getter for the raw bson bytes the element points to. | |
| v_noabi::type | type () const |
| Getter for the type of the element. | |
| v_noabi::types::bson_value::value | type_value () const |
| Equivalent to get_owning_value() const. | |
| v_noabi::types::bson_value::view | type_view () const |
| Equivalent to get_value() const. | |
| v_noabi::types::b_minkey | get_minkey () const |
| Return the BSON type value of this element. | |
| v_noabi::types::b_double | get_double () const |
| Return the BSON type value of this element. | |
| v_noabi::types::b_string | get_string () const |
| Return the BSON type value of this element. | |
| v_noabi::types::b_document | get_document () const |
| Return the BSON type value of this element. | |
| v_noabi::types::b_array | get_array () const |
| Return the BSON type value of this element. | |
| v_noabi::types::b_binary | get_binary () const |
| Return the BSON type value of this element. | |
| v_noabi::types::b_undefined | get_undefined () const |
| Return the BSON type value of this element. | |
| v_noabi::types::b_oid | get_oid () const |
| Return the BSON type value of this element. | |
| v_noabi::types::b_bool | get_bool () const |
| Return the BSON type value of this element. | |
| v_noabi::types::b_date | get_date () const |
| Return the BSON type value of this element. | |
| v_noabi::types::b_null | get_null () const |
| Return the BSON type value of this element. | |
| v_noabi::types::b_regex | get_regex () const |
| Return the BSON type value of this element. | |
| v_noabi::types::b_dbpointer | get_dbpointer () const |
| Return the BSON type value of this element. | |
| v_noabi::types::b_code | get_code () const |
| Return the BSON type value of this element. | |
| v_noabi::types::b_symbol | get_symbol () const |
| Return the BSON type value of this element. | |
| v_noabi::types::b_codewscope | get_codewscope () const |
| Return the BSON type value of this element. | |
| v_noabi::types::b_int32 | get_int32 () const |
| Return the BSON type value of this element. | |
| v_noabi::types::b_timestamp | get_timestamp () const |
| Return the BSON type value of this element. | |
| v_noabi::types::b_int64 | get_int64 () const |
| Return the BSON type value of this element. | |
| v_noabi::types::b_decimal128 | get_decimal128 () const |
| Return the BSON type value of this element. | |
| v_noabi::types::b_maxkey | get_maxkey () const |
| Return the BSON type value of this element. | |
Related Symbols | |
(Note that these are not member symbols.) | |
| bool | operator== (element const &lhs, v_noabi::types::bson_value::view const &rhs) |
| Convenience methods to compare for equality against a bson_value. | |
| bool | operator== (v_noabi::types::bson_value::view const &lhs, element const &rhs) |
| Convenience methods to compare for equality against a bson_value. | |
| bool | operator!= (element const &lhs, v_noabi::types::bson_value::view const &rhs) |
| Convenience methods to compare for equality against a bson_value. | |
| bool | operator!= (v_noabi::types::bson_value::view const &lhs, element const &rhs) |
| Convenience methods to compare for equality against a bson_value. | |
|
default |
Construct an invalid element.
This is useful when mapping the end iterator of a document or array view.
|
inline |
Construct with the bsoncxx::v1 equivalent.
Return the BSON type value of this element.
| bsoncxx::v_noabi::exception | if this element is not the requested type. |
Return the BSON type value of this element.
| bsoncxx::v_noabi::exception | if this element is not the requested type. |
Return the BSON type value of this element.
| bsoncxx::v_noabi::exception | if this element is not the requested type. |
Return the BSON type value of this element.
| bsoncxx::v_noabi::exception | if this element is not the requested type. |
Return the BSON type value of this element.
| bsoncxx::v_noabi::exception | if this element is not the requested type. |
Return the BSON type value of this element.
| bsoncxx::v_noabi::exception | if this element is not the requested type. |
Return the BSON type value of this element.
| bsoncxx::v_noabi::exception | if this element is not the requested type. |
Return the BSON type value of this element.
| bsoncxx::v_noabi::exception | if this element is not the requested type. |
Return the BSON type value of this element.
| bsoncxx::v_noabi::exception | if this element is not the requested type. |
Return the BSON type value of this element.
| bsoncxx::v_noabi::exception | if this element is not the requested type. |
Return the BSON type value of this element.
| bsoncxx::v_noabi::exception | if this element is not the requested type. |
Return the BSON type value of this element.
| bsoncxx::v_noabi::exception | if this element is not the requested type. |
Return the BSON type value of this element.
| bsoncxx::v_noabi::exception | if this element is not the requested type. |
Return the BSON type value of this element.
| bsoncxx::v_noabi::exception | if this element is not the requested type. |
Return the BSON type value of this element.
| bsoncxx::v_noabi::exception | if this element is not the requested type. |
Return the BSON type value of this element.
| bsoncxx::v_noabi::exception | if this element is not the requested type. |
Getter for a types::bson_value::value variant wrapper of the value portion of the element. The returned object will make a copy of the buffer from this object.
Return the BSON type value of this element.
| bsoncxx::v_noabi::exception | if this element is not the requested type. |
Return the BSON type value of this element.
| bsoncxx::v_noabi::exception | if this element is not the requested type. |
Return the BSON type value of this element.
| bsoncxx::v_noabi::exception | if this element is not the requested type. |
Return the BSON type value of this element.
| bsoncxx::v_noabi::exception | if this element is not the requested type. |
Return the BSON type value of this element.
| bsoncxx::v_noabi::exception | if this element is not the requested type. |
Getter for a types::bson_value::view variant wrapper of the value portion of the element.
Getter for the element's key.
| bsoncxx::v_noabi::exception | if this element is invalid. |
|
inline |
Getter for the element's key length.
|
inline |
Getter for length of the raw bson bytes the element points to.
|
inline |
Getter for the offset into the raw bson bytes the element points to.
|
inlineexplicit |
Conversion operator to bool which is true for valid elements and false for invalid elements.
|
inlineexplicit |
Convert to the bsoncxx::v1 equivalent.
| v_noabi::array::element bsoncxx::v_noabi::document::element::operator[] | ( | std::uint32_t | i | ) | const |
If this element is an array, indexes into this BSON array. If the index is out-of-bounds, an invalid array::element will be returned. As BSON represents arrays as documents, the runtime of operator[] is linear in the length of the array.
If this element is not an array, an invalid array::element will be returned.
| i | The index of the element. |
| element bsoncxx::v_noabi::document::element::operator[] | ( | v1::stdx::string_view | key | ) | const |
If this element is a document, finds the first element of the document with the provided key. If there is no such element, an invalid document::element will be returned. The runtime of operator[] is linear in the length of the document.
If this element is not a document, an invalid document::element will be returned.
| key | The key to search for. |
|
inline |
Getter for the raw bson bytes the element points to.
Getter for the type of the element.
| bsoncxx::v_noabi::exception | if this element is invalid. |
Equivalent to get_owning_value() const.
To support incremental migration to bsoncxx::v1::element::view::type_value() const.
Equivalent to get_value() const.
To support incremental migration to bsoncxx::v1::element::view::type_view() const.
|
Convenience methods to compare for equality against a bson_value.
Compares equal if the element contains a matching bson_value. Otherwise, compares unequal.
|
Convenience methods to compare for equality against a bson_value.
Compares equal if the element contains a matching bson_value. Otherwise, compares unequal.
|
Convenience methods to compare for equality against a bson_value.
Compares equal if the element contains a matching bson_value. Otherwise, compares unequal.
|
Convenience methods to compare for equality against a bson_value.
Compares equal if the element contains a matching bson_value. Otherwise, compares unequal.