lib

script.h

00001 /***************************************************************************
00002  * script.h
00003  * This file is part of the KDE project
00004  * copyright (C)2004-2005 by Sebastian Sauer (mail@dipe.org)
00005  *
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Library 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  * 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 GNU
00013  * Library General Public License for more details.
00014  * You should have received a copy of the GNU Library General Public License
00015  * along with this program; see the file COPYING.  If not, write to
00016  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017  * Boston, MA 02110-1301, USA.
00018  ***************************************************************************/
00019 
00020 #ifndef KROSS_API_SCRIPT_H
00021 #define KROSS_API_SCRIPT_H
00022 
00023 #include <qstring.h>
00024 #include <qstringlist.h>
00025 
00026 #include "class.h"
00027 
00028 namespace Kross { namespace Api {
00029 
00030     // Forward declarations.
00031     class Object;
00032     class Interpreter;
00033     class ScriptContainer;
00034     class List;
00035     class Exception;
00036 
00045     class Script
00046     {
00047         public:
00048 
00057             Script(Interpreter* const interpreter, ScriptContainer* const scriptcontainer);
00058 
00062             virtual ~Script();
00063 
00068             bool hadException();
00069 
00073             Exception::Ptr getException();
00074 
00080             void setException(Exception::Ptr e);
00081 
00086             void clearException();
00087 
00094             virtual Kross::Api::Object::Ptr execute() = 0;
00095 
00100             virtual const QStringList& getFunctionNames() = 0;
00101 
00110             virtual Kross::Api::Object::Ptr callFunction(const QString& name, Kross::Api::List::Ptr args) = 0;
00111 
00115             virtual const QStringList& getClassNames() = 0;
00116 
00124             virtual Kross::Api::Object::Ptr classInstance(const QString& name) = 0;
00125 
00126         protected:
00128             Interpreter* const m_interpreter;
00130             ScriptContainer* const m_scriptcontainer;
00131 
00132         private:
00134             Exception::Ptr m_exception;
00135     };
00136 
00137 }}
00138 
00139 #endif
00140 
KDE Home | KDE Accessibility Home | Description of Access Keys