qscriptengineagent.h

Go to the documentation of this file.
00001 /****************************************************************************
00002 **
00003 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
00004 ** All rights reserved.
00005 ** Contact: Nokia Corporation (qt-info@nokia.com)
00006 **
00007 ** This file is part of the QtScript module of the Qt Toolkit.
00008 **
00009 ** $QT_BEGIN_LICENSE:LGPL-ONLY$
00010 ** GNU Lesser General Public License Usage
00011 ** This file may be used under the terms of the GNU Lesser
00012 ** General Public License version 2.1 as published by the Free Software
00013 ** Foundation and appearing in the file LICENSE.LGPL included in the
00014 ** packaging of this file.  Please review the following information to
00015 ** ensure the GNU Lesser General Public License version 2.1 requirements
00016 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
00017 **
00018 ** If you have questions regarding the use of this file, please contact
00019 ** Nokia at qt-info@nokia.com.
00020 ** $QT_END_LICENSE$
00021 **
00022 ****************************************************************************/
00023 
00024 #ifndef QSCRIPTENGINEAGENT_H
00025 #define QSCRIPTENGINEAGENT_H
00026 
00027 #include <QtCore/qobjectdefs.h>
00028 
00029 #include <QtCore/qvariant.h>
00030 #include <QtCore/qscopedpointer.h>
00031 
00032 QT_BEGIN_HEADER
00033 
00034 QT_BEGIN_NAMESPACE
00035 
00036 QT_MODULE(Script)
00037 
00038 class QScriptEngine;
00039 class QScriptValue;
00040 
00041 class QScriptEngineAgentPrivate;
00042 class Q_SCRIPT_EXPORT QScriptEngineAgent
00043 {
00044 public:
00045     enum Extension {
00046         DebuggerInvocationRequest
00047     };
00048 
00049     QScriptEngineAgent(QScriptEngine *engine);
00050     virtual ~QScriptEngineAgent();
00051 
00052     virtual void scriptLoad(qint64 id, const QString &program,
00053                             const QString &fileName, int baseLineNumber);
00054     virtual void scriptUnload(qint64 id);
00055 
00056     virtual void contextPush();
00057     virtual void contextPop();
00058 
00059     virtual void functionEntry(qint64 scriptId);
00060     virtual void functionExit(qint64 scriptId,
00061                               const QScriptValue &returnValue);
00062 
00063     virtual void positionChange(qint64 scriptId,
00064                                 int lineNumber, int columnNumber);
00065 
00066     virtual void exceptionThrow(qint64 scriptId,
00067                                 const QScriptValue &exception,
00068                                 bool hasHandler);
00069     virtual void exceptionCatch(qint64 scriptId,
00070                                 const QScriptValue &exception);
00071 
00072     virtual bool supportsExtension(Extension extension) const;
00073     virtual QVariant extension(Extension extension,
00074                                const QVariant &argument = QVariant());
00075 
00076     QScriptEngine *engine() const;
00077 
00078 protected:
00079     QScriptEngineAgent(QScriptEngineAgentPrivate &dd, QScriptEngine *engine);
00080     QScopedPointer<QScriptEngineAgentPrivate> d_ptr;
00081 
00082 private:
00083     Q_DECLARE_PRIVATE(QScriptEngineAgent)
00084     Q_DISABLE_COPY(QScriptEngineAgent)
00085 };
00086 
00087 QT_END_NAMESPACE
00088 
00089 QT_END_HEADER
00090 
00091 #endif