Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
ui::AXRange< AXPositionType >::Iterator Class Reference

#include <ax_range.h>

Inheritance diagram for ui::AXRange< AXPositionType >::Iterator:

Public Member Functions

 Iterator ()
 
 Iterator (AXPositionInstance start, AXPositionInstance end)
 
 Iterator (const Iterator &other)=delete
 
 Iterator (Iterator &&other)
 
 ~Iterator ()=default
 
bool operator== (const Iterator &other) const
 
bool operator!= (const Iterator &other) const
 
Iteratoroperator++ ()
 
AXRange operator* () const
 

Detailed Description

template<class AXPositionType>
class ui::AXRange< AXPositionType >::Iterator

Definition at line 193 of file ax_range.h.

Constructor & Destructor Documentation

◆ Iterator() [1/4]

template<class AXPositionType >
ui::AXRange< AXPositionType >::Iterator::Iterator ( )
inline

Definition at line 195 of file ax_range.h.

196 : current_start_(AXPositionType::CreateNullPosition()),
197 iterator_end_(AXPositionType::CreateNullPosition()) {}

◆ Iterator() [2/4]

template<class AXPositionType >
ui::AXRange< AXPositionType >::Iterator::Iterator ( AXPositionInstance  start,
AXPositionInstance  end 
)
inline

Definition at line 199 of file ax_range.h.

199 {
200 if (end && !end->IsNullPosition()) {
201 current_start_ = !start ? AXPositionType::CreateNullPosition()
202 : start->AsLeafTextPosition();
203 iterator_end_ = end->AsLeafTextPosition();
204 } else {
205 current_start_ = AXPositionType::CreateNullPosition();
206 iterator_end_ = AXPositionType::CreateNullPosition();
207 }
208 }
Iterator end() const
Definition: ax_range.h:266

◆ Iterator() [3/4]

template<class AXPositionType >
ui::AXRange< AXPositionType >::Iterator::Iterator ( const Iterator other)
delete

◆ Iterator() [4/4]

template<class AXPositionType >
ui::AXRange< AXPositionType >::Iterator::Iterator ( Iterator &&  other)
inline

Definition at line 212 of file ax_range.h.

213 : current_start_(std::move(other.current_start_)),
214 iterator_end_(std::move(other.iterator_end_)) {}

◆ ~Iterator()

template<class AXPositionType >
ui::AXRange< AXPositionType >::Iterator::~Iterator ( )
default

Member Function Documentation

◆ operator!=()

template<class AXPositionType >
bool ui::AXRange< AXPositionType >::Iterator::operator!= ( const Iterator other) const
inline

Definition at line 225 of file ax_range.h.

225{ return !(*this == other); }

◆ operator*()

template<class AXPositionType >
AXRange ui::AXRange< AXPositionType >::Iterator::operator* ( ) const
inline

Definition at line 239 of file ax_range.h.

239 {
240 BASE_DCHECK(!current_start_->IsNullPosition());
241 AXPositionInstance current_end =
242 (current_start_->GetAnchor() != iterator_end_->GetAnchor())
243 ? current_start_->CreatePositionAtEndOfAnchor()
244 : iterator_end_->Clone();
245 BASE_DCHECK(*current_end <= *iterator_end_);
246
247 AXRange current_leaf_text_range(current_start_->AsTextPosition(),
248 current_end->AsTextPosition());
249 BASE_DCHECK(current_leaf_text_range.IsLeafTextRange());
250 return std::move(current_leaf_text_range);
251 }
std::unique_ptr< AXPositionType > AXPositionInstance
Definition: ax_range.h:53
#define BASE_DCHECK(condition)
Definition: logging.h:63

◆ operator++()

template<class AXPositionType >
Iterator & ui::AXRange< AXPositionType >::Iterator::operator++ ( )
inline

Definition at line 228 of file ax_range.h.

228 {
229 BASE_DCHECK(!current_start_->IsNullPosition());
230 if (current_start_->GetAnchor() == iterator_end_->GetAnchor()) {
231 current_start_ = AXPositionType::CreateNullPosition();
232 } else {
233 current_start_ = current_start_->CreateNextLeafTreePosition();
234 BASE_DCHECK(*current_start_ <= *iterator_end_);
235 }
236 return *this;
237 }

◆ operator==()

template<class AXPositionType >
bool ui::AXRange< AXPositionType >::Iterator::operator== ( const Iterator other) const
inline

Definition at line 218 of file ax_range.h.

218 {
219 return current_start_->GetAnchor() == other.current_start_->GetAnchor() &&
220 iterator_end_->GetAnchor() == other.iterator_end_->GetAnchor() &&
221 *current_start_ == *other.current_start_ &&
222 *iterator_end_ == *other.iterator_end_;
223 }

The documentation for this class was generated from the following file: