Carousel
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Properties Pages
Public Member Functions | List of all members
ScriptConsole Class Reference

It is a defaul implementation of the IScriptConsole. More...

#include <ScriptConsole.h>

Inherits IScriptConsole.

Public Member Functions

 ScriptConsole (QObject *parent=nullptr)
 
 ScriptConsole (QScriptEngine *engine, QObject *parent=nullptr)
 
const QStringListcommandHistory () const
 
QScriptEngineengine ()
 
int historyCapacity () const
 
void setHistoryCapacity (int capacity)
 
- Public Member Functions inherited from IScriptConsole
 IScriptConsole ()
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
 QObject (QObject *parent, const char *name)
 
bool blockSignals (bool block)
 
QObjectchild (const char *objName, const char *inheritsClass, bool recursiveSearch) const
 
const QObjectList & children () const
 
const char * className () const
 
bool connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const QObject *receiver, const char *method)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method)
 
void dumpObjectInfo ()
 
void dumpObjectTree ()
 
QList< QByteArraydynamicPropertyNames () const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
findChild (const QString &name) const
 
QList< T > findChildren (const QRegExp &regExp) const
 
QList< T > findChildren (const QString &name) const
 
bool inherits (const char *className) const
 
void insertChild (QObject *object)
 
void installEventFilter (QObject *filterObj)
 
bool isA (const char *className) const
 
bool isWidgetType () const
 
void killTimer (int id)
 
virtual const QMetaObjectmetaObject () const
 
void moveToThread (QThread *targetThread)
 
const char * name () const
 
const char * name (const char *defaultName) const
 
QString objectName () const
 
QObjectparent () const
 
QVariant property (const char *name) const
 
void removeChild (QObject *object)
 
void removeEventFilter (QObject *obj)
 
void setName (const char *name)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const
 
int startTimer (int interval)
 
QThreadthread () const
 
- Public Member Functions inherited from IOutputHandler
 IOutputHandler ()
 
virtual void print (const QString &message)=0
 

Additional Inherited Members

- Public Slots inherited from IScriptConsole
virtual bool execCommand (const QString &command)=0
 
virtual QString nextCommand ()=0
 
virtual QString prevCommand ()=0
 
- Signals inherited from IScriptConsole
void aboutToExecute (const QString &command)
 
void error (const QString &error)
 
void printed (const QString &message)
 
- Static Public Member Functions inherited from QObject
bool connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
bool connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *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)
 
- Protected Member Functions inherited from QObject
bool checkConnectArgs (const char *signal, const QObject *object, const char *method)
 
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const char *signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const char *signal)
 
int receivers (const char *signal) const
 
QObjectsender () const
 
int senderSignalIndex () const
 
virtual void timerEvent (QTimerEvent *event)
 
- Static Protected Member Functions inherited from QObject
QByteArray normalizeSignalSlot (const char *signalSlot)
 
- Properties inherited from IScriptConsole
QStringList commandHistory
 
int historyCapacity
 
- Properties inherited from QObject
 objectName
 

Detailed Description

It is a defaul implementation of the IScriptConsole.

There are methods similiar to the just a console or terminal - execute command and command history. But this object does not pretend for visualizatoin, there is the ScriptConsoleView for this purpose.

Also, when this interface is implemented, an IOutputHandler one should be implemented too to be able to redirect print() functions to the console printed() signal.

You can get reference to the IScriptConsole using

* IScriptingService *service = serviceLocator->locate<IScriptingService>();
* IScriptConsole *console = service->console();
*
See Also
ScriptConsoleView

Constructor & Destructor Documentation

ScriptConsole::ScriptConsole ( QObject parent = nullptr)
explicit

Initializes a new instance of the ScriptConsole class using defaul QScriptEngine as an engine for command execution.

ScriptConsole::ScriptConsole ( QScriptEngine engine,
QObject parent = nullptr 
)
explicit

Initializes a new instance of the ScriptConsole class using specified engine for command execution.

Note, that it takes ownership for engine.

Member Function Documentation

QScriptEngine* ScriptConsole::engine ( )
virtual

Gets an script engine, that executes commands. See IScriptExtension extension, if you want to extend script engine in more common way.

See Also
execCommand

Implements IScriptConsole.

int ScriptConsole::historyCapacity ( ) const
virtual

Gets a maximum amount of commands, stored in the history collection. When current size reaches this amount, further execCommand() calls will remove oldest command from the history.

See Also
setHistoryCapacity, execCommand

Implements IScriptConsole.

void ScriptConsole::setHistoryCapacity ( int  capacity)
virtual

Sets a maximum amount of commands, stored in the history collection.

See Also
historyCapacity, execCommand

Implements IScriptConsole.

const QStringList& ScriptConsole::commandHistory ( ) const
virtual

Gets all executed commands on this console.

See Also
prevCommand, nextCommand

Implements IScriptConsole.