All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines
Public Member Functions | Static Public Attributes
QGpCoreTools::TreeItem Class Reference

Brief description of class still missing. More...

#include <TreeItem.h>

Inheritance diagram for QGpCoreTools::TreeItem:
QGpCoreTools::XMLClass QGpCoreTools::TreeContainer GeopsyCore::AbstractSignalGroup QGpCoreTools::GoogleEarthKML::Folder QGpCoreTools::XMLGenericItem GeopsyCore::DefaultSignalGroup GeopsyCore::MasterSignalGroup GeopsyCore::SignalGroup GeopsyCore::SignalGroupFolder GeopsyCore::AllFilesGroup GeopsyCore::AllSignalsGroup GeopsyCore::PermanentFilesGroup GeopsyCore::TemporaryFilesGroup GeopsyCore::TemporarySignalsGroup GeopsyCore::AbstractSignalResults GeopsyCore::StationGroup

List of all members.

Public Member Functions

virtual bool isContainer () const
bool isValidParent (const TreeContainer *parent) const
TreeContainerparent ()
const TreeContainerparent () const
int rank () const
virtual void setParent (TreeContainer *parent)
virtual void setRank (int r)
 TreeItem (TreeContainer *parent=0)
virtual const QString & xml_tagName () const
virtual ~TreeItem ()

Static Public Attributes

static const QString xmlTreeItemTag = "TreeItem"

Detailed Description

Brief description of class still missing.

Full description of class still missing


Constructor & Destructor Documentation

Description of constructor still missing

References parent(), and TRACE.

  {
    TRACE;
    // As we are in constructor, parent cannot be this and if this is a container
    // it has still no children => no circular reference possible. We skip all
    // tests performed by setParent().
    if(parent) {
      parent->addChild(this);
      _parent=parent;
    } else {
      _parent=0;
    }
  }
virtual QGpCoreTools::TreeItem::~TreeItem ( ) [inline, virtual]
{}

Member Function Documentation

virtual bool QGpCoreTools::TreeItem::isContainer ( ) const [inline, virtual]

Reimplemented in QGpCoreTools::TreeContainer.

{return false;}
bool QGpCoreTools::TreeItem::isValidParent ( const TreeContainer parent) const

Returns true if parent can be a valid parent. Circular references are checked.

References parent(), and TRACE.

Referenced by GeopsyCore::AbstractSignalGroup::setParent().

  {
    TRACE;
    while(parent) {
      if(static_cast<const TreeItem *>(parent)==this) {
        return false;
      }
      parent=parent->parent();
    }
    return true;
  }
const TreeContainer* QGpCoreTools::TreeItem::parent ( ) const [inline]

Reimplemented in GeopsyCore::AbstractSignalGroup, and QGpCoreTools::XMLGenericItem.

{return _parent;}

Return the index of this item in children list of its parent. Without parents this function returns 0.

Reimplemented in QGpCoreTools::TreeContainer.

References QGpCoreTools::TreeContainer::rank(), and TRACE.

Referenced by QGpCoreTools::TreeContainer::rank().

  {
    TRACE;
    if(_parent)
      return _parent->rank(this);
    else
      return 0;
  }
void QGpCoreTools::TreeItem::setParent ( TreeContainer parent) [virtual]

Sets parent to parent. parent can be null. Circular references are not checked. It is safe to use isValidParent() before changing parent.

References parent(), and TRACE.

  {
    TRACE;
    if(_parent) {
      _parent->takeChild(this);
    }
    if(parent) {
      parent->addChild(this);
    }
    _parent=parent;
  }
void QGpCoreTools::TreeItem::setRank ( int  r) [virtual]

Set index of this item in children list of its parent. Without parents this function does nothing. If r is larger than the number of children in its parent, the rank is set to number of children less 1.

Reimplemented in QGpCoreTools::TreeContainer.

References QGpCoreTools::TreeContainer::rank(), QGpCoreTools::TreeContainer::setRank(), and TRACE.

Referenced by QGpCoreTools::TreeContainer::setRank().

  {
    TRACE;
    if(_parent) {
      int oldr=_parent->rank(this);
      ASSERT(oldr>=0); // The contrary would mean a tree corruption
      if(oldr!=r) {
        _parent->setRank(oldr, r);
      }
    }
  }
virtual const QString& QGpCoreTools::TreeItem::xml_tagName ( ) const [inline, virtual]

Member Data Documentation

const QString QGpCoreTools::TreeItem::xmlTreeItemTag = "TreeItem" [static]

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines