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:
parent
e23f6426b4
commit
fdc6992571
|
@ -195,6 +195,12 @@ NamedString* NamedList::getParam(unsigned int index) const
|
||||||
return static_cast<NamedString *>(m_params[index]);
|
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
|
const char* NamedList::getValue(const String& name, const char* defvalue) const
|
||||||
{
|
{
|
||||||
XDebug(DebugInfo,"NamedList::getValue(\"%s\",\"%s\")",name.c_str(),defvalue);
|
XDebug(DebugInfo,"NamedList::getValue(\"%s\",\"%s\")",name.c_str(),defvalue);
|
||||||
|
|
|
@ -3008,6 +3008,13 @@ public:
|
||||||
*/
|
*/
|
||||||
NamedString* getParam(unsigned int index) const;
|
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.
|
* Retrive the value of a named parameter.
|
||||||
* @param name Name of parameter to locate
|
* @param name Name of parameter to locate
|
||||||
|
|
Loading…
Reference in New Issue