44 struct is_valid_deleter : std::is_constructible<v1::document::value, std::uint8_t*, T> {};
82 _value = other._value;
90 template <typename Deleter, detail::enable_if_t<is_valid_deleter<Deleter>::value>* =
nullptr>
91 value(std::uint8_t*
data, Deleter deleter) : _value{
data, std::move(deleter)} {}
94 template <typename Deleter, detail::enable_if_t<is_valid_deleter<Deleter>::value>* =
nullptr>
114 return _value.get_deleter();
119 return _value.release();
124 _value = std::move(v._value);
173 return this->
view()[i];
177 std::uint8_t
const*
data()
const {
197 explicit operator bool()
const {
198 return this->
view().operator bool();
208 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:152
value(value const &other)
Copy construction.
Definition value.hpp:72
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:95
value(unique_ptr_type ptr)
Initialize as owning ptr.
Definition value.hpp:104
value & operator=(value const &other)
Copy assignment.
Definition value.hpp:81
deleter_type const & get_deleter() const
Return the current deleter.
Definition value.hpp:113
std::size_t size() const
Return the length of the BSON bytes being represented.
Definition value.hpp:182
v1::document::view::const_iterator const_iterator
A const iterator over the elements of a view.
Definition value.hpp:57
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:202
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:167
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:157
v1::array::view view() const
Return a view of the BSON bytes as an array.
Definition value.hpp:135
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:147
std::size_t length() const
Return the length of the BSON bytes being represented.
Definition value.hpp:187
std::uint8_t const * data() const
Return a pointer to the BSON bytes being represented.
Definition value.hpp:177
~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:98
value & operator=(v1::array::view view)
Equivalent to this->reset(view).
Definition value.hpp:75
v1::document::value::deleter_type deleter_type
The type of the deleter used to free the underlying BSON bytes.
Definition value.hpp:48
void reset(value v)
Replace the underlying BSON bytes with v.
Definition value.hpp:123
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:101
bool empty() const
Return true when the BSON bytes represents an empty view:
Definition value.hpp:192
unique_ptr_type release()
Release ownership of the underlying BSON bytes.
Definition value.hpp:118
const_iterator iterator
Equivalent to const_iterator.
Definition value.hpp:60
value(std::uint8_t *data, Deleter deleter)
Initialize as owning data which will be freed with deleter.
Definition value.hpp:91
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:162
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:172
value(v1::array::view view)
Initialize with a copy of the BSON bytes referenced by view.
Definition value.hpp:110
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:207
void reset(v1::array::view v)
Replace the underlying BSON bytes with a copy of v.
Definition value.hpp:128
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:51
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:54
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:107
A non-owning, read-only BSON array.
Definition view.hpp:47
std::uint8_t const * data() const
Return a pointer to the BSON bytes being represented.
Definition view.hpp:69
const_iterator begin() const
Return a const iterator to the beginning of the range of BSON elements within this view.
Definition view.hpp:104
std::size_t length() const
Return the length of the BSON bytes being represented.
Definition view.hpp:79
const_iterator cbegin() const
Return a const iterator to the beginning of the range of BSON elements within this view.
Definition view.hpp:94
bool empty() const
Return true when the BSON bytes represents an empty view:
Definition view.hpp:84
v1::document::view::const_iterator const_iterator
A const iterator over the elements of a view.
Definition view.hpp:50
std::size_t size() const
Return the length of the BSON bytes being represented.
Definition view.hpp:74
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:99
const_iterator end() const
Return a const iterator to the end of the range of BSON elements within this view.
Definition view.hpp:109
A BSON document.
Definition value.hpp:44
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:82
std::function< void(std::uint8_t *)> deleter_type
The type of the deleter used to free the underlying BSON bytes.
Definition value.hpp:62
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:67
A const iterator over the elements of a view.
Definition view.hpp:264
A non-owning, read-only BSON element.
Definition view.hpp:82
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.