Krita Source Code Documentation
Loading...
Searching...
No Matches
KisNodeVisitor Class Referenceabstract

#include <kis_node_visitor.h>

+ Inheritance diagram for KisNodeVisitor:

Public Member Functions

 KisNodeVisitor ()
 
virtual bool visit (KisAdjustmentLayer *layer)=0
 
virtual bool visit (KisCloneLayer *layer)=0
 
virtual bool visit (KisColorizeMask *mask)=0
 
virtual bool visit (KisExternalLayer *layer)=0
 
virtual bool visit (KisFilterMask *mask)=0
 
virtual bool visit (KisGeneratorLayer *layer)=0
 
virtual bool visit (KisGroupLayer *layer)=0
 
virtual bool visit (KisNode *node)=0
 
virtual bool visit (KisPaintLayer *layer)=0
 
virtual bool visit (KisSelectionMask *mask)=0
 
virtual bool visit (KisTransformMask *mask)=0
 
virtual bool visit (KisTransparencyMask *mask)=0
 
virtual ~KisNodeVisitor ()
 

Protected Member Functions

bool visitAll (KisNode *node, bool breakOnFail=false)
 
bool visitAllInverse (KisNode *node, bool breakOnFail=false)
 

Detailed Description

Definition at line 26 of file kis_node_visitor.h.

Constructor & Destructor Documentation

◆ KisNodeVisitor()

KisNodeVisitor::KisNodeVisitor ( )
inline

Definition at line 29 of file kis_node_visitor.h.

29{}

◆ ~KisNodeVisitor()

virtual KisNodeVisitor::~KisNodeVisitor ( )
inlinevirtual

Definition at line 30 of file kis_node_visitor.h.

30{}

Member Function Documentation

◆ visit() [1/12]

◆ visit() [2/12]

◆ visit() [3/12]

◆ visit() [4/12]

◆ visit() [5/12]

◆ visit() [6/12]

◆ visit() [7/12]

◆ visit() [8/12]

◆ visit() [9/12]

◆ visit() [10/12]

◆ visit() [11/12]

◆ visit() [12/12]

◆ visitAll()

bool KisNodeVisitor::visitAll ( KisNode * node,
bool breakOnFail = false )
protected

Visit all child nodes of the given node starting with the first one until one node returns false. Then visitAll returns false, otherwise true.

Parameters
nodethe parent node whose children will be visited
breakOnFailbreak if one of the children returns false on accept
Returns
true if none of the childnodes returns false on accepting the visitor.

Definition at line 11 of file kis_node_visitor.cpp.

12{
13 for (uint i = 0; i < node->childCount(); ++i) {
14 if (!node->at(i)->accept(*this)) {
15 if (breakOnFail)
16 return false;
17 }
18 }
19 return true;
20}
unsigned int uint
bool accept(KisNodeVisitor &v) override
Definition kis_node.cpp:269
quint32 childCount() const
Definition kis_node.cpp:414
KisNodeSP at(quint32 index) const
Definition kis_node.cpp:421

References KisNode::accept(), KisNode::at(), and KisNode::childCount().

◆ visitAllInverse()

bool KisNodeVisitor::visitAllInverse ( KisNode * node,
bool breakOnFail = false )
protected

Visit all child nodes of the given node starting with the last one until one node returns false. Then visitAll returns false, otherwise true.

Parameters
nodethe parent node whose children will be visited
breakOnFailbreak if one of the children returns false on accept
Returns
true if none of the childnodes returns false on accepting the visitor.

Definition at line 33 of file kis_node_visitor.cpp.

34{
35 KisNodeSP child = node->lastChild();
36 while (child) {
37 if (!child->accept(*this)) {
38 if (breakOnFail)
39 return false;
40 }
41 child = child->prevSibling();
42 }
43 return true;
44}
KisNodeSP prevSibling() const
Definition kis_node.cpp:402
KisNodeSP lastChild() const
Definition kis_node.cpp:367

References KisNode::accept(), KisNode::lastChild(), and KisNode::prevSibling().


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