20 #include <bsoncxx/stdx/optional.hpp>
21 #include <bsoncxx/stdx/string_view.hpp>
23 #include <bsoncxx/config/prelude.hpp>
26 inline namespace v_noabi {
27 enum class type : std::uint8_t;
54 namespace bson_value {
90 explicit operator bool()
const;
97 const std::uint8_t*
raw()
const;
129 stdx::string_view
key()
const;
399 BSONCXX_PRIVATE
explicit element(
const std::uint8_t* raw,
400 std::uint32_t length,
401 std::uint32_t offset,
402 std::uint32_t keylen);
405 BSONCXX_PRIVATE
explicit element(
const stdx::string_view key);
410 const std::uint8_t* _raw;
411 std::uint32_t _length;
412 std::uint32_t _offset;
413 std::uint32_t _keylen;
417 stdx::optional<stdx::string_view> _key;
455 #include <bsoncxx/config/postlude.hpp>
A variant view type that accesses values in serialized BSON arrays.
Definition: element.hpp:41
A variant view type that accesses values in serialized BSON documents.
Definition: element.hpp:76
std::uint32_t keylen() const
Getter for the element's key length.
types::b_codewscope get_codewscope() const
Getter for elements of the b_codewscope type.
types::b_code get_code() const
Getter for elements of the b_code type.
types::b_null get_null() const
Getter for elements of the b_null type.
types::b_binary get_binary() const
Getter for elements of the b_binary type.
element operator[](stdx::string_view key) const
If this element is a document, finds the first element of the document with the provided key.
types::b_regex get_regex() const
Getter for elements of the b_regex type.
stdx::string_view key() const
Getter for the element's key.
types::b_symbol get_symbol() const
Getter for elements of the b_symbol type.
types::b_array get_array() const
Getter for elements of the b_array type.
types::b_document get_document() const
Getter for elements of the b_document type.
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.
types::b_undefined get_undefined() const
Getter for elements of the b_undefined type.
types::bson_value::value get_owning_value() const
Getter for a types::bson_value::value variant wrapper of the value portion of the element.
types::b_bool get_bool() const
Getter for elements of the b_bool type.
types::b_dbpointer get_dbpointer() const
Getter for elements of the b_dbpointer type.
types::b_oid get_oid() const
Getter for elements of the b_oid type.
types::bson_value::view get_value() const
Getter for a types::bson_value::view variant wrapper of the value portion of the element.
types::b_double get_double() const
Getter for elements of the b_double type.
types::b_date get_date() const
Getter for elements of the b_date type.
bool operator==(const element &elem, const types::bson_value::view &v)
Convenience methods to compare for equality against a bson_value.
types::b_int32 get_int32() const
Getter for elements of the b_int32 type.
bsoncxx::type type() const
Getter for the type of the element.
types::b_timestamp get_timestamp() const
Getter for elements of the b_timestamp type.
types::b_string get_utf8() const
Getter for elements of the b_string type.
array::element operator[](std::uint32_t i) const
If this element is an array, indexes into this BSON array.
const std::uint8_t * raw() const
Getter for the raw bson bytes the element points to.
types::b_int64 get_int64() const
Getter for elements of the b_int64 type.
types::b_minkey get_minkey() const
Getter for elements of the b_minkey type.
bool operator!=(const element &elem, const types::bson_value::view &v)
Convenience methods to compare for equality against a bson_value.
types::b_maxkey get_maxkey() const
Getter for elements of the b_maxkey type.
element()
Construct an invalid element.
types::b_string get_string() const
Getter for elements of the b_string type.
types::b_decimal128 get_decimal128() const
Getter for elements of the b_decimal128 type.
A read-only, non-owning view of a BSON document.
Definition: view.hpp:33
A variant owning type that represents any BSON type.
Definition: value.hpp:43
A view-only variant that can contain any BSON type.
Definition: view.hpp:44
binary_sub_type
An enumeration of each BSON binary sub type.
Definition: types.hpp:70
type
An enumeration of each BSON type.
Definition: types.hpp:50
The top-level namespace for bsoncxx library entities.
Definition: element.hpp:24
A BSON array value.
Definition: types.hpp:199
A BSON binary data value.
Definition: types.hpp:224
A BSON boolean value.
Definition: types.hpp:282
A BSON JavaScript code value.
Definition: types.hpp:438
A BSON JavaScript code with scope value.
Definition: types.hpp:509
A BSON date value.
Definition: types.hpp:307
A BSON DBPointer value.
Definition: types.hpp:419
A BSON Decimal128 value.
Definition: types.hpp:612
A BSON document value.
Definition: types.hpp:167
A BSON double value.
Definition: types.hpp:101
A BSON signed 32-bit integer value.
Definition: types.hpp:543
A BSON 64-bit signed integer value.
Definition: types.hpp:587
A BSON max-key value.
Definition: types.hpp:655
A BSON min-key value.
Definition: types.hpp:639
A BSON null value.
Definition: types.hpp:366
A BSON ObjectId value.
Definition: types.hpp:264
A BSON regex value.
Definition: types.hpp:382
A BSON UTF-8 encoded string value.
Definition: types.hpp:126
A BSON Symbol value.
Definition: types.hpp:475
A BSON replication timestamp value.
Definition: types.hpp:568
A BSON undefined value.
Definition: types.hpp:248