summaryrefslogtreecommitdiff
path: root/src/plugins/texteditor/snippets/snippet.h
diff options
context:
space:
mode:
authorDavid Schulz <david.schulz@qt.io>2021-05-11 10:49:14 +0200
committerDavid Schulz <david.schulz@qt.io>2021-05-25 08:16:38 +0000
commit44e7047450276bf4d2c3f60aea3dc4b436374992 (patch)
treeba1a0c4344625df7be7cb3e81ec542c22e9eff31 /src/plugins/texteditor/snippets/snippet.h
parent770d87709ee4d67e24b4a8d4b3fd2bdd0eff2745 (diff)
downloadqt-creator-44e7047450276bf4d2c3f60aea3dc4b436374992.tar.gz
Editor: Allow defining custom snippet parser function
Task-number: QTCREATORBUG-22406 Change-Id: I21ae9740d348d4e0869029343d51b70f9df9cdac Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Diffstat (limited to 'src/plugins/texteditor/snippets/snippet.h')
-rw-r--r--src/plugins/texteditor/snippets/snippet.h39
1 files changed, 1 insertions, 38 deletions
diff --git a/src/plugins/texteditor/snippets/snippet.h b/src/plugins/texteditor/snippets/snippet.h
index 8334a66a49..a75b3a297e 100644
--- a/src/plugins/texteditor/snippets/snippet.h
+++ b/src/plugins/texteditor/snippets/snippet.h
@@ -27,8 +27,7 @@
#include <texteditor/texteditor_global.h>
-#include <utils/id.h>
-#include <utils/variant.h>
+#include "snippetparser.h"
#include <QChar>
#include <QCoreApplication>
@@ -37,42 +36,6 @@
namespace TextEditor {
-class TEXTEDITOR_EXPORT NameMangler
-{
-public:
- virtual ~NameMangler();
-
- virtual Utils::Id id() const = 0;
- virtual QString mangle(const QString &unmangled) const = 0;
-};
-
-class TEXTEDITOR_EXPORT ParsedSnippet
-{
-public:
- class Part {
- public:
- Part() = default;
- explicit Part(const QString &text) : text(text) {}
- QString text;
- int variableIndex = -1; // if variable index is >= 0 the text is interpreted as a variable
- NameMangler *mangler = nullptr;
- };
- QList<Part> parts;
- QList<QList<int>> variables;
-};
-
-class TEXTEDITOR_EXPORT SnippetParseError
-{
-public:
- QString errorMessage;
- QString text;
- int pos;
-
- QString htmlMessage() const;
-};
-
-using SnippetParseResult = Utils::variant<ParsedSnippet, SnippetParseError>;
-
class TEXTEDITOR_EXPORT Snippet
{
Q_DECLARE_TR_FUNCTIONS(Snippet)