Gnash  0.8.10
as_function.h
Go to the documentation of this file.
00001 // 
00002 //   Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
00003 //   Free Software Foundation, Inc
00004 // 
00005 // This program is free software; you can redistribute it and/or modify
00006 // it under the terms of the GNU General Public License as published by
00007 // the Free Software Foundation; either version 3 of the License, or
00008 // (at your option) any later version.
00009 // 
00010 // This program is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 // GNU General Public License for more details.
00014 // 
00015 // You should have received a copy of the GNU General Public License
00016 // along with this program; if not, write to the Free Software
00017 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00018 
00019 #ifndef GNASH_AS_FUNCTION_H
00020 #define GNASH_AS_FUNCTION_H
00021 
00022 #include <string>
00023 
00024 #include "as_object.h"
00025 
00026 // Forward declarations
00027 namespace gnash {
00028     class NativeFunction;
00029     class Global_as;
00030     template <typename T> class FunctionArgs;
00031 }
00032 
00033 namespace gnash {
00034 
00036 //
00062 class as_function : public as_object
00063 {
00064 public:
00065 
00067         virtual ~as_function() {}
00068 
00070         virtual as_function* to_function() { return this; }
00071 
00073     //
00076         virtual as_value call(const fn_call& fn) = 0;
00077 
00079     //
00081     virtual std::string stringValue() const;
00082 
00084     //
00087     //
00092     //
00103     as_object* construct(as_object& newobj, const as_environment& env,
00104             FunctionArgs<as_value>& args);
00105 
00107         virtual bool isBuiltin() { return false; }
00108 
00109 protected:
00110         
00112         as_function(Global_as& gl);
00113 
00114 };
00115 
00116 
00118 //
00122 //
00128 as_object* constructInstance(as_function& ctor, const as_environment& env,
00129         FunctionArgs<as_value>& args);
00130 
00131 } // gnash namespace
00132 
00133 #endif
00134