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 //
128 as_object* constructInstance(as_function& ctor, const as_environment& env,
129  FunctionArgs<as_value>& args);
130 
131 } // gnash namespace
132 
133 #endif
134