Yate
JsRegExp Class Reference

Javascript RegExp. More...

#include <yatescript.h>

Inheritance diagram for JsRegExp:
JsObject ScriptContext RefObject ExpExtender GenObject

Public Member Functions

 JsRegExp (ScriptMutex *mtx=0)
 
 JsRegExp (ScriptMutex *mtx, const char *name, unsigned int line, const char *rexp=0, bool insensitive=false, bool extended=true, bool frozen=false)
 
 JsRegExp (ScriptMutex *mtx, unsigned int line, const Regexp &rexp, bool frozen=false)
 
const Regexpregexp () const
 
Regexpregexp ()
 
virtual bool runAssign (ObjList &stack, const ExpOperation &oper, GenObject *context)
 
virtual JsObjectrunConstructor (ObjList &stack, const ExpOperation &oper, GenObject *context)
 
virtual JsObjectcopy (ScriptMutex *mtx, const ExpOperation &oper) const
 
- Public Member Functions inherited from JsObject
 JsObject (const char *name="Object", ScriptMutex *mtx=0, bool frozen=false)
 
 JsObject (ScriptMutex *mtx, const char *name, unsigned int line, bool frozen=0)
 
 JsObject (GenObject *context, unsigned int line, ScriptMutex *mtx=0, bool frozen=false)
 
virtual ~JsObject ()
 
virtual ScriptMutexmutex ()
 
JsObjectclone (const ExpOperation &oper) const
 
void setPrototype (GenObject *context, const String &objName)
 
virtual void fillFieldNames (ObjList &names)
 
virtual const HashListgetHashListParams () const
 
virtual bool hasField (ObjList &stack, const String &name, GenObject *context) const
 
virtual NamedStringgetField (ObjList &stack, const String &name, GenObject *context) const
 
virtual void initConstructor (JsFunction *construct)
 
virtual bool runFunction (ObjList &stack, const ExpOperation &oper, GenObject *context)
 
virtual bool runField (ObjList &stack, const ExpOperation &oper, GenObject *context)
 
virtual ExpOperationpopValue (ObjList &stack, GenObject *context=0)
 
virtual void clearField (const String &name)
 
bool setIntField (const char *name, int64_t val)
 
bool setBoolField (const char *name, bool val)
 
bool setStringField (const char *name, const char *val)
 
bool setObjField (const char *name, JsObject *obj)
 
bool getIntField (const String &name, int64_t &val)
 
bool getBoolField (const String &name, bool &val)
 
bool getStringField (const String &name, String &val)
 
bool getObjField (const String &name, JsObject *&obj)
 
bool frozen () const
 
void freeze ()
 
void lineNo (unsigned int line)
 
unsigned int lineNo () const
 
int extractArgs (ObjList &stack, const ExpOperation &oper, GenObject *context, ObjList &arguments)
 
- Public Member Functions inherited from ScriptContext
 ScriptContext (const char *name=0)
 
NamedListparams ()
 
const NamedListparams () const
 
virtual NamedListnativeParams () const
 
virtual const StringtoString () const
 
virtual void * getObject (const String &name) const
 
virtual RefObjectrefObj ()
 
virtual bool copyFields (ObjList &stack, const ScriptContext &original, GenObject *context)
 
virtual void addFields (const NamedList &list, const char *skipPrefix="__")
 
bool runMatchingField (ObjList &stack, const ExpOperation &oper, GenObject *context)
 
virtual void createdObj (GenObject *obj)
 
virtual void deletedObj (GenObject *obj)
 
virtual void trackObjs (unsigned int track=0)
 
virtual ObjListcountAllocations ()
 
- Public Member Functions inherited from RefObject
 RefObject ()
 
virtual ~RefObject ()
 
virtual bool alive () const
 
bool ref ()
 
bool deref ()
 
int refcount () const
 
virtual void destruct ()
 
- Public Member Functions inherited from GenObject
 GenObject ()
 
virtual ~GenObject ()
 
virtual const StringtraceId () const
 
NamedCountergetObjCounter () const
 
NamedCountersetObjCounter (NamedCounter *counter)
 
- Public Member Functions inherited from ExpExtender
virtual ~ExpExtender ()
 

Protected Member Functions

virtual JsObjectclone (const char *name, const ExpOperation &oper) const
 
bool runNative (ObjList &stack, const ExpOperation &oper, GenObject *context)
 
- Protected Member Functions inherited from JsObject
ScriptMutexmutex () const
 
void setMutex (ScriptMutex *mtx)
 
- Protected Member Functions inherited from RefObject
virtual void zeroRefs ()
 
bool resurrect ()
 
virtual void destroyed ()
 

Additional Inherited Members

- Public Types inherited from JsObject
enum  DumpFlags {
  DumpFunc = 0x01 , DumpProp = 0x02 , DumpRecursive = 0x10 , DumpType = 0x20 ,
  DumpProto = 0x40 , DumpPropObjType = 0x80 , DumpFuncOnly = DumpRecursive | DumpProto | DumpFunc , DumpPropOnly = DumpRecursive | DumpPropObjType | DumpProp
}
 
- Static Public Member Functions inherited from JsObject
static void addObject (NamedList &params, const char *name, JsObject *obj)
 
static void addConstructor (NamedList &params, const char *name, JsObject *obj)
 
static int extractArgs (JsObject *obj, ObjList &stack, const ExpOperation &oper, GenObject *context, ObjList &arguments)
 
static JsObjectbuildCallContext (ScriptMutex *mtx, JsObject *thisObj=0)
 
static void initialize (ScriptContext *context)
 
static void setLineForObj (JsObject *obj, unsigned int lineNo, bool recursive)
 
static const StringprotoName ()
 
static void deepCopyParams (NamedList &dst, const NamedList &src, ScriptMutex *mtx)
 
static void dumpRecursive (const GenObject *obj, String &buf, unsigned int flags=0xffffffff)
 
static void printRecursive (const GenObject *obj, unsigned int flags=0xffffffff)
 
static ExpOperationtoJSON (const ExpOperation *oper, int spaces)
 
- Static Public Member Functions inherited from ScriptContext
static void fillFieldNames (ObjList &names, const NamedList &list, bool checkDupl=true, const char *skip=0)
 
static void fillFieldNames (ObjList &names, const HashList &list)
 
- Static Public Member Functions inherited from RefObject
static bool alive (const RefObject *obj)
 
static bool efficientIncDec ()
 
- Static Public Member Functions inherited from GenObject
static void * getObject (const String &name, const GenObject *obj)
 
static bool getObjCounting ()
 
static void setObjCounting (bool enable)
 
static NamedCountergetObjCounter (const String &name, bool create=true)
 
static ObjListgetObjCounters ()
 
- Static Protected Member Functions inherited from JsObject
static void toJSON (const NamedString *ns, String &buf, int spaces, int indent=0)
 
static String strEscape (const char *str)
 

Detailed Description

Javascript RegExp.

Javascript RegExp class, implements regular expression matching

Constructor & Destructor Documentation

◆ JsRegExp() [1/3]

JsRegExp ( ScriptMutex * mtx = 0)

Constructor for a RegExp constructor

Parameters
mtxPointer to the mutex that serializes this object

Referenced by clone().

◆ JsRegExp() [2/3]

JsRegExp ( ScriptMutex * mtx,
const char * name,
unsigned int line,
const char * rexp = 0,
bool insensitive = false,
bool extended = true,
bool frozen = false )

Constructor for a RegExp object

Parameters
mtxPointer to the mutex that serializes this object
nameFull name of the object
lineCode line where this object was created
rexpRegular expression text
insensitiveTrue to not differentiate case
extendedTrue to use POSIX Extended Regular Expression syntax
frozenTrue to create an initially frozen object

References JsObject::frozen().

◆ JsRegExp() [3/3]

JsRegExp ( ScriptMutex * mtx,
unsigned int line,
const Regexp & rexp,
bool frozen = false )

Constructor from existing Regexp

Parameters
mtxPointer to the mutex that serializes this object
lineCode line where this object was created
rexpRegular expression to copy
frozenTrue to create an initially frozen object

References JsObject::frozen().

Member Function Documentation

◆ clone()

virtual JsObject * clone ( const char * name,
const ExpOperation & oper ) const
inlineprotectedvirtual

Clone and rename method

Parameters
nameName of the cloned object
operExpOperation that required the clone
Returns
New object instance

Reimplemented from JsObject.

References JsObject::JsObject(), JsRegExp(), ExpOperation::lineNumber(), and JsObject::mutex().

◆ copy()

virtual JsObject * copy ( ScriptMutex * mtx,
const ExpOperation & oper ) const
virtual

Deep copy method

Parameters
mtxPointer to the mutex that serializes the copied regexp
operExpOperation that required the copy
Returns
New object instance, does not keep references to old regexp

Reimplemented from JsObject.

References JsObject::JsObject().

◆ regexp() [1/2]

Regexp & regexp ( )
inline

Access the internal Regexp object that does the matching

Returns
Reference to the internal Regexp object

◆ regexp() [2/2]

const Regexp & regexp ( ) const
inline

Access the internal Regexp object that does the matching

Returns
Const reference to the internal Regexp object

◆ runAssign()

virtual bool runAssign ( ObjList & stack,
const ExpOperation & oper,
GenObject * context )
virtual

Try to assign a value to a single field

Parameters
stackEvaluation stack in use
operField to assign to, contains the field name and new value
contextPointer to arbitrary object passed from evaluation methods
Returns
True if assignment succeeded

Reimplemented from JsObject.

◆ runConstructor()

virtual JsObject * runConstructor ( ObjList & stack,
const ExpOperation & oper,
GenObject * context )
virtual

RegExp object constructor, it's run on the prototype

Parameters
stackEvaluation stack in use
operConstructor function to evaluate
contextPointer to arbitrary object passed from evaluation methods
Returns
New created and populated Javascript RegExp object

Reimplemented from JsObject.

References JsObject::JsObject().

◆ runNative()

bool runNative ( ObjList & stack,
const ExpOperation & oper,
GenObject * context )
protectedvirtual

Try to evaluate a single native method

Parameters
stackEvaluation stack in use, parameters are popped off this stack and results are pushed back on stack
operFunction to evaluate
contextPointer to arbitrary object passed from evaluation methods
Returns
True if evaluation succeeded

Reimplemented from JsObject.


The documentation for this class was generated from the following file: