forked from qt-creator/qt-creator
Utils: move text replacement helper to Utils::Text
Change-Id: I82b3304f91d575369e74d5f7404c189e14ba4730 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -36,6 +36,23 @@ QT_FORWARD_DECLARE_CLASS(QTextCursor)
|
||||
namespace Utils {
|
||||
namespace Text {
|
||||
|
||||
struct Replacement
|
||||
{
|
||||
Replacement() = default;
|
||||
Replacement(int offset, int length, const QString &text)
|
||||
: offset(offset)
|
||||
, length(length)
|
||||
, text(text)
|
||||
{}
|
||||
|
||||
int offset = -1;
|
||||
int length = -1;
|
||||
QString text;
|
||||
|
||||
bool isValid() const { return offset >= 0 && length >= 0; }
|
||||
};
|
||||
using Replacements = std::vector<Replacement>;
|
||||
|
||||
// line is 1-based, column is 1-based
|
||||
QTCREATOR_UTILS_EXPORT bool convertPosition(const QTextDocument *document,
|
||||
int pos,
|
||||
|
||||
Reference in New Issue
Block a user