summaryrefslogtreecommitdiffstats
path: root/src/script/api/qscriptprogram.cpp
diff options
context:
space:
mode:
authorKent Hansen <khansen@trolltech.com>2009-10-09 16:52:01 (GMT)
committerKent Hansen <khansen@trolltech.com>2009-10-09 16:52:01 (GMT)
commitc6cbece9baec95d54d85a26f439ed4e7274ca3fd (patch)
tree6d31226b7dc60f50b4d18d671ded9cc2a32674a4 /src/script/api/qscriptprogram.cpp
parent2e0ba7333993c417fd4871a977c4d787e344692c (diff)
downloadQt-c6cbece9baec95d54d85a26f439ed4e7274ca3fd.zip
Qt-c6cbece9baec95d54d85a26f439ed4e7274ca3fd.tar.gz
Qt-c6cbece9baec95d54d85a26f439ed4e7274ca3fd.tar.bz2
some preliminary work on QScriptProgram
Diffstat (limited to 'src/script/api/qscriptprogram.cpp')
-rw-r--r--src/script/api/qscriptprogram.cpp134
1 files changed, 134 insertions, 0 deletions
diff --git a/src/script/api/qscriptprogram.cpp b/src/script/api/qscriptprogram.cpp
new file mode 100644
index 0000000..2746c44
--- /dev/null
+++ b/src/script/api/qscriptprogram.cpp
@@ -0,0 +1,134 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtScript module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qscriptprogram.h"
+#include "qscriptprogram_p.h"
+#include "qscriptengine.h"
+#include "qscriptengine_p.h"
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \since 4.6
+ \class QScriptProgram
+
+ \brief The QScriptProgram class ...
+
+ \ingroup script
+
+*/
+
+QScriptProgramPrivate::QScriptProgramPrivate(QScriptEnginePrivate *e,
+ JSC::EvalExecutable *x,
+ intptr_t id)
+ : engine(e), executable(x), sourceId(id)
+{
+ ref = 0;
+}
+
+QScriptProgramPrivate::~QScriptProgramPrivate()
+{
+}
+
+QScriptProgramPrivate *QScriptProgramPrivate::get(const QScriptProgram &q)
+{
+ return const_cast<QScriptProgramPrivate*>(q.d_func());
+}
+
+QScriptProgram QScriptProgramPrivate::create(QScriptEnginePrivate *engine,
+ JSC::EvalExecutable *executable,
+ intptr_t sourceId)
+{
+ QScriptProgramPrivate *d = new QScriptProgramPrivate(engine, executable, sourceId);
+ QScriptProgram result;
+ result.d_ptr = d;
+ return result;
+}
+
+/*!
+ Constructs an invalid QScriptProgram.
+*/
+QScriptProgram::QScriptProgram()
+ : d_ptr(0)
+{
+}
+
+/*!
+ Constructs a new QScriptProgram that is a copy of \a other.
+*/
+QScriptProgram::QScriptProgram(const QScriptProgram &other)
+ : d_ptr(other.d_ptr)
+{
+}
+
+/*!
+ Destroys this QScriptProgram.
+*/
+QScriptProgram::~QScriptProgram()
+{
+ Q_D(QScriptProgram);
+ // if (d->engine && (d->ref == 1))
+ // d->engine->unregisterScriptProgram(d);
+}
+
+/*!
+ Assigns the \a other value to this QScriptProgram.
+*/
+QScriptProgram &QScriptProgram::operator=(const QScriptProgram &other)
+{
+ // if (d_func() && d_func()->engine && (d_func()->ref == 1))
+ // d_func()->engine->unregisterScriptProgram(d_func());
+ // }
+ d_ptr = other.d_ptr;
+ return *this;
+}
+
+/*!
+ Returns true if this QScriptProgram is valid; otherwise
+ returns false.
+*/
+bool QScriptProgram::isValid() const
+{
+ Q_D(const QScriptProgram);
+ return (d && d->engine);
+}
+
+QT_END_NAMESPACE