Commit 782ed585 authored by Jan Möbius's avatar Jan Möbius

Added function to check if a type exists

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@9357 383ad7c9-94d9-4d36-a494-682f7c89f535
parent afd54688
......@@ -181,6 +181,12 @@ DataType typeId(QString _name);
DLLEXPORT
QString typeName(DataType _id);
/** \brief Check if a type with the given name exists
*
*/
DLLEXPORT
bool typeExists( QString _name );
/** \brief Get the number of registered types
*
* This function will return the number of types registered to the core. You can use it to
......
......@@ -151,7 +151,7 @@ DataType addDataType(QString _name, QString _readableName) {
// Check if datatype already exists.
// If so, we return the typeId that is used for it
if ( stringToTypeInfo.find( _name ) != stringToTypeInfo.end() ) {
if ( typeExists(_name) ) {
std::cerr << "Redefinition of existing data type!" << std::endl;
return typeId(_name);
}
......@@ -198,6 +198,11 @@ QString typeName(DataType _id) {
}
}
/// Check if a type with the given name exists
bool typeExists( QString _name ) {
return ( stringToTypeInfo.find( _name ) != stringToTypeInfo.end() );
}
/// Return the number of registered types
uint typeCount() {
......
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