Gnash
0.8.11dev
|
The Global object ultimately contains all objects in an ActionScript run. More...
#include <Global_as.h>
Public Types | |
typedef as_value(* | ASFunction )(const fn_call &fn) |
typedef void(* | Properties )(as_object &) |
Public Member Functions | |
Global_as (VM &vm) | |
virtual | ~Global_as () |
void | registerClasses () |
as_object * | createArray () |
Construct an Array. More... | |
VM & | getVM () const |
as_function * | createFunction (Global_as::ASFunction function) |
Create an ActionScript function. More... | |
as_object * | createClass (Global_as::ASFunction ctor, as_object *prototype) |
Create an ActionScript class. More... | |
void | makeObject (as_object &o) const |
![]() | |
DSOTEXPORT | as_object (const Global_as &global) |
Construct an ActionScript object with no prototype associated. More... | |
virtual | ~as_object () |
The as_object dtor does nothing special. More... | |
virtual as_value | call (const fn_call &fn) |
Function dispatch. More... | |
virtual std::string | stringValue () const |
Return the string representation for this object. More... | |
Property * | findProperty (const ObjectURI &uri, as_object **owner=0) |
Find a property, scanning the inheritance chain. More... | |
VM & | vm () const |
Return a reference to this as_object's global object. More... | |
void | dump_members () |
Dump all properties using log_debug. More... | |
virtual bool | set_member (const ObjectURI &uri, const as_value &val, bool ifFound=false) |
Set a member value. More... | |
void | init_member (const std::string &name, const as_value &val, int flags=DefaultFlags) |
Initialize a member value by string. More... | |
void | init_member (const ObjectURI &uri, const as_value &val, int flags=DefaultFlags) |
Initialize a member value by key. More... | |
void | init_property (const std::string &key, as_function &getter, as_function &setter, int flags=DefaultFlags) |
Initialize a getter/setter property by name. More... | |
void | init_property (const std::string &key, as_c_function_ptr getter, as_c_function_ptr setter, int flags=DefaultFlags) |
Initialize a getter/setter property by name. More... | |
void | init_property (const ObjectURI &uri, as_function &getter, as_function &setter, int flags=DefaultFlags) |
Initialize a getter/setter property by key. More... | |
void | init_property (const ObjectURI &uri, as_c_function_ptr getter, as_c_function_ptr setter, int flags=DefaultFlags) |
Initialize a getter/setter property by key. More... | |
bool | init_destructive_property (const ObjectURI &uri, as_function &getter, int flags=PropFlags::dontEnum) |
Initialize a destructive getter property. More... | |
bool | init_destructive_property (const ObjectURI &uri, as_c_function_ptr getter, int flags=PropFlags::dontEnum) |
Initialize a destructive getter property. More... | |
void | init_readonly_property (const std::string &key, as_function &getter, int flags=DefaultFlags) |
Use this method for read-only properties. More... | |
void | init_readonly_property (const std::string &key, as_c_function_ptr getter, int flags=DefaultFlags) |
Use this method for read-only properties. More... | |
bool | watch (const ObjectURI &uri, as_function &trig, const as_value &cust) |
Add a watch trigger, overriding any other defined for same name. More... | |
bool | unwatch (const ObjectURI &uri) |
Remove a watch trigger. More... | |
virtual bool | get_member (const ObjectURI &uri, as_value *val) |
Get a property by name if it exists. More... | |
virtual as_object * | get_super (const ObjectURI &fname) |
as_object * | get_super () |
DSOTEXPORT std::pair< bool, bool > | delProperty (const ObjectURI &uri) |
Delete a property of this object, unless protected from deletion. More... | |
Property * | getOwnProperty (const ObjectURI &uri) |
Get this object's own named property, if existing. More... | |
void | set_member_flags (const ObjectURI &uri, int setTrue, int setFalse=0) |
Set member flags (probably used by ASSetPropFlags) More... | |
virtual as_function * | to_function () |
Cast to a as_function, or return NULL. More... | |
virtual bool | isSuper () const |
Return true if this is a 'super' object. More... | |
void | addInterface (as_object *ctor) |
Add an interface to the list of interfaces. More... | |
bool | instanceOf (as_object *ctor) |
Check whether this object is an instance of the given constructor. More... | |
bool | prototypeOf (as_object &instance) |
Check whether this object is in another object's inheritance chain. More... | |
void | setPropFlags (const as_value &props, int set_false, int set_true) |
Set property flags. More... | |
void | copyProperties (const as_object &o) |
Copy properties from the given object. More... | |
void | clearProperties () |
Drop all properties from this object. More... | |
template<typename T > | |
void | visitProperties (PropertyVisitor &visitor) const |
Visit the properties of this object by key/as_value pairs. More... | |
void | visitKeys (KeyVisitor &visitor) const |
Visit all visible property identifiers. More... | |
void | add_property (const std::string &key, as_function &getter, as_function *setter) |
Add a getter/setter property if no member already has that name. More... | |
as_object * | get_prototype () const |
Return this object's proto member. More... | |
void | set_prototype (const as_value &proto) |
Set this object's proto member. More... | |
void | setRelay (Relay *p) |
Set the as_object's Relay object. More... | |
Relay * | relay () const |
Access the as_object's Relay object. More... | |
bool | array () const |
Return true if this object should be treated as an array. More... | |
void | setArray (bool array=true) |
Set whether this object should be treated as an array. More... | |
DisplayObject * | displayObject () const |
Return the DisplayObject associated with this object. More... | |
void | setDisplayObject (DisplayObject *d) |
Set the DisplayObject associated with this as_object. More... | |
![]() | |
GcResource (GC &gc) | |
Create a Garbage-collected resource associated with a GC. More... | |
void | setReachable () const |
Mark this resource as being reachable. More... | |
bool | isReachable () const |
Return true if this object is marked as reachable. More... | |
void | clearReachable () const |
Clear the reachable flag. More... | |
Protected Member Functions | |
virtual void | markReachableResources () const |
Mark all reachable resources, override from GcResource. More... | |
![]() | |
as_object (VM &vm) | |
Construct an as_object associated with a VM. More... | |
![]() | |
virtual | ~GcResource () |
Delete this resource. More... | |
Additional Inherited Members | |
![]() | |
static const int | DefaultFlags |
The most common flags for built-in properties. More... | |
The Global object ultimately contains all objects in an ActionScript run.
An ActionScript run is a single version (AS1/2 or AS3) and includes all resources parsed from the SWF, created dynamically, loaded, or imported that are available to ActionScript code. Each VM (VM for AS1/2, Machine for AS3) has different resources in its Global object. The two objects should be entirely separate.
|
explicit |
|
virtual |
as_object * gnash::Global_as::createArray | ( | ) |
Construct an Array.
This uses the _global Array class to initialize the "constructor" and "__proto__" properties. If Array.prototype is undefined, those properties are not added.
References gnash::as_object::array(), gnash::as_object::as_object(), gnash::NSV::CLASS_ARRAY, gnash::as_object::get_member(), gnash::getMember(), gnash::getVM(), gnash::as_object::init_member(), gnash::NSV::PROP_CONSTRUCTOR, gnash::NSV::PROP_LENGTH, gnash::NSV::PROP_PROTOTYPE, gnash::as_object::set_prototype(), gnash::as_object::setArray(), and gnash::toObject().
Referenced by gnash::Function2::call(), gnash::Function::call(), gnash::XMLNode_as::childNodes(), gnash::abc::Machine::execute(), gnash::fileio_scandir(), gnash::AsBroadcaster::initialize(), and gnash::mysql_fetch().
as_object * gnash::Global_as::createClass | ( | Global_as::ASFunction | ctor, |
as_object * | prototype | ||
) |
Create an ActionScript class.
An AS2 class is generally a function (the constructor) with a prototype.
References gnash::NSV::CLASS_FUNCTION, gnash::as_object::DefaultFlags, gnash::getMember(), gnash::getOwnProperty(), gnash::as_object::init_member(), gnash::PropFlags::onlySWF6Up, gnash::NSV::PROP_CONSTRUCTOR, gnash::NSV::PROP_PROTOTYPE, gnash::NSV::PROP_uuPROTOuu, and gnash::as_value::to_function().
Referenced by gnash::button_class_init(), gnash::date_class_init(), gnash::dbus_class_init(), gnash::dejagnu_class_init(), gnash::fileio_class_init(), gnash::filereference_class_init(), gnash::gtkext_class_init(), gnash::lirc_class_init(), gnash::movieclip_class_init(), gnash::moviecliploader_class_init(), gnash::mysql_class_init(), gnash::registerBitmapClass(), gnash::registerBuiltinClass(), gnash::sharedobject_class_init(), gnash::sound_class_init(), gnash::textfield_class_init(), gnash::textformat_class_init(), gnash::video_class_init(), gnash::xml_class_init(), and gnash::xmlnode_class_init().
as_function * gnash::Global_as::createFunction | ( | Global_as::ASFunction | function | ) |
Create an ActionScript function.
References gnash::NSV::CLASS_FUNCTION, gnash::createObject(), gnash::as_object::DefaultFlags, gnash::key::f, gnash::getMember(), gnash::getOwnProperty(), gnash::as_object::init_member(), gnash::PropFlags::onlySWF6Up, gnash::NSV::PROP_CONSTRUCTOR, gnash::NSV::PROP_PROTOTYPE, gnash::NSV::PROP_uuPROTOuu, and gnash::as_value::to_function().
Referenced by gnash::attachAsBroadcasterStaticInterface(), gnash::attachKeyInterface(), gnash::attachLoadableInterface(), and registerClasses().
|
inline |
References gnash::as_object::vm().
Referenced by registerClasses().
References gnash::as_object::set_prototype().
Referenced by gnash::createObject().
|
protectedvirtual |
Mark all reachable resources, override from GcResource.
The default implementation marks all properties
If a derived class provides access to more GC-managed resources, it should override this function and call this function directly as the last step.
Reimplemented from gnash::as_object.
References gnash::ClassHierarchy::markReachableResources(), gnash::as_object::markReachableResources(), and gnash::GcResource::setReachable().
void gnash::Global_as::registerClasses | ( | ) |
References gnash::array_class_init(), gnash::NSV::CLASS_ARRAY, gnash::NSV::CLASS_FUNCTION, gnash::NSV::CLASS_OBJECT, gnash::NSV::CLASS_STRING, createFunction(), gnash::ClassHierarchy::declareAll(), gnash::PropFlags::dontEnum, gnash::flash_package_init(), gnash::function_class_init(), gnash::getMember(), gnash::VM::getNative(), gnash::getURI(), getVM(), gnash::as_object::init_member(), gnash::initObjectClass(), gnash::as_value::set_null(), gnash::string_class_init(), and gnash::as_object::vm().
Referenced by gnash::VM::VM().