lib

scriptcontainer.h

00001 /***************************************************************************
00002  * scriptcontainer.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_SCRIPTCONTAINER_H
00021 #define KROSS_API_SCRIPTCONTAINER_H
00022 
00023 #include "mainmodule.h"
00024 
00025 #include <qstring.h>
00026 #include <qvariant.h>
00027 #include <qobject.h>
00028 //#include <kdebug.h>
00029 #include <ksharedptr.h>
00030 
00031 namespace Kross { namespace Api {
00032 
00033     // Forward declarations.
00034     class Object;
00035     class List;
00036     class ScriptContainerPrivate;
00037 
00051     class ScriptContainer : public MainModule
00052     {
00053             // We protected the constructor cause ScriptContainer
00054             // instances should be created only within the
00055             // Manager::getScriptContainer() method.
00056             friend class Manager;
00057 
00058         protected:
00059 
00071             explicit ScriptContainer(const QString& name = QString::null);
00072 
00073         public:
00074 
00076             typedef KSharedPtr<ScriptContainer> Ptr;
00077 
00081             virtual ~ScriptContainer();
00082 
00087             const QString& getName() const;
00088 
00092             void setName(const QString& name);
00093 
00097             const QString& getCode() const;
00098 
00102             void setCode(const QString& code);
00103 
00108             const QString& getInterpreterName() const;
00109 
00114             void setInterpreterName(const QString& interpretername);
00115 
00120             const QString& getFile() const;
00121 
00129             void setFile(const QString& scriptfile);
00130 
00136             QMap<QString, QVariant>& getOptions();
00137 
00147             const QVariant& getOption(const QString name, QVariant defaultvalue = QVariant(), bool recursive = false);
00148 
00152             bool setOption(const QString name, const QVariant& value);
00153 
00157             Object::Ptr execute();
00158 
00163             const QStringList getFunctionNames();
00164 
00175             KSharedPtr<Object> callFunction(const QString& functionname, KSharedPtr<List> arguments = 0);
00176 
00180             const QStringList getClassNames();
00181 
00185             KSharedPtr<Object> classInstance(const QString& classname);
00186 
00193             bool initialize();
00194 
00201             void finalize();
00202 
00203         private:
00205             ScriptContainerPrivate* d;
00206     };
00207 
00208 }}
00209 
00210 #endif
00211 
KDE Home | KDE Accessibility Home | Description of Access Keys