Skip to content

Commit

Permalink
Base::Type extension to get Type by key
Browse files Browse the repository at this point in the history
  • Loading branch information
abdullahtahiriyo authored and wwmayer committed May 7, 2017
1 parent 3e862bd commit 91a6dd7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Base/Type.cpp
Expand Up @@ -184,6 +184,14 @@ Type Type::fromName(const char *name)
return Type::badType();
}

Type Type::fromKey(unsigned int key)
{
if(key < typedata.size())
return typedata[key]->type;
else
return Type::badType();
}

const char *Type::getName(void) const
{
return typedata[index]->name.c_str();
Expand Down
1 change: 1 addition & 0 deletions src/Base/Type.h
Expand Up @@ -92,6 +92,7 @@ class BaseExport Type
typedef void * (*instantiationMethod)(void);

static Type fromName(const char *name);
static Type fromKey(unsigned int key);
const char *getName(void) const;
const Type getParent(void) const;
bool isDerivedFrom(const Type type) const;
Expand Down

0 comments on commit 91a6dd7

Please sign in to comment.