152 std::uint8_t
const*
data()
const {
179 return _length == 5u;
189 return (lhs._length == rhs._length) && (std::memcmp(lhs.
data(), rhs.
data(), lhs._length) == 0);
193 return !(lhs == rhs);
216 using iterator_category = std::forward_iterator_tag;
217 using difference_type = std::ptrdiff_t;
219 const_iterator() =
default;
223 reference operator*() {
227 pointer operator->() {
233 const_iterator operator++(
int) {
234 const_iterator before(*
this);
245 friend bool operator==(const_iterator
const& lhs, const_iterator
const& rhs) {
246 return lhs._element.
raw() == rhs._element.
raw() && lhs._element.
offset() == rhs._element.
offset();
249 friend bool operator!=(const_iterator
const& lhs, const_iterator
const& rhs) {
250 return !(lhs == rhs);
257 return *(this->
find(key));
#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 const iterator over the contents of a document view.
Definition view.hpp:205
view()
Default constructs a view.
Definition view.hpp:61
A non-owning, read-only BSON document.
Definition view.hpp:54
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
std::uint8_t const * raw() const
Getter for the raw bson bytes the element points to.
Definition element.hpp:90
std::uint32_t offset() const
Getter for the offset into the raw bson bytes the element points to.
Definition element.hpp:108
A const iterator over the contents of a document view.
Definition view.hpp:205
element value_type
std::iterator_traits
Definition view.hpp:213
friend bool operator!=(const_iterator const &lhs, const_iterator const &rhs)
Compares two const_iterators for (in)-equality.
Definition view.hpp:249
friend bool operator==(const_iterator const &lhs, const_iterator const &rhs)
Compares two const_iterators for (in)-equality.
Definition view.hpp:245
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
bool empty() const
Return true when this->length() == 5.
Definition view.hpp:178
std::uint8_t const * data() const
Access the raw bytes of the underlying document.
Definition view.hpp:152
const_iterator begin() const
Definition view.hpp:264
view(v1::document::view const &v)
Construct with the bsoncxx::v1 equivalent.
Definition view.hpp:66
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 view.hpp:256
view(std::uint8_t const *data, std::size_t length)
Constructs a view from a buffer. The caller is responsible for ensuring that the lifetime of the resu...
Definition view.hpp:81
friend bool operator!=(view lhs, view rhs)
Compare two document views for (in)-equality.
Definition view.hpp:192
friend bool operator==(view lhs, view rhs)
Compare two document views for (in)-equality.
Definition view.hpp:188
std::size_t size() const
Gets the length of the underlying buffer in bytes.
Definition view.hpp:163
std::size_t length() const
Gets the length of the underlying buffer in bytes.
Definition view.hpp:168
view()
Default constructs a view.
Definition view.hpp:61
const_iterator end() const
Definition view.hpp:268
const_iterator cbegin() const
const_iterator iterator
Equivalent to const_iterator.
Definition view.hpp:51
Provides bsoncxx::v_noabi::document::element.
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:267
The top-level namespace within which all bsoncxx library entities are declared.
Provides bsoncxx::v1::document::view.
Declares bsoncxx::v_noabi::document::view.
Provides std::string_view-related polyfills for library API usage.