#include <abstracttreeitem.h>
Public Member Functions | |
virtual int | childs () const |
Return the number of childs of this item. | |
virtual QString | name () const |
Return the name of this item. | |
virtual const QStringList | childlist () const |
Return a list of names of the children. | |
virtual QString | path () const |
Return the path from the root to this item. | |
AbstractTreeItem * | getNamedChild (QString) const |
Get a named child by traversing the tree. | |
template<class T> | |
T | getNamedChild (QString n) const |
Get a named child of type T by traversing the tree. | |
AbstractTreeItem * | child (QString) const |
Get a named direct child. | |
template<class T> | |
T | child (QString n) const |
Get a named child of type T. | |
void | debugPrint (QString prefix="") const |
Dump a tree of this item and its childs for debug. | |
Protected Member Functions | |
AbstractTreeItem (QString name, AbstractTreeItem *parent) | |
Construct a new item as child of a given parent. | |
AbstractTreeItem (AbstractTreeItem &item, AbstractTreeItem *parent) | |
Construct a new item by copying from another item. | |
virtual | ~AbstractTreeItem () |
Destructor. | |
virtual QString | debug () const =0 |
Return debug-info for this item. | |
Protected Attributes | |
childlist_t | _childs |
The childs of this item. | |
AbstractTreeItem * | _parent |
The parent of this item. | |
Private Types | |
typedef std::map< QString, AbstractTreeItem * > | childlist_t |
type for the list of childs. | |
Private Member Functions | |
AbstractTreeItem (AbstractTreeItem &) | |
Disabled copy-constructor. | |
Private Attributes | |
QString | _name |
The name of this item. |
This provides the basics for named trees with object that should not be QObjects. For example results and other values that do not need signals or slots.
typedef std::map<QString,AbstractTreeItem*> NSCore::AbstractTreeItem::childlist_t [private] |
type for the list of childs.
For convinience
NSCore::AbstractTreeItem::AbstractTreeItem | ( | AbstractTreeItem & | ) | [inline, private] |
Disabled copy-constructor.
Copying an item doesn't make sense without a new parent...
NSCore::AbstractTreeItem::AbstractTreeItem | ( | QString | name, | |
AbstractTreeItem * | parent | |||
) | [protected] |
Construct a new item as child of a given parent.
If the parent is 0, this will/can be the root of a new tree.
name | The name of the new item | |
parent | The parent item for this new item |
NSCore::AbstractTreeItem::AbstractTreeItem | ( | AbstractTreeItem & | item, | |
AbstractTreeItem * | parent | |||
) | [protected] |
Construct a new item by copying from another item.
As the new item needs another parent then the original item, this new parent has to be provided.
item | The item that is to be copied | |
parent | The parent for this new item |
virtual NSCore::AbstractTreeItem::~AbstractTreeItem | ( | ) | [protected, virtual] |
Destructor.
Removes itself from the parent ( if there is a parent ) and deletes all the children
virtual int NSCore::AbstractTreeItem::childs | ( | ) | const [inline, virtual] |
virtual QString NSCore::AbstractTreeItem::name | ( | ) | const [inline, virtual] |
Return the name of this item.
References _name.
Referenced by NSCore::NamedQVariantTreeItem::debug().
virtual const QStringList NSCore::AbstractTreeItem::childlist | ( | ) | const [inline, virtual] |
Return a list of names of the children.
This returns only the names of the direct children, no traversing on the child-trees is done.
References _childs.
virtual QString NSCore::AbstractTreeItem::path | ( | ) | const [virtual] |
Return the path from the root to this item.
AbstractTreeItem* NSCore::AbstractTreeItem::getNamedChild | ( | QString | ) | const |
T NSCore::AbstractTreeItem::getNamedChild | ( | QString | n | ) | const [inline] |
AbstractTreeItem* NSCore::AbstractTreeItem::child | ( | QString | ) | const |
T NSCore::AbstractTreeItem::child | ( | QString | n | ) | const [inline] |
void NSCore::AbstractTreeItem::debugPrint | ( | QString | prefix = "" |
) | const [inline] |
virtual QString NSCore::AbstractTreeItem::debug | ( | ) | const [protected, pure virtual] |
Return debug-info for this item.
This has to be implemented by the implementations to print class- specific information in debugPrint().
Implemented in NSCore::NamedQVariantTreeItem.
Referenced by debugPrint().
childlist_t NSCore::AbstractTreeItem::_childs [protected] |
AbstractTreeItem* NSCore::AbstractTreeItem::_parent [protected] |
The parent of this item.
QString NSCore::AbstractTreeItem::_name [private] |