All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines
Public Types | Public Member Functions | Protected Member Functions | Friends
QGpCoreTools::TreeContainer Class Reference

Brief description of class still missing. More...

#include <TreeContainer.h>

Inheritance diagram for QGpCoreTools::TreeContainer:
QGpCoreTools::TreeItem QGpCoreTools::XMLClass 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 Types

typedef QList< TreeItem * >
::const_iterator 
const_iterator
typedef QList< TreeItem * >
::iterator 
iterator

Public Member Functions

iterator begin ()
const_iterator begin () const
bool canTakeChildren (const TreeContainer *o) const
TreeItemchildAt (int index)
const TreeItemchildAt (int index) const
int childrenCount () const
TreeContainercontainerAt (int index) const
int containerCount () const
int containerIndex () const
iterator end ()
const_iterator end () const
virtual bool isContainer () const
int rank () const
int rank (const TreeItem *item) const
virtual void setRank (int r)
void takeChildren (TreeContainer *o)
 TreeContainer (TreeContainer *parent=0)
virtual ~TreeContainer ()

Protected Member Functions

virtual void xml_writeChildren (XML_WRITECHILDREN_ARGS) const

Friends

class TreeItem

Detailed Description

Brief description of class still missing.

Full description of class still missing


Member Typedef Documentation


Constructor & Destructor Documentation

Default constructor.

Deletes all children.

  {
    qDeleteAll(_children);
  }

Member Function Documentation

{return _children.begin();}

Returns true if this container can take ownership of all children from o without circular references.

  {
    for(const_iterator it=o->_children.begin(); it!=o->_children.end(); ++it) {
      if(!(*it)->isValidParent(this)) {
        return false;
      }
    }
    return true;
  }

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

{return _children.at(index);}
const TreeItem* QGpCoreTools::TreeContainer::childAt ( int  index) const [inline]

Reimplemented in QGpCoreTools::XMLGenericItem.

{return _children.at(index);}

Return the child container at position index.

See also:
containerCount(), containerIndex(()

References begin(), end(), and TRACE.

Referenced by QGpGuiTools::XMLItem::index().

  {
    TRACE;
    int i=0;
    for(const_iterator it=begin(); it!=end(); ++it) {
      if((*it)->isContainer()) {
        if(i==index) {
          return static_cast<TreeContainer *>(*it);
        }
        i++;
      }
    }
    return 0;
  }

Counts the number of children that are containers.

See also:
containerAt(), indexOfContainer(()

References begin(), end(), and TRACE.

  {
    TRACE;
    int n=0;
    for(const_iterator it=begin(); it!=end(); ++it) {
      if((*it)->isContainer()) n++;
    }
    return n;
  }

Return the index of child container item.

See also:
containerCount(), containerAt()

References begin(), end(), QGpCoreTools::TreeItem::parent(), and TRACE.

Referenced by QGpGuiTools::XMLItem::parent().

  {
    TRACE;
    if(!parent()) return 0;
    int i=0;
    for(const_iterator it=parent()->begin(); it!=parent()->end(); ++it) {
      if((*it)->isContainer()) {
        if(*it==static_cast<const TreeItem *>(this)) {
          return i;
        }
        i++;
      }
    }
    // Tree is corrupted if this container cannot be found in children list of its parent.
    ASSERT(false);
    return 0;
  }
{return _children.end();}
virtual bool QGpCoreTools::TreeContainer::isContainer ( ) const [inline, virtual]

Reimplemented from QGpCoreTools::TreeItem.

{return true;}
int QGpCoreTools::TreeContainer::rank ( ) const [inline]

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

Reimplemented from QGpCoreTools::TreeItem.

References QGpCoreTools::TreeItem::rank().

Referenced by GeopsyGui::SignalGroupItem::dropMimeData(), QGpGuiTools::XMLItem::index(), GeopsyGui::SignalGroupItem::index(), GeopsyGui::SignalGroupItem::parent(), QGpCoreTools::TreeItem::rank(), and QGpCoreTools::TreeItem::setRank().

{return TreeItem::rank();}
int QGpCoreTools::TreeContainer::rank ( const TreeItem item) const [inline]
{return _children.indexOf(const_cast<TreeItem *>(item));}
virtual void QGpCoreTools::TreeContainer::setRank ( int  r) [inline, 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 from QGpCoreTools::TreeItem.

References QGpCoreTools::TreeItem::setRank().

Referenced by GeopsyGui::SignalGroupItem::dropMimeData(), and QGpCoreTools::TreeItem::setRank().

This container takes ownership of all children from o.

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

  {
    // Makes a copy of children list because setParent() modifies children lists
    // and may corrupt iterators
    QList<TreeItem *> list=o->_children;
    for(iterator it=list.begin(); it!=list.end(); ++it) {
      (*it)->setParent(this);
    }
  }

Saves all children to an XML structure.

Reimplemented from QGpCoreTools::XMLClass.

Reimplemented in QGpCoreTools::GoogleEarthKML::Folder, GeopsyCore::AbstractSignalGroup, QGpCoreTools::XMLGenericItem, and GeopsyCore::DefaultSignalGroup.

References begin(), and end().

  {
    Q_UNUSED(context);
    for(const_iterator it=begin(); it!=end(); ++it) {
      (*it)->xml_save(s, context);
    }
  }

Friends And Related Function Documentation

friend class TreeItem [friend]

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