41 using unique_ptr_type = std::unique_ptr<uint8_t[], deleter_type>;
94 template <typename T, detail::requires_not_t<
int,
std::is_same<T, array::
view>> = 0>
99 value& operator=(
const T& t) {
183 BSONCXX_PUSH_WARNINGS();
184 BSONCXX_DISABLE_WARNING(GCC(
"-Wmaybe-uninitialized"));
185 return document::view{
static_cast<uint8_t*
>(_data.get()), _length};
186 BSONCXX_POP_WARNINGS();
205 template <
typename T>
208 from_bson(temp, this->
view());
221 template <
typename T>
223 from_bson(t, this->
view());
244 unique_ptr_type _data;
245 std::size_t _length{0};
260 return !(lhs == rhs);
273using ::bsoncxx::v_noabi::document::operator==;
274using ::bsoncxx::v_noabi::document::operator!=;
286#if defined(BSONCXX_PRIVATE_DOXYGEN_PREPROCESSOR)
Provides bsoncxx::v_noabi::array::view.
The bsoncxx macro guard postlude header.
The bsoncxx macro guard prelude header.
A variant view type that accesses values in serialized BSON documents.
Definition element.hpp:46
A read-only BSON document that owns its underlying buffer. When a document::value goes out of scope,...
Definition value.hpp:38
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...
T get()
Constructs an object of type T from this document object. This method uses argument-dependent lookup ...
Definition value.hpp:206
bool operator!=(const value &lhs, const value &rhs)
Compares two document values for (in)-equality.
Definition value.hpp:259
element operator[](stdx::string_view key) const
Finds the first element of the document with the provided key. If there is no such element,...
std::size_t length() const
Gets the length of the underlying buffer.
document::view::const_iterator begin() const
const std::uint8_t * data() const
Access the raw bytes of the underlying document.
document::view::const_iterator find(stdx::string_view key) const
Finds the first element of the document with the provided key. If there is no such element,...
document::view::const_iterator cbegin() const
bool empty() const
Checks if the underlying document is empty, i.e. it is equivalent to the trivial document '{}...
unique_ptr_type release()
Transfer ownership of the underlying buffer to the caller.
void get(T &t)
Constructs an object of type T from this document object. This method uses argument-dependent lookup ...
Definition value.hpp:222
bool operator==(const value &lhs, const value &rhs)
Compares two document values for (in)-equality.
Definition value.hpp:254
document::view view() const noexcept
Get a view over the document owned by this value.
Definition value.hpp:181
document::view::const_iterator end() const
document::view::const_iterator cend() const
void reset(document::view view)
Replace the formerly-owned buffer with the new view. This will make a copy of the passed-in view.
A const iterator over the contents of a document view.
Definition view.hpp:153
A read-only, non-owning view of a BSON document.
Definition view.hpp:35
A polyfill for std::string_view.
Definition string_view.hpp:503
Declares bsoncxx::v_noabi::document::value.
Provides bsoncxx::v_noabi::document::view.
#define BSONCXX_ABI_CDECL
Expands to __cdecl when built with MSVC on Windows.
Definition fwd.hpp:217
#define BSONCXX_ABI_EXPORT_CDECL(...)
Equivalent to BSONCXX_ABI_EXPORT with BSONCXX_ABI_CDECL.
Definition fwd.hpp:225
bool operator!=(const v_noabi::document::element &elem, const v_noabi::types::bson_value::view &v)
bsoncxx::v_noabi::document::operator!=(const v_noabi::document::element& elem, const v_noabi::types::...
bool operator==(const v_noabi::document::element &elem, const v_noabi::types::bson_value::view &v)
bsoncxx::v_noabi::document::operator==(const v_noabi::document::element& elem, const v_noabi::types::...
The top-level namespace within which all bsoncxx library entities are declared.
The top-level namespace reserved for the C++ standard library.
Provides <type_traits>-related polyfills for internal use.