From f9548e5d13f5b644f75f48aa4b0f428b9c079294 Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Fri, 7 Jan 2011 16:55:34 +0100 Subject: [PATCH] Added activates-on to the quick-fixes. Reviewed-by: Christian Kamm --- src/plugins/cppeditor/cppquickfixes.cpp | 41 ++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/src/plugins/cppeditor/cppquickfixes.cpp b/src/plugins/cppeditor/cppquickfixes.cpp index 0a509b68e0..81aee4cdf5 100644 --- a/src/plugins/cppeditor/cppquickfixes.cpp +++ b/src/plugins/cppeditor/cppquickfixes.cpp @@ -79,6 +79,8 @@ namespace { a op b -> !(a invop b) (a op b) -> !(a invop b) !(a op b) -> (a invob b) + + Activates on: <= < > >= == != */ class UseInverseOp: public CppQuickFixFactory { @@ -183,6 +185,8 @@ private: As b flipop a + + Activates on: <= < > >= == != && || */ class FlipBinaryOp: public CppQuickFixFactory { @@ -278,6 +282,8 @@ private: As !(a || b) + + Activates on: && */ class RewriteLogicalAndOp: public CppQuickFixFactory { @@ -361,6 +367,8 @@ private: As int *a; int b; + + Activates on: the type or the variable names. */ class SplitSimpleDeclarationOp: public CppQuickFixFactory { @@ -489,6 +497,8 @@ private: if (a) { b; } + + Activates on: the if */ class AddBracesToIfOp: public CppQuickFixFactory { @@ -560,6 +570,8 @@ private: With Type name = foo; if (name) {...} + + Activates on: the name of the introduced variable */ class MoveDeclarationOutOfIfOp: public CppQuickFixFactory { @@ -635,6 +647,8 @@ private: With Type name; while ((name = foo()) != 0) {...} + + Activates on: the name of the introduced variable */ class MoveDeclarationOutOfWhileOp: public CppQuickFixFactory { @@ -733,6 +747,8 @@ private: x; else if (something_else) x; + + Activates on: && or || */ class SplitIfStatementOp: public CppQuickFixFactory { @@ -860,10 +876,13 @@ private: /* Replace "abcd" -> QLatin1String("abcd") + @"abcd" -> QLatin1String("abcd") 'a' -> QLatin1Char('a') Except if they are already enclosed in QLatin1Char, QT_TRANSLATE_NOOP, tr, trUtf8, QLatin1Literal, QLatin1String + + Activates on: the string literal */ class WrapStringLiteral: public CppQuickFixFactory { @@ -969,6 +988,8 @@ private: QCoreApplication::translate("CONTEXT", "abcd") or QT_TRANSLATE_NOOP("GLOBAL", "abcd") depending on what is available. + + Activates on: the string literal */ class TranslateStringLiteral: public CppQuickFixFactory { @@ -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 { public: @@ -1177,6 +1208,8 @@ private: -017; 0783; // invalid octal 0; // border case, allow only hex<->decimal + + Activates on: numeric literals */ class ConvertNumericLiteral: public CppQuickFixFactory { @@ -1306,6 +1339,8 @@ private: /* 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 { @@ -1438,6 +1473,8 @@ private: As Type a = 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 { @@ -1527,9 +1564,11 @@ private: }; }; -/* +/** * Turns "an_example_symbol" into "anExampleSymbol" and * "AN_EXAMPLE_SYMBOL" into "AnExampleSymbol". + * + * Activates on: identifiers */ class ToCamelCaseConverter : public CppQuickFixFactory { -- 2.11.0