Kross
manager.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef KROSS_MANAGER_H
00021 #define KROSS_MANAGER_H
00022
00023 #include <QtCore/QStringList>
00024 #include <QtCore/QMap>
00025 #include <QtCore/QObject>
00026 #include <QtCore/QUrl>
00027 #include <QtScript/QScriptable>
00028
00029 #include "krossconfig.h"
00030 #include "childreninterface.h"
00031 #include "metatype.h"
00032
00033 namespace Kross {
00034
00035
00036 class Interpreter;
00037 class Action;
00038 class ActionCollection;
00039 class InterpreterInfo;
00040
00049 class KROSSCORE_EXPORT Manager
00050 : public QObject
00051 , public QScriptable
00052 , public ChildrenInterface
00053 {
00054 Q_OBJECT
00055
00056 public:
00057
00062 static Manager& self();
00063
00068 QHash<QString, InterpreterInfo*> interpreterInfos() const;
00069
00074 bool hasInterpreterInfo(const QString& interpretername) const;
00075
00081 InterpreterInfo* interpreterInfo(const QString& interpretername) const;
00082
00093 const QString interpreternameForFile(const QString& file);
00094
00104 Interpreter* interpreter(const QString& interpretername) const;
00105
00111 ActionCollection* actionCollection() const;
00112
00119 MetaTypeHandler* metaTypeHandler(const QByteArray& typeName) const;
00120
00132 void registerMetaTypeHandler(const QByteArray& typeName, MetaTypeHandler::FunctionPtr* handler);
00133
00145 void registerMetaTypeHandler(const QByteArray& typeName, MetaTypeHandler::FunctionPtr2* handler);
00146
00158 void registerMetaTypeHandler(const QByteArray& typeName, MetaTypeHandler* handler);
00159
00165 bool strictTypesEnabled() const;
00166
00177 void setStrictTypesEnabled(bool enabled);
00178
00182 bool hasHandlerAssigned(const QByteArray& typeName) const;
00183 public Q_SLOTS:
00184
00190 QStringList interpreters() const;
00191
00197 bool hasAction(const QString& name);
00198
00204 QObject* action(const QString& name);
00205
00215 QObject* module(const QString& modulename);
00216
00221 bool executeScriptFile(const QUrl& file = QUrl());
00222
00223 void addQObject(QObject* obj, const QString &name = QString());
00224 QObject* qobject(const QString &name) const;
00225 QStringList qobjectNames() const;
00226
00227 Q_SIGNALS:
00228
00232 void started(Kross::Action*);
00233
00237 void finished(Kross::Action*);
00238
00239 private:
00241 class Private;
00243 Private* const d;
00244
00245 public:
00246
00251 explicit Manager();
00252
00256 virtual ~Manager();
00257 };
00258
00259 }
00260
00261 Q_DECLARE_METATYPE(Kross::Manager*)
00262
00263 #endif
00264