Public Types | Public Member Functions | Static Public Attributes | Protected Member Functions

gnash::as_object Class Reference

The base class for all ActionScript objects. More...

#include <as_object.h>

Inheritance diagram for gnash::as_object:
Inheritance graph
[legend]
Collaboration diagram for gnash::as_object:
Collaboration graph
[legend]

List of all members.

Public Types

typedef std::pair< std::string,
std::string > 
KeyValuePair
typedef std::deque< KeyValuePairSortedPropertyList
 This is used to hold an intermediate copy of an as_object's properties.

Public Member Functions

 as_object (Global_as &global)
 Construct an ActionScript object with no prototype associated.
virtual as_value call (const fn_call &fn)
 Function dispatch.
virtual const std::string & stringValue () const
 Return the string representation for this object.
PropertyfindProperty (const ObjectURI &uri, as_object **owner=NULL)
 Find a property, scanning the inheritance chain.
VMvm () const
 Return a reference to this as_object's global object.
void dump_members ()
 Dump all properties using log_debug.
void dump_members (std::map< std::string, as_value > &to)
 Dump all properties into the given container.
virtual bool set_member (const ObjectURI &uri, const as_value &val, bool ifFound=false)
 Set a member value.
void init_member (const std::string &name, const as_value &val, int flags=DefaultFlags)
 Initialize a member value by string.
void init_member (const ObjectURI &uri, const as_value &val, int flags=DefaultFlags)
 Initialize a member value by key.
void init_property (const std::string &key, as_function &getter, as_function &setter, int flags=DefaultFlags)
 Initialize a getter/setter property by name.
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.
void init_property (const ObjectURI &uri, as_function &getter, as_function &setter, int flags=DefaultFlags)
 Initialize a getter/setter property by key.
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.
bool init_destructive_property (const ObjectURI &uri, as_function &getter, int flags=PropFlags::dontEnum)
 Initialize a destructive getter property.
bool init_destructive_property (const ObjectURI &uri, as_c_function_ptr getter, int flags=PropFlags::dontEnum)
 Initialize a destructive getter property.
void init_readonly_property (const std::string &key, as_function &getter, int flags=DefaultFlags)
 Use this method for read-only properties.
void init_readonly_property (const ObjectURI &uri, as_function &getter, int flags=DefaultFlags)
void init_readonly_property (const std::string &key, as_c_function_ptr getter, int flags=DefaultFlags)
 Use this method for read-only properties.
void init_readonly_property (const ObjectURI &uri, as_c_function_ptr getter, int flags=DefaultFlags)
void enumeratePropertyKeys (as_environment &env) const
 Enumerate all non-hidden property keys to the given as_environment.
bool watch (const ObjectURI &uri, as_function &trig, const as_value &cust)
 Add a watch trigger, overriding any other defined for same name.
bool unwatch (const ObjectURI &uri)
 Remove a watch trigger.
virtual bool get_member (const ObjectURI &uri, as_value *val)
 Get a member as_value by name.
virtual as_objectget_path_element (string_table::key key)
 Resolve the given relative path component.
virtual as_objectget_super (string_table::key fname=0)
as_value getMember (const ObjectURI &uri)
 Get a member as_value by name in an AS-compatible way.
std::pair< bool, bool > delProperty (const ObjectURI &uri)
 Delete a property of this object, unless protected from deletion.
PropertygetOwnProperty (const ObjectURI &uri)
 Get this object's own named property, if existing.
bool hasOwnProperty (const ObjectURI &uri)
 Return true if this object has the named property.
void set_member_flags (const ObjectURI &uri, int setTrue, int setFalse=0)
 Set member flags (probably used by ASSetPropFlags).
virtual as_functionto_function ()
 Cast to a as_function, or return NULL.
virtual bool isSuper () const
 Return true if this is a 'super' object.
void addInterface (as_object *ctor)
 Add an interface to the list of interfaces.
bool instanceOf (as_object *ctor)
 Check whether this object is an instance of the given constructor.
bool prototypeOf (as_object &instance)
 Check whether this object is in another object's inheritance chain.
void setPropFlags (const as_value &props, int set_false, int set_true)
 Set property flags.
void copyProperties (const as_object &o)
 Copy properties from the given object.
void clearProperties ()
 Drop all properties from this object.
template<typename T >
void visitProperties (AbstractPropertyVisitor &visitor) const
 Visit the properties of this object by key/as_value pairs.
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.
as_objectget_prototype () const
 Return this object's __proto__ member.
void set_prototype (const as_value &proto)
 Set this object's __proto__ member.
void setRelay (Relay *p)
 Set the as_object's Relay object.
Relayrelay () const
 Access the as_object's Relay object.
bool array () const
 Return true if this object should be treated as an array.
void setArray (bool array=true)
 Set whether this object should be treated as an array.
DisplayObjectdisplayObject () const
 Return the DisplayObject associated with this object.
void setDisplayObject (DisplayObject *d)
 Set the DisplayObject associated with this as_object.

Static Public Attributes

static const int DefaultFlags
 The most common flags for built-in properties.

Protected Member Functions

 as_object (VM &vm)
 Construct an as_object associated with a VM.
virtual void markReachableResources () const
 Mark all reachable resources, override from GcResource.
void markAsObjectReachable () const
 Mark properties and triggers list as reachable (for the GC).

Detailed Description

The base class for all ActionScript objects.

Everything in ActionScript is an object or convertible to an object. This class is the base class for all object types and the implementation of the ActionScript Object type itself. See asobj/Object.cpp for the ActionScript Object interface. An AS2 object has 3 principle tasks: 1. to store a set of ActionScript properties and to control dynamic access to them. 2. to store native type information. 3. to store 'watches' that report on changes to any member property. A fourth but relatively minor task is to store a list of implemented interfaces (see as_object::instanceOf()). ActionScript has two different levels of Object typing: Dynamic Typing 1a. Native type information, stored in a Relay and inaccessible to ActionScript. 1b. Array type information. This is very similar (and possibly identical to) Relays. 2. Link to a DisplayObject. Both these dynamic types can be changed independently at runtime using native functions (often, but not always, constructor functions). Static Typing Functions (as_function), Super objects (as_super) and AS3 Class types (as_class) have a static type, that is, they are not convertible to each other once created.


Member Typedef Documentation

typedef std::pair<std::string, std::string> gnash::as_object::KeyValuePair

This is used to hold an intermediate copy of an as_object's properties.

AS enumerates in reverse order of creation. In order to make sure that the properties are in the correct order, the first element of a SortedPropertyList should hold the last created property. We use a deque because we push to the front in order to preserve the ordering for the copy.


Constructor & Destructor Documentation

gnash::as_object::as_object ( Global_as global  )  [explicit]

Construct an ActionScript object with no prototype associated.

Parameters:
global A reference to the Global object the new object ultimately belongs to. The created object uses the resources of the Global object.

Referenced by gnash::AVM1Global::createArray(), and gnash::AVM1Global::createObject().

gnash::as_object::as_object ( VM vm  )  [explicit, protected]

Construct an as_object associated with a VM.

This constructor is intended for subclasses. Although they could call the public constructor that accepts a Global_as, this could imply that that constructor can access members of the passed Global_as other than getVM(), which might not be available because the Global_as will not be fully constructed yet. While that is currently not the case, using this constructor eliminates this potential initialization order problem.

Parameters:
vm The VM to associate the newly created as_object with.

Member Function Documentation

void gnash::as_object::add_property ( const std::string &  key,
as_function getter,
as_function setter 
)

Add a getter/setter property if no member already has that name.

Parameters:
key Property identifier.
getter A function to invoke when this property value is requested.
setter A function to invoke when setting this property's value. By passing null, the property will have no setter. This is valid.
void gnash::as_object::addInterface ( as_object ctor  ) 

Add an interface to the list of interfaces.

This is used by the action "implements". This opcode is a compile-time promise that a class will implement all the methods of an otherwise unrelated interface class. The only use in AVM1 is to allow instanceOf to return true when a class implements another class.

Parameters:
ctor An as_object to specify as an interface implemented by this object.

References gnash::string_table::find(), gnash::PropertyList::getProperty(), gnash::getStringTable(), init_property(), and gnash::PropFlags::readOnly.

bool gnash::as_object::array (  )  const [inline]

Return true if this object should be treated as an array.

Referenced by gnash::AVM1Global::createArray().

as_value gnash::as_object::call ( const fn_call fn  )  [virtual]

Function dispatch.

Various objects can be called, including functions and super objects. A normal object has no call functionality, so the default implementation throws an ActionTypeError.

Reimplemented in gnash::abc::abc_function, gnash::as_function, gnash::builtin_function, gnash::Function, gnash::Function2, and gnash::NativeFunction.

void gnash::as_object::clearProperties (  )  [inline]

Drop all properties from this object.

References gnash::PropertyList::clear().

Referenced by gnash::DisplayObject::destroy().

void gnash::as_object::copyProperties ( const as_object o  ) 

Copy properties from the given object.

NOTE: the __proto__ member will NOT be copied.

Parameters:
o The object to copy properties from.
std::pair< bool, bool > gnash::as_object::delProperty ( const ObjectURI uri  ) 

Delete a property of this object, unless protected from deletion.

This function does *not* recurse in this object's prototype.

Parameters:
uri Property identifier. Note that if you do not care about the namespace (AS2 does not), you can call this function with the name key only.
Returns:
a pair of boolean values expressing whether the property was found (first) and whether it was deleted (second). Of course a pair(false, true) would be invalid (deleted a non-found property!). Valid returns are:
  • (false, false) : property not found
  • (true, false) : property protected from deletion
  • (true, true) : property successfully deleted

Referenced by gnash::ActionExec::delObjectMember(), and main().

DisplayObject* gnash::as_object::displayObject (  )  const [inline]

Return the DisplayObject associated with this object.

Returns:
A DisplayObject if this is as_object is associated with one, otherwise 0.

Referenced by gnash::IsDisplayObject< T >::operator()(), and gnash::as_value::set_as_object().

void gnash::as_object::dump_members (  ) 

Dump all properties using log_debug.

Note that it is very likely that this will result in changes to the object, as accessing getter/setters or destructive properties can modify properties. Only use this function for temporary debugging!

void gnash::as_object::dump_members ( std::map< std::string, as_value > &  to  ) 

Dump all properties into the given container.

Note that it is very likely that this will result in changes to the object, as accessing getter/setters or destructive properties can modify properties. Only use this function for temporary debugging!

References get_prototype().

void gnash::as_object::enumeratePropertyKeys ( as_environment env  )  const

Enumerate all non-hidden property keys to the given as_environment.

NB: this function does not access the property values, so callers can be certain no values will be changed. The enumeration recurses through the prototype chain. This implementation will keep track of visited object to avoid infinite loops in the prototype chain. NOTE: the MM player just chokes in this case.

Property * gnash::as_object::findProperty ( const ObjectURI uri,
as_object **  owner = NULL 
)

Find a property, scanning the inheritance chain.

Parameters:
uri Property identifier.
owner If not null, this is set to the object which contained an inherited property.
Returns:
A property if found and visible, NULL if not found or not visible in current VM version

References get_prototype(), gnash::getGlobal(), and gnash::getSWFVersion().

bool gnash::as_object::get_member ( const ObjectURI uri,
as_value val 
) [virtual]

Get a member as_value by name.

Order of property lookup:

NOTE that this method is non-const because accessing a getter/setter property may modify the object.

Parameters:
uri Property identifier.
val Variable to assign an existing value to. Will be untouched if no property with the given name was found.
Returns:
true if the named property was found, false otherwise.

1. Visible own properties. 2. If DisplayObject, magic properties 3. Visible own properties of all __proto__ objects (a DisplayObject ends the chain). 4. __resolve property of this object and all __proto__ objects (a Display Object ends the chain). This should ignore visibility but doesn't.

If __resolve exists, call it with the name of the undefined property.

Referenced by gnash::AVM1Global::createArray(), gnash::DisplayObject::hasEventHandler(), and main().

as_object * gnash::as_object::get_path_element ( string_table::key  key  )  [virtual]

Resolve the given relative path component.

Path components are only objects, if the given string points to a non-object member, NULL is returned.

Main use if for getvariable and settarget resolution, currently implemented in as_environment.

as_object * gnash::as_object::get_prototype (  )  const

Return this object's __proto__ member.

The __proto__ member is the exported interface (prototype) of the class this object is an instance of.

NOTE: can return NULL (and it is expected to do for Object.prototype)

Referenced by dump_members(), and findProperty().

as_object * gnash::as_object::get_super ( string_table::key  fname = 0  )  [virtual]

Get the super object of this object.

The super should be __proto__ if this is a prototype object itself, or __proto__.__proto__ if this is not a prototype object. This is only conceptual however, and may be more convoluted to obtain the actual super.

Referenced by gnash::Function2::call().

as_value gnash::as_object::getMember ( const ObjectURI uri  ) 

Get a member as_value by name in an AS-compatible way.

NOTE that this method is non-const becase a property could also be a getter/setter and we can't promise that the 'getter' won't change this object trough use of the 'this' reference.

Parameters:
uri Property identifier. Note that if you do not care about the namespace (AS2 does not), you can call this function with the name key only.
Returns:
Value of the member (possibly undefined), or undefined if not found. Use get_member if you need to know whether it was found or not.

References gnash::PropertyList::getProperty().

Referenced by gnash::AVM1Global::createArray(), gnash::foreachArray(), gnash::XMLNode_as::object(), and gnash::AVM1Global::registerClasses().

Property * gnash::as_object::getOwnProperty ( const ObjectURI uri  ) 

Get this object's own named property, if existing.

This function does *not* recurse in this object's prototype.

Parameters:
uri The name and namespace of the property. Note that if you do not care about the namespace (AS2 does not), you can call this function with the name key only.
Returns:
A Property pointer, or NULL if this object doesn't contain the named property.

Referenced by gnash::abc::Method::addGetter(), gnash::abc::Class::addGetter(), gnash::abc::Method::addSetter(), and gnash::abc::Class::addSetter().

bool gnash::as_object::hasOwnProperty ( const ObjectURI uri  ) 

Return true if this object has the named property.

Parameters:
uri Name and namespace of the property. Note that if you do not care about the namespace (AS2 does not), you can call this function with the name key only.
Returns:
true if the object has the property, false otherwise.
bool gnash::as_object::init_destructive_property ( const ObjectURI uri,
as_function getter,
int  flags = PropFlags::dontEnum 
)

Initialize a destructive getter property.

A destructive getter can be used as a place holder for the real value of a property. As soon as getValue is invoked on the getter, it destroys itself after setting its property to the return value of getValue.

Parameters:
uri Property identifier.
getter A function to invoke when this property value is requested.
flags Flags for the new member. By default dontEnum.
bool gnash::as_object::init_destructive_property ( const ObjectURI uri,
as_c_function_ptr  getter,
int  flags = PropFlags::dontEnum 
)

Initialize a destructive getter property.

A destructive getter can be used as a place holder for the real value of a property. As soon as getValue is invoked on the getter, it destroys itself after setting its property to the return value of getValue.

Parameters:
uri name/namespace property identifier.
getter A function to invoke when this property value is requested.
flags Flags for the new member. By default dontEnum.

References gnash::string_table::find(), gnash::getStringTable(), and init_property().

void gnash::as_object::init_member ( const std::string &  name,
const as_value val,
int  flags = DefaultFlags 
)

Initialize a member value by string.

This is just a wrapper around the other init_member method used as a trampoline to avoid changing all classes to use string_table::key directly.

Parameters:
name Name of the member.
val Value to assign to the member.
flags Flags for the new member. By default dontDelete and dontEnum.

Referenced by gnash::abc::Class::addMethod(), gnash::abc::Method::addSlot(), gnash::abc::Class::addSlot(), gnash::abc::Method::addValue(), gnash::abc::Class::addValue(), gnash::attachKeyInterface(), gnash::AVM1Global::createArray(), gnash::AVM1Global::createClass(), gnash::AVM1Global::createFunction(), gnash::VM::getNative(), gnash::NetConnection_as::notifyStatus(), gnash::XMLNode_as::object(), gnash::registerBuiltinClass(), gnash::registerBuiltinObject(), and gnash::AVM1Global::registerClasses().

void gnash::as_object::init_member ( const ObjectURI uri,
const as_value val,
int  flags = DefaultFlags 
)

Initialize a member value by key.

This method has to be used by built-in classes initialization (VM initialization in general) as will avoid to scan the inheritance chain.

By default, members initialized by calling this function will be protected from deletion and not shown in enumeration. These flags can be explicitly set using the third argument.

Parameters:
uri Property identifier.
val Value to assign to the member.
flags Flags for the new member. By default dontDelete and dontEnum.
void gnash::as_object::init_property ( const std::string &  key,
as_function getter,
as_function setter,
int  flags = DefaultFlags 
)

Initialize a getter/setter property by name.

This is just a wrapper around the other init_property method used as a trampoline to avoid changing all classes to use string_table::key directly.

Parameters:
key Name of the property. Will be converted to lowercase if VM is initialized for SWF6 or lower.
getter A function to invoke when this property value is requested. add_ref will be called on the function.
setter A function to invoke when setting this property's value. add_ref will be called on the function.
flags Flags for the new member. By default dontDelete and dontEnum. See PropFlags::Flags.

Referenced by gnash::abc::Method::addGetter(), gnash::abc::Class::addGetter(), addInterface(), gnash::abc::Method::addSetter(), gnash::abc::Class::addSetter(), init_destructive_property(), init_property(), instanceOf(), and set_member_flags().

void gnash::as_object::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.

This is just a wrapper around the other init_property method used as a trampoline to avoid changing all classes to use string_table::key directly.

Parameters:
key Name of the property. Will be converted to lowercase if VM is initialized for SWF6 or lower.
getter A function to invoke when this property value is requested.
setter A function to invoke when setting this property's value.
flags Flags for the new member. By default dontDelete and dontEnum. See PropFlags::Flags.
void gnash::as_object::init_property ( const ObjectURI uri,
as_function getter,
as_function setter,
int  flags = DefaultFlags 
)

Initialize a getter/setter property by key.

This method has to be used by built-in classes initialization (VM initialization in general) as will avoid to scan the inheritance chain.

Parameters:
uri Property identifier.
getter A function to invoke when this property value is requested.
setter A function to invoke when this property value is set.
flags Flags for the new member. By default dontEnum and dontDelete.
void gnash::as_object::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.

This method has to be used by built-in classes initialization (VM initialization in general) as will avoid to scan the inheritance chain.

Parameters:
uri Property identifier.
getter A function to invoke when this property value is requested.
setter A function to invoke when this property value is set.
flags Flags for the new member. By default dontEnum and dontDelete.

References gnash::string_table::find(), gnash::getStringTable(), and init_property().

void gnash::as_object::init_readonly_property ( const std::string &  key,
as_function getter,
int  flags = DefaultFlags 
)

Use this method for read-only properties.

This method achieves the same as the above init_property method. Additionally, it sets the property as read-only so that a default handler will be triggered when ActionScript attempts to set the property. The arguments are the same as the above init_property arguments, although the setter argument is omitted.

Parameters:
key Property name id
getter The getter function
flags Property flags

References gnash::PropertyList::addGetterSetter().

Referenced by gnash::NetConnection_as::setURI().

void gnash::as_object::init_readonly_property ( const ObjectURI uri,
as_function getter,
int  flags = DefaultFlags 
)
void gnash::as_object::init_readonly_property ( const std::string &  key,
as_c_function_ptr  getter,
int  flags = DefaultFlags 
)

Use this method for read-only properties.

This method achieves the same as the above init_property method. Additionally, it sets the property as read-only so that a default handler will be triggered when ActionScript attempts to set the property.

The arguments are the same as the above init_property arguments, although the setter argument is omitted.

Parameters:
key Property name id
getter The getter function
flags Property flags

References gnash::PropertyList::addDestructiveGetter().

void gnash::as_object::init_readonly_property ( const ObjectURI uri,
as_c_function_ptr  getter,
int  flags = DefaultFlags 
)
bool gnash::as_object::instanceOf ( as_object ctor  ) 

Check whether this object is an instance of the given constructor.

An object is an instance of a constructor if constructor.prototype is found anywhere in the object's prototype chain (e.g. if object.__proto__ == constructor.prototype). It is also an instance of a constructor if the constructor is listed in the object's interfaces (this is a compile-time promise and has no runtime effects other than for instanceOf).

Parameters:
ctor The as_object to compare this object to. For more ActionScript-like syntax it can be any object or null.
Returns:
true if this object is an instance of ctor. The return is always false if ctor is null.

An object is never an instance of a null prototype.

References gnash::PropertyList::getProperty(), init_property(), and gnash::PropFlags::readOnly.

virtual bool gnash::as_object::isSuper (  )  const [inline, virtual]

Return true if this is a 'super' object.

void gnash::as_object::markAsObjectReachable (  )  const [protected]

Mark properties and triggers list as reachable (for the GC).

Referenced by gnash::AVM1Global::markReachableResources(), and markReachableResources().

virtual void gnash::as_object::markReachableResources (  )  const [inline, protected, virtual]

Mark all reachable resources, override from GcResource.

The default implementation marks all properties as being reachable, calling markAsObjectReachable().

If a derived class provides access to more GC-managed resources, it should override this method and call markAsObjectReachable() as the last step.

Reimplemented from gnash::GcResource.

Reimplemented in gnash::AVM1Global, and gnash::Function.

References markAsObjectReachable().

bool gnash::as_object::prototypeOf ( as_object instance  ) 

Check whether this object is in another object's inheritance chain.

This is roughly the inverse of instanceOf().

Parameters:
instance The instance object to check for inheritance from this object.
Returns:
true if instance inherits from this object.
Relay* gnash::as_object::relay (  )  const [inline]

Access the as_object's Relay object.

The Relay object is a polymorphic object containing native type characteristics. It is rarely useful to use this function directly. Instead use the convenience functions ensure<>() and isNativeType() to access the Relay object. Relay objects are not available to ActionScript, so this object should not be used in built-in functions (that is, functions implemented in ActionScript).

Referenced by gnash::isNativeType(), and gnash::ThisIsNative< T >::operator()().

bool gnash::as_object::set_member ( const ObjectURI uri,
const as_value val,
bool  ifFound = false 
) [virtual]

Set a member value.

Order of property lookup:

Parameters:
uri Property identifier.
val Value to assign to the named property.
ifFound If true, don't create a new member, but rather only update an existing one.
Returns:
true if the given member existed, false otherwise. NOTE: the return doesn't tell if the member exists after the call, as watch triggers might have deleted it after setting.

0. MovieClip textfield variables. TODO: this is a hack and should be eradicated. 1. Own properties even if invisible or not getter-setters. 2. If DisplayObject, magic properties 3. Visible own getter-setter properties of all __proto__ objects (a DisplayObject ends the chain).

Referenced by gnash::abc::Method::addValue(), gnash::abc::Class::addValue(), gnash::fileio_scandir(), gnash::XMLNode_as::setAttribute(), gnash::TextField::setHtmlTextValue(), gnash::abc::Method::setOwner(), and gnash::TextField::setTextValue().

void gnash::as_object::set_member_flags ( const ObjectURI uri,
int  setTrue,
int  setFalse = 0 
)

Set member flags (probably used by ASSetPropFlags).

Parameters:
name Name of the property. Must be all lowercase if the current VM is initialized for a target up to SWF6.
setTrue The set of flags to set
setFalse The set of flags to clear

References gnash::PropertyList::getProperty(), init_property(), and gnash::PropFlags::readOnly.

void gnash::as_object::set_prototype ( const as_value proto  ) 

Set this object's __proto__ member.

This does more or less what set_member("__proto__") does, but without the lookup process.

References gnash::getSWFVersion(), gnash::Property::isGetterSetter(), and gnash::visible().

Referenced by gnash::AVM1Global::createArray(), gnash::AVM1Global::createObject(), and gnash::XMLNode_as::object().

void gnash::as_object::setArray ( bool  array = true  )  [inline]

Set whether this object should be treated as an array.

Referenced by gnash::AVM1Global::createArray().

void gnash::as_object::setDisplayObject ( DisplayObject d  )  [inline]

Set the DisplayObject associated with this as_object.

Referenced by gnash::DisplayObject::DisplayObject().

void gnash::as_object::setPropFlags ( const as_value props,
int  set_false,
int  set_true 
)

Set property flags.

Parameters:
props A comma-delimited list of property names as a string, a NULL value. This is in fact a string, which should be split on the ',' to an array then processed. TODO: this would be much better as a free function.
set_false A mask of flags to set to false.
set_true A mask of flags to set to true.
void gnash::as_object::setRelay ( Relay p  )  [inline]

Set the as_object's Relay object.

This is a pointer to a native object that contains special type characteristics. Setting the Relay object allows native functions to get or set non-ActionScript properties. This function should only be used in native functions such as constructors and special creation functions like MovieClip.createTextField(). As Relay objects are not available to ActionScript, this should never appear in built-in functions. This function also removes Array typing from an object when a Relay is assigned. There are tests verifying this behaviour in actionscript.all and the swfdec testsuite.

Referenced by gnash::XMLNode_as::object().

const std::string & gnash::as_object::stringValue (  )  const [virtual]

Return the string representation for this object.

This is dependent on the VM version and the type of object, function, or class.

Reimplemented in gnash::abc::as_class, and gnash::as_function.

virtual as_function* gnash::as_object::to_function (  )  [inline, virtual]

Cast to a as_function, or return NULL.

Reimplemented in gnash::as_function.

Referenced by gnash::as_value::is_function(), and gnash::as_value::to_function().

bool gnash::as_object::unwatch ( const ObjectURI uri  ) 

Remove a watch trigger.

Parameters:
uri Property identifier.
Returns:
true if the trigger was successfully removed, false otherwise (no such trigger exists).
template<typename T >
void gnash::as_object::visitProperties ( AbstractPropertyVisitor visitor  )  const [inline]

Visit the properties of this object by key/as_value pairs.

The method will invoke the given visitor method with the identifier and value of the property. Note that this access values, which may change the object.

Parameters:
visitor The visitor function. Will be invoked for each property of this object with a string_table::key reference as first argument and a const as_value reference as second argument.

References gnash::key::T, and gnash::PropertyList::visitValues().

Referenced by gnash::ExternalInterface::arrayToXML(), and gnash::ExternalInterface::objectToXML().

VM& gnash::as_object::vm (  )  const [inline]

Return a reference to this as_object's global object.

Referenced by gnash::Function2::call(), gnash::AVM1Global::getVM(), and gnash::AVM1Global::registerClasses().

bool gnash::as_object::watch ( const ObjectURI uri,
as_function trig,
const as_value cust 
)

Add a watch trigger, overriding any other defined for same name.

Parameters:
uri property namespace.
trig A function to invoke when this property value is assigned to. The function will be called with old val, new val and the custom value below. Its return code will be used to set actual value
cust Custom value to always pass to the trigger as third arg
Returns:
true if the trigger was successfully added, false otherwise.

Member Data Documentation

const int gnash::as_object::DefaultFlags [static]
Initial value:

The most common flags for built-in properties.

Most API properties, including classes and objects, have these flags.

Referenced by gnash::registerBuiltinClass(), and gnash::registerBuiltinObject().


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