20 #include <bsoncxx/array/view.hpp>
21 #include <bsoncxx/document/view.hpp>
23 #include <bsoncxx/config/prelude.hpp>
26 BSONCXX_INLINE_NAMESPACE_BEGIN
36 using deleter_type = void (*)(std::uint8_t*);
37 using unique_ptr_type = std::unique_ptr<uint8_t[], deleter_type>;
51 value(std::uint8_t* data, std::size_t length, deleter_type dtor);
62 value(unique_ptr_type ptr, std::size_t length);
88 typename std::enable_if<!std::is_same<T, typename array::view>::value,
int>
::type = 0>
93 value& operator=(
const T& t) {
101 document::view::const_iterator cbegin()
const;
106 document::view::const_iterator cend()
const;
111 document::view::const_iterator begin()
const;
116 document::view::const_iterator end()
const;
133 document::view::const_iterator find(stdx::string_view key)
const;
145 element operator[](stdx::string_view key)
const;
152 const std::uint8_t* data()
const;
162 std::size_t length()
const;
175 BSONCXX_INLINE document::view view() const noexcept;
182 BSONCXX_INLINE operator document::view() const noexcept;
191 template <typename T>
194 from_bson(temp, this->view());
207 template <
typename T>
209 from_bson(t, this->view());
221 unique_ptr_type release();
230 unique_ptr_type _data;
231 std::size_t _length{0};
235 return document::view{
static_cast<uint8_t*
>(_data.get()), _length};
253 BSONCXX_INLINE
bool operator!=(
const value& lhs,
const value& rhs) {
254 return !(lhs == rhs);
262 BSONCXX_INLINE_NAMESPACE_END
265 #include <bsoncxx/config/postlude.hpp>