lib

interpreter.h

00001 /***************************************************************************
00002  * interpreter.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_INTERPRETER_H
00021 #define KROSS_API_INTERPRETER_H
00022 
00023 #include <qstring.h>
00024 #include <qmap.h>
00025 
00026 #include "object.h"
00027 
00028 namespace Kross { namespace Api {
00029 
00030     // Forward declaration.
00031     class Manager;
00032     class ScriptContainer;
00033     class Script;
00034     class Interpreter;
00035 
00041     class InterpreterInfo
00042     {
00043         public:
00044 
00049             class Option
00050             {
00051                 public:
00052 
00056                     typedef QMap<QString, Option*> Map;
00057 
00066                     Option(const QString& name, const QString& comment, const QVariant& value)
00067                         : name(name), comment(comment), value(value) {}
00068 
00070                     QString name;
00071 
00073                     QString comment;
00074 
00076                     QVariant value;
00077             };
00078 
00082             InterpreterInfo(const QString& interpretername, const QString& library, const QString& wildcard, QStringList mimetypes, Option::Map options);
00083 
00087             ~InterpreterInfo();
00088 
00092             const QString getInterpretername();
00093 
00100             const QString getWildcard();
00101 
00108             const QStringList getMimeTypes();
00109 
00113             bool hasOption(const QString& key);
00114 
00118             Option* getOption(const QString name);
00119 
00125             const QVariant getOptionValue(const QString name, QVariant defaultvalue = QVariant());
00126 
00130             Option::Map getOptions();
00131 
00136             Interpreter* getInterpreter();
00137 
00138         private:
00140             QString m_interpretername;
00142             QString m_library;
00144             QString m_wildcard;
00146             QStringList m_mimetypes;
00148             Option::Map m_options;
00150             Interpreter* m_interpreter;
00151     };
00152 
00162     class Interpreter
00163     {
00164         public:
00165 
00172             Interpreter(InterpreterInfo* info);
00173 
00177             virtual ~Interpreter();
00178 
00187             virtual Script* createScript(ScriptContainer* scriptcontainer) = 0;
00188 
00189         protected:
00191             InterpreterInfo* m_interpreterinfo;
00192     };
00193 
00194 }}
00195 
00196 #endif
00197 
KDE Home | KDE Accessibility Home | Description of Access Keys