diff options
author | Lars Knoll <lars.knoll@digia.com> | 2013-08-08 09:31:39 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-08-08 12:22:32 +0200 |
commit | ce34b58ad0496664cf62053797fa316f862c9f34 (patch) | |
tree | ffa7c4d055f5ba44da65406c668cff48b01409a7 /src | |
parent | 3288b87e2f75278c7415fbc7c4574bcf7da71295 (diff) |
Remove the now unused rewriter directory
The qml rewriter is not needed anymore with the
new JS engine
Change-Id: I87fe92eff6e28f6699df6377c1aca5a5b1c92ddd
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/qml/qml/qml.pri | 1 | ||||
-rw-r--r-- | src/qml/qml/rewriter/rewriter.pri | 2 | ||||
-rw-r--r-- | src/qml/qml/rewriter/textwriter.cpp | 195 | ||||
-rw-r--r-- | src/qml/qml/rewriter/textwriter_p.h | 94 |
4 files changed, 0 insertions, 292 deletions
diff --git a/src/qml/qml/qml.pri b/src/qml/qml/qml.pri index 1914a388d0..4601f8ca00 100644 --- a/src/qml/qml/qml.pri +++ b/src/qml/qml/qml.pri @@ -133,6 +133,5 @@ HEADERS += \ $$PWD/qqmltypewrapper_p.h include(parser/parser.pri) -include(rewriter/rewriter.pri) include(ftw/ftw.pri) include(v8/v8.pri) diff --git a/src/qml/qml/rewriter/rewriter.pri b/src/qml/qml/rewriter/rewriter.pri deleted file mode 100644 index e51ee5ba4e..0000000000 --- a/src/qml/qml/rewriter/rewriter.pri +++ /dev/null @@ -1,2 +0,0 @@ -HEADERS += $$PWD/textwriter_p.h -SOURCES += $$PWD/textwriter.cpp diff --git a/src/qml/qml/rewriter/textwriter.cpp b/src/qml/qml/rewriter/textwriter.cpp deleted file mode 100644 index da89414e5b..0000000000 --- a/src/qml/qml/rewriter/textwriter.cpp +++ /dev/null @@ -1,195 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtQml 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$ -** -****************************************************************************/ - -#include "textwriter_p.h" - -QT_QML_BEGIN_NAMESPACE - -using namespace QQmlJS; - -TextWriter::TextWriter() - :string(0) -{ -} - -static bool overlaps(int posA, int lengthA, int posB, int lengthB) { - return (posA < posB + lengthB && posA + lengthA > posB + lengthB) - || (posA < posB && posA + lengthA > posB); -} - -bool TextWriter::hasOverlap(int pos, int length) -{ - { - QListIterator<Replace> i(replaceList); - while (i.hasNext()) { - const Replace &cmd = i.next(); - if (overlaps(pos, length, cmd.pos, cmd.length)) - return true; - } - } - { - QListIterator<Move> i(moveList); - while (i.hasNext()) { - const Move &cmd = i.next(); - if (overlaps(pos, length, cmd.pos, cmd.length)) - return true; - } - } - return false; -} - -bool TextWriter::hasMoveInto(int pos, int length) -{ - QListIterator<Move> i(moveList); - while (i.hasNext()) { - const Move &cmd = i.next(); - if (cmd.to >= pos && cmd.to < pos + length) - return true; - } - return false; -} - -void TextWriter::replace(int pos, int length, const QString &replacement) -{ - Q_ASSERT(!hasOverlap(pos, length)); - Q_ASSERT(!hasMoveInto(pos, length)); - - Replace cmd; - cmd.pos = pos; - cmd.length = length; - cmd.replacement = replacement; - replaceList += cmd; -} - -void TextWriter::move(int pos, int length, int to) -{ - Q_ASSERT(!hasOverlap(pos, length)); - - Move cmd; - cmd.pos = pos; - cmd.length = length; - cmd.to = to; - moveList += cmd; -} - -void TextWriter::doReplace(const Replace &replace) -{ - int diff = replace.replacement.size() - replace.length; - { - QMutableListIterator<Replace> i(replaceList); - while (i.hasNext()) { - Replace &c = i.next(); - if (replace.pos < c.pos) - c.pos += diff; - else if (replace.pos + replace.length < c.pos + c.length) - c.length += diff; - } - } - { - QMutableListIterator<Move> i(moveList); - while (i.hasNext()) { - Move &c = i.next(); - if (replace.pos < c.pos) - c.pos += diff; - else if (replace.pos + replace.length < c.pos + c.length) - c.length += diff; - - if (replace.pos < c.to) - c.to += diff; - } - } - - string->replace(replace.pos, replace.length, replace.replacement); -} - -void TextWriter::doMove(const Move &move) -{ - QString text(string->mid(move.pos, move.length)); - - Replace cut; - cut.pos = move.pos; - cut.length = move.length; - Replace paste; - paste.pos = move.to; - paste.length = 0; - paste.replacement = text; - - replaceList.append(cut); - replaceList.append(paste); - - Replace cmd; - while (!replaceList.isEmpty()) { - cmd = replaceList.first(); - replaceList.removeFirst(); - doReplace(cmd); - } -} - -void TextWriter::write(QString *s) -{ - string = s; - write_helper(); - string = 0; -} - -void TextWriter::write_helper() -{ - Q_ASSERT(string); - - { - Replace cmd; - while (!replaceList.isEmpty()) { - cmd = replaceList.first(); - replaceList.removeFirst(); - doReplace(cmd); - } - } - { - Move cmd; - while (!moveList.isEmpty()) { - cmd = moveList.first(); - moveList.removeFirst(); - doMove(cmd); - } - } -} - -QT_QML_END_NAMESPACE diff --git a/src/qml/qml/rewriter/textwriter_p.h b/src/qml/qml/rewriter/textwriter_p.h deleted file mode 100644 index fdfd955d9f..0000000000 --- a/src/qml/qml/rewriter/textwriter_p.h +++ /dev/null @@ -1,94 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtQml 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 TEXTWRITER_H -#define TEXTWRITER_H - -#include <private/qqmljsglobal_p.h> - -#include <QtCore/QString> -#include <QtCore/QList> - -QT_QML_BEGIN_NAMESPACE - -namespace QQmlJS { - -class TextWriter -{ - QString *string; - - struct Replace { - int pos; - int length; - QString replacement; - }; - - QList<Replace> replaceList; - - struct Move { - int pos; - int length; - int to; - }; - - QList<Move> moveList; - - bool hasOverlap(int pos, int length); - bool hasMoveInto(int pos, int length); - - void doReplace(const Replace &replace); - void doMove(const Move &move); - - void write_helper(); - -public: - TextWriter(); - - void replace(int pos, int length, const QString &replacement); - void move(int pos, int length, int to); - - void write(QString *s); -}; - -} // end of namespace QQmlJS - -QT_QML_END_NAMESPACE -#endif // TEXTWRITER_H |