Bug 82 (Add convenience API to retrieve default values)

This commit is contained in:
Gustavo J. A. M. Carneiro
2007-10-08 17:49:18 +01:00
parent c0ed9be287
commit 3a41b51160

View File

@@ -97,6 +97,21 @@ class DefaultValueList
static Iterator End (void);
static void Remove (const std::string &name);
static void Add (DefaultValueBase *defaultValue);
template <typename T>
static const T* Get (const std::string &name)
{
for (Iterator iter = Begin (); iter != End (); iter++)
{
const DefaultValueBase *value = *iter;
if (value->GetName () == name)
{
return dynamic_cast<const T*> (value);
}
}
return NULL;
}
private:
typedef std::list<DefaultValueBase *> List;
static List *GetList (void);