Types.cc File Reference

#include "TypesInternal.hh"
#include "DataTypes.hh"
#include <map>
#include <QCoreApplication>
#include <OpenFlipper/common/GlobalOptions.hh>
Include dependency graph for Types.cc:

Go to the source code of this file.

Classes

class  TypeInfo

Functions

std::ostream & operator<< (std::ostream &stream, DataType type)
void initializeTypes ()
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.
uint typeCount ()
 Return the number of registered types.
QString typeIconName (QString _name)
 Get the icon of a given dataType.
QString typeIconName (DataType _id)
 get the icon of a given dataType
QIcon & 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_ = 2
static std::map< DataType,
QString > 
typeToString
static std::map< QString,
unsigned int > 
stringToTypeInfo
static std::map< DataType,
unsigned int > 
typeToTypeInfo
static QIcon dummyIcon
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 300 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 289 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 246 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 234 of file Types.cc.

References typeToTypeInfo.

Referenced by PlaneObject::cleanup(), and PlaneObject::PlaneObject().

uint typeCount (  ) 

Return the number of registered types.

Get the number of registered types.

Definition at line 196 of file Types.cc.

Referenced by CoreWidget::showAboutWidget(), and Core::slotAddEmptyObjectMenu().

QIcon& typeIcon ( DataType  _id  ) 

get the icon of a given dataType

Get an QIcon associated with the given datatype.

Definition at line 223 of file Types.cc.

References typeToTypeInfo.

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

QString typeIconName ( DataType  _id  ) 

get the icon of a given dataType

Get a string with the filename of the icon for the DataType.

Definition at line 212 of file Types.cc.

References typeToTypeInfo.

QString typeIconName ( QString  _name  ) 

Get the icon of a given dataType.

Get a string with the filename of the icon for the DataType name.

Definition at line 201 of file Types.cc.

References stringToTypeInfo.

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 165 of file Types.cc.

References DATA_UNKNOWN, and stringToTypeInfo.

Referenced by MeshObject< MeshT >::getObjectinfo(), Core::objectList(), Core::openIniFile(), Core::readRecentFiles(), MeshObject< MeshT >::requestTriangleBsp(), Core::slotRecentOpen(), and CoreWidget::updateRecent().

QString typeName ( DataType  _id  ) 

Get the name of a type with given id.

The ids are organized in a bitfield. So use either the macro for getting the type id or use the id directly (they have to be power of 2! ... Bitfield)

Definition at line 180 of file Types.cc.

References typeToString.

Referenced by BaseObject::dumpTree(), DataType::name(), Core::openIniFile(), CoreWidget::showAboutWidget(), Core::slotAddEmptyObjectMenu(), CoreWidget::updatePopupMenuObject(), and Core::writeIniFile().


Variable Documentation

int nextTypeId_ = 2 [static]

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

Definition at line 70 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 78 of file Types.cc.

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

std::map< DataType, QString > typeToString [static]

This map maps an dataType id to an typeName

Definition at line 74 of file Types.cc.

Referenced by addDataType(), and typeName().

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

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

Definition at line 82 of file Types.cc.

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


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