Node Class Reference
The basis of the data structure.
More...
#include <node.h>
List of all members.
Detailed Description
The basis of the data structure.
A node contains of caption, creation date, modification date, labels and content. It has a parent and can have child nodes. That means the basic structure is a tree.
- Author:
- Manuel Unglaub
Constructor & Destructor Documentation
Node::Node |
( |
Node * |
parent = 0 |
) |
|
The constructor.
Constructs a node which is a child of parent.
- Parameters:
-
| parent | The parent of this Node. |
The destructor.
Destroys the object including its children.
Member Function Documentation
bool Node::addChild |
( |
Node * |
child, |
|
|
int |
position | |
|
) |
| | |
Add a node as child to this node at a specific position.
- Parameters:
-
| child | The node which will be added to the childs of this node. |
| position | The posittion of the node in the list of children. It must be greater or equal then 0 and less or equal to getChildCount(). |
- Returns:
- True if it was successfull.
- See also:
- getChild(), takeChild(), removeChildren(), addChildren()
bool Node::addChildren |
( |
int |
position, |
|
|
int |
count | |
|
) |
| | |
Add a number of children at a specific position.
- Parameters:
-
| position | The position where the children will be created. It must be greater or equal 0 and less or equal to getChildCount(). |
| count | The number of children that will be created. |
- Returns:
- True if it was successfull.
- See also:
- getChild(), takeChild(), removeChildren(), addChild()
void Node::addLabel |
( |
QString |
label |
) |
|
void Node::addLabels |
( |
QStringList |
labels |
) |
|
Add labels to this node. This will also change the modification date of this node and emit the changed() signal.
- Parameters:
-
| labels | The list of labels which will be added to this node. |
- See also:
- addLabel(), getLabels(), removeLabel()
void Node::changed |
( |
Node * |
node |
) |
[signal] |
Signal is emitted when the caption, labels or the content changes.
- Parameters:
-
| node | A pointer to this node. |
bool Node::contains |
( |
Node * |
node |
) |
|
Find out if a specific node is within the nodes below this node.
- Parameters:
-
| node | The node to look for. |
- Returns:
- True if the node is within the nodes below this node, false if not.
QString Node::getCaption |
( |
|
) |
const |
Get the caption of this node.
- Returns:
- The caption of this node.
- See also:
- setCaption()
Node * Node::getChild |
( |
int |
index |
) |
const |
int Node::getChildCount |
( |
|
) |
const |
Get the number of children of this node.
- Returns:
- The number of children of this node.
Get the content of this node.
- Returns:
- The content of this node.
- See also:
- setContent()
QDateTime Node::getCreationDate |
( |
|
) |
const |
Get the date this node was created.
- Returns:
- The creation date of this node.
- See also:
- setCreationDate()
Get the id of this node.
- Returns:
- The NodeId of this node.
- See also:
- setId()
int Node::getIndex |
( |
|
) |
const |
Get the position of this node in its parents list of children.
- Returns:
- The position index of this node.
QStringList * Node::getLabels |
( |
|
) |
|
QDateTime Node::getModificationDate |
( |
|
) |
const |
Get the modification date of this node.
- Returns:
- The date of the last modification of this node.
- See also:
- setModificationDate()
Node * Node::getParent |
( |
|
) |
const |
Get the parent of this node.
- Returns:
- The parent of this node or 0 if it does not have one.
bool Node::removeChildren |
( |
int |
position, |
|
|
int |
count | |
|
) |
| | |
Remove children from this node.
- Parameters:
-
| position | The position of the children which will be removed. The position must be greater or equal to 0 and less then position + getChildCount() - count. |
| count | The number of children which will be removed. |
- Returns:
- True if the children are removed successfull.
- See also:
- getChild(), takeChild(), addChildren(), addChild()
bool Node::removeLabel |
( |
QString |
label |
) |
|
Remove a label from this node. If the removal of the label was successfull the modification date of the node will be changed and the changed() signal will be emitted.
- Parameters:
-
| label | The label which will be removed from this node. |
- Returns:
- True if the label was removed.
- See also:
- addLabel(), addLabels(), getLabels()
bool Node::setCaption |
( |
QString |
caption |
) |
|
Set the caption of this node. This will also change the modification date of this node and emit the changed() signal.
- Parameters:
-
| caption | The new caption of this node. |
- Returns:
- True if it was successfull.
- See also:
- getCaption()
Set the content of this node. This will also change the modification date of this node and emit the changed() signal. Whenever the changed() signal of the content is emited the modification date will be updated and the changed() signal of this node will be emited.
- Parameters:
-
| content | The new content of this node. |
- See also:
- getContent()
void Node::setCreationDate |
( |
QDateTime |
date |
) |
|
Set the creation date of this node. Should be used to initialize the node after loading it from the persistence layer.
- Parameters:
-
| date | The creation date of this node. |
- See also:
- getCreationDate()
void Node::setId |
( |
NodeId * |
id |
) |
|
Set the id of this node.
- Parameters:
-
| id | The NodeId which will be assigned to this node. |
- See also:
- getId()
void Node::setModificationDate |
( |
QDateTime |
date |
) |
|
Set the modification date of this node. Should be used to initialize the node after loading it form the persistence layer.
- Parameters:
-
| date | The modification date of this node. |
- See also:
- getModificationDate()
void Node::setParent |
( |
Node * |
parent |
) |
[protected] |
Set a new parent for this node.
- Parameters:
-
| parent | The parent of this node. |
- See also:
- getParent()
Node * Node::takeChild |
( |
int |
position |
) |
|
Get a child of this node and remove it from the nodes list of children.
- Parameters:
-
| position | The position of the node in the list of children. It must be greater or equal to 0 and less then getChildCount(). |
- Returns:
- The node position or 0 if the position is out of bounds.
- See also:
- getChild(), addChildren(), removeChildren(), addChild()
QList< Node * > Node::toNodeList |
( |
|
) |
|
Get a list containing this node and all nodes below it.
- Returns:
- A list of this node and all nodes below it.
QString Node::toString |
( |
|
) |
|
Transform the node to a QString.
- Returns:
- The node as a QString.
The documentation for this class was generated from the following files:
- src/data/node/node.h
- src/data/node/node.cpp