LibreOffice Module sd (master) 1
Public Member Functions | Private Attributes | List of all members
sd::outliner::Iterator Class Reference

This iterator can be used to iterate over all <type>SdrObject</type> objects of one of three set denoted by the <type>IteratorType</type>: More...

#include <OutlinerIterator.hxx>

Public Member Functions

 Iterator ()
 
 Iterator (const Iterator &rIterator)
 The copy constructor creates a new iterator by copying the implementation object. More...
 
 Iterator (Iterator &&rIterator) noexcept
 
 Iterator (std::unique_ptr< IteratorImplBase > pObject)
 Create a new iterator with the implementation object being the provided one. More...
 
 ~Iterator ()
 
Iteratoroperator= (const Iterator &rIterator)
 Assign the iterator from the given one. More...
 
Iteratoroperator= (Iterator &&rIterator) noexcept
 
const IteratorPositionoperator* () const
 Return the current position of the iterator. More...
 
Iteratoroperator++ ()
 The prefix increment operator returns the iterator pointing to the next object. More...
 
bool operator== (const Iterator &rIterator) const
 Test equality of two iterators. More...
 
bool operator!= (const Iterator &rIterator) const
 Test whether two iterators point to different objects. More...
 
void Reverse ()
 Reverse the direction of iteration. More...
 

Private Attributes

std::unique_ptr< IteratorImplBasemxIterator
 The implementation object to which most of the methods are forwarded. More...
 

Detailed Description

This iterator can be used to iterate over all <type>SdrObject</type> objects of one of three set denoted by the <type>IteratorType</type>:

Note that the iterator does not change pages or views. It is the task of the user of the iterator to take the information provided by the <type>IteratorPosition</type> as returned by the <member>operator*()</member> method and set view, visible page, and selection/edit mode markers to reflect this position.

A simple forward iteration from the first to the last object would instantiate the iterator with Iterator(pDocument,pViewShell,true,BEGIN) for some document and view shell. This iterator can then be compared against Iterator(pDocument,pViewShell,true,END). On equality the iteration should be stopped without evaluating the iterator: The position of an end iterator is not valid.

Definition at line 74 of file OutlinerIterator.hxx.

Constructor & Destructor Documentation

◆ Iterator() [1/4]

sd::outliner::Iterator::Iterator ( )

Definition at line 55 of file OutlinerIterator.cxx.

◆ Iterator() [2/4]

sd::outliner::Iterator::Iterator ( const Iterator rIterator)

The copy constructor creates a new iterator by copying the implementation object.

Definition at line 59 of file OutlinerIterator.cxx.

◆ Iterator() [3/4]

sd::outliner::Iterator::Iterator ( Iterator &&  rIterator)
noexcept

Definition at line 64 of file OutlinerIterator.cxx.

◆ Iterator() [4/4]

sd::outliner::Iterator::Iterator ( std::unique_ptr< IteratorImplBase pObject)
explicit

Create a new iterator with the implementation object being the provided one.

Parameters
pObjectA copy of this object will become the implementation object.

Definition at line 69 of file OutlinerIterator.cxx.

References pObject.

◆ ~Iterator()

sd::outliner::Iterator::~Iterator ( )

Definition at line 74 of file OutlinerIterator.cxx.

Member Function Documentation

◆ operator!=()

bool sd::outliner::Iterator::operator!= ( const Iterator rIterator) const

Test whether two iterators point to different objects.

This is just the negation of the result of the equality operator.

Parameters
rIteratorThe iterator to test inequality with.
Returns
Returns <TRUE> when both iterators point to the different objects.

Definition at line 117 of file OutlinerIterator.cxx.

References operator==().

◆ operator*()

const IteratorPosition & sd::outliner::Iterator::operator* ( void  ) const

Return the current position of the iterator.

Returns
Returns a reference to the current position. Therefore this method is not thread safe. The reason for this behaviour is, of course, to omit the copying of the returned position.

Definition at line 96 of file OutlinerIterator.cxx.

References DBG_ASSERT, and mxIterator.

◆ operator++()

Iterator & sd::outliner::Iterator::operator++ ( void  )

The prefix increment operator returns the iterator pointing to the next object.

When in doubt prefer this operator over the postfix increment operator.

Returns
Returns a reference to this iterator pointing to the next object.

Definition at line 102 of file OutlinerIterator.cxx.

References mxIterator.

◆ operator=() [1/2]

Iterator & sd::outliner::Iterator::operator= ( const Iterator rIterator)

Assign the iterator from the given one.

The implementation object of this iterator will be a copy of the given iterator.

Parameters
rIteratorThe iterator which to assign from.

Definition at line 78 of file OutlinerIterator.cxx.

References mxIterator.

◆ operator=() [2/2]

Iterator & sd::outliner::Iterator::operator= ( Iterator &&  rIterator)
noexcept

Definition at line 90 of file OutlinerIterator.cxx.

◆ operator==()

bool sd::outliner::Iterator::operator== ( const Iterator rIterator) const

Test equality of two iterators.

Two iterators are taken to be equal when they point are of the same type (their implementation objects are instances of the same class) and point to the same object.

Parameters
rIteratorThe iterator to test equality with.
Returns
Returns <TRUE> when both iterators point to the same object.

Definition at line 109 of file OutlinerIterator.cxx.

References mxIterator.

Referenced by operator!=().

◆ Reverse()

void sd::outliner::Iterator::Reverse ( )

Reverse the direction of iteration.

The position of the iterator is not changed. Thus calling this method twice returns to the old state.

Definition at line 122 of file OutlinerIterator.cxx.

References mxIterator.

Referenced by SdOutliner::Initialize().

Member Data Documentation

◆ mxIterator

std::unique_ptr<IteratorImplBase> sd::outliner::Iterator::mxIterator
private

The implementation object to which most of the methods are forwarded.

Definition at line 140 of file OutlinerIterator.hxx.

Referenced by operator*(), operator++(), operator=(), operator==(), and Reverse().


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