|
|
Javascript Object class, base for all JS objects
| JsObject (const char* name = "Object", Mutex* mtx = 0, bool frozen = false)
| JsObject |
Constructor
Parameters:
| name | Name of the object |
| mtx | Pointer to the mutex that serializes this object |
| frozen | True if the object is to be frozen from creation |
| JsObject (Mutex* mtx, const char* name, bool frozen = false)
| JsObject |
Constructor for an empty object
Parameters:
| mtx | Pointer to the mutex that serializes this object |
| name | Full name of the object |
| frozen | True if the object is to be frozen from creation |
| JsObject (GenObject* context, Mutex* mtx = 0, bool frozen = false)
| JsObject |
Constructor for an empty object with prototype
Parameters:
| context | Script context from which Object prototype is obtainend |
| mtx | Pointer to the mutex that serializes this object |
| frozen | True if the object is to be frozen from creation |
| ~JsObject ()
| ~JsObject |
[virtual]
Destructor
| Mutex* mutex ()
| mutex |
[virtual]
Retrieve the Mutex object used to serialize object access
Returns: Pointer to the mutex of the context this object belongs to
Reimplemented from ScriptContext.
| JsObject* clone (const char* name)
| clone |
[const virtual]
Clone and rename method
Parameters:
| name | Name of the cloned object |
Returns: New object instance
| inline JsObject* clone ()
| clone |
[const]
Clone method
Returns: New object instance
| void setPrototype (GenObject* context, const String& objName)
| setPrototype |
Set the object prototype
Parameters:
| context | Pointer to arbitrary object passed from evaluation methods |
| objName | Name of the object prototype to set the this object |
| JsObject* copy (Mutex* mtx)
| copy |
[const virtual]
Deep copy method
Parameters:
| mtx | Pointer to the mutex that serializes the copied object |
Returns: New object instance, does not keep references to old object
| void fillFieldNames (ObjList& names)
| fillFieldNames |
[virtual]
Fill a list with the unique names of all fields
Parameters:
| names | List to which key names must be added |
Reimplemented from ScriptContext.
| bool hasField (ObjList& stack, const String& name, GenObject* context)
| hasField |
[const virtual]
Check if a certain field is assigned in the object or its prototype
Parameters:
| stack | Evaluation stack in use |
| name | Name of the field to test |
| context | Pointer to arbitrary object passed from evaluation methods |
Returns: True if the field is present
Reimplemented from ScriptContext.
| NamedString* getField (ObjList& stack, const String& name, GenObject* context)
| getField |
[const virtual]
Get a pointer to a field in the object or its prototype
Parameters:
| stack | Evaluation stack in use |
| name | Name of the field to retrieve |
| context | Pointer to arbitrary object passed from evaluation methods |
Returns: Pointer to field, NULL if not present
Reimplemented from ScriptContext.
| void initConstructor (JsFunction* construct)
| initConstructor |
[virtual]
Native constructor initialization, called by addConstructor on the prototype
Parameters:
| construct | Function that has this object as prototype |
| JsObject* runConstructor (ObjList& stack, const ExpOperation& oper, GenObject* context)
| runConstructor |
[virtual]
Native object constructor, it's run on the prototype
Parameters:
| stack | Evaluation stack in use |
| oper | Constructor function to evaluate |
| context | Pointer to arbitrary object passed from evaluation methods |
Returns: New created and populated Javascript object
| bool runFunction (ObjList& stack, const ExpOperation& oper, GenObject* context)
| runFunction |
[virtual]
Try to evaluate a single method
Parameters:
| stack | Evaluation stack in use, parameters are popped off this stack and results are pushed back on stack |
| oper | Function to evaluate |
| context | Pointer to arbitrary object passed from evaluation methods |
Returns: True if evaluation succeeded
Reimplemented from ScriptContext.
| bool runField (ObjList& stack, const ExpOperation& oper, GenObject* context)
| runField |
[virtual]
Try to evaluate a single field
Parameters:
| stack | Evaluation stack in use, field value must be pushed on it |
| oper | Field to evaluate |
| context | Pointer to arbitrary object passed from evaluation methods |
Returns: True if evaluation succeeded
Reimplemented from ScriptContext.
| bool runAssign (ObjList& stack, const ExpOperation& oper, GenObject* context)
| runAssign |
[virtual]
Try to assign a value to a single field if object is not frozen
Parameters:
| stack | Evaluation stack in use |
| oper | Field to assign to, contains the field name and new value |
| context | Pointer to arbitrary object passed from evaluation methods |
Returns: True if assignment succeeded
Reimplemented from ScriptContext.
| ExpOperation* popValue (ObjList& stack, GenObject* context = 0)
| popValue |
[virtual]
Pops and evaluate the value of an operand off an evaluation stack, does not pop a barrier
Parameters:
| stack | Evaluation stack to remove the operand from |
| context | Pointer to arbitrary object to be passed to called methods |
Returns: Value removed from stack, NULL if stack underflow or field not evaluable
| inline bool frozen ()
| frozen |
[const]
Retrieve the object frozen status (cannot modify attributes or methods)
Returns: True if the object is frozen
| inline void freeze ()
| freeze |
Freeze the Javascript object preventing external changes to it
| void addObject (NamedList& params, const char* name, JsObject* obj)
| addObject |
[static]
Helper static method that adds an object to a parent
Parameters:
| params | List of parameters where to add the object |
| name | Name of the new parameter |
| obj | Pointer to the object to add |
| void addConstructor (NamedList& params, const char* name, JsObject* obj)
| addConstructor |
[static]
Helper static method that adds a constructor to a parent
Parameters:
| params | List of parameters where to add the constructor |
| name | Name of the new parameter |
| obj | Pointer to the prototype object to add |
| int extractArgs (JsObject* obj, ObjList& stack, const ExpOperation& oper,
GenObject* context, ObjList& arguments)
| extractArgs |
[static]
Helper static method that pops arguments off a stack to a list in proper order
Parameters:
| obj | Pointer to the object to use when popping each argument |
| stack | Evaluation stack in use, parameters are popped off this stack |
| oper | Function that is being evaluated |
| context | Pointer to arbitrary object passed from evaluation methods |
| arguments | List where the arguments are added in proper order |
Returns: Number of arguments popped off stack
| inline int extractArgs (ObjList& stack, const ExpOperation& oper, GenObject* context, ObjList& arguments)
| extractArgs |
Helper method that pops arguments off a stack to a list in proper order
Parameters:
| stack | Evaluation stack in use, parameters are popped off this stack |
| oper | Function that is being evaluated |
| context | Pointer to arbitrary object passed from evaluation methods |
| arguments | List where the arguments are added in proper order |
Returns: Number of arguments popped off stack
| JsObject* buildCallContext (Mutex* mtx, JsObject* thisObj = 0)
| buildCallContext |
[static]
Create an empty function call context
Parameters:
| mtx | Pointer to the mutex that serializes this object |
| thisObj | Optional object that will be set as "this" |
Returns: New empty object usable as call context
| void initialize (ScriptContext* context)
| initialize |
[static]
Initialize the standard global objects in a context
Parameters:
| context | Script context to initialize |
| inline const String& protoName ()
| protoName |
[static]
Get the name of the internal property used to track prototypes
Returns: The "__proto__" constant string
| void deepCopyParams (NamedList& dst, const NamedList& src, Mutex* mtx)
| deepCopyParams |
[static]
Static helper method that deep copies all parameters
Parameters:
| dst | Destination parameters |
| src | Source parameters |
| mtx | Mutex to be used to synchronize all new objects |
| void dumpRecursive (const GenObject* obj, String& buf)
| dumpRecursive |
[static]
Helper method to return the hierarchical structure of an object
Parameters:
| obj | Object to dump structure |
| buf | String to which the structure is added |
| void printRecursive (const GenObject* obj)
| printRecursive |
[static]
Helper method to display the hierarchical structure of an object
Parameters:
| obj | Object to display |
| bool runNative (ObjList& stack, const ExpOperation& oper, GenObject* context)
| runNative |
[protected virtual]
Try to evaluate a single native method
Parameters:
| stack | Evaluation stack in use, parameters are popped off this stack and results are pushed back on stack |
| oper | Function to evaluate |
| context | Pointer to arbitrary object passed from evaluation methods |
Returns: True if evaluation succeeded
| inline Mutex* mutex ()
| mutex |
[protected const]
Retrieve the Mutex object used to serialize object access
Returns: Pointer to the mutex of the context this object belongs to
Reimplemented from ScriptContext.
| Generated by: paulc on bussard on Thu Jul 24 18:41:02 2014, using kdoc 2.0a54. |