39template <
typename Iterator>
40class packed_bit_element {
65 constexpr bool operator==(packed_bit_element
const& other)
const noexcept {
66 return byte == other.byte && bit == other.bit;
70 constexpr bool operator!=(packed_bit_element
const& other)
const noexcept {
71 return byte != other.byte || bit != other.bit;
75 constexpr bool operator<(packed_bit_element
const& other)
const noexcept {
76 return byte < other.byte || (
byte == other.byte && bit < other.bit);
80 constexpr bool operator<=(packed_bit_element
const& other)
const noexcept {
81 return byte < other.byte || (
byte == other.byte && bit <= other.bit);
85 constexpr bool operator>(packed_bit_element
const& other)
const noexcept {
86 return byte > other.byte || (
byte == other.byte && bit > other.bit);
90 constexpr bool operator>=(packed_bit_element
const& other)
const noexcept {
91 return byte > other.byte || (
byte == other.byte && bit >= other.bit);
107 return *
this + (-other);
118 return *
this = *
this + other;
123 return *
this = *
this - other;
138 packed_bit_element prev = *
this;
145 packed_bit_element prev = *
this;
153 friend class
accessor<formats::f_packed_bit const>;
156 : byte{byte_iter}, bit{bit_index} {}
164template <
typename Iterator>
165class packed_bit_byte {
187 return {byte, (
byte + 1) == byte_end ? last_byte_mask :
value_type{0xFFu}};
191 constexpr bool operator==(packed_bit_byte
const& other)
const noexcept {
192 return byte == other.byte;
196 constexpr bool operator!=(packed_bit_byte
const& other)
const noexcept {
197 return byte != other.byte;
201 constexpr bool operator<(packed_bit_byte
const& other)
const noexcept {
202 return byte < other.byte;
206 constexpr bool operator<=(packed_bit_byte
const& other)
const noexcept {
207 return byte <= other.byte;
211 constexpr bool operator>(packed_bit_byte
const& other)
const noexcept {
212 return byte > other.byte;
216 constexpr bool operator>=(packed_bit_byte
const& other)
const noexcept {
217 return byte >= other.byte;
224 return {
byte + other, byte_end, last_byte_mask};
231 return *
this + (-other);
237 return {
byte - other.byte};
242 return *
this = *
this + other;
247 return *
this = *
this - other;
262 packed_bit_byte prev = *
this;
269 packed_bit_byte prev = *
this;
275 friend struct detail::format_traits<
formats::f_packed_bit>;
276 friend struct detail::format_traits<formats::f_packed_bit const>;
278 constexpr
packed_bit_byte(packed_bit_element<Iterator> element, packed_bit_element<Iterator> element_end)
279 : byte{element.byte},
280 byte_end{(element_end + 7u).
byte},
281 last_byte_mask{
value_type(0xFFu << (-element_end.bit & 7u))} {}
283 constexpr packed_bit_byte(Iterator
byte, Iterator byte_end,
value_type last_byte_mask)
284 : byte{byte}, byte_end{byte_end}, last_byte_mask{last_byte_mask} {}
Declares bsoncxx::v_noabi::vector::accessor.
The bsoncxx v_noabi macro guard postlude header.
The bsoncxx v_noabi macro guard prelude header.
Accessor for the contents of a valid BSON Binary Vector.
Definition accessor.hpp:53
Reference to a byte or partial byte within a vector of packed_bit elements. Allows access to each byt...
Definition elements.hpp:169
Reference to a single element in a packed_bit vector.
Definition elements.hpp:104
Iterator for bytes within a packed_bit vector.
Definition iterators.hpp:165
packed_bit_byte & operator++() noexcept
Pre-increment.
Definition iterators.hpp:251
packed_bit_byte & operator+=(difference_type const &other) noexcept
Advance this iterator forward by the indicated number of bytes.
Definition iterators.hpp:241
constexpr bool operator==(packed_bit_byte const &other) const noexcept
Compare two byte iterators.
Definition iterators.hpp:191
constexpr packed_bit_byte operator-(difference_type const &other) const noexcept
Calculate a signed subtraction of a ptrdiff_t from this iterator, moving it backward or forward the i...
Definition iterators.hpp:230
packed_bit_byte operator--(int) noexcept
Post-decrement.
Definition iterators.hpp:268
constexpr reference operator*() const noexcept
Dereference the byte iterator.
Definition iterators.hpp:186
elements::packed_bit_byte< std::uint8_t * > const reference
Definition iterators.hpp:172
constexpr difference_type operator-(packed_bit_byte const &other) const noexcept
Calculate the difference in position between two byte iterators If the two iterators do not point int...
Definition iterators.hpp:236
constexpr bool operator!=(packed_bit_byte const &other) const noexcept
Compare two byte iterators.
Definition iterators.hpp:196
constexpr bool operator>(packed_bit_byte const &other) const noexcept
Compare two byte iterators.
Definition iterators.hpp:211
elements::packed_bit_byte< std::uint8_t * > const * pointer
Definition iterators.hpp:176
packed_bit_byte & operator--() noexcept
Pre-decrement.
Definition iterators.hpp:256
constexpr bool operator<=(packed_bit_byte const &other) const noexcept
Compare two byte iterators.
Definition iterators.hpp:206
std::random_access_iterator_tag iterator_category
Definition iterators.hpp:179
constexpr packed_bit_byte operator+(difference_type const &other) const noexcept
Calculate a signed addition of this iterator with a ptrdiff_t, moving it forward or backward the indi...
Definition iterators.hpp:223
constexpr bool operator>=(packed_bit_byte const &other) const noexcept
Compare two byte iterators.
Definition iterators.hpp:216
std::uint8_t value_type
Definition iterators.hpp:168
packed_bit_byte & operator-=(difference_type const &other) noexcept
Move this iterator backward by the indicated number of bytes.
Definition iterators.hpp:246
std::ptrdiff_t difference_type
Definition iterators.hpp:182
packed_bit_byte operator++(int) noexcept
Post-increment.
Definition iterators.hpp:261
constexpr bool operator<(packed_bit_byte const &other) const noexcept
Compare two byte iterators.
Definition iterators.hpp:201
Iterator for elements within a packed_bit vector.
Definition iterators.hpp:40
constexpr difference_type operator-(packed_bit_element const &other) const noexcept
Calculate the difference in position between two bit iterators If the two iterators do not point into...
Definition iterators.hpp:112
packed_bit_element operator--(int) noexcept
Post-decrement.
Definition iterators.hpp:144
std::ptrdiff_t difference_type
Definition iterators.hpp:56
constexpr bool operator==(packed_bit_element const &other) const noexcept
Compare two bit iterators.
Definition iterators.hpp:65
packed_bit_element & operator+=(difference_type const &other) noexcept
Advance this iterator forward by the indicated number of bits.
Definition iterators.hpp:117
packed_bit_element & operator--() noexcept
Pre-decrement.
Definition iterators.hpp:132
elements::packed_bit_element< std::uint8_t * > const * pointer
Definition iterators.hpp:50
constexpr packed_bit_element operator-(difference_type const &other) const noexcept
Calculate a signed subtraction of a ptrdiff_t from this iterator, moving it backward or forward the i...
Definition iterators.hpp:106
elements::packed_bit_element< std::uint8_t * > const reference
Definition iterators.hpp:46
std::random_access_iterator_tag iterator_category
Definition iterators.hpp:53
constexpr packed_bit_element operator+(difference_type const &other) const noexcept
Calculate a signed addition of this iterator with a ptrdiff_t, moving it forward or backward the indi...
Definition iterators.hpp:97
packed_bit_element & operator-=(difference_type const &other) noexcept
Move this iterator backward by the indicated number of bits.
Definition iterators.hpp:122
packed_bit_element & operator++() noexcept
Pre-increment.
Definition iterators.hpp:127
bool value_type
Definition iterators.hpp:43
constexpr bool operator<=(packed_bit_element const &other) const noexcept
Compare two bit iterators.
Definition iterators.hpp:80
constexpr bool operator>(packed_bit_element const &other) const noexcept
Compare two bit iterators.
Definition iterators.hpp:85
constexpr bool operator!=(packed_bit_element const &other) const noexcept
Compare two bit iterators.
Definition iterators.hpp:70
constexpr reference operator*() const noexcept
Dereference this bit iterator into a bit reference.
Definition iterators.hpp:60
packed_bit_element operator++(int) noexcept
Post-increment.
Definition iterators.hpp:137
constexpr bool operator<(packed_bit_element const &other) const noexcept
Compare two bit iterators.
Definition iterators.hpp:75
constexpr bool operator>=(packed_bit_element const &other) const noexcept
Compare two bit iterators.
Definition iterators.hpp:90
Declares entities in bsoncxx::v_noabi::vector::elements.
Forward declarations for bsoncxx::v_noabi::vector::iterators.
Declares iterator types for BSON Binary Vector.
Declarations related to the BSON Binary Vector subtype.
Declares entities whose ABI stability is NOT guaranteed.
The top-level namespace within which all bsoncxx library entities are declared.