Renamed addParameter method to add to be more generic

This commit is contained in:
anschrammh 2019-04-01 23:54:34 +02:00
parent 7717fa94e3
commit aa12a97adf

View File

@ -11,6 +11,7 @@ template <typename T>
class Dictionary
{
public:
Dictionary() :_parameter(NULL), _value(NULL), _next(NULL), _head(this){}
~Dictionary()
{
if(_head == this)
@ -21,17 +22,17 @@ public:
//_value = NULL; //Useless, just my c habits
}
boolean addParameter(const char *parameter, T *value)
boolean add(const char *parameter, T *value)
{
Dictionary *dictionaryNode = new Dictionary(parameter, value);
return addNewNodeAtTheEnd(dictionaryNode);
}
boolean addParameter(const char *parameter, T value)
boolean add(const char *parameter, T value)
{
Dictionary *dictionaryNode = new Dictionary(parameter, new T(value));
return addNewNodeAtTheEnd(dictionaryNode);
}
boolean deleteParameter(const char *parameter)
boolean remove(const char *parameter)
{
if(_head->_next == NULL) return false;
@ -124,7 +125,6 @@ public:
T* getValueRef(){return _value;}
const char *getParameter() const{return _parameter == NULL ? "" : _parameter;}
protected:
Dictionary() :_parameter(NULL), _value(NULL), _next(NULL), _head(this){}
Dictionary(const char *parameter, T *value) : Dictionary()
{
//We copy the parameter and the value