#include <Q/q.h>
Inheritance diagram for Q::ConceptIterator:
List of all members.
Detailed Description
The ConceptIterator is a convenient way to find all concepts descendant from a given parent to a given depth. The parent is associated with a Concept through the "isa" relation. Examples are (tibbles isa cat), (cat isa animal), (animal isa thing), (dog isa animal), (spike isa dog) and (spot isa dog).
The parent-child relationships between Concepts via "isa" constitute a type lattice.
Suppose we want to find all dogs. Use a ConceptIterator(dog) to get the list (spike spot). ConceptIterator(animal) would get (cat dog). Both these examples work to the default depth of 1.
Using depths > 1, you can find more derived types. Note that only the leaves are returned. For example, ConceptIterator(animal, 2) would get (tibbles spike spot). A depth of zero continues to the most derived types.
Constructor & Destructor Documentation
| Q::ConceptIterator::ConceptIterator |
( |
|
) |
[inline] |
|
Member Function Documentation
|
|
If the object referenced by obj is a ConceptIterator, then return a suitable reference to the object. |
| ClassType Q::ConceptIterator::classType |
( |
|
) |
[static] |
|
|
|
Return the type of this class. |
|
|
Create a new iterator for subtypes of the given parent at the given depth. - Note:
depth=0 finds the most derived types.
|
| Concept Q::ConceptIterator::current |
( |
|
) |
const |
|
|
|
Return the iterator's current Concept. |
| unsigned int Q::ConceptIterator::currentDepth |
( |
|
) |
const |
|
|
|
Return the depth of the current ConceptIterator's current position in the list. |
|
|
Advance the iterator to the next object in the list or if the current object is the last object in the list, then set the state of the iterator to invalid. |
| Concept Q::ConceptIterator::operator * |
( |
|
) |
const [inline] |
|
| bool Q::ConceptIterator::valid |
( |
|
) |
const |
|
|
|
Return true if the iterator's current position in the iteration represents a valid concept. When the iterator has finished iterating through the list, valid() will return false.
Reimplemented from Q::ObjectBase. |