Added handy parameter inspect operator[].

git-svn-id: http://voip.null.ro/svn/yate@1706 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
paulc 2008-01-30 17:55:29 +00:00
parent e23f6426b4
commit fdc6992571
2 changed files with 13 additions and 0 deletions

View File

@ -195,6 +195,12 @@ NamedString* NamedList::getParam(unsigned int index) const
return static_cast<NamedString *>(m_params[index]);
}
const String& NamedList::operator[](const String& name) const
{
const String* s = getParam(name);
return s ? *s : String::empty();
}
const char* NamedList::getValue(const String& name, const char* defvalue) const
{
XDebug(DebugInfo,"NamedList::getValue(\"%s\",\"%s\")",name.c_str(),defvalue);

View File

@ -3008,6 +3008,13 @@ public:
*/
NamedString* getParam(unsigned int index) const;
/**
* Parameter access operator
* @param name Name of the parameter to return
* @return String value of the parameter, @ref String::empty() if missing
*/
const String& operator[](const String& name) const;
/**
* Retrive the value of a named parameter.
* @param name Name of parameter to locate