Types.cc File Reference

#include "Types.hh"
#include <map>
#include <QCoreApplication>
Include dependency graph for Types.cc:

Go to the source code of this file.

Classes

class  TypeInfo

Functions

void initialize ()
DataType addDataType (QString _name, QString _readableName)
 Adds a datatype and returns the id for the new type.
DataType typeId (QString _name)
 Get the id of a type with given name.
QString typeName (DataType _id)
 Get the name of a type with given id.
QString typeIcon (QString _name)
 Get the icon of a given dataType.
QString typeIcon (DataType _id)
 get the icon of a given dataType
void setTypeIcon (DataType _id, QString _icon)
 Set the icon for a given dataType.
void setTypeIcon (QString _name, QString _icon)
 Set the icon for a given dataType.
QString dataTypeName (DataType _id)
 Get DataType Human readable name ( this name might change. Use the typeName insted! ).
QString dataTypeName (QString _typeName)
 Get DataType Human readable name ( this name might change. Use the typeName insted! ).
void setDataTypeName (DataType _id, QString _name)
 Set the icon for a given dataType.
void setDataTypeName (QString _typeName, QString _name)
 Set the icon for a given dataType.

Variables

static int nextTypeId_ = 8
static bool initialized_ = false
 Variable used to automatically initialize the maps.
static std::map< unsigned int,
QString > 
typeToString
static std::map< QString,
unsigned int > 
stringToTypeInfo
static std::map< unsigned int,
unsigned int > 
typeToTypeInfo
static std::vector< TypeInfotypes

Detailed Description

This File contains the basic functions to handle datatypes

Definition in file Types.cc.


Function Documentation

DataType addDataType ( QString  _name,
QString  _readableName 
)

Adds a datatype and returns the id for the new type.

Adds a datatype and returns the id for the new type

Parameters:
_name Internal name for the new DataType
_readableName Human readable Name for this type ( Use tr to make it translatable )

Definition at line 150 of file Types.cc.

References nextTypeId_, stringToTypeInfo, typeToString, and typeToTypeInfo.

void setDataTypeName ( QString  _typeName,
QString  _name 
)

Set the icon for a given dataType.

Set DataType Human readable name.

Definition at line 289 of file Types.cc.

References stringToTypeInfo.

void setDataTypeName ( DataType  _id,
QString  _name 
)

Set the icon for a given dataType.

Set DataType Human readable name.

Definition at line 277 of file Types.cc.

References typeToTypeInfo.

void setTypeIcon ( QString  _name,
QString  _icon 
)

Set the icon for a given dataType.

Set an Icon for a given DataType.

Definition at line 232 of file Types.cc.

References stringToTypeInfo.

void setTypeIcon ( DataType  _id,
QString  _icon 
)

Set the icon for a given dataType.

Set an Icon for a given DataType.

Definition at line 220 of file Types.cc.

References typeToTypeInfo.

QString typeIcon ( DataType  _id  ) 

get the icon of a given dataType

Get an icon for a given DataType.

Definition at line 208 of file Types.cc.

References typeToTypeInfo.

QString typeIcon ( QString  _name  ) 

Get the icon of a given dataType.

Get an icon for a given DataType.

Definition at line 196 of file Types.cc.

References stringToTypeInfo.

Referenced by CoreWidget::updatePopupMenuObject(), and CoreWidget::updateRecent().

DataType typeId ( QString  _name  ) 

Get the id of a type with given name.

Given a dataType Identifier string this function will return the id of the datatype.

Definition at line 166 of file Types.cc.

References DATA_UNKNOWN, and stringToTypeInfo.

Referenced by Core::objectList(), Core::openIniFile(), Core::preprocessObjFile(), and Core::readRecentFiles().


Variable Documentation

int nextTypeId_ = 8 [static]

This field defines the start id for custom datatypes. It starts high to avoid conflicts with previously hardcoded versions.

Definition at line 68 of file Types.cc.

Referenced by addDataType().

std::map< QString , unsigned int > stringToTypeInfo [static]

This map maps an dataType name to its id in the types vector

Definition at line 79 of file Types.cc.

Referenced by addDataType(), dataTypeName(), setDataTypeName(), setTypeIcon(), typeIcon(), and typeId().

std::map< unsigned int, QString > typeToString [static]

This map maps an dataType id to an typeName

Definition at line 75 of file Types.cc.

Referenced by addDataType(), and typeName().

std::map< unsigned int , unsigned int > typeToTypeInfo [static]

This map maps an dataType id to its id in the types vector

Definition at line 83 of file Types.cc.

Referenced by addDataType(), dataTypeName(), setDataTypeName(), setTypeIcon(), and typeIcon().


acg pic Project OpenFlipper, ©  Computer Graphics Group, RWTH Aachen. Documentation generated using doxygen .