implemented clear() function for nodegraphs
Added a convenient (destructive) way of emptying a NodeGraph completely.
This commit is contained in:
+9
-1
@@ -25,6 +25,14 @@ NodeGraph::NodeGraph()
|
||||
|
||||
}
|
||||
|
||||
void NodeGraph::Clear()
|
||||
{
|
||||
foreach (Node* node, node_children_) {
|
||||
delete node;
|
||||
}
|
||||
node_children_.clear();
|
||||
}
|
||||
|
||||
void NodeGraph::AddNode(Node *node)
|
||||
{
|
||||
if (ContainsNode(node)) {
|
||||
@@ -91,7 +99,7 @@ QList<Node *> NodeGraph::TakeNodeWithItsDependencies(Node *node, QObject *new_pa
|
||||
return deps;
|
||||
}
|
||||
|
||||
QList<Node *> NodeGraph::nodes()
|
||||
const QList<Node *> &NodeGraph::nodes()
|
||||
{
|
||||
return node_children_;
|
||||
}
|
||||
|
||||
+6
-1
@@ -37,6 +37,11 @@ public:
|
||||
*/
|
||||
NodeGraph();
|
||||
|
||||
/**
|
||||
* @brief Destructively destroys all nodes in the graph
|
||||
*/
|
||||
void Clear();
|
||||
|
||||
/**
|
||||
* @brief Add a node to this graph
|
||||
*
|
||||
@@ -73,7 +78,7 @@ public:
|
||||
/**
|
||||
* @brief Retrieve a complete list of the nodes belonging to this graph
|
||||
*/
|
||||
QList<Node*> nodes();
|
||||
const QList<Node*>& nodes();
|
||||
|
||||
/**
|
||||
* @brief Returns whether a certain Node is in the graph or not
|
||||
|
||||
Reference in New Issue
Block a user