Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
Inkscape::UI::NodeIterator< N > Class Template Reference

Iterator for editable nodes. More...

#include <node.h>

Inheritance diagram for Inkscape::UI::NodeIterator< N >:

Public Types

using self = NodeIterator
 

Public Member Functions

 NodeIterator ()
 
selfoperator++ ()
 
selfoperator-- ()
 
bool operator== (self const &other) const
 
Noperator* () const
 
 operator bool () const
 
Nget_pointer () const
 Get a pointer to the underlying node. Equivalent to &*i.
 
Nptr () const
 
self next () const
 
self prev () const
 
selfadvance ()
 
selfretreat ()
 

Private Member Functions

 NodeIterator (ListNode const *n)
 

Private Attributes

ListNode_node
 

Friends

class NodeList
 

Detailed Description

template<typename N>
class Inkscape::UI::NodeIterator< N >

Iterator for editable nodes.

Use this class for all operations that require some knowledge about the node's neighbors. It is a bidirectional iterator.

Because paths can be cyclic, node iterators have two different ways to increment and decrement them. When using ++/–, the end iterator will eventually be returned. When using advance()/retreat(), the end iterator will only be returned when the path is open. If it's closed, calling advance() will cycle indefinitely. This is particularly useful for cases where the adjacency of nodes is more important than their sequence order.

When i is a node iterator, then:

  • ++i moves the iterator to the next node in sequence order;
  • –i moves the iterator to the previous node in sequence order;
  • i.next() returns the next node with wrap-around;
  • i.prev() returns the previous node with wrap-around;
  • i.advance() moves the iterator to the next node with wrap-around;
  • i.retreat() moves the iterator to the previous node with wrap-around.

next() and prev() do not change their iterator. They can return the end iterator if the path is open.

Unlike most other iterators, you can check whether you've reached the end of the list without having access to the iterator's container. Simply use if (i) { ...

Definition at line 285 of file node.h.

Member Typedef Documentation

◆ self

template<typename N >
using Inkscape::UI::NodeIterator< N >::self = NodeIterator

Definition at line 289 of file node.h.

Constructor & Destructor Documentation

◆ NodeIterator() [1/2]

template<typename N >
Inkscape::UI::NodeIterator< N >::NodeIterator ( )
inline

Definition at line 290 of file node.h.

◆ NodeIterator() [2/2]

template<typename N >
Inkscape::UI::NodeIterator< N >::NodeIterator ( ListNode const *  n)
inlineprivate

Definition at line 325 of file node.h.

Member Function Documentation

◆ advance()

template<typename N >
NodeIterator< N > & Inkscape::UI::NodeIterator< N >::advance ( )

Definition at line 489 of file node.h.

Referenced by Inkscape::UI::NodeIterator< N >::next().

◆ get_pointer()

template<typename N >
N * Inkscape::UI::NodeIterator< N >::get_pointer ( ) const
inline

Get a pointer to the underlying node. Equivalent to &*i.

Definition at line 307 of file node.h.

References Inkscape::UI::NodeIterator< N >::_node, and N.

◆ next()

◆ operator bool()

template<typename N >
Inkscape::UI::NodeIterator< N >::operator bool ( ) const
inline

Definition at line 485 of file node.h.

◆ operator*()

template<typename N >
N & Inkscape::UI::NodeIterator< N >::operator* ( ) const
inline

Definition at line 304 of file node.h.

References Inkscape::UI::NodeIterator< N >::_node, and N.

◆ operator++()

template<typename N >
self & Inkscape::UI::NodeIterator< N >::operator++ ( )
inline

◆ operator--()

template<typename N >
self & Inkscape::UI::NodeIterator< N >::operator-- ( )
inline

◆ operator==()

template<typename N >
bool Inkscape::UI::NodeIterator< N >::operator== ( self const &  other) const
inline

Definition at line 303 of file node.h.

References Inkscape::UI::NodeIterator< N >::_node.

◆ prev()

◆ ptr()

◆ retreat()

template<typename N >
NodeIterator< N > & Inkscape::UI::NodeIterator< N >::retreat ( )

Definition at line 495 of file node.h.

Referenced by Inkscape::UI::NodeIterator< N >::prev().

Friends And Related Symbol Documentation

◆ NodeList

template<typename N >
friend class NodeList
friend

Definition at line 329 of file node.h.

Member Data Documentation

◆ _node


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