eb2be374fd
I added `enum class` to one thing and decided that that was quite enough before disabling the `enum class` warning. Looks like 16.8 made more map/vector operations noexcept, so we have to re-annotate to remain compliant.
63 lines
1.7 KiB
C++
63 lines
1.7 KiB
C++
/*++
|
|
Copyright (c) Microsoft Corporation
|
|
Licensed under the MIT license.
|
|
|
|
Module Name:
|
|
- AttrRowIterator.hpp
|
|
|
|
Abstract:
|
|
- iterator for ATTR_ROW to walk the TextAttributes of the run
|
|
- read only iterator
|
|
|
|
Author(s):
|
|
- Austin Diviness (AustDi) 04-Jun-2018
|
|
--*/
|
|
|
|
#pragma once
|
|
|
|
#include "TextAttribute.hpp"
|
|
#include "TextAttributeRun.hpp"
|
|
|
|
class ATTR_ROW;
|
|
|
|
class AttrRowIterator final
|
|
{
|
|
public:
|
|
using iterator_category = std::bidirectional_iterator_tag;
|
|
using value_type = TextAttribute;
|
|
using difference_type = std::ptrdiff_t;
|
|
using pointer = TextAttribute*;
|
|
using reference = TextAttribute&;
|
|
|
|
static AttrRowIterator CreateEndIterator(const ATTR_ROW* const attrRow) noexcept;
|
|
|
|
AttrRowIterator(const ATTR_ROW* const attrRow) noexcept;
|
|
|
|
operator bool() const noexcept;
|
|
|
|
bool operator==(const AttrRowIterator& it) const noexcept;
|
|
bool operator!=(const AttrRowIterator& it) const noexcept;
|
|
|
|
AttrRowIterator& operator++() noexcept;
|
|
AttrRowIterator operator++(int) noexcept;
|
|
|
|
AttrRowIterator& operator+=(const ptrdiff_t& movement);
|
|
AttrRowIterator& operator-=(const ptrdiff_t& movement);
|
|
|
|
AttrRowIterator& operator--() noexcept;
|
|
AttrRowIterator operator--(int) noexcept;
|
|
|
|
const TextAttribute* operator->() const;
|
|
const TextAttribute& operator*() const;
|
|
|
|
private:
|
|
std::vector<TextAttributeRun>::const_iterator _run;
|
|
const ATTR_ROW* _pAttrRow;
|
|
size_t _currentAttributeIndex; // index of TextAttribute within the current TextAttributeRun
|
|
bool _exceeded;
|
|
|
|
void _increment(size_t count) noexcept;
|
|
void _decrement(size_t count) noexcept;
|
|
void _setToEnd() noexcept;
|
|
};
|