62 std::size_t _length{0};
73 value(value&&) =
default;
74 value& operator=(value&&) =
default;
76 value(value
const& other) : value{other.
view()} {}
101 : _data{
data, std::move(deleter)}, _length{
length} {}
139 template <typename T, detail::requires_not_t<
int, std::is_same<T,
array::
view>> = 0>
140 explicit value(T const& t) : value({}) {
154 template <
typename T>
187 auto const length = _length;
189 return {_data.release(),
length, std::move(_data.get_deleter())};
236 return this->
view().operator[](key);
244 std::uint8_t
const*
data()
const {
279 return {_data.get(), _length};
298 template <
typename T>
301 from_bson(temp, this->
view());
314 template <
typename T>
316 from_bson(t, this->
view());
329 return std::move(_data);
353 return !(lhs == rhs);
391using v_noabi::document::operator==;
392using v_noabi::document::operator!=;
#define BSONCXX_ABI_CDECL
Expands to __cdecl when built with MSVC on Windows.
Definition export.hpp:49
#define BSONCXX_ABI_EXPORT_CDECL(...)
Equivalent to BSONCXX_ABI_EXPORT with BSONCXX_ABI_CDECL.
Definition export.hpp:52
The bsoncxx v_noabi macro guard postlude header.
The bsoncxx v_noabi macro guard prelude header.
A BSON document.
Definition value.hpp:46
v1::document::view view() const
Return a view of the BSON bytes as a document.
Definition value.hpp:377
A polyfill for std::string_view.
Definition string_view.hpp:412
A variant view type that accesses values in serialized BSON documents.
Definition element.hpp:52
A read-only BSON document that owns its underlying buffer.
Definition value.hpp:48
void( *)(std::uint8_t *) deleter_type
The type of the deleter used to free the underlying BSON binary data.
Definition value.hpp:53
std::uint8_t const * data() const
Access the raw bytes of the underlying document.
Definition value.hpp:244
T get()
Constructs an object of type T from this document object. This method uses argument-dependent lookup ...
Definition value.hpp:299
std::size_t length() const
Gets the length of the underlying buffer.
Definition value.hpp:261
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 ...
Definition value.hpp:116
bool operator==(value const &lhs, value const &rhs)
Compares two document values for (in)-equality.
Definition value.hpp:347
const_iterator find(v1::stdx::string_view key) const
Finds the first element of the document with the provided key. If there is no such element,...
Definition value.hpp:221
v_noabi::document::view view() const noexcept
Get a view over the document owned by this value.
Definition value.hpp:278
const_iterator cbegin() const
Definition value.hpp:195
bool empty() const
Return true when this->length() == 5.
Definition value.hpp:271
const_iterator cend() const
Definition value.hpp:202
unique_ptr_type release()
Transfer ownership of the underlying buffer to the caller.
Definition value.hpp:328
void get(T &t)
Constructs an object of type T from this document object. This method uses argument-dependent lookup ...
Definition value.hpp:315
void reset(v_noabi::document::view view)
Replace the formerly-owned buffer with the new view. This will make a copy of the passed-in view.
Definition value.hpp:336
std::size_t size() const
Gets the length of the underlying buffer.
Definition value.hpp:256
std::unique_ptr< std::uint8_t[], deleter_type > unique_ptr_type
The type of the unique pointer used to manage the underlying BSON binary data.
Definition value.hpp:58
const_iterator begin() const
Definition value.hpp:209
v_noabi::document::element operator[](v1::stdx::string_view key) const
Finds the first element of the document with the provided key. If there is no such element,...
Definition value.hpp:235
value(std::uint8_t *data, std::size_t length, deleter_type deleter)
Constructs a value from a buffer.
Definition value.hpp:100
bool operator!=(value const &lhs, value const &rhs)
Compares two document values for (in)-equality.
Definition value.hpp:352
v_noabi::document::view::const_iterator const_iterator
A const iterator over the contents of a document view.
Definition value.hpp:66
const_iterator end() const
Definition value.hpp:216
value & operator=(T const &t)
Assignment used for serialization of user objects. This uses argument-dependent lookup to find the fu...
Definition value.hpp:155
const_iterator iterator
Equivalent to const_iterator.
Definition value.hpp:69
A const iterator over the contents of a document view.
Definition view.hpp:205
A read-only, non-owning view of a BSON document.
Definition view.hpp:40
const_iterator find(v1::stdx::string_view key) const
Finds the first element of the document with the provided key. If there is no such element,...
const_iterator cend() const
Definition view.hpp:260
const_iterator begin() const
Definition view.hpp:264
const_iterator end() const
Definition view.hpp:268
const_iterator cbegin() const
Provides bsoncxx::v_noabi::document::element.
Declares entities representing a BSON document.
Declares entities representing a BSON array.
Declares entities representing a BSON document.
Declares entities whose ABI stability is NOT guaranteed.
v1::element::view to_v1(v_noabi::array::element const &v)
Convert to the bsoncxx::v1 equivalent of v.
Definition element.hpp:132
v_noabi::array::value from_v1(v1::array::value const &v)
Convert from the bsoncxx::v1 equivalent of v.
Definition value.hpp:263
The top-level namespace within which all bsoncxx library entities are declared.
Provides bsoncxx::v1::document::value.
Provides std::string_view-related polyfills for library API usage.
Provides bsoncxx::v_noabi::array::view.
Declares bsoncxx::v_noabi::document::value.
Provides bsoncxx::v_noabi::document::view.