Added handy NamedList dump method.
git-svn-id: http://yate.null.ro/svn/yate/trunk@2627 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
parent
212aef34a5
commit
8e99bcb53f
|
@ -172,6 +172,20 @@ NamedList& NamedList::copyParams(const NamedList& original, const String& list,
|
|||
return *this;
|
||||
}
|
||||
|
||||
void NamedList::dump(String& str, const char* separator, char quote, bool force) const
|
||||
{
|
||||
if (force && str.null())
|
||||
str << separator;
|
||||
str << quote << *this << quote;
|
||||
const ObjList *p = m_params.skipNull();
|
||||
for (; p; p = p->skipNext()) {
|
||||
const NamedString* s = static_cast<const NamedString *>(p->get());
|
||||
String tmp;
|
||||
tmp << quote << s->name() << quote << "=" << quote << *s << quote;
|
||||
str.append(tmp,separator);
|
||||
}
|
||||
}
|
||||
|
||||
int NamedList::getIndex(const NamedString* param) const
|
||||
{
|
||||
if (!param)
|
||||
|
|
10
yateclass.h
10
yateclass.h
|
@ -3396,6 +3396,16 @@ public:
|
|||
*/
|
||||
int replaceParams(String& str, bool sqlEsc = false, char extraEsc = 0) const;
|
||||
|
||||
/**
|
||||
* Dumps the name and all parameters to a string in a human readable format.
|
||||
* No escaping takes place so this method should be used for debugging only
|
||||
* @param str String to which the name and parameters are appended
|
||||
* @param separator Separator string to use before each parameter
|
||||
* @param quote String quoting character, usually single or double quote
|
||||
* @param force True to insert the separator even in an empty string
|
||||
*/
|
||||
void dump(String& str, const char* separator, char quote = 0, bool force = false) const;
|
||||
|
||||
/**
|
||||
* A static empty named list
|
||||
* @return Reference to a static empty named list
|
||||
|
|
Loading…
Reference in New Issue