Gnash  0.8.11dev
as_function.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
3 // Free Software Foundation, Inc
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 
19 #ifndef GNASH_AS_FUNCTION_H
20 #define GNASH_AS_FUNCTION_H
21 
22 #include <string>
23 
24 #include "as_object.h"
25 
26 // Forward declarations
27 namespace gnash {
28  class NativeFunction;
29  class Global_as;
30  template <typename T> class FunctionArgs;
31 }
32 
33 namespace gnash {
34 
36 //
62 class as_function : public as_object
63 {
64 public:
65 
67  virtual ~as_function() {}
68 
70  virtual as_function* to_function() { return this; }
71 
73  //
76  virtual as_value call(const fn_call& fn) = 0;
77 
79  //
81  virtual std::string stringValue() const;
82 
84  //
87  //
92  //
103  as_object* construct(as_object& newobj, const as_environment& env,
104  FunctionArgs<as_value>& args);
105 
107  virtual bool isBuiltin() { return false; }
108 
109 protected:
110 
112  as_function(Global_as& gl);
113 
114 };
115 
116 
118 //
122 //
129  FunctionArgs<as_value>& args);
130 
131 } // gnash namespace
132 
133 #endif
134 
gnash::as_function::stringValue
virtual std::string stringValue() const
Return the string value of this as_object subclass.
Definition: as_function.cpp:41
gnash::as_object
The base class for all ActionScript objects.
Definition: as_object.h:162
as_object.h
gnash::GnashException
Top-level gnash exception.
Definition: GnashException.h:31
gnash::toObject
as_object * toObject(const as_value &v, VM &vm)
Convert an as_value to an object.
Definition: VM.cpp:457
gnash::as_function::~as_function
virtual ~as_function()
Destructor.
Definition: as_function.h:67
gnash::as_object::set_prototype
void set_prototype(const as_value &proto)
Set this object's proto member.
Definition: as_object.cpp:518
_
#define _(String)
Definition: log.h:44
gnash::as_environment
Provides information about timeline context.
Definition: as_environment.h:51
gnash::as_object::init_member
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
gnash::as_function::as_function
as_function(Global_as &gl)
Construct a function.
Definition: as_function.cpp:34
gnash
Anonymous namespace for callbacks, local functions, event handlers etc.
Definition: dbus_ext.cpp:41
gnash::PropFlags::dontEnum
@ dontEnum
Protect from enumeration.
Definition: PropFlags.h:36
as_value.h
Global_as.h
gnash::getGlobal
Global_as & getGlobal(const as_environment &env)
Definition: as_environment.cpp:651
gnash::NSV::PROP_CONSTRUCTOR
@ PROP_CONSTRUCTOR
Definition: namedStrings.h:68
gnash::getVM
VM & getVM(const as_environment &env)
Definition: as_environment.h:222
as_function.h
gnash::log_error
void log_error(StringType msg, Args... args)
Definition: log.h:283
gnash::fn_call
Parameters/environment for builtin or user-defined functions callable from ActionScript.
Definition: fn_call.h:118
gnash::NSV::PROP_uuCONSTRUCTORuu
@ PROP_uuCONSTRUCTORuu
Definition: namedStrings.h:117
gnash::FunctionArgs
A class to contain transferable arguments for a fn_call.
Definition: fn_call.h:57
gnash::constructInstance
as_object * constructInstance(as_function &ctor, const as_environment &env, fn_call::Args &args)
Definition: as_function.cpp:47
gnash::Property
An abstract property.
Definition: Property.h:277
gnash::Property::getValue
DSOTEXPORT as_value getValue(const as_object &this_ptr) const
Get value of this property.
Definition: Property.cpp:98
gnash::as_value
ActionScript value type.
Definition: as_value.h:95
gnash::as_function::call
virtual as_value call(const fn_call &fn)=0
Function dispatch.
gnash::as_function::isBuiltin
virtual bool isBuiltin()
Return true if this is a built-in class.
Definition: as_function.h:107
log.h
fn_call.h
gnash::PropFlags::onlySWF6Up
@ onlySWF6Up
Only visible by VM initialized for version 6 or higher.
Definition: PropFlags.h:45
namedStrings.h
gnash::Global_as
The Global object ultimately contains all objects in an ActionScript run.
Definition: Global_as.h:50
gnash::getSWFVersion
int getSWFVersion(const as_environment &env)
Definition: as_environment.cpp:657
gnash::as_function::to_function
virtual as_function * to_function()
Return this as_object as an as_function.
Definition: as_function.h:70
gnash::as_function::construct
as_object * construct(as_object &newobj, const as_environment &env, FunctionArgs< as_value > &args)
Run this function as a constructor on an object.
Definition: as_function.cpp:64
gnash::NSV::PROP_PROTOTYPE
@ PROP_PROTOTYPE
Definition: namedStrings.h:87
gnash::as_value::is_object
bool is_object() const
Return true if this value is an object.
Definition: as_value.h:219
GnashException.h
gnash::as_function
ActionScript Function, either builtin or SWF-defined.
Definition: as_function.h:63
gnash::as_object::getOwnProperty
Property * getOwnProperty(const ObjectURI &uri)
Get this object's own named property, if existing.
Definition: as_object.cpp:926