F:/KPlato/koffice/libs/kross/core/interpreter.h

Aller à la documentation de ce fichier.
00001 /***************************************************************************
00002  * interpreter.h
00003  * This file is part of the KDE project
00004  * copyright (C)2004-2006 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_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     // Forward declaration.
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 

Généré le Wed Nov 22 23:41:11 2006 pour KPlato par  doxygen 1.5.1-p1