52template <
typename Format>
54 using format_traits =
typename detail::format_traits<typename std::remove_cv<Format>::type>;
69 std::is_const<Format>::value,
70 typename format_traits::value_type
const,
71 typename format_traits::value_type>
::type;
83 std::is_const<Format>::value,
84 typename format_traits::const_reference,
85 typename format_traits::reference>
::type;
97 std::is_const<Format>::value,
98 typename format_traits::const_iterator,
99 typename format_traits::iterator>
::type;
105 using byte_type =
typename detail::accessor_data<format>::byte_type;
140 std::is_const<Format>::value,
141 typename format_traits::const_byte_reference,
142 typename format_traits::byte_reference>
::type;
153 std::is_const<Format>::value,
154 typename format_traits::const_byte_iterator,
155 typename format_traits::byte_iterator>
::type;
168 return {{_data.bytes, _data.size, _data.header_copy}};
178 return format_traits::element_count(_data.size, _data.header_copy);
183 return iterator(_data.bytes + detail::header_size);
227 return format_traits::make_byte_iterator(
begin(),
end());
237 return format_traits::make_byte_iterator(
cbegin(),
cend());
296 if (index >=
size()) {
307 if (index >=
size()) {
328 constexpr bool empty() const noexcept {
328 constexpr bool empty() const noexcept {
…}
336 accessor(detail::accessor_data<format> data) noexcept : _data{data} {}
338 detail::accessor_data<format> _data;
Declares bsoncxx::v_noabi::vector::accessor.
The bsoncxx v_noabi macro guard postlude header.
The bsoncxx v_noabi macro guard prelude header.
Provides bsoncxx::v_noabi::error_code.
Provides bsoncxx::v_noabi::exception.
Represents a BSON Binary element being constructed during an append operation.
Definition sub_binary.hpp:40
Base class for all exceptions thrown by the bsoncxx library unless otherwise specified.
Definition exception.hpp:33
Accessor for the contents of a valid BSON Binary Vector.
Definition accessor.hpp:53
const_reference at(element_count_type index) const
Obtain a const reference to a numbered element, with bounds checking.
Definition accessor.hpp:306
accessor(types::b_binary const &binary)
Construct a const vector accessor by validating a bsoncxx::v_noabi::types::b_binary reference.
Definition accessor.hpp:163
typename format_traits::const_iterator const_iterator
Iterator for const-qualified vector elements.
Definition accessor.hpp:89
reference at(element_count_type index)
Obtain a reference to a numbered element, with bounds checking.
Definition accessor.hpp:295
byte_reference byte_at(byte_count_type index)
Obtain a reference to a numbered byte, with bounds checking.
Definition accessor.hpp:273
constexpr iterator begin() const noexcept
Obtain a per-element iterator pointing to the beginning of the vector.
Definition accessor.hpp:182
constexpr const_byte_reference byte_front() const noexcept
Obtain a const reference to the first byte.
Definition accessor.hpp:253
Format format
The type from bsoncxx::v_noabi::vector::formats representing this vector's layout and element type.
Definition accessor.hpp:58
constexpr const_byte_reference byte_back() const noexcept
Obtain a const reference to the last byte.
Definition accessor.hpp:265
typename format_traits::const_byte_reference const_byte_reference
Type for referencing const-qualified vector bytes in-place.
Definition accessor.hpp:133
typename std::conditional< std::is_const< Format >::value, typename format_traits::value_type const, typename format_traits::value_type >::type value_type
A type suitable for holding element values.
Definition accessor.hpp:68
constexpr byte_count_type byte_size() const noexcept
Count the bytes of element data, not including any headers.
Definition accessor.hpp:172
byte_reference byte_back() noexcept
Obtain a reference to the last byte.
Definition accessor.hpp:259
constexpr byte_iterator byte_begin() const noexcept
Obtain a per-byte iterator pointing to the beginning of the vector.
Definition accessor.hpp:226
constexpr const_byte_iterator byte_cbegin() const noexcept
Obtain a const per-byte iterator pointing to the beginning of the vector.
Definition accessor.hpp:236
constexpr const_reference operator[](element_count_type index) const noexcept
Obtain a const reference to a numbered element, without bounds checking.
Definition accessor.hpp:323
const_byte_reference byte_at(byte_count_type index) const
Obtain a const reference to a numbered byte, with bounds checking.
Definition accessor.hpp:284
typename std::conditional< std::is_const< Format >::value, typename format_traits::const_byte_reference, typename format_traits::byte_reference >::type byte_reference
Type for referencing vector bytes in-place.
Definition accessor.hpp:139
typename std::conditional< std::is_const< Format >::value, typename format_traits::const_reference, typename format_traits::reference >::type reference
Type for referencing vector elements in-place.
Definition accessor.hpp:82
constexpr bool empty() const noexcept
Test whether the vector is empty.
Definition accessor.hpp:328
reference operator[](element_count_type index) noexcept
Obtain a reference to a numbered element, without bounds checking.
Definition accessor.hpp:316
constexpr const_reference back() const noexcept
Obtain a const reference to the last element.
Definition accessor.hpp:221
constexpr const_iterator cend() const noexcept
Obtain a const per-element end iterator.
Definition accessor.hpp:197
constexpr element_count_type size() const noexcept
Count the number of elements.
Definition accessor.hpp:177
typename format_traits::value_type const const_value_type
Const qualified version of value_type.
Definition accessor.hpp:62
typename format_traits::element_count_type element_count_type
Type for element counts.
Definition accessor.hpp:117
constexpr const_reference front() const noexcept
Obtain a const reference to the first element.
Definition accessor.hpp:209
typename detail::accessor_data< format >::byte_count_type byte_count_type
Type for byte counts.
Definition accessor.hpp:111
typename std::conditional< std::is_const< Format >::value, typename format_traits::const_iterator, typename format_traits::iterator >::type iterator
Element iterator type.
Definition accessor.hpp:96
typename format_traits::byte_difference_type byte_difference_type
Type for signed differences between byte iterators.
Definition accessor.hpp:123
typename format_traits::const_byte_iterator const_byte_iterator
Iterator for const-qualified vector bytes.
Definition accessor.hpp:146
byte_reference byte_front() noexcept
Obtain a reference to the first byte.
Definition accessor.hpp:247
constexpr const_iterator cbegin() const noexcept
Obtain a const per-element iterator pointing to the beginning of the vector.
Definition accessor.hpp:192
constexpr byte_iterator byte_end() const noexcept
Obtain a per-byte end iterator.
Definition accessor.hpp:231
reference back() noexcept
Obtain a reference to the last element.
Definition accessor.hpp:215
typename detail::accessor_data< format >::byte_type byte_type
Type for the underlying byte data.
Definition accessor.hpp:105
constexpr accessor< format const > as_const() const noexcept
Obtain a const version of this vector accessor, without re-validating the vector data.
Definition accessor.hpp:166
typename format_traits::element_difference_type element_difference_type
Type for signed differences between element iterators.
Definition accessor.hpp:129
typename std::conditional< std::is_const< Format >::value, typename format_traits::const_byte_iterator, typename format_traits::byte_iterator >::type byte_iterator
Byte iterator type.
Definition accessor.hpp:152
constexpr const_byte_iterator byte_cend() const noexcept
Obtain a const per-byte end iterator.
Definition accessor.hpp:241
typename format_traits::const_reference const_reference
Type for referencing const-qualified vector elements in-place.
Definition accessor.hpp:75
constexpr iterator end() const noexcept
Obtain a per-element end iterator.
Definition accessor.hpp:187
reference front() noexcept
Obtain a reference to the first element.
Definition accessor.hpp:203
Declarations related to the BSON Binary Vector subtype.
Declares entities whose ABI stability is NOT guaranteed.
@ k_vector_out_of_range
Attempted out-of-range access to a BSON Binary Vector element.
Definition error_code.hpp:153
type
An enumeration of each BSON type.
Definition types.hpp:43
stdx::optional< document::view > validate(std::uint8_t const *data, std::size_t length)
Validates a BSON document. This is a simplified overload that will only do the bare minimum validatio...
The top-level namespace within which all bsoncxx library entities are declared.
A BSON binary data value.
Definition types.hpp:227
Declares bsoncxx::v_noabi::builder::basic::sub_binary.