#include <bsoncxx/v_noabi/bsoncxx/array/value.hpp>
A read-only BSON array that owns its underlying buffer.
When a array::value goes out of scope, the underlying buffer is freed. Generally this class should be used sparingly; array::view should be used instead wherever possible.
Public Types | |
| using | const_iterator = v_noabi::array::view::const_iterator |
| A const iterator over the contents of a document view. | |
| using | deleter_type = void( *)(std::uint8_t*) |
| The type of the deleter used to free the underlying BSON binary data. | |
| using | iterator = const_iterator |
| Equivalent to const_iterator. | |
| using | unique_ptr_type = std::unique_ptr<uint8_t[], deleter_type> |
| The type of the unique pointer used to manage the underlying BSON binary data. | |
Public Member Functions | |
| value (std::uint8_t *data, std::size_t length, deleter_type deleter) | |
| Constructs a value from a buffer. | |
| value (unique_ptr_type ptr, std::size_t length) | |
| Constructs a value from a std::unique_ptr to a buffer. The ownership of the buffer is transferred to the resulting value. | |
| value (v_noabi::array::view view) | |
| Constructs a value from a view of an array. The data referenced by the array::view will be copied into a new buffer managed by the constructed value. | |
| const_iterator | begin () const |
| const_iterator | cbegin () const |
| const_iterator | cend () const |
| std::uint8_t const * | data () const |
| Access the raw bytes of the underlying array. | |
| bool | empty () const |
| Return true when this->length() == 5. | |
| const_iterator | end () const |
| const_iterator | find (std::uint32_t i) const |
| Indexes into this BSON array. If the index is out-of-bounds, a past-the-end iterator will be returned. As BSON represents arrays as documents, the runtime of find() is linear in the length of the array. | |
| std::size_t | length () const |
| Gets the length of the underlying buffer in bytes. | |
| operator v1::array::value () && | |
| Convert to the bsoncxx::v1 equivalent. | |
| operator v1::array::value () const & | |
| Convert to the bsoncxx::v1 equivalent. | |
| operator v_noabi::array::view () const noexcept | |
| Conversion operator that provides a view given a value. | |
| v_noabi::document::element | operator[] (std::uint32_t i) const |
| Indexes into this BSON array. If the index is out-of-bounds, the invalid array::element will be returned. As BSON represents arrays as documents, the runtime of operator[] is linear in the length of the array. | |
| unique_ptr_type | release () |
| Transfer ownership of the underlying buffer to the caller. | |
| void | reset (v_noabi::array::view view) |
| Replace the formerly-owned buffer with the new view. This will make a copy of the passed-in view. | |
| std::size_t | size () const |
| Gets the length of the underlying buffer in bytes. | |
| v_noabi::array::view | view () const noexcept |
| Get a view over the array owned by this value. | |
A const iterator over the contents of a document view.
This iterator type provides a const forward iterator interface to document view elements.
| using bsoncxx::v_noabi::array::value::deleter_type = void( *)(std::uint8_t*) |
The type of the deleter used to free the underlying BSON binary data.
Equivalent to const_iterator.
| using bsoncxx::v_noabi::array::value::unique_ptr_type = std::unique_ptr<uint8_t[], deleter_type> |
The type of the unique pointer used to manage the underlying BSON binary data.
|
inline |
Constructs a value from a buffer.
This constructor transfers ownership of the buffer to the resulting value. A user-provided deleter is used to destroy the buffer.
| data | A pointer to a buffer containing a valid BSON array. |
| length | The length of the document. |
| deleter | A user provided deleter. |
|
inline |
Constructs a value from a std::unique_ptr to a buffer. The ownership of the buffer is transferred to the resulting value.
| ptr | A pointer to a buffer containing a valid BSON array. |
| length | The length of the document. |
|
explicit |
Constructs a value from a view of an array. The data referenced by the array::view will be copied into a new buffer managed by the constructed value.
| view | A view of another array to copy. |
|
inline |
|
inline |
|
inline |
|
inline |
Access the raw bytes of the underlying array.
|
inline |
Return true when this->length() == 5.
|
inline |
|
inline |
Indexes into this BSON array. If the index is out-of-bounds, a past-the-end iterator will be returned. As BSON represents arrays as documents, the runtime of find() is linear in the length of the array.
| i | The index of the element. |
|
inline |
Gets the length of the underlying buffer in bytes.
|
inlineexplicit |
Convert to the bsoncxx::v1 equivalent.
|
inlineexplicit |
Convert to the bsoncxx::v1 equivalent.
|
inlinenoexcept |
Conversion operator that provides a view given a value.
|
inline |
Indexes into this BSON array. If the index is out-of-bounds, the invalid array::element will be returned. As BSON represents arrays as documents, the runtime of operator[] is linear in the length of the array.
| i | The index of the element. |
|
inline |
Transfer ownership of the underlying buffer to the caller.
|
inline |
Replace the formerly-owned buffer with the new view. This will make a copy of the passed-in view.
|
inline |
Gets the length of the underlying buffer in bytes.
|
inlinenoexcept |
Get a view over the array owned by this value.