#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.
|
| value (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.
|
|
| value (std::uint8_t *data, std::size_t length, deleter_type dtor) |
| 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.
|
|
| 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.
|
|
| operator array::view () const noexcept |
| Conversion operator that provides a view given a value.
|
|
unique_ptr_type | release () |
| Transfer ownership of the underlying buffer to the caller.
|
|
array::view | view () const noexcept |
| Get a view over the document owned by this value.
|
|
◆ value() [1/3]
bsoncxx::v_noabi::array::value::value |
( |
std::uint8_t * | data, |
|
|
std::size_t | length, |
|
|
deleter_type | dtor ) |
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.
- Parameters
-
data | A pointer to a buffer containing a valid BSON array. |
length | The length of the document. |
dtor | A user provided deleter. |
◆ value() [2/3]
bsoncxx::v_noabi::array::value::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.
- Parameters
-
ptr | A pointer to a buffer containing a valid BSON array. |
length | The length of the document. |
◆ value() [3/3]
bsoncxx::v_noabi::array::value::value |
( |
array::view | view | ) |
|
|
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.
- Parameters
-
view | A view of another array to copy. |
◆ operator array::view()
bsoncxx::v_noabi::array::value::operator array::view |
( |
| ) |
const |
|
inlinenoexcept |
Conversion operator that provides a view given a value.
- Returns
- A view over the value.
◆ release()
unique_ptr_type bsoncxx::v_noabi::array::value::release |
( |
| ) |
|
Transfer ownership of the underlying buffer to the caller.
- Warning
- After calling release() it is illegal to call any methods on this class, unless it is subsequently moved into.
- Returns
- A std::unique_ptr with ownership of the buffer.
◆ view()
array::view bsoncxx::v_noabi::array::value::view |
( |
| ) |
const |
|
inlinenoexcept |
Get a view over the document owned by this value.
The documentation for this class was generated from the following file: