Krita Source Code Documentation
Loading...
Searching...
No Matches
KisNodeUuidInfo Class Reference

#include <kis_node_uuid_info.h>

Public Member Functions

KisNodeSP findNode (KisNodeSP rootNode)
 
 KisNodeUuidInfo ()
 
 KisNodeUuidInfo (const QString &name)
 
 KisNodeUuidInfo (const QUuid &uuid)
 
 KisNodeUuidInfo (KisNodeSP node)
 
QString name ()
 
QUuid uuid ()
 

Private Member Functions

bool check (KisNodeSP node)
 

Private Attributes

QString m_name
 
QUuid m_uuid
 

Detailed Description

Definition at line 16 of file kis_node_uuid_info.h.

Constructor & Destructor Documentation

◆ KisNodeUuidInfo() [1/4]

KisNodeUuidInfo::KisNodeUuidInfo ( )

Definition at line 12 of file kis_node_uuid_info.cpp.

13{
14}

◆ KisNodeUuidInfo() [2/4]

KisNodeUuidInfo::KisNodeUuidInfo ( const QUuid & uuid)

Definition at line 16 of file kis_node_uuid_info.cpp.

References m_uuid, and uuid().

◆ KisNodeUuidInfo() [3/4]

KisNodeUuidInfo::KisNodeUuidInfo ( const QString & name)

Definition at line 21 of file kis_node_uuid_info.cpp.

22{
23 m_name = name;
24}

References m_name, and name().

◆ KisNodeUuidInfo() [4/4]

KisNodeUuidInfo::KisNodeUuidInfo ( KisNodeSP node)

Definition at line 26 of file kis_node_uuid_info.cpp.

27{
28 m_uuid = node->uuid();
29 m_name = node->name();
30}
QUuid uuid() const
QString name() const

References m_name, m_uuid, KisBaseNode::name(), and KisBaseNode::uuid().

Member Function Documentation

◆ check()

bool KisNodeUuidInfo::check ( KisNodeSP node)
private

Definition at line 47 of file kis_node_uuid_info.cpp.

48{
49 if (m_uuid == node->uuid()) // every node has valid uuid
50 return true;
51 if (m_uuid.isNull() && m_name == node->name()) // but some may have empty names
52 return true;
53 return false;
54}

References m_name, m_uuid, KisBaseNode::name(), and KisBaseNode::uuid().

◆ findNode()

KisNodeSP KisNodeUuidInfo::findNode ( KisNodeSP rootNode)

Definition at line 32 of file kis_node_uuid_info.cpp.

33{
34 if (check(rootNode))
35 return rootNode;
36
37 KisNodeSP child = rootNode->firstChild();
38 KisNodeSP node = 0;
39 while (child && !node)
40 {
41 node = findNode(child);
42 child = child->nextSibling();
43 }
44 return node;
45}
bool check(KisNodeSP node)
KisNodeSP findNode(KisNodeSP rootNode)
KisNodeSP firstChild() const
Definition kis_node.cpp:361
KisNodeSP nextSibling() const
Definition kis_node.cpp:408

References check(), findNode(), KisNode::firstChild(), and KisNode::nextSibling().

◆ name()

QString KisNodeUuidInfo::name ( )
inline

Definition at line 31 of file kis_node_uuid_info.h.

32 {
33 return m_name;
34 }

◆ uuid()

QUuid KisNodeUuidInfo::uuid ( )
inline

Definition at line 26 of file kis_node_uuid_info.h.

27 {
28 return m_uuid;
29 }

Member Data Documentation

◆ m_name

QString KisNodeUuidInfo::m_name
private

Definition at line 44 of file kis_node_uuid_info.h.

◆ m_uuid

QUuid KisNodeUuidInfo::m_uuid
private

Definition at line 43 of file kis_node_uuid_info.h.


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