#include <bsoncxx/v1/array/value.hpp>
A BSON array.
Public Types | |
| using | const_iterator = v1::document::view::const_iterator |
| A const iterator over the elements of a view. | |
| using | default_deleter_type = v1::document::value::default_deleter_type |
| The deleter used to free copied BSON bytes when a user-provided deleter is not specified. | |
| using | deleter_type = v1::document::value::deleter_type |
| The type of the deleter used to free the underlying BSON bytes. | |
| using | iterator = const_iterator |
| Equivalent to const_iterator. | |
| using | unique_ptr_type = v1::document::value::unique_ptr_type |
| The type of the unique pointer used to manage the underlying BSON bytes. | |
Public Member Functions | |
| value ()=default | |
| Initialize as an empty document (or array). | |
| value (std::uint8_t *data) | |
| Initialize as owning data which will be freed with default_deleter_type. | |
| template<typename Deleter, detail::enable_if_t< is_valid_deleter< Deleter >::value > * = nullptr> | |
| value (std::uint8_t *data, Deleter deleter) | |
| Initialize as owning data which will be freed with deleter. | |
| value (std::uint8_t *data, std::size_t length) | |
| Equivalent to value(std::uint8_t* data), but validates the embedded length against length. | |
| template<typename Deleter, detail::enable_if_t< is_valid_deleter< Deleter >::value > * = nullptr> | |
| 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 length. | |
| value (unique_ptr_type ptr) | |
| Initialize as owning ptr. | |
| value (unique_ptr_type ptr, std::size_t length) | |
| Equivalent to value(unique_ptr_type ptr), but validates the embedded length against length. | |
| value (v1::array::view view) | |
| Initialize with a copy of the BSON bytes referenced by view. | |
| value (value &&other) noexcept=default | |
| Move construction. noexcept | |
| value (value const &other) | |
| Copy construction. | |
| ~value ()=default | |
| Destroy this object. | |
| v1::array::view::const_iterator | begin () const |
| Return a const iterator to the beginning of the range of BSON elements within this view. | |
| v1::array::view::const_iterator | cbegin () const |
| Return a const iterator to the beginning of the range of BSON elements within this view. | |
| v1::array::view::const_iterator | cend () const |
| Return a const iterator to the end of the range of BSON elements within this view. | |
| std::uint8_t const * | data () const |
| Return a pointer to the BSON bytes being represented. | |
| bool | empty () const |
| Return true when the BSON bytes represents an empty view: | |
| v1::array::view::const_iterator | end () const |
| Return a const iterator to the end of the range of BSON elements within this view. | |
| 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 comparison. | |
| deleter_type const & | get_deleter () const |
| Return the current deleter. | |
| std::size_t | length () const |
| Return the length of the BSON bytes being represented. | |
| operator bool () const | |
| Return true when this view is valid. | |
| operator v1::array::view () const | |
| Implicitly convert to this->view(). | |
| value & | operator= (v1::array::view view) |
| Equivalent to this->reset(view). | |
| value & | operator= (value &&other) noexcept=default |
| Move assignment. noexcept | |
| value & | operator= (value const &other) |
| Copy assignment. | |
| v1::element::view | operator[] (std::uint32_t i) const |
| Return the first element within the represented BSON array whose key compares equal to i. | |
| unique_ptr_type | release () |
| Release ownership of the underlying BSON bytes. | |
| void | reset (v1::array::view v) |
| Replace the underlying BSON bytes with a copy of v. | |
| void | reset (value v) |
| Replace the underlying BSON bytes with v. | |
| std::size_t | size () const |
| Return the length of the BSON bytes being represented. | |
| v1::array::view | view () const |
| Return a view of the BSON bytes as an array. | |
Friends | |
| bool | operator!= (value const &lhs, value const &rhs) |
| Compare equal when the BSON bytes represented by lhs and rhs compare equal. | |
| bool | operator== (value const &lhs, value const &rhs) |
| Compare equal when the BSON bytes represented by lhs and rhs compare equal. | |
A const iterator over the elements of a view.
The deleter used to free copied BSON bytes when a user-provided deleter is not specified.
The type of the deleter used to free the underlying BSON bytes.
A deleter D that is wrapped by deleter_type must:
These requirements are the same as those for a std::unique_ptr<T, D> deleter D, but do not include nothrow move assignability due to being wrapped by deleter_type.
Equivalent to const_iterator.
The type of the unique pointer used to manage the underlying BSON bytes.
|
default |
Destroy this object.
|
defaultnoexcept |
Move construction. noexcept
|
inline |
Copy construction.
The copied value is allocated using operator new[] and the deleter is set to default_deleter_type.
|
default |
Initialize as an empty document (or array).
The value is equivalent to a default-initialized bsoncxx::v1::document::view and the deleter is set to bsoncxx::v1::document::value::noop_deleter.
|
inline |
Initialize as owning data which will be freed with deleter.
|
inline |
Equivalent to value(std::uint8_t* data, Deleter deleter), but validates the embedded length against length.
| bsoncxx::v1::exception | with bsoncxx::v1::document::view::errc::invalid_length if `length` is less than 5 or less than this->size(). |
|
inlineexplicit |
Initialize as owning data which will be freed with default_deleter_type.
|
inline |
Equivalent to value(std::uint8_t* data), but validates the embedded length against length.
| bsoncxx::v1::exception | with bsoncxx::v1::document::view::errc::invalid_length if `length` is less than 5 or less than this->size(). |
|
inlineexplicit |
|
inline |
Equivalent to value(unique_ptr_type ptr), but validates the embedded length against length.
| bsoncxx::v1::exception | with bsoncxx::v1::document::view::errc::invalid_length if `length` is less than 5 or less than this->size(). |
|
inlineexplicit |
Initialize with a copy of the BSON bytes referenced by view.
If view is equivalent to a default-initialized bsoncxx::v1::document::view, this value is equivalent to value().
If view is invalid, this value is equivalent to value{nullptr}.
Otherwise, the copied value is allocated using operator new[] and the deleter is set to default_deleter_type.
|
inline |
Return a const iterator to the beginning of the range of BSON elements within this view.
If this view is invalid, returns an end iterator.
| bsoncxx::v1::exception | with bsoncxx::v1::document::view::errc::invalid_data if this operation failed due to invalid BSON bytes. |
|
inline |
Return a const iterator to the beginning of the range of BSON elements within this view.
If this view is invalid, returns an end iterator.
| bsoncxx::v1::exception | with bsoncxx::v1::document::view::errc::invalid_data if this operation failed due to invalid BSON bytes. |
|
inline |
Return a const iterator to the end of the range of BSON elements within this view.
|
inline |
Return a pointer to the BSON bytes being represented.
|
inline |
|
inline |
Return a const iterator to the end of the range of BSON elements within this view.
|
inline |
Return a const iterator to the element within the represented BSON array at index i via key string comparison.
If this view is invalid or the requested field is not found, returns an end iterator.
| bsoncxx::v1::exception | with bsoncxx::v1::document::view::errc::invalid_data if this operation failed due to invalid BSON bytes. |
|
inline |
Return the current deleter.
|
inline |
Return the length of the BSON bytes being represented.
If this->data() is null, returns 0.
|
inlineexplicit |
Return true when this view is valid.
|
inline |
Implicitly convert to this->view().
|
inline |
Equivalent to this->reset(view).
Move assignment. noexcept
Copy assignment.
The copied value is allocated using operator new[] and the deleter is set to default_deleter_type.
|
inline |
Return the first element within the represented BSON array whose key compares equal to i.
| bsoncxx::v1::exception | with bsoncxx::v1::document::view::errc::invalid_data if this operation failed due to invalid BSON bytes. |
|
inline |
Release ownership of the underlying BSON bytes.
|
inline |
Replace the underlying BSON bytes with a copy of v.
If v is invalid, reset to a default-initialized value.
The copied value is allocated using operator new[] and the deleter is set to default_deleter_type.
|
inline |
Replace the underlying BSON bytes with v.
|
inline |
Return the length of the BSON bytes being represented.
If this->data() is null, returns 0.
|
inline |
Return a view of the BSON bytes as an array.
Compare equal when the BSON bytes represented by lhs and rhs compare equal.
An invalid view only compares equal to another invalid view. The underlying BSON bytes (if any) is ignored for an invalid document.
Compare equal when the BSON bytes represented by lhs and rhs compare equal.
An invalid view only compares equal to another invalid view. The underlying BSON bytes (if any) is ignored for an invalid document.