lib
interpreter.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef KROSS_API_INTERPRETER_H
00021 #define KROSS_API_INTERPRETER_H
00022
00023 #include <qstring.h>
00024 #include <qmap.h>
00025 #include <kdebug.h>
00026
00027 #include "object.h"
00028
00029 namespace Kross { namespace Api {
00030
00031
00032 class Manager;
00033 class ScriptContainer;
00034 class Script;
00035 class Interpreter;
00036
00042 class InterpreterInfo
00043 {
00044 public:
00045
00050 class Option
00051 {
00052 public:
00053
00057 typedef QMap<QString, Option*> Map;
00058
00067 Option(const QString& name, const QString& comment, const QVariant& value)
00068 : name(name), comment(comment), value(value) {}
00069
00071 QString name;
00072
00074 QString comment;
00075
00077 QVariant value;
00078 };
00079
00083 InterpreterInfo(const QString& interpretername, const QString& library, const QString& wildcard, QStringList mimetypes, Option::Map options);
00084
00088 ~InterpreterInfo();
00089
00093 const QString& getInterpretername();
00094
00101 const QString& getWildcard();
00102
00109 const QStringList getMimeTypes();
00110
00114 bool hasOption(const QString& key);
00115
00119 Option* getOption(const QString name);
00120
00126 const QVariant& getOptionValue(const QString name, QVariant defaultvalue = QVariant());
00127
00131 Option::Map getOptions();
00132
00137 Interpreter* getInterpreter();
00138
00139 private:
00141 QString m_interpretername;
00143 QString m_library;
00145 QString m_wildcard;
00147 QStringList m_mimetypes;
00149 Option::Map m_options;
00151 Interpreter* m_interpreter;
00152 };
00153
00163 class Interpreter
00164 {
00165 public:
00166
00173 Interpreter(InterpreterInfo* info);
00174
00178 virtual ~Interpreter();
00179
00188 virtual Script* createScript(ScriptContainer* scriptcontainer) = 0;
00189
00190 protected:
00192 InterpreterInfo* m_interpreterinfo;
00193 };
00194
00195 }}
00196
00197 #endif
00198
|