diff --git a/src/plugins/texteditor/blockrange.h b/src/plugins/texteditor/blockrange.h new file mode 100644 index 00000000000..debfb4ea5d3 --- /dev/null +++ b/src/plugins/texteditor/blockrange.h @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing +** +** This file is part of Qt Creator. +** +** 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 The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/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 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef BLOCKRANGE_H +#define BLOCKRANGE_H + +namespace TextEditor { + +class BlockRange +{ +public: + BlockRange() = default; + BlockRange(int firstPosition, int lastPosition) + : firstPosition(firstPosition), + lastPosition(lastPosition) + {} + + bool isNull() const + { + return lastPosition < firstPosition; + } + + int first() const + { + return firstPosition; + } + + int last() const + { + return lastPosition; + } + +private: + int firstPosition = 0; + int lastPosition = -1; +}; + +} // namespace TextEditor + +#endif // BLOCKRANGE_H diff --git a/src/plugins/texteditor/texteditor.h b/src/plugins/texteditor/texteditor.h index c4ab6864a20..273d5bbb277 100644 --- a/src/plugins/texteditor/texteditor.h +++ b/src/plugins/texteditor/texteditor.h @@ -32,6 +32,7 @@ #define TEXTEDITOR_H #include "texteditor_global.h" +#include "blockrange.h" #include "codeassist/assistenums.h" #include @@ -91,24 +92,6 @@ class MarginSettings; class StorageSettings; class TypingSettings; -class TEXTEDITOR_EXPORT BlockRange -{ -public: - BlockRange() : _first(0), _last(-1) {} - BlockRange(int firstPosition, int lastPosition) - : _first(firstPosition), _last(lastPosition) - {} - - inline bool isNull() const { return _last < _first; } - - int first() const { return _first; } - int last() const { return _last; } - -private: - int _first; - int _last; -}; - enum TextPositionOperation { CurrentPosition = 1, diff --git a/src/plugins/texteditor/texteditor.pro b/src/plugins/texteditor/texteditor.pro index a4f47b2500d..9c6d2c0919e 100644 --- a/src/plugins/texteditor/texteditor.pro +++ b/src/plugins/texteditor/texteditor.pro @@ -210,7 +210,8 @@ HEADERS += texteditorplugin.h \ textmark.h \ codeassist/keywordscompletionassist.h \ textmarkregistry.h \ - marginsettings.h + marginsettings.h \ + blockrange.h FORMS += \ displaysettingspage.ui \ diff --git a/src/plugins/texteditor/texteditor.qbs b/src/plugins/texteditor/texteditor.qbs index 0e3ad79dad9..17cd8845ba8 100644 --- a/src/plugins/texteditor/texteditor.qbs +++ b/src/plugins/texteditor/texteditor.qbs @@ -27,6 +27,7 @@ QtcPlugin { "behaviorsettingswidget.cpp", "behaviorsettingswidget.h", "behaviorsettingswidget.ui", + "blockrange.h", "circularclipboard.cpp", "circularclipboard.h", "circularclipboardassist.cpp",