Skip to content
Permalink
Browse files

Base::Type extension to get Type by key

  • Loading branch information...
abdullahtahiriyo authored and wwmayer committed May 5, 2017
1 parent 3e862bd commit 91a6dd728514c55b1ba333692acbe5f979a6876a
Showing with 9 additions and 0 deletions.
  1. +8 −0 src/Base/Type.cpp
  2. +1 −0 src/Base/Type.h
@@ -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();
@@ -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;

0 comments on commit 91a6dd7

Please sign in to comment.
You can’t perform that action at this time.