Brief description of class still missing. More...
#include <TreeContainer.h>
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 |
TreeItem * | childAt (int index) |
const TreeItem * | childAt (int index) const |
int | childrenCount () const |
TreeContainer * | containerAt (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 |
Brief description of class still missing.
Full description of class still missing
typedef QList<TreeItem *>::const_iterator QGpCoreTools::TreeContainer::const_iterator |
typedef QList<TreeItem *>::iterator QGpCoreTools::TreeContainer::iterator |
QGpCoreTools::TreeContainer::TreeContainer | ( | TreeContainer * | parent = 0 | ) | [inline] |
QGpCoreTools::TreeContainer::~TreeContainer | ( | ) | [virtual] |
Deletes all children.
{ qDeleteAll(_children); }
iterator QGpCoreTools::TreeContainer::begin | ( | ) | [inline] |
Referenced by QGpCoreTools::XMLGenericItem::children(), containerAt(), containerCount(), containerIndex(), GeopsyCore::AbstractSignalGroup::contains(), GeopsyCore::AbstractSignalGroup::convertIds(), GeopsyCore::AbstractSignalGroup::find(), QGpCoreTools::XMLGenericItem::find(), GeopsyCore::AbstractSignalGroup::isModified(), GeopsyCore::AbstractSignalGroup::printList(), GeopsyCore::AbstractSignalGroup::removeSignal(), GeopsyCore::AbstractSignalGroup::signalCount(), GeopsyCore::AbstractSignalGroup::subPool(), xml_writeChildren(), QGpCoreTools::XMLGenericItem::xml_writeChildren(), GeopsyCore::AbstractSignalGroup::xml_writeChildren(), and QGpCoreTools::XMLGenericItem::xml_writeProperties().
{return _children.begin();}
const_iterator QGpCoreTools::TreeContainer::begin | ( | ) | const [inline] |
{return _children.begin();}
bool QGpCoreTools::TreeContainer::canTakeChildren | ( | const TreeContainer * | o | ) | const |
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; }
TreeItem* QGpCoreTools::TreeContainer::childAt | ( | int | index | ) | [inline] |
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);}
int QGpCoreTools::TreeContainer::childrenCount | ( | ) | const [inline] |
Referenced by GeopsyCore::MasterSignalGroup::clear(), QGpCoreTools::XMLGenericItem::find(), QGpGuiTools::XMLItem::flags(), GeopsyGui::SignalGroupItem::rowCount(), QGpGuiTools::XMLItem::rowCount(), QGpGuiTools::XMLEditor::setEnabled(), GroupProperties::setValues(), QGpCoreTools::XMLGenericItem::xml_writeChildren(), and QGpCoreTools::XMLGenericItem::xml_writeProperties().
{return _children.count();}
TreeContainer * QGpCoreTools::TreeContainer::containerAt | ( | int | index | ) | const |
Return the child container at position index.
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; }
int QGpCoreTools::TreeContainer::containerCount | ( | ) | const |
Counts the number of children that are containers.
References begin(), end(), and TRACE.
{ TRACE; int n=0; for(const_iterator it=begin(); it!=end(); ++it) { if((*it)->isContainer()) n++; } return n; }
int QGpCoreTools::TreeContainer::containerIndex | ( | ) | const |
Return the index of child container item.
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; }
iterator QGpCoreTools::TreeContainer::end | ( | ) | [inline] |
Referenced by QGpCoreTools::XMLGenericItem::children(), containerAt(), containerCount(), containerIndex(), GeopsyCore::AbstractSignalGroup::contains(), GeopsyCore::AbstractSignalGroup::convertIds(), GeopsyCore::AbstractSignalGroup::find(), QGpCoreTools::XMLGenericItem::find(), GeopsyCore::AbstractSignalGroup::isModified(), GeopsyCore::AbstractSignalGroup::printList(), GeopsyCore::AbstractSignalGroup::removeSignal(), GeopsyCore::AbstractSignalGroup::signalCount(), GeopsyCore::AbstractSignalGroup::subPool(), xml_writeChildren(), QGpCoreTools::XMLGenericItem::xml_writeChildren(), GeopsyCore::AbstractSignalGroup::xml_writeChildren(), and QGpCoreTools::XMLGenericItem::xml_writeProperties().
{return _children.end();}
const_iterator QGpCoreTools::TreeContainer::end | ( | ) | const [inline] |
{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().
{TreeItem::setRank(r);}
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); } }
void QGpCoreTools::TreeContainer::xml_writeChildren | ( | XML_WRITECHILDREN_ARGS | ) | const [protected, virtual] |
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); } }
friend class TreeItem [friend] |