Added helper methods to check if a value is null or undefined.

git-svn-id: http://voip.null.ro/svn/yate@5144 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
paulc 2012-06-22 08:31:22 +00:00
parent 89ee4322b7
commit 80a7605cfd
2 changed files with 26 additions and 0 deletions

View File

@ -2301,4 +2301,18 @@ ExpOperation* JsParser::nullClone()
return s_null.ExpOperation::clone();
}
// Check if an object is identic to null
bool JsParser::isNull(const ExpOperation& oper)
{
ExpWrapper* w = YOBJECT(ExpWrapper,&oper);
return w && (w->object() == s_null.object());
}
// Check if an operation is undefined
bool JsParser::isUndefined(const ExpOperation& oper)
{
ExpWrapper* w = YOBJECT(ExpWrapper,&oper);
return w && !w->object();
}
/* vi: set ts=8 sw=4 sts=4 noet: */

View File

@ -2159,6 +2159,18 @@ public:
*/
static ExpOperation* nullClone();
/**
* Check if an operation holds a null value
* @return True if the operation holds a null object
*/
static bool isNull(const ExpOperation& oper);
/**
* Check if an operation holds an undefined value
* @return True if the operation holds an undefined value
*/
static bool isUndefined(const ExpOperation& oper);
private:
String m_basePath;
};