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>
This commit is contained in:
Tobias Hunger
2013-08-09 17:45:14 +02:00
parent b589336e54
commit ee47b652a6
6 changed files with 184 additions and 23 deletions

View File

@@ -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;
};