Added JsRegExp function used to check if the object contains a valid regexp.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6095 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
parent
26cb46d632
commit
28db40ad77
|
@ -1142,6 +1142,7 @@ JsRegExp::JsRegExp(Mutex* mtx)
|
|||
: JsObject("RegExp",mtx)
|
||||
{
|
||||
params().addParam(new ExpFunction("test"));
|
||||
params().addParam(new ExpFunction("valid"));
|
||||
}
|
||||
|
||||
JsRegExp::JsRegExp(Mutex* mtx, const char* name, const char* rexp, bool insensitive, bool extended, bool frozen)
|
||||
|
@ -1149,6 +1150,7 @@ JsRegExp::JsRegExp(Mutex* mtx, const char* name, const char* rexp, bool insensit
|
|||
m_regexp(rexp,extended,insensitive)
|
||||
{
|
||||
params().addParam(new ExpFunction("test"));
|
||||
params().addParam(new ExpFunction("valid"));
|
||||
params().addParam("ignoreCase",String::boolText(insensitive));
|
||||
params().addParam("basicPosix",String::boolText(!extended));
|
||||
}
|
||||
|
@ -1158,6 +1160,7 @@ JsRegExp::JsRegExp(Mutex* mtx, const Regexp& rexp, bool frozen)
|
|||
m_regexp(rexp)
|
||||
{
|
||||
params().addParam(new ExpFunction("test"));
|
||||
params().addParam(new ExpFunction("valid"));
|
||||
params().addParam("ignoreCase",String::boolText(rexp.isCaseInsensitive()));
|
||||
params().addParam("basicPosix",String::boolText(!rexp.isExtended()));
|
||||
}
|
||||
|
@ -1174,6 +1177,11 @@ bool JsRegExp::runNative(ObjList& stack, const ExpOperation& oper, GenObject* co
|
|||
TelEngine::destruct(op);
|
||||
ExpEvaluator::pushOne(stack,new ExpOperation(ok));
|
||||
}
|
||||
else if (oper.name() == YSTRING("valid")) {
|
||||
if (oper.number())
|
||||
return false;
|
||||
ExpEvaluator::pushOne(stack,new ExpOperation(regexp().valid()));
|
||||
}
|
||||
else
|
||||
return JsObject::runNative(stack,oper,context);
|
||||
return true;
|
||||
|
|
Loading…
Reference in New Issue