#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 Types | |
| using | iterator = const_iterator |
| Equivalent to const_iterator. | |
Public Member Functions | |
| view () | |
| Default constructs a view. | |
| 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 resulting view is a subset of the buffer's. | |
| view (v1::document::view const &v) | |
| Construct with the bsoncxx::v1 equivalent. | |
| const_iterator | begin () const |
| const_iterator | cbegin () const |
| const_iterator | cend () const |
| std::uint8_t const * | data () const |
| Access the raw bytes of the underlying document. | |
| bool | empty () const |
| Return true when this->length() == 5. | |
| const_iterator | end () const |
| 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, 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 in bytes. | |
| operator v1::document::view () const | |
| Convert to the bsoncxx::v1 equivalent. | |
| 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, the invalid document::element will be returned. The runtime of operator[] is linear in the length of the document. | |
| std::size_t | size () const |
| Gets the length of the underlying buffer in bytes. | |
Related Symbols | |
(Note that these are not member symbols.) | |
| bool | operator== (view lhs, view rhs) |
| Compare two document views for (in)-equality. | |
| bool | operator!= (view lhs, view rhs) |
| Compare two document views for (in)-equality. | |
Equivalent to const_iterator.
|
inline |
|
inline |
Construct with the bsoncxx::v1 equivalent.
|
inline |
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 pointer to valid BSON data. |
| length | The size of the BSON data in bytes. |
|
inline |
|
inline |
|
inline |
Access the raw bytes of the underlying document.
|
inline |
Return true when this->length() == 5.
|
inline |
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. |
|
inline |
Gets the length of the underlying buffer in bytes.
|
inlineexplicit |
Convert to the bsoncxx::v1 equivalent.
|
inline |
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. |
|
inline |
Gets the length of the underlying buffer in bytes.