Utils: move text replacement helper to Utils::Text

Change-Id: I82b3304f91d575369e74d5f7404c189e14ba4730
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
David Schulz
2020-01-08 10:43:13 +01:00
parent 88edfdb1b2
commit c56e58fab4
6 changed files with 72 additions and 69 deletions

View File

@@ -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,