Go to the documentation of this file.
19 #ifndef GNASH_AS_METHOD_H
20 #define GNASH_AS_METHOD_H
74 _maxRegisters = maxRegisters;
109 _traits.push_back(
t);
121 bool hasBody()
const {
return _body != NULL; }
129 return _needsActivation;
133 _needsActivation =
true;
155 std::uint32_t slotID,
Method *method);
182 bool isFinal()
const {
return _flags & FLAGS_FINAL; }
194 bool isPrivate()
const {
return _flags & FLAGS_PRIVATE; }
199 _flags = (_flags & ~(FLAGS_PUBLIC | FLAGS_PROTECTED)) | FLAGS_PRIVATE;
205 return _flags & FLAGS_PROTECTED;
211 _flags = (_flags & ~(FLAGS_PUBLIC | FLAGS_PRIVATE)) | FLAGS_PROTECTED; }
214 bool isPublic()
const {
return _flags & FLAGS_PUBLIC; }
218 _flags = (_flags & ~(FLAGS_PRIVATE | FLAGS_PROTECTED)) | FLAGS_PUBLIC;
266 FLAGS_PROTECTED = 0x02,
272 typedef std::map<string_table::key, asBinding> BindingContainer;
276 std::vector<Trait> _traits;
278 std::uint32_t _methodID;
280 abc_function* _prototype;
283 std::uint32_t _bodyLength;
286 std::list<as_value> _optionalArguments;
288 unsigned char _flags;
290 std::uint32_t _maxRegisters;
292 std::uint32_t _scopeDepth;
293 std::uint32_t _maxScope;
294 std::uint32_t _maxStack;
296 bool _needsActivation;
string_table::key getURI() const
What is the Uri of the namespace?
Definition: Namespace.h:76
Class describing a static property.
Definition: AbcBlock.h:72
std::uint32_t methodID() const
Definition: Method.h:61
std::string name
Definition: LocalConnection_as.cpp:149
void setScopeDepth(std::uint32_t depth)
Definition: Method.h:97
void setPrivate()
Make the method private.
Definition: Method.h:198
The base class for all ActionScript objects.
Definition: as_object.h:162
bool addMethod(string_table::key name, Namespace *ns, Method *method)
Definition: Method.cpp:196
bool addValue(string_table::key name, Namespace *ns, std::uint32_t slotID, Class *type, as_value &val, bool isconst)
Definition: Method.cpp:95
std::uint8_t read_as3op()
Read an opcode for ActionScript 3.
Definition: CodeStream.cpp:54
void log_debug(StringType msg, Args... args)
Definition: log.h:301
Represent an ActionScript Namespace.
Definition: Namespace.h:49
std::int32_t y
Definition: BitmapData_as.cpp:435
@ i
Definition: GnashKey.h:155
bool isPublic() const
Is the method public?
Definition: Method.h:214
void setOwner(Class *s)
Set the owner of this method.
Definition: Method.cpp:72
bool needsActivation() const
Definition: Method.h:128
@ CLASS_FUNCTION
Definition: namedStrings.h:216
#define _(String)
Definition: log.h:44
void addTrait(const Trait &t)
Add a Trait to this Method.
Definition: Method.h:108
void init_member(const std::string &name, const as_value &val, int flags=DefaultFlags)
Initialize a member value by string.
Definition: as_object.cpp:669
Anonymous namespace for callbacks, local functions, event handlers etc.
Definition: dbus_ext.cpp:41
@ g
Definition: GnashKey.h:153
bool isPrivate() const
Is the method private?
Definition: Method.h:194
@ dontEnum
Protect from enumeration.
Definition: PropFlags.h:36
@ dontDelete
Protect from deletion.
Definition: PropFlags.h:39
@ m
Definition: GnashKey.h:159
@ s
Definition: GnashKey.h:165
std::list< Class * > ArgumentList
Definition: Method.h:57
void init_property(const std::string &key, as_function &getter, as_function &setter, int flags=DefaultFlags)
Initialize a getter/setter property by name.
Definition: as_object.cpp:690
std::uint32_t getBodyLength()
Definition: Method.h:77
The ActionScript bytecode of a single ABC tag in a SWF.
Definition: AbcBlock.h:209
void log_error(StringType msg, Args... args)
Definition: log.h:283
std::uint32_t getMaxRegisters()
Definition: Method.h:71
void setMaxStack(std::uint32_t max)
Definition: Method.h:81
Property asBinding
Definition: Method.h:48
std::uint32_t maxStack() const
Definition: Method.h:85
#define CLOCK_REALTIME
Definition: getclocktime.hpp:44
@ t
Definition: GnashKey.h:166
void pushOptional(const as_value &v)
Push an optional argument's default value.
Definition: Method.h:239
bool addSlotFunction(string_table::key name, Namespace *ns, std::uint32_t slotID, Method *method)
Definition: Method.cpp:180
asBinding * getBinding(string_table::key name)
void for_each(C &container, R(T::*pmf)(const A &), const A &arg)
Definition: Renderer_ogl.cpp:690
bool finalize(AbcBlock *block, abc::Class *cl, bool do_static)
Definition: AbcBlock.cpp:42
void setMaxArgumentCount(int i)
Set the required maximum arguments.
Definition: Method.h:231
@ a
Definition: GnashKey.h:147
as_object * getPrototype()
Necessary for the current bogus implementation.
Definition: Class.h:256
as_function * getImplementation()
Get an object capable of executing this function. Note: This may be NULL, because we might have infor...
Definition: Method.h:255
Method()
Definition: Method.cpp:36
type
Definition: GnashKey.h:330
void setProtected()
Make the method protected.
Definition: Method.h:210
bool isNative()
Definition: Method.h:120
void pushArgument(Class *t)
Push an argument of type t into the method definition.
Definition: Method.h:236
bool optionalArguments() const
Are any of the arguments optional?
Definition: Method.h:242
T * get(as_object *o)
Extract the DisplayObject attached to an object.
Definition: as_object.h:842
@ length
Definition: klash_part.cpp:329
Definition: CodeStream.h:41
void initTraits(AbcBlock &bl)
Initialize Traits. This is bogus.
Definition: Method.cpp:82
An abstract property.
Definition: Property.h:277
The virtual machine for executing ABC (ActionScript Bytecode).
Definition: Machine.h:74
A class to represent AS3 Classes.
Definition: Class.h:76
void unsetFinal()
Unset the method as final. Not final anymore.
Definition: Method.h:190
as_object * to_object(VM &vm) const
Return value as an object, converting primitive values as needed.
Definition: as_value.cpp:453
@ _1
Definition: GnashKey.h:95
ActionScript value type.
Definition: as_value.h:95
bool addMemberScript(string_table::key name, Namespace *ns, std::uint32_t slotID, Class *type)
Definition: Method.cpp:162
void seekTo(unsigned int set)
Set the current position to an absolute value (relative to the start)
Definition: CodeStream.cpp:75
void setFinal()
Set the method as final.
Definition: Method.h:186
void log_parse(StringType msg, Args... args)
Definition: log.h:313
bool addGetter(string_table::key name, Namespace *ns, Method *method)
Definition: Method.cpp:122
void setPublic()
Make the method public.
Definition: Method.h:217
std::uint32_t scopeDepth() const
Definition: Method.h:101
bool isFinal() const
Is the method final? If so, it may not be overridden.
Definition: Method.h:182
as_object * construct(as_object *)
Definition: Method.h:123
ABC-defined Function.
Definition: abc_function.h:41
void setMaxScope(std::uint32_t max)
Definition: Method.h:89
static RcInitFile & getDefaultInstance()
Return the default instance of RC file.
Definition: rc.cpp:61
The Global object ultimately contains all objects in an ActionScript run.
Definition: Global_as.h:50
virtual bool set_member(const ObjectURI &uri, const as_value &val, bool ifFound=false)
Set a member value.
Definition: as_object.cpp:583
uri
Definition: test.py:12
const ArgumentList & getArgumentList() const
Get a reference to a list of argument types.
Definition: Method.h:249
bool addSetter(string_table::key name, Namespace *ns, Method *method)
Definition: Method.cpp:142
@ INTERNAL_TYPE
Definition: namedStrings.h:276
void setMinArgumentCount(int i)
Set the required minimum arguments.
Definition: Method.h:225
void setBody(CodeStream *b)
Definition: Method.h:137
void setBodyLength(std::uint32_t length)
Definition: Method.h:79
std::size_t key
Definition: string_table.h:83
void setReturnType(Class *t)
Set the return type.
Definition: Method.cpp:89
bool addSlot(string_table::key name, Namespace *ns, std::uint32_t slotID, Class *type)
Definition: Method.cpp:169
std::uint32_t maxScope() const
Definition: Method.h:93
int maxArgumentCount() const
How many arguments are allowed? -1 means unknown.
Definition: Method.h:228
bool hasBody() const
Definition: Method.h:121
@ readOnly
Protect from assigning a value.
Definition: PropFlags.h:42
void initPrototype(Machine *machine)
Definition: Method.cpp:190
@ PROP_PROTOTYPE
Definition: namedStrings.h:87
A URI for describing as_objects.
Definition: ObjectURI.h:45
bool is_object() const
Return true if this value is an object.
Definition: as_value.h:219
void setMethodID(std::uint32_t m)
Definition: Method.h:65
std::int32_t x
Definition: BitmapData_as.cpp:434
@ b
Definition: GnashKey.h:148
void setNeedsActivation()
Definition: Method.h:132
CodeStream * getBody()
Definition: Method.h:136
Class * getReturnType() const
Get the unique identifier for the return type. 0 is 'anything'. (This is the value of any dynamic pro...
void print_body()
Print the opcodes that define a method using log_parse.
Definition: Method.cpp:56
bool isProtected() const
Is the method protected?
Definition: Method.h:204
void setMaxRegisters(std::uint32_t maxRegisters)
Definition: Method.h:73
abc_function * getPrototype()
Definition: Method.h:105
int minArgumentCount() const
How many arguments are required? -1 means unknown.
Definition: Method.h:222
ActionScript Function, either builtin or SWF-defined.
Definition: as_function.h:63
Property * getOwnProperty(const ObjectURI &uri)
Get this object's own named property, if existing.
Definition: as_object.cpp:926