diff options
author | Erik Verbruggen <erik.verbruggen@me.com> | 2013-03-18 11:03:51 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@digia.com> | 2013-03-18 12:23:37 +0100 |
commit | 3d117215f6dbec1d152ea5bef0dd39f3e53055c8 (patch) | |
tree | eff286213aaafe2242e1f4abe2d6ee3e785d4303 /src | |
parent | 08cf00242c12474e208eca5e67fefab2b51a0602 (diff) |
Moved TemporaryAssignment into its own header.
So we can re-use it without including all of qv4engine.h.
Change-Id: I3de1e6a26b20afef4969001dd2dd774688f25620
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/v4/qv4engine.h | 27 | ||||
-rw-r--r-- | src/v4/qv4util.h | 74 | ||||
-rw-r--r-- | src/v4/v4.pro | 3 |
3 files changed, 80 insertions, 24 deletions
diff --git a/src/v4/qv4engine.h b/src/v4/qv4engine.h index adaa159f67..a7fc1fff9d 100644 --- a/src/v4/qv4engine.h +++ b/src/v4/qv4engine.h @@ -38,12 +38,13 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#ifndef QMLJS_ENGINE_H -#define QMLJS_ENGINE_H +#ifndef QV4ENGINE_H +#define QV4ENGINE_H #include "qv4global.h" #include "qv4isel_p.h" #include "qv4object.h" +#include "qv4util.h" #include "qv4context.h" #include <setjmp.h> @@ -242,29 +243,9 @@ struct Q_V4_EXPORT ExecutionEngine void ensureContextStackSize(); }; -template <typename T> -struct TemporaryAssignment -{ - TemporaryAssignment(T &var, const T& temporaryValue) - : variable(var) - , savedValue(var) - { - variable = temporaryValue; - } - ~TemporaryAssignment() - { - variable = savedValue; - } - T &variable; - T savedValue; -private: - TemporaryAssignment(const TemporaryAssignment<T>&); - TemporaryAssignment operator=(const TemporaryAssignment<T>&); -}; - } // namespace VM } // namespace QQmlJS QT_END_NAMESPACE -#endif +#endif // QV4ENGINE_H diff --git a/src/v4/qv4util.h b/src/v4/qv4util.h new file mode 100644 index 0000000000..c43d85eca7 --- /dev/null +++ b/src/v4/qv4util.h @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the V4VM module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** 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, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#ifndef QV4UTIL_H +#define QV4UTIL_H + +#include "qv4global.h" + +QT_BEGIN_NAMESPACE + +namespace QQmlJS { + +template <typename T> +struct TemporaryAssignment +{ + TemporaryAssignment(T &var, const T& temporaryValue) + : variable(var) + , savedValue(var) + { + variable = temporaryValue; + } + ~TemporaryAssignment() + { + variable = savedValue; + } + T &variable; + T savedValue; +private: + TemporaryAssignment(const TemporaryAssignment<T>&); + TemporaryAssignment operator=(const TemporaryAssignment<T>&); +}; + +} // namespace QQmlJS + +QT_END_NAMESPACE + +#endif // QV4UTIL_H diff --git a/src/v4/v4.pro b/src/v4/v4.pro index 15821e61aa..20ab02feb8 100644 --- a/src/v4/v4.pro +++ b/src/v4/v4.pro @@ -92,7 +92,8 @@ HEADERS += \ qv4unwindhelper_p-dw2.h \ qv4unwindhelper_p-arm.h \ qv4v8.h \ - qcalculatehash_p.h + qcalculatehash_p.h \ + qv4util.h llvm-libs { |