#include <hierarchyobject.h>
Iterator Class to run through all the elements of a HierarchyObjectRef in a linear manner.
Example usage:
for ( const HierarchyObjectRef& it : HierarchyObjectIterator<HierarchyObjectRef>(rootObject)) { // do something with it here }Since the iterator is templated you can easily filter the hierarchy for certain types. In this example OSWindowRef is (amongst others) derived from HierarchyObjectRef . By passing the type <OSWindowRef> to the iterator you will get only these objects - no matter where they are located in the hierarchy.
for ( const OSWindowRef& it : HierarchyObjectIterator<OSWindowRef>(rootObject)) { // do something with it here }Please note that the HierarchyObjectIterator automatically gives you the correct typed object. This saves you from manually checking for the correct type and the do a (potential risky) cast to the target type like in this (not recommended) example.
for ( const HierarchyObjectRef& it : HierarchyObjectIterator<HierarchyObjectRef>(rootObject)) { if (it.IsInstanceOf<OSWindowRef>) { OSWindowRef window = Cast<OSWindowRef>(it); // do something with window here } }
公共成员函数 |
|
HierarchyObjectIterator () | |
HierarchyObjectIterator (const HierarchyObjectIterator & src ) | |
HierarchyObjectIterator ( HierarchyObjectIterator && src ) | |
MAXON_OPERATOR_COPY_ASSIGNMENT ( HierarchyObjectIterator ) | |
MAXON_OPERATOR_MOVE_ASSIGNMENT ( HierarchyObjectIterator ) | |
HierarchyObjectIterator (const HierarchyObjectRef <> &first) | |
void | operator++ () |
operator Bool () const | |
REFTYPE & | operator* () |
REFTYPE * | operator-> () |
Private Attributes |
|
REFTYPE | _last |
HierarchyObjectRef | _parent |
HierarchyObjectIterator | ( | ) |
HierarchyObjectIterator | ( | const HierarchyObjectIterator < REFTYPE > & | src | ) |
HierarchyObjectIterator | ( | HierarchyObjectIterator < REFTYPE > && | src | ) |
|
explicit |
MAXON_OPERATOR_COPY_ASSIGNMENT | ( | HierarchyObjectIterator < REFTYPE > | ) |
MAXON_OPERATOR_MOVE_ASSIGNMENT | ( | HierarchyObjectIterator < REFTYPE > | ) |
void operator++ | ( | ) |
|
explicit |
REFTYPE& operator* | ( | ) |
REFTYPE* operator-> | ( | ) |
REFTYPE _last | private |
|
private |