MongoDB C++ Driver mongocxx-3.11.0
|
#include <bsoncxx/v_noabi/bsoncxx/document/view.hpp>
A read-only, non-owning view of a BSON document.
Classes | |
class | const_iterator |
A const iterator over the contents of a document view. More... | |
Public Member Functions | |
view () | |
Default constructs a view. The resulting view will be initialized to point at an empty BSON document. | |
view (const std::uint8_t *data, std::size_t length) | |
Constructs a view from a buffer. The caller is responsible for ensuring that the lifetime of the resulting view is a subset of the buffer's. | |
const_iterator | begin () const |
const_iterator | cbegin () const |
const_iterator | cend () const |
const std::uint8_t * | data () const |
Access the raw bytes of the underlying document. | |
bool | empty () const |
Checks if the underlying document is empty, i.e. it is equivalent to the trivial document '{}'. | |
const_iterator | end () const |
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, the past-the-end iterator will be returned. The runtime of find() is linear in the length of the document. This method only searches the top-level document, and will not recurse to any subdocuments. | |
std::size_t | length () const |
Gets the length of the underlying buffer. | |
element | operator[] (stdx::string_view key) const |
Finds the first element of the document with the provided key. If there is no such element, the invalid document::element will be returned. The runtime of operator[] is linear in the length of the document. | |
Related Symbols | |
(Note that these are not member symbols.) | |
bool | operator== (view, view) |
Compare two document views for (in)-equality. | |
bool | operator!= (view, view) |
Compare two document views for (in)-equality. | |
bsoncxx::v_noabi::document::view::view | ( | ) |
Default constructs a view. The resulting view will be initialized to point at an empty BSON document.
bsoncxx::v_noabi::document::view::view | ( | const std::uint8_t * | data, |
std::size_t | length ) |
Constructs a view from a buffer. The caller is responsible for ensuring that the lifetime of the resulting view is a subset of the buffer's.
data | A buffer containing a valid BSON document. |
length | The size of the buffer, in bytes. |
const_iterator bsoncxx::v_noabi::document::view::begin | ( | ) | const |
const_iterator bsoncxx::v_noabi::document::view::cbegin | ( | ) | const |
const_iterator bsoncxx::v_noabi::document::view::cend | ( | ) | const |
const std::uint8_t * bsoncxx::v_noabi::document::view::data | ( | ) | const |
Access the raw bytes of the underlying document.
bool bsoncxx::v_noabi::document::view::empty | ( | ) | const |
Checks if the underlying document is empty, i.e. it is equivalent to the trivial document '{}'.
const_iterator bsoncxx::v_noabi::document::view::end | ( | ) | const |
const_iterator bsoncxx::v_noabi::document::view::find | ( | stdx::string_view | key | ) | const |
Finds the first element of the document with the provided key. If there is no such element, the past-the-end iterator will be returned. The runtime of find() is linear in the length of the document. This method only searches the top-level document, and will not recurse to any subdocuments.
key | The key to search for. |
std::size_t bsoncxx::v_noabi::document::view::length | ( | ) | const |
Gets the length of the underlying buffer.
element bsoncxx::v_noabi::document::view::operator[] | ( | stdx::string_view | key | ) | const |
Finds the first element of the document with the provided key. If there is no such element, the invalid document::element will be returned. The runtime of operator[] is linear in the length of the document.
key | The key to search for. |