Public Member Functions | Protected Member Functions | Protected Attributes

conan::ObjectItem Class Reference

Used to wrap QObjects for use in a ObjectModel. More...

#include <ObjectModel.h>

Inherited by conan::RootItem.

List of all members.

Public Member Functions

 ObjectItem (const QObject *inObject=0, const ObjectItem *inParent=0)
 Constructs an item for the given object and all its children.
virtual ~ObjectItem ()
 Destructs the item and all its children.
int Index () const
 Returns the index of this item at its parent.
int ChildIndex (const ObjectItem *inChild) const
 Returns the index of the given object if it is a child; otherwise -1.
int ChildCount () const
 Returns the number of child items.
const ObjectItemParent () const
 Returns the parent item.
const ObjectItemChild (int inIndex) const
 Returns the child item at the given index. Performs no range checking!
const QObject * Object () const
 Returns the wrapped object.
const QString & Name () const
 Returns the object name of the wrapped object.
const QString & Class () const
 Returns the class name of the wrapped object.
const QString & Address () const
 Returns the object address of the wrapped object.
template<typename Pred >
const ObjectItemFind (Pred inPred, const ObjectItem *inStartItem=0, bool *inActive=0) const
 Starts a recursive search for an item whose name, class or address matches a given value.
template<typename Pred >
void Sort (Pred inPred)
 Sort all children recursively.

Protected Member Functions

void Reset ()
 Destroyes all children and resets all members.

Protected Attributes

const ObjectItemmParent
QVector< ObjectItem * > mChildren
QPointer< QObject > mObject
 The wrapped QObject, or 0 when it has been destroyed.
QString mAddress
 The address of mObject.
QString mName
 The object name of mObject.
QString mClass
 The class name of mObject.

Detailed Description

Used to wrap QObjects for use in a ObjectModel.


Constructor & Destructor Documentation

conan::ObjectItem::ObjectItem ( const QObject *  inObject = 0,
const ObjectItem inParent = 0 
)

Constructs an item for the given object and all its children.

conan::ObjectItem::~ObjectItem (  )  [virtual]

Destructs the item and all its children.


Member Function Documentation

const QString & conan::ObjectItem::Address (  )  const

Returns the object address of the wrapped object.

const ObjectItem * conan::ObjectItem::Child ( int  inIndex  )  const

Returns the child item at the given index. Performs no range checking!

int conan::ObjectItem::ChildCount (  )  const

Returns the number of child items.

int conan::ObjectItem::ChildIndex ( const ObjectItem inChild  )  const

Returns the index of the given object if it is a child; otherwise -1.

const QString & conan::ObjectItem::Class (  )  const

Returns the class name of the wrapped object.

template<typename Pred >
const ObjectItem * conan::ObjectItem::Find ( Pred  inPred,
const ObjectItem inStartItem = 0,
bool *  inActive = 0 
) const

Starts a recursive search for an item whose name, class or address matches a given value.

Parameters:
[in] inPred A unary predicate function object that defines the matching criterion
[in] inStartItem (optional) The item at which the search starts or stops; depends on inActive
[in] inActive (optional) When false the search starts at inStartItem; otherwise the search stops at inStartItem
Returns:
The item that matches inValue; otherwise 0
int conan::ObjectItem::Index (  )  const

Returns the index of this item at its parent.

const QString & conan::ObjectItem::Name (  )  const

Returns the object name of the wrapped object.

const QObject * conan::ObjectItem::Object (  )  const

Returns the wrapped object.

const ObjectItem * conan::ObjectItem::Parent (  )  const

Returns the parent item.

void conan::ObjectItem::Reset (  )  [protected]

Destroyes all children and resets all members.

template<typename Pred >
void conan::ObjectItem::Sort ( Pred  inPred  ) 

Sort all children recursively.

Parameters:
[in] inPred A binary predicate function object that defines the comparison criterion

Member Data Documentation

QString conan::ObjectItem::mAddress [protected]

The address of mObject.

QString conan::ObjectItem::mClass [protected]

The class name of mObject.

QString conan::ObjectItem::mName [protected]

The object name of mObject.

QPointer<QObject> conan::ObjectItem::mObject [protected]

The wrapped QObject, or 0 when it has been destroyed.


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