![]() |
TinkerCell Core 1.0
TinkerCell's Core library providing all basic functionalities
|
This class defines the family of a node or connection. The class contains the icon for the family, family name, and minimal data that defines the family. Each family has a name, which is internally converted to an integer (ID) The ID is used to perform isA checks, thus avoiding repeated string matches. More...
#include <ItemFamily.h>
Public Member Functions | |
virtual QString | name () const |
name of this family | |
virtual void | setName (const QString &) |
set name of this family | |
virtual bool | isA (const QString &) const |
indicates whether or not the given string is the name of this family or any of its parent families | |
virtual bool | isA (const ItemFamily *) const |
indicates whether or not the given family is the name of this family or any of its parent families | |
virtual bool | isParentOf (const QString &) const |
indicates whether or not the given string is the name of this family or any of its child families | |
virtual bool | isParentOf (const ItemFamily *) const |
indicates whether or not the given family is the name of this family or any of its child families | |
virtual ItemFamily * | root () const |
get the top-most family | |
virtual bool | isRelatedTo (const ItemFamily *) const |
checks if the given family shares its root family with this family | |
virtual ItemFamily * | parent () const |
get the parent for this family. If there are more than one parents, returns the one with the highest depth | |
virtual int | depth () const |
counts the number of parents that have to be traversed in order to reach the root handle. If this handle has no parents, the values returned is 0. If its parent has no parent, then the value is 1, and so on. | |
virtual QList< ItemFamily * > | parents () const |
get all the parents for this family. | |
virtual QList< ItemFamily * > | children () const |
get all the families that inherit directly from this family | |
virtual QList< ItemFamily * > | allChildren () const |
get all the families that inherit from this family. the list will be ordered in a breadth-first ordering | |
virtual | ~ItemFamily () |
destructor. | |
ItemFamily (const QString &name=QString()) | |
constructor | |
Public Attributes | |
QString | description |
description of this family | |
QStringList | synonyms |
other names for this family | |
QStringList | restrictions |
restrictions that apply to this family | |
QList< Unit > | measurementUnitOptions |
the possible options for measurement name and unit for items in this family | |
Unit | measurementUnit |
the measurement name and unit for items in this family | |
QHash< QString, qreal > | numericalAttributes |
the list of numerical attributes that are common to all members of this family | |
QHash< QString, QString > | textAttributes |
the list of string attributes that are common to all members of this family | |
QList< QGraphicsItem * > | graphicsItems |
the default set of graphics items used to represent items of this family | |
QPixmap | pixmap |
the icon representing this family | |
Protected Member Functions | |
virtual bool | isA (int ID) const |
indicates whether or not the given family ID is the name of this family or any of its parent families | |
Protected Attributes | |
int | type |
used for casting between different sub-classes | |
QString | _name |
name of this family | |
int | ID |
the ID for this family. It is used for quick equality checks (instead of using strings) | |
Static Protected Attributes | |
static QStringList | ALLNAMES |
all family names. This list's lenth is used to assign the next ID | |
static QList< const ItemFamily * > | ALLFAMILIES |
all families by index | |
static QHash< QString, int > | NAMETOID |
the hash stores names for each ID | |
Friends | |
class | NodeFamily |
class | ConnectionFamily |
This class defines the family of a node or connection. The class contains the icon for the family, family name, and minimal data that defines the family. Each family has a name, which is internally converted to an integer (ID) The ID is used to perform isA checks, thus avoiding repeated string matches.
Definition at line 69 of file ItemFamily.h.
Tinkercell::ItemFamily::~ItemFamily | ( | ) | [virtual] |
destructor.
Definition at line 50 of file ItemFamily.cpp.
Tinkercell::ItemFamily::ItemFamily | ( | const QString & | name = QString() | ) |
constructor
QString | name |
Definition at line 45 of file ItemFamily.cpp.
QList< ItemFamily * > Tinkercell::ItemFamily::allChildren | ( | ) | const [virtual] |
get all the families that inherit from this family. the list will be ordered in a breadth-first ordering
Definition at line 164 of file ItemFamily.cpp.
QList< ItemFamily * > Tinkercell::ItemFamily::children | ( | ) | const [virtual] |
get all the families that inherit directly from this family
Reimplemented in Tinkercell::NodeFamily, and Tinkercell::ConnectionFamily.
Definition at line 66 of file ItemFamily.cpp.
int Tinkercell::ItemFamily::depth | ( | ) | const [virtual] |
counts the number of parents that have to be traversed in order to reach the root handle. If this handle has no parents, the values returned is 0. If its parent has no parent, then the value is 1, and so on.
Definition at line 68 of file ItemFamily.cpp.
bool Tinkercell::ItemFamily::isA | ( | const QString & | name | ) | const [virtual] |
indicates whether or not the given string is the name of this family or any of its parent families
Reimplemented in Tinkercell::NodeFamily, and Tinkercell::ConnectionFamily.
Definition at line 103 of file ItemFamily.cpp.
bool Tinkercell::ItemFamily::isA | ( | const ItemFamily * | family | ) | const [virtual] |
indicates whether or not the given family is the name of this family or any of its parent families
Reimplemented in Tinkercell::NodeFamily, and Tinkercell::ConnectionFamily.
Definition at line 125 of file ItemFamily.cpp.
bool Tinkercell::ItemFamily::isA | ( | int | ID | ) | const [protected, virtual] |
indicates whether or not the given family ID is the name of this family or any of its parent families
Reimplemented in Tinkercell::NodeFamily, and Tinkercell::ConnectionFamily.
Definition at line 98 of file ItemFamily.cpp.
bool Tinkercell::ItemFamily::isParentOf | ( | const QString & | name | ) | const [virtual] |
indicates whether or not the given string is the name of this family or any of its child families
Definition at line 131 of file ItemFamily.cpp.
bool Tinkercell::ItemFamily::isParentOf | ( | const ItemFamily * | family | ) | const [virtual] |
indicates whether or not the given family is the name of this family or any of its child families
Definition at line 144 of file ItemFamily.cpp.
bool Tinkercell::ItemFamily::isRelatedTo | ( | const ItemFamily * | family | ) | const [virtual] |
checks if the given family shares its root family with this family
Definition at line 158 of file ItemFamily.cpp.
QString Tinkercell::ItemFamily::name | ( | ) | const [virtual] |
name of this family
Definition at line 57 of file ItemFamily.cpp.
ItemFamily * Tinkercell::ItemFamily::parent | ( | ) | const [virtual] |
get the parent for this family. If there are more than one parents, returns the one with the highest depth
Reimplemented in Tinkercell::NodeFamily, and Tinkercell::ConnectionFamily.
Definition at line 62 of file ItemFamily.cpp.
QList< ItemFamily * > Tinkercell::ItemFamily::parents | ( | ) | const [virtual] |
get all the parents for this family.
Reimplemented in Tinkercell::NodeFamily, and Tinkercell::ConnectionFamily.
Definition at line 64 of file ItemFamily.cpp.
ItemFamily * Tinkercell::ItemFamily::root | ( | ) | const [virtual] |
get the top-most family
Definition at line 150 of file ItemFamily.cpp.
void Tinkercell::ItemFamily::setName | ( | const QString & | s | ) | [virtual] |
set name of this family
Definition at line 80 of file ItemFamily.cpp.
friend class ConnectionFamily [friend] |
Reimplemented in Tinkercell::NodeFamily.
Definition at line 142 of file ItemFamily.h.
friend class NodeFamily [friend] |
Definition at line 141 of file ItemFamily.h.
QString Tinkercell::ItemFamily::_name [protected] |
name of this family
Definition at line 131 of file ItemFamily.h.
QList< const ItemFamily * > Tinkercell::ItemFamily::ALLFAMILIES [static, protected] |
all families by index
Definition at line 137 of file ItemFamily.h.
QStringList Tinkercell::ItemFamily::ALLNAMES [static, protected] |
all family names. This list's lenth is used to assign the next ID
Definition at line 135 of file ItemFamily.h.
description of this family
Definition at line 73 of file ItemFamily.h.
QList<QGraphicsItem*> Tinkercell::ItemFamily::graphicsItems |
the default set of graphics items used to represent items of this family
Definition at line 87 of file ItemFamily.h.
int Tinkercell::ItemFamily::ID [protected] |
the ID for this family. It is used for quick equality checks (instead of using strings)
Definition at line 133 of file ItemFamily.h.
the measurement name and unit for items in this family
Definition at line 81 of file ItemFamily.h.
the possible options for measurement name and unit for items in this family
Definition at line 79 of file ItemFamily.h.
QHash< QString, int > Tinkercell::ItemFamily::NAMETOID [static, protected] |
the hash stores names for each ID
Definition at line 139 of file ItemFamily.h.
QHash<QString,qreal> Tinkercell::ItemFamily::numericalAttributes |
the list of numerical attributes that are common to all members of this family
Definition at line 83 of file ItemFamily.h.
QPixmap Tinkercell::ItemFamily::pixmap |
the icon representing this family
Definition at line 89 of file ItemFamily.h.
QStringList Tinkercell::ItemFamily::restrictions |
restrictions that apply to this family
Definition at line 77 of file ItemFamily.h.
QStringList Tinkercell::ItemFamily::synonyms |
other names for this family
Definition at line 75 of file ItemFamily.h.
QHash<QString,QString> Tinkercell::ItemFamily::textAttributes |
the list of string attributes that are common to all members of this family
Definition at line 85 of file ItemFamily.h.
int Tinkercell::ItemFamily::type [protected] |
used for casting between different sub-classes
Definition at line 127 of file ItemFamily.h.