svcore
1.9
|
#include <UnitDatabase.h>
Signals | |
void | unitDatabaseChanged () |
Public Member Functions | |
QStringList | getKnownUnits () const |
void | registerUnit (QString unit) |
int | getUnitId (QString unit, bool registerNew=true) |
Return the reference id for a given unit name. | |
QString | getUnitById (int id) |
Static Public Member Functions | |
static UnitDatabase * | getInstance () |
Protected Types | |
typedef std::map< QString, int > | UnitMap |
Protected Member Functions | |
UnitDatabase () | |
Protected Attributes | |
UnitMap | m_units |
int | m_nextId |
Static Protected Attributes | |
static UnitDatabase | m_instance |
Definition at line 29 of file UnitDatabase.h.
typedef std::map<QString, int> UnitDatabase::UnitMap [protected] |
Definition at line 54 of file UnitDatabase.h.
UnitDatabase::UnitDatabase | ( | ) | [protected] |
Definition at line 27 of file UnitDatabase.cpp.
UnitDatabase * UnitDatabase::getInstance | ( | ) | [static] |
Definition at line 22 of file UnitDatabase.cpp.
References m_instance.
Referenced by PropertyContainer::convertPropertyStrings(), and SparseValueModel< RegionRec >::setScaleUnits().
QStringList UnitDatabase::getKnownUnits | ( | ) | const |
Definition at line 33 of file UnitDatabase.cpp.
References m_units.
void UnitDatabase::registerUnit | ( | QString | unit | ) |
Definition at line 43 of file UnitDatabase.cpp.
References m_nextId, m_units, and unitDatabaseChanged().
Referenced by getUnitId(), and SparseValueModel< RegionRec >::setScaleUnits().
int UnitDatabase::getUnitId | ( | QString | unit, |
bool | registerNew = true |
||
) |
Return the reference id for a given unit name.
If registerNew is true and the unit is not known, register it and return its new id. If register is false and the unit is not known, return -1.
Definition at line 52 of file UnitDatabase.cpp.
References m_units, and registerUnit().
Referenced by PropertyContainer::convertPropertyStrings().
QString UnitDatabase::getUnitById | ( | int | id | ) |
Definition at line 62 of file UnitDatabase.cpp.
References m_units.
void UnitDatabase::unitDatabaseChanged | ( | ) | [signal] |
Referenced by registerUnit().
UnitMap UnitDatabase::m_units [protected] |
Definition at line 55 of file UnitDatabase.h.
Referenced by getKnownUnits(), getUnitById(), getUnitId(), and registerUnit().
int UnitDatabase::m_nextId [protected] |
Definition at line 56 of file UnitDatabase.h.
Referenced by registerUnit().
UnitDatabase UnitDatabase::m_instance [static, protected] |
Definition at line 58 of file UnitDatabase.h.
Referenced by getInstance().