summaryrefslogtreecommitdiff
path: root/src/plugins/texteditor/snippets/snippet.h
diff options
context:
space:
mode:
authorTobias Hunger <tobias.hunger@digia.com>2013-08-09 17:45:14 +0200
committerTobias Hunger <tobias.hunger@digia.com>2013-08-20 14:49:17 +0200
commitee47b652a61e153ee82732b391a94e45d012ad7b (patch)
tree25fe5417be08a07355e3fe903655e505838bae0d /src/plugins/texteditor/snippets/snippet.h
parentb589336e54a79701d9091afca2d0a861fe6a96fe (diff)
downloadqt-creator-ee47b652a61e153ee82732b391a94e45d012ad7b.tar.gz
Snippets: Allow lowercase/titlecase/uppercase modifiers for variables
Use the same syntax already used in the custom wizard to denote variables that are modified to be lower-/title-/uppercase: $tESt:u$ will become TEST $tESt:c$ will become TESt $tESt:l$ will become test The snippet will be inserted without any name mangling happening. Once the editing is done the name mangling is applied to all fields. Change-Id: I7c1f5a1ad2bb5acf1b88b54de51bb39391c64763 Reviewed-by: David Schulz <david.schulz@digia.com>
Diffstat (limited to 'src/plugins/texteditor/snippets/snippet.h')
-rw-r--r--src/plugins/texteditor/snippets/snippet.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/plugins/texteditor/snippets/snippet.h b/src/plugins/texteditor/snippets/snippet.h
index dcd5d24011..8163f31a47 100644
--- a/src/plugins/texteditor/snippets/snippet.h
+++ b/src/plugins/texteditor/snippets/snippet.h
@@ -36,8 +36,19 @@
#include <QList>
#include <QString>
+namespace Core { class Id; }
+
namespace TextEditor {
+class TEXTEDITOR_EXPORT NameMangler
+{
+public:
+ virtual ~NameMangler() { }
+
+ virtual Core::Id id() const = 0;
+ virtual QString mangle(const QString &unmangled) const = 0;
+};
+
class TEXTEDITOR_EXPORT Snippet
{
public:
@@ -73,9 +84,10 @@ public:
QString text;
bool success;
struct Range {
- Range(int s, int l) : start(s), length(l) { }
+ Range(int s, int l, NameMangler *m) : start(s), length(l), mangler(m) { }
int start;
int length;
+ NameMangler *mangler;
};
QList<Range> ranges;
};