function_object.h

00001 // -*- c-basic-offset: 2 -*-
00002 /*
00003  *  This file is part of the KDE libraries
00004  *  Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
00005  *
00006  *  This library is free software; you can redistribute it and/or
00007  *  modify it under the terms of the GNU Lesser General Public
00008  *  License as published by the Free Software Foundation; either
00009  *  version 2 of the License, or (at your option) any later version.
00010  *
00011  *  This library is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  *  Lesser General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU Lesser General Public
00017  *  License along with this library; if not, write to the Free Software
00018  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00019  *
00020  */
00021 
00022 #ifndef _FUNCTION_OBJECT_H_
00023 #define _FUNCTION_OBJECT_H_
00024 
00025 #include "internal.h"
00026 #include "object_object.h"
00027 #include "function.h"
00028 
00029 namespace KJS {
00030 
00035   class FunctionPrototypeImp : public InternalFunctionImp {
00036   public:
00037     FunctionPrototypeImp(ExecState *exec);
00038     virtual ~FunctionPrototypeImp();
00039 
00040     virtual bool implementsCall() const;
00041     virtual Value call(ExecState *exec, Object &thisObj, const List &args);
00042   };
00043 
00050   class FunctionProtoFuncImp : public InternalFunctionImp {
00051   public:
00052     FunctionProtoFuncImp(ExecState *exec,
00053                         FunctionPrototypeImp *funcProto, int i, int len, const Identifier &_ident);
00054 
00055     virtual bool implementsCall() const;
00056     virtual Value call(ExecState *exec, Object &thisObj, const List &args);
00057 
00058     enum { ToString, Apply, Call };
00059   private:
00060     int id;
00061   };
00062 
00068   class FunctionObjectImp : public InternalFunctionImp {
00069   public:
00070     FunctionObjectImp(ExecState *exec, FunctionPrototypeImp *funcProto);
00071     virtual ~FunctionObjectImp();
00072 
00073     virtual bool implementsConstruct() const;
00074     virtual Object construct(ExecState *exec, const List &args);
00075     virtual bool implementsCall() const;
00076     virtual Value call(ExecState *exec, Object &thisObj, const List &args);
00077   };
00078 
00079 } // namespace
00080 
00081 #endif // _FUNCTION_OBJECT_H_
KDE Home | KDE Accessibility Home | Description of Access Keys