forked from qt-creator/qt-creator
TextEditor: Move BlockRange out of texteditor.h
Change-Id: Idc00622e67c4498b35bab73108551ae4cc0c2359 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
This commit is contained in:
67
src/plugins/texteditor/blockrange.h
Normal file
67
src/plugins/texteditor/blockrange.h
Normal file
@@ -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
|
@@ -32,6 +32,7 @@
|
||||
#define TEXTEDITOR_H
|
||||
|
||||
#include "texteditor_global.h"
|
||||
#include "blockrange.h"
|
||||
#include "codeassist/assistenums.h"
|
||||
|
||||
#include <coreplugin/editormanager/ieditor.h>
|
||||
@@ -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,
|
||||
|
@@ -210,7 +210,8 @@ HEADERS += texteditorplugin.h \
|
||||
textmark.h \
|
||||
codeassist/keywordscompletionassist.h \
|
||||
textmarkregistry.h \
|
||||
marginsettings.h
|
||||
marginsettings.h \
|
||||
blockrange.h
|
||||
|
||||
FORMS += \
|
||||
displaysettingspage.ui \
|
||||
|
@@ -27,6 +27,7 @@ QtcPlugin {
|
||||
"behaviorsettingswidget.cpp",
|
||||
"behaviorsettingswidget.h",
|
||||
"behaviorsettingswidget.ui",
|
||||
"blockrange.h",
|
||||
"circularclipboard.cpp",
|
||||
"circularclipboard.h",
|
||||
"circularclipboardassist.cpp",
|
||||
|
Reference in New Issue
Block a user