forked from qt-creator/qt-creator
Snippets: Move snippet parsing into the snippet class
* Move the code to parse snippets into the snippet class * Allow to escape $ so that this character can be used in snippets * Add unit tests for the snippet parsing Change-Id: I134f3c0de8290e1d7fcaf808577b31f5ac8fbc63 Reviewed-by: David Schulz <david.schulz@digia.com>
This commit is contained in:
@@ -33,6 +33,7 @@
|
||||
#include <texteditor/texteditor_global.h>
|
||||
|
||||
#include <QChar>
|
||||
#include <QList>
|
||||
#include <QString>
|
||||
|
||||
namespace TextEditor {
|
||||
@@ -67,6 +68,20 @@ public:
|
||||
|
||||
static const QChar kVariableDelimiter;
|
||||
|
||||
class ParsedSnippet {
|
||||
public:
|
||||
QString text;
|
||||
bool success;
|
||||
struct Range {
|
||||
Range(int s, int l) : start(s), length(l) { }
|
||||
int start;
|
||||
int length;
|
||||
};
|
||||
QList<Range> ranges;
|
||||
};
|
||||
|
||||
static ParsedSnippet parse(const QString &snippet);
|
||||
|
||||
private:
|
||||
bool m_isRemoved;
|
||||
bool m_isModified;
|
||||
|
||||
Reference in New Issue
Block a user