Commit f9548e5d authored by Erik Verbruggen's avatar Erik Verbruggen
Browse files

Added activates-on to the quick-fixes.

Reviewed-by: Christian Kamm
parent ef806894
...@@ -79,6 +79,8 @@ namespace { ...@@ -79,6 +79,8 @@ namespace {
a op b -> !(a invop b) a op b -> !(a invop b)
(a op b) -> !(a invop b) (a op b) -> !(a invop b)
!(a op b) -> (a invob b) !(a op b) -> (a invob b)
Activates on: <= < > >= == !=
*/ */
class UseInverseOp: public CppQuickFixFactory class UseInverseOp: public CppQuickFixFactory
{ {
...@@ -183,6 +185,8 @@ private: ...@@ -183,6 +185,8 @@ private:
As As
b flipop a b flipop a
Activates on: <= < > >= == != && ||
*/ */
class FlipBinaryOp: public CppQuickFixFactory class FlipBinaryOp: public CppQuickFixFactory
{ {
...@@ -278,6 +282,8 @@ private: ...@@ -278,6 +282,8 @@ private:
As As
!(a || b) !(a || b)
Activates on: &&
*/ */
class RewriteLogicalAndOp: public CppQuickFixFactory class RewriteLogicalAndOp: public CppQuickFixFactory
{ {
...@@ -361,6 +367,8 @@ private: ...@@ -361,6 +367,8 @@ private:
As As
int *a; int *a;
int b; int b;
Activates on: the type or the variable names.
*/ */
class SplitSimpleDeclarationOp: public CppQuickFixFactory class SplitSimpleDeclarationOp: public CppQuickFixFactory
{ {
...@@ -489,6 +497,8 @@ private: ...@@ -489,6 +497,8 @@ private:
if (a) { if (a) {
b; b;
} }
Activates on: the if
*/ */
class AddBracesToIfOp: public CppQuickFixFactory class AddBracesToIfOp: public CppQuickFixFactory
{ {
...@@ -560,6 +570,8 @@ private: ...@@ -560,6 +570,8 @@ private:
With With
Type name = foo; Type name = foo;
if (name) {...} if (name) {...}
Activates on: the name of the introduced variable
*/ */
class MoveDeclarationOutOfIfOp: public CppQuickFixFactory class MoveDeclarationOutOfIfOp: public CppQuickFixFactory
{ {
...@@ -635,6 +647,8 @@ private: ...@@ -635,6 +647,8 @@ private:
With With
Type name; Type name;
while ((name = foo()) != 0) {...} while ((name = foo()) != 0) {...}
Activates on: the name of the introduced variable
*/ */
class MoveDeclarationOutOfWhileOp: public CppQuickFixFactory class MoveDeclarationOutOfWhileOp: public CppQuickFixFactory
{ {
...@@ -733,6 +747,8 @@ private: ...@@ -733,6 +747,8 @@ private:
x; x;
else if (something_else) else if (something_else)
x; x;
Activates on: && or ||
*/ */
class SplitIfStatementOp: public CppQuickFixFactory class SplitIfStatementOp: public CppQuickFixFactory
{ {
...@@ -860,10 +876,13 @@ private: ...@@ -860,10 +876,13 @@ private:
/* /*
Replace Replace
"abcd" -> QLatin1String("abcd") "abcd" -> QLatin1String("abcd")
@"abcd" -> QLatin1String("abcd")
'a' -> QLatin1Char('a') 'a' -> QLatin1Char('a')
Except if they are already enclosed in Except if they are already enclosed in
QLatin1Char, QT_TRANSLATE_NOOP, tr, QLatin1Char, QT_TRANSLATE_NOOP, tr,
trUtf8, QLatin1Literal, QLatin1String trUtf8, QLatin1Literal, QLatin1String
Activates on: the string literal
*/ */
class WrapStringLiteral: public CppQuickFixFactory class WrapStringLiteral: public CppQuickFixFactory
{ {
...@@ -969,6 +988,8 @@ private: ...@@ -969,6 +988,8 @@ private:
QCoreApplication::translate("CONTEXT", "abcd") or QCoreApplication::translate("CONTEXT", "abcd") or
QT_TRANSLATE_NOOP("GLOBAL", "abcd") QT_TRANSLATE_NOOP("GLOBAL", "abcd")
depending on what is available. depending on what is available.
Activates on: the string literal
*/ */
class TranslateStringLiteral: public CppQuickFixFactory class TranslateStringLiteral: public CppQuickFixFactory
{ {
...@@ -1086,6 +1107,16 @@ private: ...@@ -1086,6 +1107,16 @@ private:
}; };
}; };
/**
* Replace
* "abcd"
* QLatin1String("abcd")
* QLatin1Literal("abcd")
* With
* @"abcd"
*
* Activates on: the string literal, if the file type is a Objective-C(++) file.
*/
class CStringToNSString: public CppQuickFixFactory class CStringToNSString: public CppQuickFixFactory
{ {
public: public:
...@@ -1177,6 +1208,8 @@ private: ...@@ -1177,6 +1208,8 @@ private:
-017; -017;
0783; // invalid octal 0783; // invalid octal
0; // border case, allow only hex<->decimal 0; // border case, allow only hex<->decimal
Activates on: numeric literals
*/ */
class ConvertNumericLiteral: public CppQuickFixFactory class ConvertNumericLiteral: public CppQuickFixFactory
{ {
...@@ -1306,6 +1339,8 @@ private: ...@@ -1306,6 +1339,8 @@ private:
/* /*
Can be triggered on a class forward declaration to add the matching #include. Can be triggered on a class forward declaration to add the matching #include.
Activates on: the name of a forward-declared class or struct
*/ */
class FixForwardDeclarationOp: public CppQuickFixFactory class FixForwardDeclarationOp: public CppQuickFixFactory
{ {
...@@ -1438,6 +1473,8 @@ private: ...@@ -1438,6 +1473,8 @@ private:
As As
Type a = foo(); Type a = foo();
Where Type is the return type of foo() Where Type is the return type of foo()
Activates on: the assignee, if the type of the right-hand side of the assignment is known.
*/ */
class AddLocalDeclarationOp: public CppQuickFixFactory class AddLocalDeclarationOp: public CppQuickFixFactory
{ {
...@@ -1527,9 +1564,11 @@ private: ...@@ -1527,9 +1564,11 @@ private:
}; };
}; };
/* /**
* Turns "an_example_symbol" into "anExampleSymbol" and * Turns "an_example_symbol" into "anExampleSymbol" and
* "AN_EXAMPLE_SYMBOL" into "AnExampleSymbol". * "AN_EXAMPLE_SYMBOL" into "AnExampleSymbol".
*
* Activates on: identifiers
*/ */
class ToCamelCaseConverter : public CppQuickFixFactory class ToCamelCaseConverter : public CppQuickFixFactory
{ {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment