00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef KROSS_INTERPRETER_H
00021 #define KROSS_INTERPRETER_H
00022
00023 #include <QString>
00024 #include <QStringList>
00025 #include <QVariant>
00026 #include <QMap>
00027
00028 #include "errorinterface.h"
00029 #include <koffice_export.h>
00030
00031 namespace Kross {
00032
00033
00034 class Manager;
00035 class Action;
00036 class Script;
00037 class Interpreter;
00038
00044 class KROSSCORE_EXPORT InterpreterInfo
00045 {
00046 public:
00047
00052 class Option
00053 {
00054 public:
00055
00059 typedef QMap<QString, Option* > Map;
00060
00067 Option(const QString& comment, const QVariant& value)
00068 : comment(comment), value(value) {}
00069
00071 QString comment;
00072
00074 QVariant value;
00075 };
00076
00080 InterpreterInfo(const QString& interpretername, const QString& library, const QString& wildcard, QStringList mimetypes, Option::Map options);
00081
00085 ~InterpreterInfo();
00086
00090 const QString interpreterName() const;
00091
00098 const QString wildcard() const;
00099
00106 const QStringList mimeTypes() const;
00107
00111 bool hasOption(const QString& key) const;
00112
00116 Option* option(const QString name) const;
00117
00123 const QVariant optionValue(const QString name, QVariant defaultvalue = QVariant()) const;
00124
00128 Option::Map options();
00129
00134 Interpreter* interpreter();
00135
00136 private:
00138 class Private;
00140 Private* const d;
00141 };
00142
00152 class KROSSCORE_EXPORT Interpreter : public ErrorInterface
00153 {
00154 public:
00155
00162 Interpreter(InterpreterInfo* info);
00163
00167 virtual ~Interpreter();
00168
00173 InterpreterInfo* interpreterInfo() const;
00174
00183 virtual Script* createScript(Action* Action) = 0;
00184
00186 virtual void virtual_hook(int id, void* data);
00187
00188 private:
00190 class Private;
00192 Private* const d;
00193 };
00194
00195 }
00196
00197 #endif
00198