Kross::Manager

#include <manager.h>

Inheritance diagram for Kross::Manager:

Signals

void finished (Kross::Action *)
 
void started (Kross::Action *)
 

Public Slots

QObjectaction (const QString &name)
 
void addQObject (QObject *obj, const QString &name=QString())
 
void deleteModules ()
 
bool executeScriptFile (const QUrl &file=QUrl())
 
bool hasAction (const QString &name)
 
QStringList interpreters () const
 
QObjectmodule (const QString &modulename)
 
QObjectqobject (const QString &name) const
 
QStringList qobjectNames () const
 

Public Member Functions

 Manager ()
 
virtual ~Manager ()
 
ActionCollectionactionCollection () const
 
bool hasHandlerAssigned (const QByteArray &typeName) const
 
bool hasInterpreterInfo (const QString &interpretername) const
 
Interpreterinterpreter (const QString &interpretername) const
 
InterpreterInfointerpreterInfo (const QString &interpretername) const
 
QHash< QString, InterpreterInfo * > interpreterInfos () const
 
const QString interpreternameForFile (const QString &file)
 
MetaTypeHandlermetaTypeHandler (const QByteArray &typeName) const
 
void registerMetaTypeHandler (const QByteArray &typeName, MetaTypeHandler::FunctionPtr *handler)
 
void registerMetaTypeHandler (const QByteArray &typeName, MetaTypeHandler::FunctionPtr2 *handler)
 
void registerMetaTypeHandler (const QByteArray &typeName, MetaTypeHandler *handler)
 
void setStrictTypesEnabled (bool enabled)
 
bool strictTypesEnabled () const
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
bool blockSignals (bool block)
 
const QObjectListchildren () const const
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method) const const
 
bool disconnect (const QObject *receiver, const char *method) const const
 
void dumpObjectInfo ()
 
void dumpObjectInfo () const const
 
void dumpObjectTree ()
 
void dumpObjectTree () const const
 
QList< QByteArraydynamicPropertyNames () const const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
findChild (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegExp &regExp, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const
 
bool inherits (const char *className) const const
 
void installEventFilter (QObject *filterObj)
 
bool isWidgetType () const const
 
bool isWindowType () const const
 
void killTimer (int id)
 
virtual const QMetaObjectmetaObject () const const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const const
 
void objectNameChanged (const QString &objectName)
 
QObjectparent () const const
 
QVariant property (const char *name) const const
 
 Q_CLASSINFO (Name, Value)
 
 Q_DISABLE_COPY (Class)
 
 Q_DISABLE_COPY_MOVE (Class)
 
 Q_DISABLE_MOVE (Class)
 
 Q_EMIT Q_EMIT
 
 Q_ENUM (...)
 
 Q_ENUM_NS (...)
 
 Q_ENUMS (...)
 
 Q_FLAG (...)
 
 Q_FLAG_NS (...)
 
 Q_FLAGS (...)
 
 Q_GADGET Q_GADGET
 
 Q_INTERFACES (...)
 
 Q_INVOKABLE Q_INVOKABLE
 
 Q_NAMESPACE Q_NAMESPACE
 
 Q_NAMESPACE_EXPORT (EXPORT_MACRO)
 
 Q_OBJECT Q_OBJECT
 
 Q_PROPERTY (...)
 
 Q_REVISION Q_REVISION
 
 Q_SET_OBJECT_NAME (Object)
 
 Q_SIGNAL Q_SIGNAL
 
 Q_SIGNALS Q_SIGNALS
 
 Q_SLOT Q_SLOT
 
 Q_SLOTS Q_SLOTS
 
qFindChild (const QObject *obj, const QString &name)
 
QList< T > qFindChildren (const QObject *obj, const QRegExp &regExp)
 
QList< T > qFindChildren (const QObject *obj, const QString &name)
 
qobject_cast (QObject *object)
 
qobject_cast (const QObject *object)
 
 QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const const
 
int startTimer (int interval, Qt::TimerType timerType)
 
int startTimer (std::chrono::milliseconds time, Qt::TimerType timerType)
 
QThreadthread () const const
 
- Public Member Functions inherited from Kross::ChildrenInterface
void addObject (QObject *object, const QString &name=QString(), Options options=NoOption)
 
bool hasObject (const QString &name) const
 
QObjectobject (const QString &name) const
 
Options objectOption (const QString &name) const
 
QHash< QString, OptionsobjectOptions () const
 
QHash< QString, QObject * > objects () const
 

Static Public Member Functions

static Managerself ()
 
- Static Public Member Functions inherited from QObject
QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, Functor functor)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
 
bool disconnect (const QMetaObject::Connection &connection)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 

Additional Inherited Members

- Public Types inherited from Kross::ChildrenInterface
enum  Options { NoOption = 0x00, AutoConnectSignals = 0x01, LastOption = 0x1000000 }
 
- Properties inherited from QObject
 objectName
 
- Public Attributes inherited from QObject
typedef QObjectList
 
- Protected Member Functions inherited from QObject
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 
bool isSignalConnected (const QMetaMethod &signal) const const
 
int receivers (const char *signal) const const
 
QObjectsender () const const
 
int senderSignalIndex () const const
 
virtual void timerEvent (QTimerEvent *event)
 

Detailed Description

The Manager class is a singleton that provides the main entry point to deal with the Kross Scripting Framework.

Use Interpreter to just work with some implementated interpreter like python or ruby. While Action implements a flexible abstract container to deal with single script files.

Definition at line 50 of file manager.h.

Constructor & Destructor Documentation

Manager::Manager ( )
explicit

The constructor.

Use self() to access the Manager singleton instance and don't call this direct.

Definition at line 126 of file manager.cpp.

Manager::~Manager ( )
virtual

Destructor.

Definition at line 225 of file manager.cpp.

Member Function Documentation

QObject * Manager::action ( const QString name)
slot
Returns
the Action QObject instance defined with name which is child of this Manager instance. If there exists no such Action yet, create one.

Definition at line 291 of file manager.cpp.

ActionCollection * Manager::actionCollection ( ) const
Returns
the root ActionCollection instance. Each collection could have children of other collections and/or Action instances.

Definition at line 281 of file manager.cpp.

void Manager::deleteModules ( )
slot

External modules are dynamically loadable and are normally deleted when the kross library is unloaded.

Applications may choose to call deleteModules() instead to control deletion of the modules at another time.

Definition at line 333 of file manager.cpp.

bool Manager::executeScriptFile ( const QUrl file = QUrl())
slot

Execute a script file.

Parameters
fileThe script file that should be executed.

Definition at line 339 of file manager.cpp.

void Kross::Manager::finished ( Kross::Action )
signal

This signal is emitted when the execution of a script is finished.

bool Manager::hasAction ( const QString name)
slot
Returns
true if there exists a Action QObject instance which is child of this Manager instance and is defined as name else false is returned.

Definition at line 286 of file manager.cpp.

bool Manager::hasHandlerAssigned ( const QByteArray typeName) const
Returns
whether typeName has a handler assigned or not.

Definition at line 394 of file manager.cpp.

bool Manager::hasInterpreterInfo ( const QString interpretername) const
Returns
true if there exists an interpreter with the name interpretername else false.

Definition at line 239 of file manager.cpp.

Interpreter * Manager::interpreter ( const QString interpretername) const

Return the Interpreter instance defined by the interpretername.

Parameters
interpreternameThe name of the interpreter. e.g. "python" or "ruby".
Returns
The Interpreter instance or NULL if there does not exists an interpreter with such an interpretername.

Definition at line 267 of file manager.cpp.

InterpreterInfo * Manager::interpreterInfo ( const QString interpretername) const
Returns
the InterpreterInfo* matching to the defined interpretername or NULL if there does not exists such a interpreter.

Definition at line 244 of file manager.cpp.

QHash< QString, InterpreterInfo * > Manager::interpreterInfos ( ) const
Returns
a map with InterpreterInfo* instances used to describe interpreters.

Definition at line 234 of file manager.cpp.

const QString Manager::interpreternameForFile ( const QString file)

Return the name of the Interpreter that feels responsible for the defined file .

Parameters
fileThe filename we should try to determinate the interpretername for.
Returns
The name of the Interpreter which will be used to execute the file or QString() if we failed to determinate a matching interpreter for the file.

Definition at line 249 of file manager.cpp.

QStringList Manager::interpreters ( ) const
slot
Returns
a list of names of all supported scripting interpreters. The list may contain for example "python" and "ruby" depending on what interpreter-plugins are installed.

Definition at line 276 of file manager.cpp.

MetaTypeHandler * Manager::metaTypeHandler ( const QByteArray typeName) const
Returns
the MetaTypeHandler instance for custom types of type typeName .
Since
4.2

Definition at line 364 of file manager.cpp.

QObject * Manager::module ( const QString modulename)
slot

Load and return an external module.

Modules are dynamic loadable plugins which could be loaded on demand to provide additional functionality.

Parameters
modulenameThe name of the module we should try to load.
Returns
The QObject instance that repesents the module or NULL if loading failed.

Definition at line 303 of file manager.cpp.

void Manager::registerMetaTypeHandler ( const QByteArray typeName,
MetaTypeHandler::FunctionPtr *  handler 
)

Register a handler for custom types.

See also the WrapperInterface class.

Parameters
typeNameThe custom type the handler should handle.
handlerFunction that should be called to handle a custom type.
Since
4.2

Definition at line 369 of file manager.cpp.

void Manager::registerMetaTypeHandler ( const QByteArray typeName,
MetaTypeHandler::FunctionPtr2 *  handler 
)

Register a handler for custom types.

See also the WrapperInterface class.

Parameters
typeNameThe custom type the handler should handle.
handlerFunction that should be called to handle a custom type.
Since
4.2

Definition at line 374 of file manager.cpp.

void Manager::registerMetaTypeHandler ( const QByteArray typeName,
MetaTypeHandler handler 
)

Register a handler for custom types.

See also the WrapperInterface class.

Parameters
typeNameThe custom type the handler should handle.
handlerFunction that should be called to handle a custom type.
Since
4.2

Definition at line 379 of file manager.cpp.

Manager & Manager::self ( )
static

Return the Manager instance.

Always use this function to access the Manager singleton.

Definition at line 74 of file manager.cpp.

void Manager::setStrictTypesEnabled ( bool  enabled)

Enable more strict type handling.

If enabled then scripting-backends don't handle unknown pointer-types where no MetaTypeHandler was registered for. If disabled, such unknown types will be reinterpret_cast to QObject* what allows to also handle unknown QObject's but will also result in a crash if the unknown type isn't a QObject. Per default strict type handling is enabled.

Since
4.2

Definition at line 389 of file manager.cpp.

void Kross::Manager::started ( Kross::Action )
signal

This signal is emitted when the execution of a script is started.

bool Manager::strictTypesEnabled ( ) const

Returns true if strict type handling is enabled.

Since
4.2

Definition at line 384 of file manager.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Sep 21 2020 22:59:49 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.