Frapper  1.0a
Static Public Member Functions | Static Private Attributes | List of all members
Frapper::NodeFactory Class Reference

Static class managing node types and Node object creation. More...

#include <NodeFactory.h>

Static Public Member Functions

static void initialize ()
 Initializes the node factory for producing nodes.
 
static void registerType (const QString &filename)
 Loads the XML description of a node type from the file with the given name.
 
static unsigned int getNumCategories ()
 Returns the number of node type categories available in the node factory.
 
static QString getCategoryName (unsigned int index)
 Returns the name of the node type category with the given index.
 
static QString getCategoryName (const QString &typeName)
 Returns the name of the category under which nodes of the given type name should be filed.
 
static QString getCategoryIconName (unsigned int index)
 Returns the name of the icon of the node type category with the given index.
 
static QString getCategoryIconName (const QString &typeName)
 Returns the name of the icon of the category under which nodes of the given type name should be filed.
 
static QStringList getTypeNames (bool internalTypes=false)
 Returns the list of types that are registered with the NodeFactory.
 
static QColor getColor (const QString &typeName)
 Returns the color associated with the node type of the given name.
 
static bool isErroneous (const QString &typeName)
 Returns whether errors or warnings occured while parsing the description file for the node type with the given name.
 
static NodecreateNode (const QString &typeName, const QString &name)
 Creates a node of the given type name with the given name.
 
static void freeResources ()
 Frees all resources that were used by private static data of the node factory class.
 

Static Private Attributes

static NodeType::CategoryList s_nodeTypeCategories
 A list of node type categories available in the node factory.
 
static NodeType::Map s_nodeTypes
 The map of node types with node type names as keys and pointers to node type objects as values.
 

Detailed Description

Static class managing node types and Node object creation.

Member Function Documentation

void Frapper::NodeFactory::initialize ( )
static

Initializes the node factory for producing nodes.

Public Static Functions.

void Frapper::NodeFactory::registerType ( const QString &  filename)
static

Loads the XML description of a node type from the file with the given name.

Parameters
filenameThe name of an XML file describing a node type.
unsigned int Frapper::NodeFactory::getNumCategories ( )
static

Returns the number of node type categories available in the node factory.

Returns
The number of node type categories available in the node factory.
QString Frapper::NodeFactory::getCategoryName ( unsigned int  index)
static

Returns the name of the node type category with the given index.

Parameters
indexThe index of the node type category whose name to return.
Returns
The name of the node type category with the given index.
QString Frapper::NodeFactory::getCategoryName ( const QString &  typeName)
static

Returns the name of the category under which nodes of the given type name should be filed.

Parameters
typeNameThe name of a node type for which to return the category name.
Returns
The category name corresponding to the given node type name.
QString Frapper::NodeFactory::getCategoryIconName ( unsigned int  index)
static

Returns the name of the icon of the node type category with the given index.

Parameters
indexThe index of the node type category whose icon name to return.
Returns
The name of the icon of the node type category with the given index.
QString Frapper::NodeFactory::getCategoryIconName ( const QString &  typeName)
static

Returns the name of the icon of the category under which nodes of the given type name should be filed.

Parameters
typeNameThe name of a node type for which to return the category icon.
Returns
The name of the category icon corresponding to the given node type name.
QStringList Frapper::NodeFactory::getTypeNames ( bool  internalTypes = false)
static

Returns the list of types that are registered with the NodeFactory.

Parameters
internalTypesFlag to control whether to include internal node types in the result.
Returns
The list of types that are registered with the NodeFactory.
QColor Frapper::NodeFactory::getColor ( const QString &  typeName)
static

Returns the color associated with the node type of the given name.

Parameters
typeNameThe name of the node type for which to return the associated color.
Returns
A color representing nodes of the given type name.
bool Frapper::NodeFactory::isErroneous ( const QString &  typeName)
static

Returns whether errors or warnings occured while parsing the description file for the node type with the given name.

Parameters
typeNameThe name of the node type for which to return whether errors or warnings occured.
Returns
True if errors or warnings occured while parsing the description file for the node type with the given name, otherwise False.
Node * Frapper::NodeFactory::createNode ( const QString &  typeName,
const QString &  name 
)
static

Creates a node of the given type name with the given name.

Parameters
typeNameThe name of the type to use for the new node.
nameThe name to give to the new node.
Returns
A pointer to the new node.
void Frapper::NodeFactory::freeResources ( )
static

Frees all resources that were used by private static data of the node factory class.

Member Data Documentation

QList< NodeType::Category > Frapper::NodeFactory::s_nodeTypeCategories
staticprivate

A list of node type categories available in the node factory.

Private Static Data.

QMap< QString, NodeType * > Frapper::NodeFactory::s_nodeTypes
staticprivate

The map of node types with node type names as keys and pointers to node type objects as values.


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