19 #ifndef GNASH_AS_OBJECT_H 20 #define GNASH_AS_OBJECT_H 31 #include <boost/noncopyable.hpp> 66 _propname(
std::move(propname)),
68 _customArg(
std::move(customArg)),
88 bool dead()
const {
return _dead; }
105 std::string _propname;
187 virtual std::string stringValue()
const;
229 bool ifFound =
false);
241 void init_member(
const std::string&
name,
const as_value& val,
242 int flags = DefaultFlags);
260 int flags = DefaultFlags);
283 void init_property(
const std::string& key,
as_function& getter,
361 bool init_destructive_property(
const ObjectURI& uri,
377 void init_readonly_property(
const std::string& key,
as_function& getter,
378 int flags = DefaultFlags);
393 void init_readonly_property(
const std::string& key,
435 virtual as_object* get_super(
const ObjectURI& fname);
436 as_object* get_super();
468 void set_member_flags(
const ObjectURI& uri,
int setTrue,
int setFalse = 0);
474 virtual bool isSuper()
const {
return false; }
486 void addInterface(as_object* ctor);
503 bool instanceOf(as_object* ctor);
512 bool prototypeOf(as_object& instance);
523 void setPropFlags(
const as_value& props,
int set_false,
int set_true);
530 void copyProperties(
const as_object&
o);
548 _members.visitValues<
T>(visitor);
573 void add_property(
const std::string& key,
as_function& getter,
582 as_object* get_prototype()
const;
588 void set_prototype(
const as_value& proto);
605 if (p) _array =
false;
606 if (_relay) _relay->clean();
639 return _displayObject;
659 explicit as_object(
VM& vm);
668 virtual void markReachableResources()
const;
689 template<
typename T>
class PrototypeRecursor;
710 std::unique_ptr<Relay> _relay;
722 std::vector<as_object*> _interfaces;
724 typedef std::map<ObjectURI, Trigger, ObjectURI::LessThan> TriggerContainer;
725 std::unique_ptr<TriggerContainer> _trigs;
789 return visible(prop, _version);
844 if (!o)
return nullptr;
877 if (!obj)
return false;
878 relay =
dynamic_cast<T*
>(obj->
relay());
930 #endif // GNASH_AS_OBJECT_H
bool test() const
Definition: PropFlags.h:94
Trigger(std::string propname, as_function &trig, as_value customArg)
Definition: as_object.h:63
void setReachable() const
Definition: as_object.cpp:1032
bool array() const
Return true if this object should be treated as an array.
Definition: as_object.h:625
Definition: GnashKey.h:150
Property * getOwnProperty(const ObjectURI &uri)
Get this object's own named property, if existing.
Definition: as_object.cpp:926
Protect from deletion.
Definition: PropFlags.h:39
SortedPropertyList enumerateProperties(as_object &obj)
Enumerate all non-hidden properties to the passed container.
Definition: as_object.cpp:1069
DisplayObject is the base class for all DisplayList objects.
Definition: DisplayObject.h:168
void clearProperties()
Drop all properties from this object.
Definition: as_object.h:533
ActionScript value type.
Definition: as_value.h:94
bool dead() const
True if this Trigger has been disposed of.
Definition: as_object.h:88
void sendEvent(as_object &o, const as_environment &env, const ObjectURI &name)
Send a system event.
Definition: as_object.cpp:1099
An abstract property.
Definition: Property.h:276
Global_as & getGlobal(const as_environment &env)
Definition: as_environment.cpp:651
virtual ~as_object()
The as_object dtor does nothing special.
Definition: as_object.h:174
uri
Definition: test.py:12
bool operator()(const Property &) const
Definition: as_object.h:799
Anonymous namespace for callbacks, local functions, event handlers etc.
Definition: dbus_ext.cpp:40
Exists()
Definition: as_object.h:798
std::string getURLEncodedVars(as_object &o)
Get url-encoded variables.
Definition: as_object.cpp:946
as_value(* as_c_function_ptr)(const fn_call &fn)
Definition: Property.h:34
Definition: GnashKey.h:149
bool isNativeType(const as_object *obj, T *&relay)
Check whether the object is an instance of a known type.
Definition: as_object.h:875
The base class for all ActionScript objects.
Definition: as_object.h:161
IsVisible(int version)
Definition: as_object.h:787
Definition: GnashKey.h:161
VM & vm() const
Return a reference to this as_object's global object.
Definition: as_object.h:205
as_value call(const as_value &oldval, const as_value &newval, as_object &this_obj)
Call the trigger.
Definition: as_object.cpp:1039
DisplayObject * displayObject() const
Return the DisplayObject associated with this object.
Definition: as_object.h:638
as_value getOwnProperty(as_object &o, const ObjectURI &uri)
Get an own member of an object.
Definition: as_object.h:777
A general use string table.
Definition: string_table.h:41
A URI for describing as_objects.
Definition: ObjectURI.h:44
as_value getMember(as_object &o, const ObjectURI &uri)
Get a member of an object using AS lookup rules.
Definition: as_object.h:756
bool operator()(const Property &p) const
Definition: as_object.h:808
Provides information about timeline context.
Definition: as_environment.h:50
as_object * getObjectWithPrototype(Global_as &gl, const ObjectURI &c)
Definition: as_object.cpp:1109
VM & getVM(const as_environment &env)
Definition: as_environment.h:222
An abstract property visitor.
Definition: PropertyList.h:49
virtual as_function * to_function()
Cast to a as_function, or return NULL.
Definition: as_object.h:471
bool visible(const Property &prop, int version)
Is this member supposed to be visible by a VM of given version ?
Definition: Property.h:423
Class to group together per-run and external resources for Gnash.
Definition: RunResources.h:53
void setDisplayObject(DisplayObject *d)
Set the DisplayObject associated with this as_object.
Definition: as_object.h:643
A trigger that can be associated with a property name.
Definition: as_object.h:59
void setArray(bool array=true)
Set whether this object should be treated as an array.
Definition: as_object.h:630
Relay * relay() const
Access the as_object's Relay object.
Definition: as_object.h:620
void visitProperties(PropertyVisitor &visitor) const
Visit the properties of this object by key/as_value pairs.
Definition: as_object.h:547
DSOTEXPORT as_value getValue(const as_object &this_ptr) const
Get value of this property.
Definition: Property.cpp:98
Definition: as_object.h:804
std::vector< std::pair< ObjectURI, as_value > > SortedPropertyList
This is used to hold an intermediate copy of an as_object's properties.
Definition: as_object.h:887
void setRelay(Relay *p)
Set the as_object's Relay object.
Definition: as_object.h:604
virtual bool isSuper() const
Return true if this is a 'super' object.
Definition: as_object.h:474
#define DSOEXPORT
Definition: dsodefs.h:55
void kill()
Definition: as_object.h:90
int getSWFVersion(const as_environment &env)
Definition: as_environment.cpp:657
The Global object ultimately contains all objects in an ActionScript run.
Definition: Global_as.h:49
bool operator()(const Property &prop) const
Definition: as_object.h:788
string_table & getStringTable(const as_environment &env)
Definition: as_environment.cpp:639
The AVM1 virtual machine.
Definition: VM.h:71
Definition: GnashKey.h:132
bool caseless(const as_object &o)
Return whether property matching is caseless.
Definition: as_object.h:924
Definition: GnashKey.h:162
Set of properties associated with an ActionScript object.
Definition: PropertyList.h:81
const RunResources & getRunResources(const as_object &o)
Get the RunResources from an as_object.
Definition: as_object.cpp:1142
This is the base class for type-specific object data.
Definition: Relay.h:49
#define DSOTEXPORT
Definition: dsodefs.h:63
Function objects for visiting properties.
Definition: as_object.h:784
virtual bool get_member(const ObjectURI &uri, as_value *val)
Get a property by name if it exists.
Definition: as_object.cpp:378
const PropFlags & getFlags() const
accessor to the properties flags
Definition: Property.h:322
Definition: as_object.h:795
bool hasOwnProperty(as_object &o, const ObjectURI &uri)
Return true if this object has the named property.
Definition: as_object.h:854
Collectable resource.
Definition: GC.h:74
Parameters/environment for builtin or user-defined functions callable from ActionScript.
Definition: fn_call.h:117
as_object * getPathElement(as_object &o, const ObjectURI &uri)
Resolve the given relative path component.
Definition: as_object.cpp:1089
IsEnumerable()
Definition: as_object.h:807
An abstract key visitor.
Definition: PropertyList.h:58
std::string name
Definition: LocalConnection_as.cpp:149
ActionScript Function, either builtin or SWF-defined.
Definition: as_function.h:62
movie_root & getRoot(const as_environment &env)
Definition: as_environment.cpp:645
Protect from enumeration.
Definition: PropFlags.h:36
This class represents the 'Stage' and top-level movie.
Definition: movie_root.h:150