Added static empty instances of ObjList and NamedList.

git-svn-id: http://yate.null.ro/svn/yate/trunk@2280 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
paulc 2008-10-22 13:32:25 +00:00
parent 1a95c86897
commit 6e24d52c38
4 changed files with 28 additions and 1 deletions

View File

@ -24,6 +24,13 @@
using namespace TelEngine;
static const NamedList s_empty("");
const NamedList& NamedList::empty()
{
return s_empty;
}
NamedList::NamedList(const char* name)
: String(name)
{

View File

@ -24,6 +24,13 @@
using namespace TelEngine;
static const ObjList s_empty;
const ObjList& ObjList::empty()
{
return s_empty;
}
ObjList::ObjList()
: m_next(0), m_obj(0), m_delete(true)
{

View File

@ -182,7 +182,7 @@ void StringMatchPrivate::fixup()
}
static String s_empty;
static const String s_empty;
const String& String::empty()
{

View File

@ -1113,6 +1113,12 @@ public:
inline void setDelete(bool autodelete)
{ m_delete = autodelete; }
/**
* A static empty object list
* @return Reference to a static empty list
*/
static const ObjList& empty();
private:
ObjList* m_next;
GenObject* m_obj;
@ -1292,6 +1298,7 @@ public:
/**
* A static null String
* @return Reference to a static empty String
*/
static const String& empty();
@ -3180,6 +3187,12 @@ public:
*/
int replaceParams(String& str, bool sqlEsc = false, char extraEsc = 0) const;
/**
* A static empty named list
* @return Reference to a static empty named list
*/
static const NamedList& empty();
private:
NamedList(); // no default constructor please
NamedList& operator=(const NamedList& value); // no assignment please