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 
virtual as_value call(const fn_call &fn)=0
Function dispatch.
ActionScript value type.
Definition: as_value.h:94
virtual as_function * to_function()
Return this as_object as an as_function.
Definition: as_function.h:70
Anonymous namespace for callbacks, local functions, event handlers etc.
Definition: dbus_ext.cpp:40
as_function(Global_as &gl)
Construct a function.
Definition: as_function.cpp:34
The base class for all ActionScript objects.
Definition: as_object.h:161
virtual std::string stringValue() const
Return the string value of this as_object subclass.
Definition: as_function.cpp:41
Provides information about timeline context.
Definition: as_environment.h:50
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
virtual bool isBuiltin()
Return true if this is a built-in class.
Definition: as_function.h:107
A class to contain transferable arguments for a fn_call.
Definition: as_function.h:30
as_object * constructInstance(as_function &ctor, const as_environment &env, fn_call::Args &args)
Definition: as_function.cpp:47
virtual ~as_function()
Destructor.
Definition: as_function.h:67
The Global object ultimately contains all objects in an ActionScript run.
Definition: Global_as.h:49
Parameters/environment for builtin or user-defined functions callable from ActionScript.
Definition: fn_call.h:117
ActionScript Function, either builtin or SWF-defined.
Definition: as_function.h:62