46 struct is_valid_deleter : std::is_constructible<v1::document::value, std::uint8_t*, T> {};
84 _value = other._value;
92 template <typename Deleter, detail::enable_if_t<is_valid_deleter<Deleter>::value>* =
nullptr>
93 value(std::uint8_t*
data, Deleter deleter) : _value{
data, std::move(deleter)} {}
96 template <typename Deleter, detail::enable_if_t<is_valid_deleter<Deleter>::value>* =
nullptr>
116 return _value.get_deleter();
121 return _value.release();
126 _value = std::move(v._value);
175 return this->
view()[i];
179 std::uint8_t
const*
data()
const {
199 explicit operator bool()
const {
200 return this->
view().operator bool();
210 return !(lhs == rhs);
The bsoncxx v1 macro guard postlude header.
The bsoncxx v1 macro guard prelude header.
v1::array::view::const_iterator cend() const
Return a const iterator to the end of the range of BSON elements within this view.
Definition value.hpp:154
value(value const &other)
Copy construction.
Definition value.hpp:74
value(std::uint8_t *data, std::size_t length, Deleter deleter)
Equivalent to value(std::uint8_t* data, Deleter deleter), but validates the embedded length against l...
Definition value.hpp:97
value(unique_ptr_type ptr)
Initialize as owning ptr.
Definition value.hpp:106
value & operator=(value const &other)
Copy assignment.
Definition value.hpp:83
deleter_type const & get_deleter() const
Return the current deleter.
Definition value.hpp:115
std::size_t size() const
Return the length of the BSON bytes being represented.
Definition value.hpp:184
v1::document::view::const_iterator const_iterator
A const iterator over the elements of a view.
Definition value.hpp:59
friend bool operator==(value const &lhs, value const &rhs)
Compare equal when the BSON bytes represented by lhs and rhs compare equal.
Definition value.hpp:204
v1::array::view::const_iterator find(std::uint32_t i) const
Return a const iterator to the element within the represented BSON array at index i via key string co...
Definition value.hpp:169
v1::array::view::const_iterator begin() const
Return a const iterator to the beginning of the range of BSON elements within this view.
Definition value.hpp:159
v1::array::view view() const
Return a view of the BSON bytes as an array.
Definition value.hpp:137
v1::array::view::const_iterator cbegin() const
Return a const iterator to the beginning of the range of BSON elements within this view.
Definition value.hpp:149
std::size_t length() const
Return the length of the BSON bytes being represented.
Definition value.hpp:189
std::uint8_t const * data() const
Return a pointer to the BSON bytes being represented.
Definition value.hpp:179
~value()=default
Destroy this object.
value(std::uint8_t *data)
Initialize as owning data which will be freed with default_deleter_type.
Definition value.hpp:100
value & operator=(v1::array::view view)
Equivalent to this->reset(view).
Definition value.hpp:77
v1::document::value::deleter_type deleter_type
The type of the deleter used to free the underlying BSON bytes.
Definition value.hpp:50
void reset(value v)
Replace the underlying BSON bytes with v.
Definition value.hpp:125
value(std::uint8_t *data, std::size_t length)
Equivalent to value(std::uint8_t* data), but validates the embedded length against length.
Definition value.hpp:103
bool empty() const
Return true when the BSON bytes represents an empty view:
Definition value.hpp:194
unique_ptr_type release()
Release ownership of the underlying BSON bytes.
Definition value.hpp:120
const_iterator iterator
Equivalent to const_iterator.
Definition value.hpp:62
value(std::uint8_t *data, Deleter deleter)
Initialize as owning data which will be freed with deleter.
Definition value.hpp:93
v1::array::view::const_iterator end() const
Return a const iterator to the end of the range of BSON elements within this view.
Definition value.hpp:164
v1::element::view operator[](std::uint32_t i) const
Return the first element within the represented BSON array whose key compares equal to i.
Definition value.hpp:174
value(v1::array::view view)
Initialize with a copy of the BSON bytes referenced by view.
Definition value.hpp:112
value & operator=(value &&other) noexcept=default
Move assignment. noexcept
friend bool operator!=(value const &lhs, value const &rhs)
Compare equal when the BSON bytes represented by lhs and rhs compare equal.
Definition value.hpp:209
void reset(v1::array::view v)
Replace the underlying BSON bytes with a copy of v.
Definition value.hpp:130
value()=default
Initialize as an empty document (or array).
value(value &&other) noexcept=default
Move construction. noexcept
v1::document::value::default_deleter_type default_deleter_type
The deleter used to free copied BSON bytes when a user-provided deleter is not specified.
Definition value.hpp:53
v1::document::value::unique_ptr_type unique_ptr_type
The type of the unique pointer used to manage the underlying BSON bytes.
Definition value.hpp:56
value(unique_ptr_type ptr, std::size_t length)
Equivalent to value(unique_ptr_type ptr), but validates the embedded length against length.
Definition value.hpp:109
A non-owning, read-only BSON array.
Definition view.hpp:49
std::uint8_t const * data() const
Return a pointer to the BSON bytes being represented.
Definition view.hpp:71
const_iterator begin() const
Return a const iterator to the beginning of the range of BSON elements within this view.
Definition view.hpp:106
std::size_t length() const
Return the length of the BSON bytes being represented.
Definition view.hpp:81
const_iterator cbegin() const
Return a const iterator to the beginning of the range of BSON elements within this view.
Definition view.hpp:96
bool empty() const
Return true when the BSON bytes represents an empty view:
Definition view.hpp:86
v1::document::view::const_iterator const_iterator
A const iterator over the elements of a view.
Definition view.hpp:52
std::size_t size() const
Return the length of the BSON bytes being represented.
Definition view.hpp:76
const_iterator find(std::uint32_t i) const
Return a const iterator to the element within the represented BSON array at index i via key string co...
const_iterator cend() const
Return a const iterator to the end of the range of BSON elements within this view.
Definition view.hpp:101
const_iterator end() const
Return a const iterator to the end of the range of BSON elements within this view.
Definition view.hpp:111
A BSON document.
Definition value.hpp:46
std::unique_ptr< std::uint8_t[], deleter_type > unique_ptr_type
The type of the unique pointer used to manage the underlying BSON bytes.
Definition value.hpp:84
std::function< void(std::uint8_t *)> deleter_type
The type of the deleter used to free the underlying BSON bytes.
Definition value.hpp:64
std::default_delete< std::uint8_t[]> default_deleter_type
The deleter used to free copied BSON bytes when a user-provided deleter is not specified.
Definition value.hpp:69
A const iterator over the elements of a view.
Definition view.hpp:274
A non-owning, read-only BSON element.
Definition view.hpp:84
Declares entities representing a BSON array.
Declares entities whose ABI stability is guaranteed for documented symbols.
The top-level namespace within which all bsoncxx library entities are declared.
Declares bsoncxx::v1::array::value.
Provides bsoncxx::v1::array::view.
Provides bsoncxx::v1::document::value.