|Home | Tutorial | Classes | Functions | QSA Developer | Language | Library | Qt API | QSA Articles | Qt Script for Applications | ![]() |
This is the verbatim text of the qsinterpreter.h include file. It is provided only for illustration; the copyright remains with Trolltech.
/**************************************************************************** ** $Id$ ** ** Definition of the QSInterpreter class. ** ** Copyright (C) 2001-2002 Trolltech AS. All rights reserved. ** ** This file is part of the Qt Script for Applications framework (QSA). ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** Licensees holding a valid QSA Beta Evaluation Version license may use ** this file in accordance with the QSA Beta Evaluation Version License ** Agreement provided with the Software. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for ** information about QSA Commercial License Agreements. ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** *****************************************************************************/ #ifndef QSINTERPRETER_H #define QSINTERPRETER_H #include "qsaglobal.h" #include "qsproject.h" #include <qobject.h> #include <qvariant.h> #include <qobjectlist.h> class QSProject; class QSInterpreterPrivate; class QuickInterpreter; class QSObjectFactory; struct QSA_EXPORT QSSignalHandler { QObject *sender, *receiver; QString signal, function; bool operator==( const QSSignalHandler &sh ) const { return ( sh.sender == sender && sh.receiver == receiver && sh.signal == signal && sh.function == function ); } }; class QSA_EXPORT QSInterpreter : public QObject { friend class QSProject; friend class QSWrapperFactory; // for access to interpreter() friend class QSObjectFactory; friend class QuickDebuggerFrontend; friend class QSInterfaceFactory; Q_OBJECT Q_ENUMS( ErrorMode ) Q_PROPERTY( ErrorMode errorMode READ errorMode WRITE setErrorMode ) public: enum ErrorMode { Notify, AskForDebug, Debug, Nothing }; QSInterpreter( QSProject * project=0 ); virtual ~QSInterpreter(); static QSInterpreter *defaultInterpreter(); QVariant evaluate( const QString &code, QObject *context = 0 ); QVariant call( const QString &function, const QValueList<QVariant> & arguments, QObject *context = 0 ); bool checkSyntax( const QString &code ); void setErrorMode( ErrorMode m ); ErrorMode errorMode() const; QObject *currentContext() const; // objects const QObjectList *objects() const; //void setProject( QSProject *project ); // #### not implemented yet QSProject* project() const; // signal handlers void addSignalHandler( QObject *sender, const char *signal, QObject *receiver, const char *qtscriptFunction ); void addSignalHandler( QObject *sender, const char *signal, const char *qtscriptFunction ); void removeSignalHandler( QObject *sender, const char *signal, QObject *receiver, const char *qtscriptFunction ); void removeSignalHandler( QObject *sender, const char *signal, const char *qtscriptFunction ); // code inspection QStringList functionsOf( const QString &context, bool includeSignature = FALSE ) const; QStringList functionsOf( QObject *context, bool includeSignature = FALSE ) const; QStringList globalFunctions( bool includeSignature = FALSE ) const; QStringList classes() const; QStringList classesOf( const QString &context ) const; QStringList classesOf( QObject *context ) const; QStringList globalClasses() const; QStringList variablesOf( const QString &context ) const; QStringList variablesOf( QObject *context ) const; QStringList globalVariables() const; bool isRunning() const; public slots: void addObject( QObject *o ); void removeObject( QObject *o ); void clearObjects(); void clear(); signals: void error( const QString &message, const QString &filename, int lineNumber ); void error( const QString &message, QObject *context, const QString &filename, int lineNumber ); private: // disabled copy constructor and assignment operator QSInterpreter( const QSInterpreter & ); QSInterpreter& operator=( const QSInterpreter & ); // used by factory classes QuickInterpreter *interpreter() const; QSInterfaceFactory *interfaceFactory() const; void readdObjects(); void readdEventHandlers(); private slots: void runtimeError( const QString &message, const QString &filename, int lineNumber ); void runtimeError(); void runFinished(); void objectDestroyed( QObject *obj ); private: ErrorMode em; QSInterpreterPrivate *d; QSProject *proj; QuickInterpreter *quickinter; QObjectList appObjs; QValueList<QSSignalHandler> *signalHandlers; QSInterfaceFactory *ifaceFactory; uint running:1; uint hadError:1; uint blockErrors:1; uint needRerun:1; }; inline bool QSInterpreter::isRunning() const { return running; } #endif
Copyright © 2001-2003 Trolltech | Trademarks | QSA version 1.0.0-beta2
|