Hot Door CORE  0.7.0
Adobe® Illustrator® Plug-in Library
Public Member Functions | Friends | List of all members
hdi::core::Layer::Iterator Class Reference

Allows for iteration through the siblings of a layer, a la std::vector iteration. More...

#include <hdicoreLayer.h>

Public Member Functions

 Iterator (const Iterator &iter_)
 Constructs an Iterator object from an existing Iterator object (copy constructor) More...
 
 ~Iterator ()
 Destructs an Iterator object. More...
 
Iteratoroperator= (const Iterator &rhs_)
 Assigns one Iterator object to another. More...
 
bool operator== (const Iterator &rhs_) const
 Tests whether a given Iterator object is the same as another. More...
 
bool operator!= (const Iterator &rhs_) const
 Tests whether a given Iterator object is not the same as another. More...
 
Iteratoroperator++ ()
 Prefix increment operator for forward iteration. More...
 
Iterator operator++ (int)
 Postfix increment operator for forward iteration. More...
 
Iteratoroperator-- ()
 Prefix decrement operator for reverse iteration. More...
 
Iterator operator-- (int)
 Postfix decrement operator for reverse iteration. More...
 
bool atEnd () const
 Determines whether iteration should stop; works well as the conditional in a for() loop. More...
 
std::auto_ptr< Layerlayer () const
 Gets the current layer pointed to by the iterator. More...
 

Friends

class Layer
 

Detailed Description

Allows for iteration through the siblings of a layer, a la std::vector iteration.

// Here's an example, iterating through all top-level layers of a document:
std::auto_ptr<hdi::core::Layer> layer0 = HDI_CORE_ILLUSTRATOR->currentDocument()->firstLayer();
for(hdi::core::Layer::Iterator iter = layer0->begin(); !iter.atEnd(); ++iter)
{
// Do stuff with iter.layer() ...
}
// Here's another example, reverse iterating through all top-level layers of a document:
std::auto_ptr<hdi::core::Layer> layerN = HDI_CORE_ILLUSTRATOR->currentDocument()->lastLayer();
for(hdi::core::Layer::Iterator iter = layerN->begin(); !iter.atEnd(); --iter)
{
// Do more stuff with iter.layer() ...
}

Constructor & Destructor Documentation

hdi::core::Layer::Iterator::Iterator ( const Iterator iter_)

Constructs an Iterator object from an existing Iterator object (copy constructor)

Author
GW
Date
10/2013
Parameters
iter_Existing Iterator object
hdi::core::Layer::Iterator::~Iterator ( )

Destructs an Iterator object.

Author
GW
Date
08/2013

Member Function Documentation

bool hdi::core::Layer::Iterator::atEnd ( ) const

Determines whether iteration should stop; works well as the conditional in a for() loop.

Author
GW
Date
08/2013
Returns
true if at the end of the list of siblings, false otherwise
std::auto_ptr<Layer> hdi::core::Layer::Iterator::layer ( ) const

Gets the current layer pointed to by the iterator.

Author
GW
Date
08/2013
Returns
The current layer, or an empty Layer object if at the end (see default Layer constructor for more information)
bool hdi::core::Layer::Iterator::operator!= ( const Iterator rhs_) const

Tests whether a given Iterator object is not the same as another.

Author
GW
Date
10/2013
Parameters
rhs_Iterator to compare against (righthand side of inequality operator)
Returns
true for the target and rhs_ having differing states, false otherwise
Iterator& hdi::core::Layer::Iterator::operator++ ( )

Prefix increment operator for forward iteration.

Author
GW
Date
08/2013
Returns
A reference to the iterator after its position was changed
Iterator hdi::core::Layer::Iterator::operator++ ( int  )

Postfix increment operator for forward iteration.

Author
GW
Date
08/2013
Returns
A copy of the original iterator before its position was changed
Iterator& hdi::core::Layer::Iterator::operator-- ( )

Prefix decrement operator for reverse iteration.

Author
GW
Date
08/2013
Returns
A reference to the iterator after its position was changed
Iterator hdi::core::Layer::Iterator::operator-- ( int  )

Postfix decrement operator for reverse iteration.

Author
GW
Date
08/2013
Returns
A copy of the original iterator before its position was changed
Iterator& hdi::core::Layer::Iterator::operator= ( const Iterator rhs_)

Assigns one Iterator object to another.

Author
GW
Date
10/2013
Parameters
rhs_Existing Iterator object to copy values from
Returns
The target Iterator object, but with its values updated to match that of the rhs_ argument
bool hdi::core::Layer::Iterator::operator== ( const Iterator rhs_) const

Tests whether a given Iterator object is the same as another.

Author
GW
Date
10/2013
Parameters
rhs_Iterator to compare against (righthand side of equality operator)
Returns
true for the target and rhs_ having the same state, false otherwise