NSCore::AbstractTreeItem Class Reference

Abstract class for TreeItems that are no QObjects. More...

#include <abstracttreeitem.h>

Inheritance diagram for NSCore::AbstractTreeItem:

NSCore::NamedQVariantTreeItem
Collaboration diagram for NSCore::AbstractTreeItem:

Collaboration graph
[legend]

List of all members.

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.
AbstractTreeItemgetNamedChild (QString) const
 Get a named child by traversing the tree.
template<class T>
getNamedChild (QString n) const
 Get a named child of type T by traversing the tree.
AbstractTreeItemchild (QString) const
 Get a named direct child.
template<class 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.


Detailed Description

Abstract class for TreeItems that are no QObjects.

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.


Member Typedef Documentation

typedef std::map<QString,AbstractTreeItem*> NSCore::AbstractTreeItem::childlist_t [private]

type for the list of childs.

For convinience


Constructor & Destructor Documentation

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.

Parameters:
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.

Parameters:
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


Member Function Documentation

virtual int NSCore::AbstractTreeItem::childs (  )  const [inline, virtual]

Return the number of childs of this item.

References _childs.

Referenced by debugPrint().

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

Get a named child by traversing the tree.

Referenced by getNamedChild().

template<class T>
T NSCore::AbstractTreeItem::getNamedChild ( QString  n  )  const [inline]

Get a named child of type T by traversing the tree.

References getNamedChild().

AbstractTreeItem* NSCore::AbstractTreeItem::child ( QString   )  const

Get a named direct child.

Referenced by child().

template<class T>
T NSCore::AbstractTreeItem::child ( QString  n  )  const [inline]

Get a named child of type T.

References child().

void NSCore::AbstractTreeItem::debugPrint ( QString  prefix = ""  )  const [inline]

Dump a tree of this item and its childs for debug.

References _childs, childs(), and debug().

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().


Member Data Documentation

The childs of this item.

Referenced by childlist(), childs(), and debugPrint().

The parent of this item.

The name of this item.

Referenced by name().


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

Generated on Tue Apr 12 02:10:24 2011 for epos by  doxygen 1.5.5