Commit 18445b20 authored by Mike Kremer's avatar Mike Kremer

Added type iterator to global members and adapted view control plugin to...

Added type iterator to global members and adapted view control plugin to automatically fetch data types via this accessor rather than hardcoded.

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@12096 383ad7c9-94d9-4d36-a494-682f7c89f535
parent b4df6ac4
......@@ -129,6 +129,36 @@ class DLLEXPORT DataType {
unsigned int field;
};
class TypeInfo {
public:
TypeInfo(DataType _type, QString _name, QString _iconName, QString _readableName ) :
type(_type),
name(_name),
iconName(_iconName),
readableName(_readableName)
{
// Use internal name if no external name is given
if ( _readableName == "" )
readableName = _name;
}
/// The id of the datatype
DataType type;
/// The name of the datatype
QString name;
/// The icon of the datatype
QString iconName;
QIcon icon;
/// Human readable name
QString readableName;
};
/// Identifier for all available objects
const DataType DATA_ALL(UINT_MAX);
......@@ -199,6 +229,21 @@ uint typeCount();
/** @} */
//================================================================================================
/** @name Type iterators
* @{ */
//================================================================================================
/// Get iterator pointing to the first element in the tyoes list
DLLEXPORT
std::vector< TypeInfo >::const_iterator typesBegin();
/// Get iterator pointing to the last element in the tyoes list
DLLEXPORT
std::vector< TypeInfo >::const_iterator typesEnd();
/** @} */
//================================================================================================
/** @name Datatype Name handling
* @{ */
......
......@@ -81,36 +81,6 @@ static std::map< QString , unsigned int > stringToTypeInfo;
*/
static std::map< DataType , unsigned int > typeToTypeInfo;
class TypeInfo {
public:
TypeInfo(DataType _type, QString _name, QString _iconName, QString _readableName ) :
type(_type),
name(_name),
iconName(_iconName),
readableName(_readableName)
{
// Use internal name if no external name is given
if ( _readableName == "" )
readableName = _name;
}
/// The id of the datatype
DataType type;
/// The name of the datatype
QString name;
/// The icon of the datatype
QString iconName;
QIcon icon;
/// Human readable name
QString readableName;
};
static QIcon dummyIcon;
static std::vector< TypeInfo > types;
......@@ -209,6 +179,16 @@ uint typeCount() {
return types.size();
}
/// Get iterator pointing to the first element in the tyoes list
std::vector< TypeInfo >::const_iterator typesBegin() {
return types.begin();
}
/// Get iterator pointing to the last element in the tyoes list
std::vector< TypeInfo >::const_iterator typesEnd() {
return types.end();
}
/// Get the icon of a given dataType
QString typeIconName(QString _name) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment