Added method to check if any parameter in a list starts with a certain prefix.
git-svn-id: http://yate.null.ro/svn/yate/trunk@5318 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
parent
62bbf17bfc
commit
83234869ad
|
@ -216,6 +216,19 @@ NamedList& NamedList::copySubParams(const NamedList& original, const String& pre
|
|||
return *this;
|
||||
}
|
||||
|
||||
bool NamedList::hasSubParams(const char* prefix) const
|
||||
{
|
||||
XDebug(DebugInfo,"NamedList::hasSubParams(\"%s\") [%p]",prefix,this);
|
||||
if (!TelEngine::null(prefix)) {
|
||||
for (const ObjList* l = m_params.skipNull(); l; l = l->skipNext()) {
|
||||
const NamedString* s = static_cast<const NamedString*>(l->get());
|
||||
if (s->name().startsWith(prefix))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void NamedList::dump(String& str, const char* separator, char quote, bool force) const
|
||||
{
|
||||
if (force && str.null())
|
||||
|
|
|
@ -3799,6 +3799,13 @@ public:
|
|||
*/
|
||||
NamedList& copySubParams(const NamedList& original, const String& prefix, bool skipPrefix = true);
|
||||
|
||||
/**
|
||||
* Check if we have a parameter that starts with prefix
|
||||
* @param prefix Prefix to match in parameter name, must not be NULL
|
||||
* @return True if a parameter starts with prefix
|
||||
*/
|
||||
bool hasSubParams(const char* prefix) const;
|
||||
|
||||
/**
|
||||
* Get the index of a named string in the parameter list.
|
||||
* @param param Pointer to the parameter to locate
|
||||
|
|
Loading…
Reference in New Issue