| 254 | * This iterator should be stable over field deletes, but not insertions. |
| 255 | */ |
| 256 | class iterator |
| 257 | { |
| 258 | using self_type = iterator; ///< Self reference types. |
| 259 | |
| 260 | public: |
| 261 | iterator() = default; |
| 262 | |
| 263 | // STL iterator compliance types. |
| 264 | using difference_type = void; |
| 265 | using value_type = MIMEField; |
| 266 | using pointer = value_type *; |
| 267 | using reference = value_type &; |
| 268 | using iterator_category = std::forward_iterator_tag; |
| 269 | |
| 270 | pointer operator->(); |
| 271 | reference operator*(); |
| 272 | |
| 273 | self_type &operator++(); |
| 274 | self_type operator++(int); |
| 275 | |
| 276 | bool operator==(self_type const &that) const; |
| 277 | bool operator!=(self_type const &that) const; |
| 278 | |
| 279 | protected: |
| 280 | MIMEFieldBlockImpl *_block = nullptr; ///< Current block. |
| 281 | unsigned _slot = 0; ///< Slot in @a _block |
| 282 | |
| 283 | /** Internal constructor. |
| 284 | * |
| 285 | * @param block Block containing current field. |
| 286 | * @param slot Index of current field. |
| 287 | */ |
| 288 | iterator(MIMEFieldBlockImpl *block, unsigned slot) : _block(block), _slot(slot) { this->step(); } |
| 289 | |
| 290 | /** Move to a valid (live) slot. |
| 291 | * |
| 292 | * This enforces the invariant that the iterator is exactly one of |
| 293 | * 1. referencing a valid slot |
| 294 | * 2. equal to the @c end iterator |
| 295 | * |
| 296 | * Therefore if called when the iterator is in state (1) the iterator is unchanged. |
| 297 | * |
| 298 | * @return @a this |
| 299 | */ |
| 300 | self_type &step(); |
| 301 | |
| 302 | friend class MIMEHdr; |
| 303 | friend struct MIMEHdrImpl; |
| 304 | }; |
| 305 | |
| 306 | // HdrHeapObjImpl is 4 bytes, so this will result in 4 bytes padding |
| 307 | uint64_t m_presence_bits; |