21#include <bsoncxx/document/element.hpp>
22#include <bsoncxx/stdx/string_view.hpp>
24#include <bsoncxx/config/prelude.hpp>
27BSONCXX_INLINE_NAMESPACE_BEGIN
53 view(
const std::uint8_t* data, std::size_t length);
109 const std::uint8_t*
data()
const;
143 const std::uint8_t* _data;
153class BSONCXX_API
view::
iterator :
public std::iterator<std::forward_iterator_tag, element> {
158 reference operator*();
159 pointer operator->();
188 :
public std::iterator<std::forward_iterator_tag, element, std::ptrdiff_t, const element*,
194 reference operator*();
195 pointer operator->();
218BSONCXX_INLINE_NAMESPACE_END
221#include <bsoncxx/config/postlude.hpp>
A variant view type that accesses values in serialized BSON documents.
Definition element.hpp:70
A const iterator over the contents of a document view.
Definition view.hpp:189
friend bool operator!=(const const_iterator &, const const_iterator &)
Compares two const_iterators for (in)-equality.
friend bool operator==(const const_iterator &, const const_iterator &)
Compares two const_iterators for (in)-equality.
A mutable iterator over the contents of a document view.
Definition view.hpp:153
friend bool operator!=(const iterator &, const iterator &)
Compares two iterators for in-equality.
friend bool operator==(const iterator &, const iterator &)
Compares two iterators for in-equality.
A read-only, non-owning view of a BSON document.
Definition view.hpp:33
iterator find(stdx::string_view key) const
Finds the first element of the document with the provided key.
const std::uint8_t * data() const
Access the raw bytes of the underlying document.
const_iterator cbegin() const
friend bool operator==(view, view)
Compare two document views for (in)-equality.
view()
Default constructs a view.
view(const std::uint8_t *data, std::size_t length)
Constructs a view from a buffer.
std::size_t length() const
Gets the length of the underlying buffer.
bool empty() const
Checks if the underlying document is empty, i.e.
friend bool operator!=(view, view)
Compare two document views for (in)-equality.
element operator[](stdx::string_view key) const
Finds the first element of the document with the provided key.
const_iterator cend() const