Added assignment operator for NamedList.

git-svn-id: http://voip.null.ro/svn/yate@3278 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
paulc 2010-05-04 10:14:59 +00:00
parent ab9274e550
commit 9d0212f010
2 changed files with 15 additions and 3 deletions

View File

@ -52,13 +52,19 @@ NamedList::NamedList(const char* name, const NamedList& original, const String&
copySubParams(original,prefix);
}
NamedList& NamedList::operator=(const NamedList& value)
{
String::operator=(value);
clearParams();
return copyParams(value);
}
void* NamedList::getObject(const String& name) const
{
if (name == "NamedList")
return const_cast<NamedList*>(this);
return String::getObject(name);
}
NamedList& NamedList::addParam(NamedString* param)
{
@ -346,5 +352,5 @@ int NamedList::replaceParams(String& str, bool sqlEsc, char extraEsc) const
}
return cnt;
}
/* vi: set ts=8 sw=4 sts=4 noet: */

View File

@ -3248,6 +3248,13 @@ public:
*/
NamedList(const char* name, const NamedList& original, const String& prefix);
/**
* Assignment operator
* @param value New name and parameters to assign
* @return Reference to this NamedList
*/
NamedList& operator=(const NamedList& value);
/**
* Get a pointer to a derived class given that class name
* @param name Name of the class we are asking for
@ -3454,7 +3461,6 @@ public:
private:
NamedList(); // no default constructor please
NamedList& operator=(const NamedList& value); // no assignment please
ObjList m_params;
};