Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergey Prigogin2011-11-07 14:00:43 -0500
committerSergey Prigogin2011-11-07 14:04:35 -0500
commitafb3fae823eca93ea486d6aebb4525bfbccac796 (patch)
tree1ec57b44ff4870749ca370f871373deff60ed6a4
parent65673a50e15988ab8840f73eca11e2423db301d4 (diff)
downloadorg.eclipse.cdt-afb3fae823eca93ea486d6aebb4525bfbccac796.tar.gz
org.eclipse.cdt-afb3fae823eca93ea486d6aebb4525bfbccac796.tar.xz
org.eclipse.cdt-afb3fae823eca93ea486d6aebb4525bfbccac796.zip
Automatic formatting of code affected by refactoring.
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/astwriter/ASTWriterTest.java5
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/astwriter/SourceRewriteTester.java6
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/ChangeGeneratorTest.java2
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/insertbefore/AddDeclarationBug.java26
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/insertbefore/ArrayModifierTest.java33
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/insertbefore/ArraySizeExpressionTest.java31
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/insertbefore/CtorChainInitializerTest.java28
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/insertbefore/ExceptionTest.java22
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/insertbefore/ExpressionTest.java26
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/insertbefore/FirstParameterTest.java27
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/insertbefore/InsertBeforeTestSuite.java7
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/insertbefore/MultilineWhitespaceHandlingTest.java28
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/insertbefore/PointerParameterTest.java22
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/insertbefore/SelfInsertionTest.java26
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/replace/MoveRenameTest.java33
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/replace/MoveTest.java32
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/replace/ReplaceInsertStatementTest.java39
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/replace/StatementTest.java28
-rw-r--r--core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterCommentedDeclSpecTestSource.awts5
-rw-r--r--core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterCommentedDeclarationTestSource.awts45
-rw-r--r--core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterCommentedDeclaratorTestSource.awts46
-rw-r--r--core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterCommentedNameTestSource.awts4
-rw-r--r--core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterCommentedStatementTestSource.awts60
-rw-r--r--core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterCommentedTestSource.awts653
-rw-r--r--core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterCommentedTestSource2.awts9
-rw-r--r--core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterDeclSpecTestSource.awts7
-rw-r--r--core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterDeclarationTestSource.awts17
-rw-r--r--core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterDeclaratorTestSource.awts42
-rw-r--r--core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterExpressionTestSource.awts17
-rw-r--r--core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterNameTestSource.awts2
-rw-r--r--core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterStatementTestSource.awts40
-rw-r--r--core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterTemplateTestSource.awts5
-rw-r--r--core/org.eclipse.cdt.core.tests/resources/rewrite/CommentHandlingTestSource.rts19
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/ASTWriter.java108
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/ASTWriterVisitor.java77
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/DeclSpecWriter.java22
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/DeclarationWriter.java48
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/DeclaratorWriter.java26
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/ExpressionWriter.java3
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/InitializerWriter.java3
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/NameWriter.java7
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/NodeWriter.java16
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/Scribe.java75
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/StatementWriter.java36
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/TemplateParameterWriter.java3
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/changegenerator/ASTModificationHelper.java3
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/changegenerator/ChangeGenerator.java317
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/changegenerator/ModifiedASTDeclSpecWriter.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/changegenerator/ModifiedASTDeclarationWriter.java17
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/changegenerator/ModifiedASTDeclaratorWriter.java38
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/changegenerator/ModifiedASTExpressionWriter.java4
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/changegenerator/ModifiedASTStatementWriter.java4
-rw-r--r--core/org.eclipse.cdt.ui.tests/resources/refactoring/DefinitionFinder.rts4
-rw-r--r--core/org.eclipse.cdt.ui.tests/resources/refactoring/ExtractConstant.rts306
-rw-r--r--core/org.eclipse.cdt.ui.tests/resources/refactoring/ExtractConstantHistory.rts90
-rw-r--r--core/org.eclipse.cdt.ui.tests/resources/refactoring/ExtractExpression.rts525
-rw-r--r--core/org.eclipse.cdt.ui.tests/resources/refactoring/ExtractFunctionTemplates.rts69
-rw-r--r--core/org.eclipse.cdt.ui.tests/resources/refactoring/ExtractLocalVariable.rts466
-rw-r--r--core/org.eclipse.cdt.ui.tests/resources/refactoring/ExtractLocalVariableHistory.rts14
-rw-r--r--core/org.eclipse.cdt.ui.tests/resources/refactoring/ExtractMethod.rts1555
-rw-r--r--core/org.eclipse.cdt.ui.tests/resources/refactoring/ExtractMethodDuplicates.rts566
-rw-r--r--core/org.eclipse.cdt.ui.tests/resources/refactoring/ExtractMethodHistory.rts211
-rw-r--r--core/org.eclipse.cdt.ui.tests/resources/refactoring/ExtractMethodPreprocessor.rts173
-rw-r--r--core/org.eclipse.cdt.ui.tests/resources/refactoring/GenerateGettersAndSetters.rts1189
-rw-r--r--core/org.eclipse.cdt.ui.tests/resources/refactoring/HideMethod.rts761
-rw-r--r--core/org.eclipse.cdt.ui.tests/resources/refactoring/HideMethodHistory.rts22
-rw-r--r--core/org.eclipse.cdt.ui.tests/resources/refactoring/ImplementMethod.rts474
-rw-r--r--core/org.eclipse.cdt.ui.tests/resources/refactoring/NewCreationTest.rts17
-rw-r--r--core/org.eclipse.cdt.ui.tests/resources/refactoring/NewImplementRefactoring.rts10
-rw-r--r--core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleCommentsClassToHeader.rts182
-rw-r--r--core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleCommentsHeaderToClass.rts121
-rw-r--r--core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleCommentsHeaderToImpl.rts69
-rw-r--r--core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleCommentsImplToHeader.rts98
-rw-r--r--core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleCtorDtorRefactoring.rts184
-rw-r--r--core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleDefaultParameterRefactoring.rts58
-rw-r--r--core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleDifferentSelections.rts62
-rw-r--r--core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleErrorRefactoring.rts58
-rw-r--r--core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleFreeFunction.rts202
-rw-r--r--core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleNamespaceRefactoring.rts211
-rw-r--r--core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleNestedRefactoring.rts87
-rw-r--r--core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleOrdering.rts198
-rw-r--r--core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleSelection.rts109
-rw-r--r--core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleSimpleFunctionRefactoring.rts130
-rw-r--r--core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleTemplateRefactoring.rts124
-rw-r--r--core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleTryCatchRefactoring.rts211
-rw-r--r--core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleVirtualFunction.rts64
-rw-r--r--core/org.eclipse.cdt.ui.tests/resources/refactoring/TranslationunitHelper.rts6
-rw-r--r--core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/extractfunction/ExtractFunctionTestSuite.java2
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/extractfunction/ExtractFunctionRefactoring.java2
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/extractfunction/ExtractFunctionRefactoringDescription.java4
90 files changed, 5113 insertions, 5726 deletions
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/astwriter/ASTWriterTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/astwriter/ASTWriterTest.java
index 154faa5698..29f9781df2 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/astwriter/ASTWriterTest.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/astwriter/ASTWriterTest.java
@@ -70,11 +70,12 @@ public class ASTWriterTest extends RewriteBaseTest {
}
@Override
- protected void compareFiles(Map<String,TestSourceFile> testResourceFiles) throws Exception {
+ protected void compareFiles(Map<String, TestSourceFile> testResourceFiles) throws Exception {
for (String fileName : testResourceFiles.keySet()) {
TestSourceFile testFile = testResourceFiles.get(fileName);
String code = generateSource(testFile);
- assertEquals(TestHelper.unifyNewLines(testFile.getExpectedSource()), TestHelper.unifyNewLines(code + System.getProperty("line.separator"))); //$NON-NLS-1$
+ assertEquals(TestHelper.unifyNewLines(testFile.getExpectedSource()),
+ TestHelper.unifyNewLines(code + System.getProperty("line.separator"))); //$NON-NLS-1$
}
}
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/astwriter/SourceRewriteTester.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/astwriter/SourceRewriteTester.java
index 7703effae0..ee1b12a3f2 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/astwriter/SourceRewriteTester.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/astwriter/SourceRewriteTester.java
@@ -56,7 +56,7 @@ public class SourceRewriteTester extends TestSuite {
TestSuite suite = new TestSuite(name);
Iterator<RewriteBaseTest> it = testCases.iterator();
while (it.hasNext()) {
- RewriteBaseTest subject =it.next();
+ RewriteBaseTest subject = it.next();
suite.addTest(subject);
}
return suite;
@@ -88,11 +88,11 @@ public class SourceRewriteTester extends TestSuite {
}
private static ArrayList<RewriteBaseTest> createTests(BufferedReader inputReader) throws Exception {
- String line;
ASTWriterTestSourceFile file = null;
MatcherState matcherState = MatcherState.skip;
ArrayList<RewriteBaseTest> testCases = new ArrayList<RewriteBaseTest>();
+ String line;
while ((line = inputReader.readLine()) != null) {
if (lineMatchesBeginOfTest(line)) {
matcherState = MatcherState.inTest;
@@ -156,7 +156,7 @@ public class SourceRewriteTester extends TestSuite {
}
private static RewriteBaseTest createTestClass(String testName, ASTWriterTestSourceFile file) throws Exception {
- ASTWriterTest test = new ASTWriterTest(testName,file);
+ ASTWriterTest test = new ASTWriterTest(testName, file);
TextSelection sel = file.getSelection();
if (sel != null) {
test.setFileWithSelection(file.getName());
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/ChangeGeneratorTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/ChangeGeneratorTest.java
index b2efed6ad0..f40b77b2e2 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/ChangeGeneratorTest.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/ChangeGeneratorTest.java
@@ -49,7 +49,7 @@ public abstract class ChangeGeneratorTest extends BaseTestFramework {
}
@Override
- public void runTest() throws Exception{
+ public void runTest() throws Exception {
final ASTModificationStore modStore = new ASTModificationStore();
IFile testFile = importFile("source.h", source); //$NON-NLS-1$
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/insertbefore/AddDeclarationBug.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/insertbefore/AddDeclarationBug.java
index 98d6a21273..a4ee61615b 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/insertbefore/AddDeclarationBug.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/insertbefore/AddDeclarationBug.java
@@ -7,18 +7,18 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Institute for Software (IFS)- initial API and implementation
+ * Institute for Software (IFS)- initial API and implementation
******************************************************************************/
package org.eclipse.cdt.core.parser.tests.rewrite.changegenerator.insertbefore;
import junit.framework.Test;
+import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclSpecifier;
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration;
import org.eclipse.cdt.core.dom.ast.IASTStandardFunctionDeclarator;
-import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTParameterDeclaration;
import org.eclipse.cdt.core.parser.tests.rewrite.changegenerator.ChangeGeneratorTest;
@@ -29,26 +29,26 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTParameterDeclaration;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTSimpleDeclSpecifier;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTSimpleDeclaration;
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModification;
-import org.eclipse.cdt.internal.core.dom.rewrite.ASTModificationStore;
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModification.ModificationKind;
+import org.eclipse.cdt.internal.core.dom.rewrite.ASTModificationStore;
/**
* @author Emanuel Graf IFS
- *
*/
public class AddDeclarationBug extends ChangeGeneratorTest {
-
-
-
-
- public AddDeclarationBug() {
- super("Add Declaration Bug Test");
+
+ AddDeclarationBug() {
+ super("AddDeclarationBug");
+ }
+
+ public static Test suite() {
+ return new AddDeclarationBug();
}
@Override
protected void setUp() throws Exception {
source = "class A\n{\npublic:\n A();\n virtual ~A();\n int foo();\n \nprivate:\n int help();\n};"; //$NON-NLS-1$
- expectedSource = "class A\n{\npublic:\n A();\n virtual ~A();\n int foo();\n \nprivate:\n int help();\n int exp(int i);\n};"; //$NON-NLS-1$
+ expectedSource = "class A\n{\npublic:\n A();\n virtual ~A();\n int foo();\n \nprivate:\n int help();\n\tint exp(int i);\n};"; //$NON-NLS-1$
super.setUp();
}
@@ -84,8 +84,4 @@ public class AddDeclarationBug extends ChangeGeneratorTest {
}
};
}
-
- public static Test suite() {
- return new AddDeclarationBug();
- }
}
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/insertbefore/ArrayModifierTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/insertbefore/ArrayModifierTest.java
index 5c748a3ec0..68f994fbde 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/insertbefore/ArrayModifierTest.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/insertbefore/ArrayModifierTest.java
@@ -7,40 +7,44 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Institute for Software - initial API and implementation
+ * Institute for Software - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.core.parser.tests.rewrite.changegenerator.insertbefore;
import junit.framework.Test;
+import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTArrayDeclarator;
import org.eclipse.cdt.core.dom.ast.IASTArrayModifier;
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
import org.eclipse.cdt.core.dom.ast.IASTExpression;
-import org.eclipse.cdt.core.dom.ast.ASTVisitor;
+import org.eclipse.cdt.core.dom.ast.IASTLiteralExpression;
import org.eclipse.cdt.core.parser.tests.rewrite.changegenerator.ChangeGeneratorTest;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTArrayModifier;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTLiteralExpression;
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModification;
-import org.eclipse.cdt.internal.core.dom.rewrite.ASTModificationStore;
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModification.ModificationKind;
+import org.eclipse.cdt.internal.core.dom.rewrite.ASTModificationStore;
public class ArrayModifierTest extends ChangeGeneratorTest {
- public ArrayModifierTest(){
- super("Replace Array Modifier"); //$NON-NLS-1$
+ ArrayModifierTest() {
+ super("ArrayModifierTest");
+ }
+
+ public static Test suite() {
+ return new ArrayModifierTest();
}
@Override
protected void setUp() throws Exception {
- source = "int *pi[3];"; //$NON-NLS-1$
- expectedSource = "int *pi[5][3];"; //$NON-NLS-1$
+ source = "int* pi[3];"; //$NON-NLS-1$
+ expectedSource = "int* pi[5][3];"; //$NON-NLS-1$
super.setUp();
}
@Override
- protected ASTVisitor createModificator(
- final ASTModificationStore modStore) {
+ protected ASTVisitor createModificator(final ASTModificationStore modStore) {
return new ASTVisitor() {
{
shouldVisitDeclarators = true;
@@ -49,11 +53,12 @@ public class ArrayModifierTest extends ChangeGeneratorTest {
@Override
public int visit(IASTDeclarator declarator) {
if (declarator instanceof IASTArrayDeclarator) {
- IASTArrayDeclarator arrayDeclarator = (IASTArrayDeclarator)declarator;
-
+ IASTArrayDeclarator arrayDeclarator = (IASTArrayDeclarator) declarator;
+
IASTArrayModifier[] modifiers = arrayDeclarator.getArrayModifiers();
IASTArrayModifier newModifier = new CPPASTArrayModifier();
- IASTExpression expr = new CPPASTLiteralExpression(0, "5"); //$NON-NLS-1$
+ IASTExpression expr =
+ new CPPASTLiteralExpression(IASTLiteralExpression.lk_integer_constant, "5".toCharArray()); //$NON-NLS-1$
newModifier.setConstantExpression(expr);
ASTModification modification = new ASTModification(ModificationKind.INSERT_BEFORE, modifiers[0], newModifier, null);
modStore.storeModification(null, modification);
@@ -62,8 +67,4 @@ public class ArrayModifierTest extends ChangeGeneratorTest {
}
};
}
-
- public static Test suite() {
- return new ArrayModifierTest();
- }
}
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/insertbefore/ArraySizeExpressionTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/insertbefore/ArraySizeExpressionTest.java
index 19767bdc6a..df71239e07 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/insertbefore/ArraySizeExpressionTest.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/insertbefore/ArraySizeExpressionTest.java
@@ -7,17 +7,18 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Institute for Software - initial API and implementation
+ * Institute for Software - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.core.parser.tests.rewrite.changegenerator.insertbefore;
import junit.framework.Test;
+import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTArrayDeclarator;
import org.eclipse.cdt.core.dom.ast.IASTArrayModifier;
import org.eclipse.cdt.core.dom.ast.IASTExpression;
+import org.eclipse.cdt.core.dom.ast.IASTLiteralExpression;
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
-import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNewExpression;
import org.eclipse.cdt.core.parser.tests.rewrite.changegenerator.ChangeGeneratorTest;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTArrayModifier;
@@ -25,25 +26,25 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTLiteralExpression;
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModification;
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModificationStore;
-
-
public class ArraySizeExpressionTest extends ChangeGeneratorTest {
- public ArraySizeExpressionTest(){
- super("Insert Array Size Expression"); //$NON-NLS-1$
+ ArraySizeExpressionTest() {
+ super("ArraySizeExpressionTest");
+ }
+
+ public static Test suite() {
+ return new ArraySizeExpressionTest();
}
@Override
protected void setUp() throws Exception {
- source = "int *values = new int[5];"; //$NON-NLS-1$
- expectedSource = "int *values = new int[6][5];"; //$NON-NLS-1$
+ source = "int* values = new int[5];"; //$NON-NLS-1$
+ expectedSource = "int* values = new int[6][5];"; //$NON-NLS-1$
super.setUp();
}
-
@Override
- protected ASTVisitor createModificator(
- final ASTModificationStore modStore) {
+ protected ASTVisitor createModificator(final ASTModificationStore modStore) {
return new ASTVisitor() {
{
shouldVisitExpressions = true;
@@ -56,7 +57,8 @@ public class ArraySizeExpressionTest extends ChangeGeneratorTest {
IASTTypeId id= newExpression.getTypeId();
IASTArrayDeclarator dtor= (IASTArrayDeclarator) id.getAbstractDeclarator();
IASTArrayModifier[] mods= dtor.getArrayModifiers();
- IASTArrayModifier add= new CPPASTArrayModifier(new CPPASTLiteralExpression(0, "6"));
+ IASTArrayModifier add= new CPPASTArrayModifier(
+ new CPPASTLiteralExpression(IASTLiteralExpression.lk_integer_constant, "6".toCharArray()));
ASTModification modification = new ASTModification(ASTModification.ModificationKind.INSERT_BEFORE, mods[0], add, null);
modStore.storeModification(null, modification);
}
@@ -64,9 +66,4 @@ public class ArraySizeExpressionTest extends ChangeGeneratorTest {
}
};
}
-
- public static Test suite() {
- return new ArraySizeExpressionTest();
-
- }
}
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/insertbefore/CtorChainInitializerTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/insertbefore/CtorChainInitializerTest.java
index 68c0d52dba..983348efcb 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/insertbefore/CtorChainInitializerTest.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/insertbefore/CtorChainInitializerTest.java
@@ -7,14 +7,14 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Institute for Software - initial API and implementation
+ * Institute for Software - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.core.parser.tests.rewrite.changegenerator.insertbefore;
import junit.framework.Test;
-import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
+import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConstructorChainInitializer;
import org.eclipse.cdt.core.parser.tests.rewrite.changegenerator.ChangeGeneratorTest;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTConstructorChainInitializer;
@@ -22,25 +22,28 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTFunctionDeclarator;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTIdExpression;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTName;
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModification;
-import org.eclipse.cdt.internal.core.dom.rewrite.ASTModificationStore;
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModification.ModificationKind;
+import org.eclipse.cdt.internal.core.dom.rewrite.ASTModificationStore;
public class CtorChainInitializerTest extends ChangeGeneratorTest {
- public CtorChainInitializerTest(){
- super("Insert Before Ctor Initializer"); //$NON-NLS-1$
+ CtorChainInitializerTest() {
+ super("CtorChainInitializerTest");
+ }
+
+ public static Test suite() {
+ return new CtorChainInitializerTest();
}
@Override
protected void setUp() throws Exception {
- source = "TestClass::TestClass(int a, int b):beta(b){\n}\n\n"; //$NON-NLS-1$
- expectedSource = "TestClass::TestClass(int a, int b):alpha(a), beta(b){\n}\n\n"; //$NON-NLS-1$
+ source = "TestClass::TestClass(int a, int b):beta(b) {\n}\n\n"; //$NON-NLS-1$
+ expectedSource = "TestClass::TestClass(int a, int b) :\n\t\talpha(a), beta(b) {\n}\n\n"; //$NON-NLS-1$
super.setUp();
}
@Override
- protected ASTVisitor createModificator(
- final ASTModificationStore modStore) {
+ protected ASTVisitor createModificator(final ASTModificationStore modStore) {
return new ASTVisitor() {
{
shouldVisitDeclarators = true;
@@ -49,7 +52,7 @@ public class CtorChainInitializerTest extends ChangeGeneratorTest {
@Override
public int visit(IASTDeclarator declarator) {
if (declarator instanceof CPPASTFunctionDeclarator) {
- CPPASTFunctionDeclarator functionDeclarator = (CPPASTFunctionDeclarator)declarator;
+ CPPASTFunctionDeclarator functionDeclarator = (CPPASTFunctionDeclarator) declarator;
ICPPASTConstructorChainInitializer ctorInitializer = functionDeclarator.getConstructorChain()[0];
CPPASTIdExpression initExpr = new CPPASTIdExpression(new CPPASTName("a".toCharArray())); //$NON-NLS-1$
CPPASTName initName = new CPPASTName("alpha".toCharArray()); //$NON-NLS-1$
@@ -63,9 +66,4 @@ public class CtorChainInitializerTest extends ChangeGeneratorTest {
}
};
}
-
- public static Test suite() {
- return new CtorChainInitializerTest();
-
- }
}
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/insertbefore/ExceptionTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/insertbefore/ExceptionTest.java
index 8525070781..4612e5a13f 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/insertbefore/ExceptionTest.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/insertbefore/ExceptionTest.java
@@ -7,16 +7,16 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Institute for Software - initial API and implementation
+ * Institute for Software - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.core.parser.tests.rewrite.changegenerator.insertbefore;
import junit.framework.Test;
+import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclSpecifier;
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
-import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.parser.tests.rewrite.changegenerator.ChangeGeneratorTest;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTDeclarator;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTFunctionDeclarator;
@@ -24,15 +24,19 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTName;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTSimpleDeclSpecifier;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTTypeId;
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModification;
-import org.eclipse.cdt.internal.core.dom.rewrite.ASTModificationStore;
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModification.ModificationKind;
+import org.eclipse.cdt.internal.core.dom.rewrite.ASTModificationStore;
public class ExceptionTest extends ChangeGeneratorTest {
- public ExceptionTest(){
- super("Insert Before Exception Declaration"); //$NON-NLS-1$
+ ExceptionTest() {
+ super("ExceptionTest");
}
+ public static Test suite() {
+ return new ExceptionTest();
+ }
+
@Override
protected void setUp() throws Exception {
source = "void foo(int parameter) throw (/*Test*/float) /*Test2*/{\n}\n\n"; //$NON-NLS-1$
@@ -41,8 +45,7 @@ public class ExceptionTest extends ChangeGeneratorTest {
}
@Override
- protected ASTVisitor createModificator(
- final ASTModificationStore modStore) {
+ protected ASTVisitor createModificator(final ASTModificationStore modStore) {
return new ASTVisitor() {
{
shouldVisitDeclarators = true;
@@ -69,9 +72,4 @@ public class ExceptionTest extends ChangeGeneratorTest {
}
};
}
-
- public static Test suite() {
- return new ExceptionTest();
-
- }
}
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/insertbefore/ExpressionTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/insertbefore/ExpressionTest.java
index 6dcd8c941e..af06f5d44f 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/insertbefore/ExpressionTest.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/insertbefore/ExpressionTest.java
@@ -7,16 +7,16 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Institute for Software - initial API and implementation
+ * Institute for Software - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.core.parser.tests.rewrite.changegenerator.insertbefore;
import junit.framework.Test;
+import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTBinaryExpression;
import org.eclipse.cdt.core.dom.ast.IASTExpression;
import org.eclipse.cdt.core.dom.ast.IASTExpressionList;
-import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.parser.tests.rewrite.changegenerator.ChangeGeneratorTest;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTBinaryExpression;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTIdExpression;
@@ -25,14 +25,14 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTName;
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModification;
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModificationStore;
-
-
-
-
public class ExpressionTest extends ChangeGeneratorTest {
- public ExpressionTest(){
- super("Insert Expression"); //$NON-NLS-1$
+ ExpressionTest() {
+ super("ExpressionTest");
+ }
+
+ public static Test suite() {
+ return new ExpressionTest();
}
@Override
@@ -41,10 +41,9 @@ public class ExpressionTest extends ChangeGeneratorTest {
expectedSource = "void main(){int s = 0, c = 0, h = 0;\ns = 3, c = 9, h = 5;}"; //$NON-NLS-1$
super.setUp();
}
-
+
@Override
- protected ASTVisitor createModificator(
- final ASTModificationStore modStore) {
+ protected ASTVisitor createModificator(final ASTModificationStore modStore) {
return new ASTVisitor() {
{
shouldVisitExpressions = true;
@@ -63,9 +62,4 @@ public class ExpressionTest extends ChangeGeneratorTest {
}
};
}
-
- public static Test suite() {
- return new ExpressionTest();
-
- }
}
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/insertbefore/FirstParameterTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/insertbefore/FirstParameterTest.java
index 0646e1e596..52e3fc5e10 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/insertbefore/FirstParameterTest.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/insertbefore/FirstParameterTest.java
@@ -7,16 +7,16 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Institute for Software - initial API and implementation
+ * Institute for Software - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.core.parser.tests.rewrite.changegenerator.insertbefore;
import junit.framework.Test;
+import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
import org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration;
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclSpecifier;
-import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.parser.tests.rewrite.changegenerator.ChangeGeneratorTest;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTDeclarator;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTFunctionDeclarator;
@@ -24,17 +24,17 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTName;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTParameterDeclaration;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTSimpleDeclSpecifier;
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModification;
-import org.eclipse.cdt.internal.core.dom.rewrite.ASTModificationStore;
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModification.ModificationKind;
-
-
-
-
+import org.eclipse.cdt.internal.core.dom.rewrite.ASTModificationStore;
public class FirstParameterTest extends ChangeGeneratorTest {
- public FirstParameterTest(){
- super("Insert Before First Parameter"); //$NON-NLS-1$
+ FirstParameterTest() {
+ super("FirstParameterTest");
+ }
+
+ public static Test suite() {
+ return new FirstParameterTest();
}
@Override
@@ -43,11 +43,9 @@ public class FirstParameterTest extends ChangeGeneratorTest {
expectedSource = "void foo(int newParameter, int a){\n}\n\n"; //$NON-NLS-1$
super.setUp();
}
-
@Override
- protected ASTVisitor createModificator(
- final ASTModificationStore modStore) {
+ protected ASTVisitor createModificator(final ASTModificationStore modStore) {
return new ASTVisitor() {
{
shouldVisitDeclarators = true;
@@ -77,9 +75,4 @@ public class FirstParameterTest extends ChangeGeneratorTest {
}
};
}
-
- public static Test suite() {
- return new FirstParameterTest();
-
- }
}
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/insertbefore/InsertBeforeTestSuite.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/insertbefore/InsertBeforeTestSuite.java
index 8790942047..bd847e623a 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/insertbefore/InsertBeforeTestSuite.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/insertbefore/InsertBeforeTestSuite.java
@@ -7,7 +7,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Institute for Software - initial API and implementation
+ * Institute for Software - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.core.parser.tests.rewrite.changegenerator.insertbefore;
@@ -16,12 +16,11 @@ import junit.framework.TestSuite;
/**
* @author Thomas Corbat
- *
*/
-public class InsertBeforeTestSuite{
+public class InsertBeforeTestSuite {
public static Test suite() throws Exception {
- TestSuite suite = new TestSuite("Changegenerator InsertBefore Tests");
+ TestSuite suite = new TestSuite("ChangeGenerator InsertBefore Tests");
suite.addTest(FirstParameterTest.suite());
suite.addTest(PointerParameterTest.suite());
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/insertbefore/MultilineWhitespaceHandlingTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/insertbefore/MultilineWhitespaceHandlingTest.java
index f1b0c65f42..fd334b535b 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/insertbefore/MultilineWhitespaceHandlingTest.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/insertbefore/MultilineWhitespaceHandlingTest.java
@@ -7,50 +7,44 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Institute for Software - initial API and implementation
+ * Institute for Software - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.core.parser.tests.rewrite.changegenerator.insertbefore;
import junit.framework.Test;
+import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTCompoundStatement;
import org.eclipse.cdt.core.dom.ast.IASTDeclarationStatement;
import org.eclipse.cdt.core.dom.ast.IASTForStatement;
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclSpecifier;
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration;
import org.eclipse.cdt.core.dom.ast.IASTStatement;
-import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTSimpleDeclSpecifier;
import org.eclipse.cdt.core.parser.tests.rewrite.changegenerator.ChangeGeneratorTest;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPNodeFactory;
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModification;
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModificationStore;
-
-
-
-
public class MultilineWhitespaceHandlingTest extends ChangeGeneratorTest {
- public MultilineWhitespaceHandlingTest(){
- super("Multiline Whitespace Handling"); //$NON-NLS-1$
- }
-
- @Override
- protected void setUp() throws Exception {
- source = "void foo(){\r\n\r\n for(int i = 0; i < 10; i++){\r\n\r\n }\r\n}\r\n"; //$NON-NLS-1$
- expectedSource = "void foo(){\r\n\r\n for(int i = 0; i < 10; i++){\r\n int i;\r\n int j;\r\n\r\n }\r\n}\r\n"; //$NON-NLS-1$
- super.setUp();
+ MultilineWhitespaceHandlingTest() {
+ super("MultilineWhitespaceHandlingTest");
}
public static Test suite() {
return new MultilineWhitespaceHandlingTest();
}
+ @Override
+ protected void setUp() throws Exception {
+ source = "void foo() {\r\n\r\n\tfor(int i = 0; i < 10; i++) {\r\n\r\n\t}\r\n}\r\n"; //$NON-NLS-1$
+ expectedSource = "void foo() {\r\n\r\n\tfor(int i = 0; i < 10; i++) {\r\n\t\tint i;\r\n\t\tint j;\r\n\r\n\t}\r\n}\r\n"; //$NON-NLS-1$
+ super.setUp();
+ }
@Override
- protected ASTVisitor createModificator(
- final ASTModificationStore modStore) {
+ protected ASTVisitor createModificator(final ASTModificationStore modStore) {
return new ASTVisitor() {
{
shouldVisitStatements = true;
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/insertbefore/PointerParameterTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/insertbefore/PointerParameterTest.java
index 46ae41e6c0..aebdd2799d 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/insertbefore/PointerParameterTest.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/insertbefore/PointerParameterTest.java
@@ -7,27 +7,31 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Institute for Software - initial API and implementation
+ * Institute for Software - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.core.parser.tests.rewrite.changegenerator.insertbefore;
import junit.framework.Test;
+import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
import org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration;
import org.eclipse.cdt.core.dom.ast.IASTPointerOperator;
-import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.parser.tests.rewrite.changegenerator.ChangeGeneratorTest;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTFunctionDeclarator;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTPointer;
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModification;
-import org.eclipse.cdt.internal.core.dom.rewrite.ASTModificationStore;
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModification.ModificationKind;
+import org.eclipse.cdt.internal.core.dom.rewrite.ASTModificationStore;
public class PointerParameterTest extends ChangeGeneratorTest {
- public PointerParameterTest(){
- super("Insert Pointer for Parameter"); //$NON-NLS-1$
+ PointerParameterTest() {
+ super("PointerParameterTest");
+ }
+
+ public static Test suite() {
+ return new PointerParameterTest();
}
@Override
@@ -38,8 +42,7 @@ public class PointerParameterTest extends ChangeGeneratorTest {
}
@Override
- protected ASTVisitor createModificator(
- final ASTModificationStore modStore) {
+ protected ASTVisitor createModificator(final ASTModificationStore modStore) {
return new ASTVisitor() {
{
shouldVisitDeclarators = true;
@@ -63,9 +66,4 @@ public class PointerParameterTest extends ChangeGeneratorTest {
}
};
}
-
- public static Test suite() {
- return new PointerParameterTest();
-
- }
}
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/insertbefore/SelfInsertionTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/insertbefore/SelfInsertionTest.java
index 946678acd0..ebaf97b3a3 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/insertbefore/SelfInsertionTest.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/insertbefore/SelfInsertionTest.java
@@ -7,7 +7,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Institute for Software - initial API and implementation
+ * Institute for Software - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.core.parser.tests.rewrite.changegenerator.insertbefore;
@@ -21,31 +21,25 @@ import org.eclipse.cdt.core.parser.tests.rewrite.changegenerator.ChangeGenerator
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModification;
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModificationStore;
-
-
-
-
public class SelfInsertionTest extends ChangeGeneratorTest {
- public SelfInsertionTest(){
- super("Self Insertion Test"); //$NON-NLS-1$
- }
-
- @Override
- protected void setUp() throws Exception {
- source = "void foo(){\r\n\r\n for(int i = 0; i < 10; i++){\r\n }\r\n}\r\n"; //$NON-NLS-1$
- expectedSource = "void foo(){\r\n\r\n for(int i = 0; i < 10; i++){\r\n for(int i = 0;i < 10;i++){\r\n }\r\n }\r\n}\r\n"; //$NON-NLS-1$
- super.setUp();
+ SelfInsertionTest() {
+ super("SelfInsertionTest");
}
public static Test suite() {
return new SelfInsertionTest();
}
+ @Override
+ protected void setUp() throws Exception {
+ source = "void foo() {\r\n\r\n\tfor (int i = 0; i < 10; i++) {\r\n\t}\r\n}\r\n"; //$NON-NLS-1$
+ expectedSource = "void foo() {\r\n\r\n\tfor (int i = 0; i < 10; i++) {\r\n\t\tfor (int i = 0; i < 10; i++) {\r\n\t\t}\r\n\t}\r\n}\r\n"; //$NON-NLS-1$
+ super.setUp();
+ }
@Override
- protected ASTVisitor createModificator(
- final ASTModificationStore modStore) {
+ protected ASTVisitor createModificator(final ASTModificationStore modStore) {
return new ASTVisitor() {
{
shouldVisitStatements = true;
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/replace/MoveRenameTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/replace/MoveRenameTest.java
index a6b0409d91..57cbb37f25 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/replace/MoveRenameTest.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/replace/MoveRenameTest.java
@@ -7,16 +7,16 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Institute for Software - initial API and implementation
+ * Institute for Software - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.core.parser.tests.rewrite.changegenerator.replace;
import junit.framework.Test;
+import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
import org.eclipse.cdt.core.dom.ast.IASTName;
-import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier;
import org.eclipse.cdt.core.parser.tests.rewrite.changegenerator.ChangeGeneratorTest;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTCompositeTypeSpecifier;
@@ -25,32 +25,25 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTSimpleDeclaration;
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModification;
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModificationStore;
-
-
-
-
public class MoveRenameTest extends ChangeGeneratorTest {
- public MoveRenameTest(){
- super("Swap Rename Declarations"); //$NON-NLS-1$
+ MoveRenameTest() {
+ super("MoveRenameTest");
+ }
+
+ public static Test suite() {
+ return new MoveRenameTest();
}
-
+
@Override
protected void setUp() throws Exception {
-
- source = "#ifndef A_H_\r\n#define A_H_\r\n\r\nclass A {\r\n\r\nprivate:\r\n int b;\r\n int a;\r\n};\r\n\r\n#endif /*A_H_*/\r\n\r\n"; //$NON-NLS-1$
- expectedSource = "#ifndef A_H_\r\n#define A_H_\r\n\r\nclass A {\r\n\r\nprivate:\r\n int d;\r\n int b;\r\n};\r\n\r\n#endif /*A_H_*/\r\n\r\n"; //$NON-NLS-1$
+ source = "#ifndef A_H_\r\n#define A_H_\r\n\r\nclass A {\r\n\r\nprivate:\r\n\tint b;\r\n\tint a;\r\n};\r\n\r\n#endif /*A_H_*/\r\n\r\n"; //$NON-NLS-1$
+ expectedSource = "#ifndef A_H_\r\n#define A_H_\r\n\r\nclass A {\r\n\r\nprivate:\r\n\tint d;\r\n\tint b;\r\n};\r\n\r\n#endif /*A_H_*/\r\n\r\n"; //$NON-NLS-1$
super.setUp();
}
-
- public static Test suite() {
- return new MoveRenameTest();
- }
-
@Override
- protected ASTVisitor createModificator(
- final ASTModificationStore modStore) {
+ protected ASTVisitor createModificator(final ASTModificationStore modStore) {
return new ASTVisitor() {
{
shouldVisitDeclSpecifiers = true;
@@ -70,8 +63,6 @@ public class MoveRenameTest extends ChangeGeneratorTest {
}
return super.visit(declSpec);
}
-
};
}
-
}
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/replace/MoveTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/replace/MoveTest.java
index 9904ceebd8..a5c48afa3a 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/replace/MoveTest.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/replace/MoveTest.java
@@ -7,46 +7,40 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Institute for Software - initial API and implementation
+ * Institute for Software - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.core.parser.tests.rewrite.changegenerator.replace;
import junit.framework.Test;
+import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
-import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier;
import org.eclipse.cdt.core.parser.tests.rewrite.changegenerator.ChangeGeneratorTest;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTCompositeTypeSpecifier;
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModification;
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModificationStore;
-
-
-
-
public class MoveTest extends ChangeGeneratorTest {
- public MoveTest(){
- super("Swap Declarations"); //$NON-NLS-1$
+ MoveTest() {
+ super("MoveTest");
}
-
+
+ public static Test suite() {
+ return new MoveTest();
+ }
+
@Override
protected void setUp() throws Exception {
- source = "#ifndef A_H_\r\n#define A_H_\r\n\r\nclass A {\r\n\r\nprivate:\r\n int b;\r\n int a;\r\n};\r\n\r\n#endif /*A_H_*/\r\n\r\n"; //$NON-NLS-1$
- expectedSource = "#ifndef A_H_\r\n#define A_H_\r\n\r\nclass A {\r\n\r\nprivate:\r\n int a;\r\n int b;\r\n};\r\n\r\n#endif /*A_H_*/\r\n\r\n"; //$NON-NLS-1$
+ source = "#ifndef A_H_\r\n#define A_H_\r\n\r\nclass A {\r\n\r\nprivate:\r\n\tint b;\r\n\tint a;\r\n};\r\n\r\n#endif /*A_H_*/\r\n\r\n"; //$NON-NLS-1$
+ expectedSource = "#ifndef A_H_\r\n#define A_H_\r\n\r\nclass A {\r\n\r\nprivate:\r\n\tint a;\r\n\tint b;\r\n};\r\n\r\n#endif /*A_H_*/\r\n\r\n"; //$NON-NLS-1$
super.setUp();
}
-
- public static Test suite() {
- return new MoveTest();
-
- }
@Override
- protected ASTVisitor createModificator(
- final ASTModificationStore modStore) {
+ protected ASTVisitor createModificator(final ASTModificationStore modStore) {
return new ASTVisitor() {
{
shouldVisitDeclSpecifiers = true;
@@ -64,8 +58,6 @@ public class MoveTest extends ChangeGeneratorTest {
}
return super.visit(declSpec);
}
-
};
}
-
}
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/replace/ReplaceInsertStatementTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/replace/ReplaceInsertStatementTest.java
index 7f44495590..ec9997d57c 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/replace/ReplaceInsertStatementTest.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/replace/ReplaceInsertStatementTest.java
@@ -7,12 +7,13 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Institute for Software - initial API and implementation
+ * Institute for Software - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.core.parser.tests.rewrite.changegenerator.replace;
import junit.framework.Test;
+import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTBinaryExpression;
import org.eclipse.cdt.core.dom.ast.IASTCompoundStatement;
import org.eclipse.cdt.core.dom.ast.IASTExpressionStatement;
@@ -20,7 +21,6 @@ import org.eclipse.cdt.core.dom.ast.IASTIdExpression;
import org.eclipse.cdt.core.dom.ast.IASTLiteralExpression;
import org.eclipse.cdt.core.dom.ast.IASTStatement;
import org.eclipse.cdt.core.dom.ast.IASTUnaryExpression;
-import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.parser.tests.rewrite.changegenerator.ChangeGeneratorTest;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTBinaryExpression;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTExpressionStatement;
@@ -33,43 +33,37 @@ import org.eclipse.cdt.internal.core.dom.rewrite.ASTModificationStore;
public class ReplaceInsertStatementTest extends ChangeGeneratorTest {
- public ReplaceInsertStatementTest() {
- super("Replace Insert Statement Test");
+ ReplaceInsertStatementTest() {
+ super("ReplaceInsertStatementTest");
+ }
+
+ public static Test suite() {
+ return new ReplaceInsertStatementTest();
}
@Override
protected void setUp() throws Exception {
- source = "void main(){\r\n int i = 0;\r\n ++i;\r\n}"; //$NON-NLS-1$
- expectedSource = "void main(){\r\n int i = 0;\r\n i = 42;\r\n i++;\r\n}"; //$NON-NLS-1$
+ source = "void main() {\r\n\tint i = 0;\r\n\t++i;\r\n}"; //$NON-NLS-1$
+ expectedSource = "void main() {\r\n\tint i = 0;\r\n\ti = 42;\r\n\ti++;\r\n}"; //$NON-NLS-1$
super.setUp();
}
- public static Test suite() {
- return new ReplaceInsertStatementTest();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.tests.rewrite.changegenerator.ChangeGeneratorTest#createModificator(org.eclipse.cdt.internal.core.dom.rewrite.ASTModificationStore)
- */
@Override
- protected ASTVisitor createModificator(
- final ASTModificationStore modStore) {
+ protected ASTVisitor createModificator(final ASTModificationStore modStore) {
return new ASTVisitor() {
{
shouldVisitStatements = true;
}
-
@Override
public int visit(IASTStatement statement) {
if (statement instanceof IASTCompoundStatement) {
IASTCompoundStatement compStmt = (IASTCompoundStatement) statement;
IASTStatement stmt = compStmt.getStatements()[1];
- IASTIdExpression id = new CPPASTIdExpression(
- new CPPASTName("i".toCharArray()));
+ IASTIdExpression id = new CPPASTIdExpression(new CPPASTName("i".toCharArray()));
IASTLiteralExpression value = new CPPASTLiteralExpression(
- IASTLiteralExpression.lk_integer_constant, "42");
+ IASTLiteralExpression.lk_integer_constant, "42".toCharArray());
IASTExpressionStatement insertStmt = new CPPASTExpressionStatement(
new CPPASTBinaryExpression(
IASTBinaryExpression.op_assign, id, value));
@@ -82,15 +76,12 @@ public class ReplaceInsertStatementTest extends ChangeGeneratorTest {
incExp);
ASTModification replaceMod = new ASTModification(
- ASTModification.ModificationKind.REPLACE, stmt,
- replaceStatement, null);
+ ASTModification.ModificationKind.REPLACE, stmt, replaceStatement, null);
modStore.storeModification(null, replaceMod);
ASTModification insertMod = new ASTModification(
- ASTModification.ModificationKind.INSERT_BEFORE,
- stmt, insertStmt, null);
+ ASTModification.ModificationKind.INSERT_BEFORE, stmt, insertStmt, null);
modStore.storeModification(null, insertMod);
-
}
return PROCESS_CONTINUE;
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/replace/StatementTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/replace/StatementTest.java
index 6bad67fc41..a45f81c17f 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/replace/StatementTest.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/replace/StatementTest.java
@@ -7,16 +7,16 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Institute for Software - initial API and implementation
+ * Institute for Software - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.core.parser.tests.rewrite.changegenerator.replace;
import junit.framework.Test;
+import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTIfStatement;
import org.eclipse.cdt.core.dom.ast.IASTStatement;
import org.eclipse.cdt.core.dom.ast.IASTUnaryExpression;
-import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.parser.tests.rewrite.changegenerator.ChangeGeneratorTest;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTCompoundStatement;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTExpressionStatement;
@@ -26,31 +26,25 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTUnaryExpression;
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModification;
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModificationStore;
-
-
-
-
public class StatementTest extends ChangeGeneratorTest {
+
+ StatementTest() {
+ super("StatementTest");
+ }
- public StatementTest(){
- super("Replace Then-Statement"); //$NON-NLS-1$
+ public static Test suite() {
+ return new StatementTest();
}
@Override
protected void setUp() throws Exception {
- source = "int f()\r\n{\r\n\tint i = 0;\r\n\tif(i < 1){\r\n\t\t++i;\r\n\t}\r\n}\r\n"; //$NON-NLS-1$
- expectedSource = "int f()\r\n{\r\n\tint i = 0;\r\n\tif(i < 1){\r\n\t i++;\r\n\t}\r\n}\r\n"; //$NON-NLS-1$
+ source = "int f()\r\n{\r\n\tint i = 0;\r\n\tif (i < 1) {\r\n\t\t++i;\r\n\t}\r\n}\r\n"; //$NON-NLS-1$
+ expectedSource = "int f()\r\n{\r\n\tint i = 0;\r\n\tif (i < 1) {\r\n\t\ti++;\r\n\t}\r\n}\r\n"; //$NON-NLS-1$
super.setUp();
}
- public static Test suite() {
- return new StatementTest();
- }
-
-
@Override
- protected ASTVisitor createModificator(
- final ASTModificationStore modStore) {
+ protected ASTVisitor createModificator(final ASTModificationStore modStore) {
return new ASTVisitor() {
{
shouldVisitStatements = true;
diff --git a/core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterCommentedDeclSpecTestSource.awts b/core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterCommentedDeclSpecTestSource.awts
index 7dca475d67..255cd87c3d 100644
--- a/core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterCommentedDeclSpecTestSource.awts
+++ b/core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterCommentedDeclSpecTestSource.awts
@@ -11,11 +11,12 @@ const int a = 1;
//Test3
volatile int b = 3;
//Test4
-typedef int *intp;
+typedef int* intp;
//Test5
extern int b;
//Test6
static int c;
+
//Test7
int foo()
{
@@ -59,7 +60,7 @@ public:
//!Commented ElaboratedTypeSpecifier 1
//%CPP
//Test1
-class A *A; //Test2
+class A* A; //Test2
//Test3
enum Status{ good, bad}; //Test4
//Test5
diff --git a/core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterCommentedDeclarationTestSource.awts b/core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterCommentedDeclarationTestSource.awts
index 8a28473db0..f09bc5f059 100644
--- a/core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterCommentedDeclarationTestSource.awts
+++ b/core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterCommentedDeclarationTestSource.awts
@@ -76,42 +76,51 @@ extern "C" typedef void FUNC(); /*TEST 2*/
//!Commented NamespaceAlias 1
//%CPP
//TEST 1
-namespace kurz = ziemlichlangernamespace; //TEST 2
+namespace kurz = somenamespace; //TEST 2
//!Commented NamespaceAlias 2
//%CPP
/*TEST 1*/
-namespace kurz = ziemlichlangernamespace; /*TEST 2*/
+namespace kurz = somenamespace; /*TEST 2*/
//!Commented NamespaceDefinition 1
//%CPP
//TEST 1
-namespace ziemlichlangernamespace
+namespace namespace1
{
- //TEST 2
+
+//TEST 2
+
} //TEST 3
//!Commented NamespaceDefinition 2
//%CPP
/*TEST 1*/
-namespace ziemlichlangernamespace
+namespace namespace2
{
- /*TEST 2*/
+
+/*TEST 2*/
+
} /*TEST 3*/
//!Commented NamespaceDefinition 3
//%CPP
-namespace ziemlichlangernamespace
+namespace namespace3
{
- //TEST
+
+//TEST
+
}
//!Commented NamespaceDefinition 4
//%CPP
-namespace ziemlichlangernamespace
+namespace namespace4
{
- //TEST
+
+//TEST
+
}
+
void doIt()
{
int i = 0;
@@ -158,8 +167,9 @@ template<> class MyQueue<double> //TEST 2
{
//TEST 3
std::vector<double> data;
+
public:
- void Add(const double& );
+ void Add(const double&);
void Remove();
void Print();
//TEST 4
@@ -173,8 +183,9 @@ template<> class MyQueue<double> /*TEST 2*/
{
/*TEST 3*/
std::vector<double> data;
+
public:
- void Add(const double& );
+ void Add(const double&);
void Remove();
void Print();
/*TEST 4*/
@@ -214,9 +225,11 @@ class A
//TEST 1
public: //TEST 2
int hallo();
+
/*TEST 3*/
protected: /*TEST 4*/
int b, c;
+
private:
int p;
};
@@ -231,13 +244,13 @@ int i = 2; //TEST 2
/*TEST 1*/
int i = 2; /*TEST 2*/
-//!Commented typename qualfier 1
+//!Commented typename qualifier 1
//%CPP
//TEST 1
-typename T::A *a6; //TEST 2
+typename T::A* a6; //TEST 2
-//!Commented typename qualfier 2
+//!Commented typename qualifier 2
//%CPP
/*TEST 1*/
-typename T::A *a6; /*TEST 2*/
+typename T::A* a6; /*TEST 2*/
diff --git a/core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterCommentedDeclaratorTestSource.awts b/core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterCommentedDeclaratorTestSource.awts
index 564bcd0506..407ee5bfeb 100644
--- a/core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterCommentedDeclaratorTestSource.awts
+++ b/core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterCommentedDeclaratorTestSource.awts
@@ -8,7 +8,7 @@ void foo()
{
int f();
};
- int (B::* pb)() = &B::f;
+ int (B::*pb)() = &B::f;
}
@@ -22,13 +22,14 @@ void foo()
{
int f();
};
- int (B::* pb)() = &B::f;
+ int (B::*pb)() = &B::f;
}
//!Commented CPPFunctionDeclaratorTest 1
//%CPP
-char & operator [](unsigned int);
+char& operator [](unsigned int);
+
//TEST 1
TestClass::TestClass(int a) //TEST 2
{
@@ -38,7 +39,8 @@ TestClass::TestClass(int a) //TEST 2
//!Commented CPPFunctionDeclaratorTest 2
//%CPP
-char & operator [](unsigned int);
+char& operator [](unsigned int);
+
/*TEST 1*/
TestClass::TestClass(int a) /*TEST 2*/
{
@@ -48,7 +50,8 @@ TestClass::TestClass(int a) /*TEST 2*/
//!Commented CPPFunctionDeclaratorTest 3
//%CPP
-char & operator [](unsigned int);
+char& operator [](unsigned int);
+
//TEST 1
TestClass::TestClass(int a)
:alpha(a) //TEST 2
@@ -59,7 +62,8 @@ TestClass::TestClass(int a)
//!Commented CPPFunctionDeclaratorTest 4
//%CPP
-char & operator [](unsigned int);
+char& operator [](unsigned int);
+
/*TEST 1*/
TestClass::TestClass(int a)
:alpha(a) /*TEST 3*/
@@ -76,7 +80,7 @@ void foo()
try {
i++;
}
- catch(...){
+ catch (...){
}
}
@@ -90,7 +94,7 @@ void foo()
try {
i++;
}
- catch(...){
+ catch (...){
}
}
@@ -104,7 +108,7 @@ void foo()
//Test
i++;
}
- catch(...){
+ catch (...){
}
}
@@ -118,7 +122,7 @@ void foo()
{
i++;
}
- catch(...){
+ catch (...){
}
}
@@ -132,7 +136,7 @@ void foo()
//Test
i++;
}
- catch(...){
+ catch (...){
}
}
@@ -145,7 +149,7 @@ void foo()
try {
i++; //Test
}
- catch(...){
+ catch (...){
}
}
@@ -159,7 +163,7 @@ void foo()
i++;
//Test
}
- catch(...){
+ catch (...){
}
}
@@ -172,7 +176,7 @@ void foo()
try {
i++;
} //Test
- catch(...){
+ catch (...){
}
}
@@ -185,7 +189,7 @@ void foo()
try {
i++;
}
- catch(...){
+ catch (...){
//Test
}
}
@@ -199,7 +203,7 @@ void foo()
try {
i++;
}
- catch(...){
+ catch (...){
//Test
}
}
@@ -213,7 +217,7 @@ void foo()
try {
i++;
}
- catch(...){
+ catch (...){
}
//Test
}
@@ -227,9 +231,9 @@ void foo()
try {
i++;
}
- catch(Overflow oo){
+ catch (Overflow oo){
}
- catch(Matherr mm){
+ catch (Matherr mm){
}
}
@@ -242,9 +246,9 @@ void foo()
try {
i++;
}
- catch(Overflow oo){
+ catch (Overflow oo){
}
- catch(Matherr mm){
+ catch (Matherr mm){
//Test
}
}
diff --git a/core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterCommentedNameTestSource.awts b/core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterCommentedNameTestSource.awts
index b6009c399a..916e7952ba 100644
--- a/core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterCommentedNameTestSource.awts
+++ b/core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterCommentedNameTestSource.awts
@@ -30,7 +30,7 @@ class Foo
{
public:
//Test
- char & operator [](unsigned int);
+ char& operator [](unsigned int);
};
//!Commented OperatorName2
@@ -38,7 +38,7 @@ public:
class Foo
{
public:
- char & operator [](unsigned int); //Test
+ char& operator [](unsigned int); //Test
};
//!Commented ConversionName1
diff --git a/core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterCommentedStatementTestSource.awts b/core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterCommentedStatementTestSource.awts
index 9a790cd0c9..7f6a0c46ac 100644
--- a/core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterCommentedStatementTestSource.awts
+++ b/core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterCommentedStatementTestSource.awts
@@ -2,7 +2,7 @@
//%CPP
void foo()
{
- while(true){
+ while (true){
//TEST 1
break; //TEST 2
}
@@ -13,7 +13,7 @@ void foo()
//%CPP
void foo()
{
- while(true){
+ while (true){
/*TEST 1*/
break; /*TEST 2*/
}
@@ -62,7 +62,7 @@ void foo()
//%CPP
void foo()
{
- while(true){
+ while (true){
//TEST 1
continue; //TEST 2
}
@@ -73,7 +73,7 @@ void foo()
//%CPP
void foo()
{
- while(true){
+ while (true){
/*TEST 1*/
continue; /*TEST 2*/
}
@@ -112,7 +112,7 @@ void foo()
do{ //TEST 2
continue; //TEST 3
//TEST 4
- } while(true); //TEST 5
+ } while (true); //TEST 5
}
@@ -124,7 +124,7 @@ void foo()
//TEST 2
continue; //TEST 3
//TEST 4
- } while(true); //TEST 5
+ } while (true); //TEST 5
}
@@ -136,7 +136,7 @@ void foo()
do{ /*TEST 2*/
continue; /*TEST 3*/
/*TEST 4*/
- } while(true); /*TEST 5*/
+ } while (true); /*TEST 5*/
}
@@ -148,7 +148,7 @@ void foo()
/*TEST 2*/
continue; /*TEST 3*/
/*TEST 4*/
- } while(true); /*TEST 5*/
+ } while (true); /*TEST 5*/
}
@@ -158,7 +158,7 @@ void foo()
{
do{
continue;
- } while(true); /*TEST 1*/
+ } while (true); /*TEST 1*/
}
@@ -197,7 +197,7 @@ void foo()
void foo()
{
//TEST 1
- for(int i = 0;i < 1;++i){ //TEST 2
+ for (int i = 0;i < 1;++i){ //TEST 2
break; //TEST 3
} //TEST 4
}
@@ -207,7 +207,7 @@ void foo()
void foo()
{
//TEST 1
- for(int i = 0;i < 1;++i){
+ for (int i = 0;i < 1;++i){
//TEST 2
break; //TEST 3
} //TEST 4
@@ -219,7 +219,7 @@ void foo()
void foo()
{
/*TEST 1*/
- for(int i = 0;i < 1;++i){ /*TEST 2*/
+ for (int i = 0;i < 1;++i){ /*TEST 2*/
break; /*TEST 3*/
} /*TEST 4*/
}
@@ -229,7 +229,7 @@ void foo()
void foo()
{
/*TEST 1*/
- for(int i = 0;i < 1;++i){
+ for (int i = 0;i < 1;++i){
/*TEST 2*/
break; /*TEST 3*/
} /*TEST 4*/
@@ -240,7 +240,7 @@ void foo()
//%CPP
void foo()
{
- for(int i = 0;i < 1;++i){
+ for (int i = 0;i < 1;++i){
break;
} /*TEST 4*/
}
@@ -385,7 +385,7 @@ void foo()
//%CPP
int f()
{
- if(int c = f()){
+ if (int c = f()){
c++;
} //TEST 1
return i;
@@ -398,7 +398,7 @@ int f()
{
int i = 0;
//TEST 1
- if(i < 1){
+ if (i < 1){
//TEST 3
++i;
//TEST 4
@@ -407,7 +407,7 @@ int f()
--i;
//TEST 6
} //TEST 7
- if(int c = f()){
+ if (int c = f()){
c++;
} //TEST 8
return i;
@@ -420,7 +420,7 @@ int f()
{
int i = 0;
/*TEST 1*/
- if(i < 1){
+ if (i < 1){
/*TEST 1*/
++i;
/*TEST 1*/
@@ -429,7 +429,7 @@ int f()
--i;
/*TEST 1*/
} /*TEST 1*/
- if(int c = f()){
+ if (int c = f()){
c++;
} /*TEST 1*/
return i;
@@ -440,7 +440,7 @@ int f()
//%CPP
int g()
{
- if(10 > 5) //TEST 1
+ if (10 > 5) //TEST 1
return 1; //TEST 2
return 0;
@@ -449,7 +449,7 @@ int g()
//=
int g()
{
- if(10 > 5)
+ if (10 > 5)
//TEST 1
return 1; //TEST 2
@@ -460,7 +460,7 @@ int g()
//%CPP
int g()
{
- if(10 > 5) /*TEST 1*/
+ if (10 > 5) /*TEST 1*/
return 1; /*TEST 2*/
return 0;
@@ -469,7 +469,7 @@ int g()
//=
int g()
{
- if(10 > 5)
+ if (10 > 5)
/*TEST 1*/
return 1; /*TEST 2*/
@@ -583,7 +583,7 @@ void foo()
void foo()
{
//TEST 1
- while(true){ //TEST 2
+ while (true){ //TEST 2
//TEST 3
break; //TEST 4
//TEST 5
@@ -595,7 +595,7 @@ void foo()
void foo()
{
//TEST 1
- while(true){
+ while (true){
//TEST 2
//TEST 3
break; //TEST 4
@@ -609,7 +609,7 @@ void foo()
void foo()
{
/*TEST 1*/
- while(true){ /*TEST 2*/
+ while (true){ /*TEST 2*/
/*TEST 3*/
break; /*TEST 4*/
/*TEST 5*/
@@ -621,7 +621,7 @@ void foo()
void foo()
{
/*TEST 1*/
- while(true){
+ while (true){
/*TEST 2*/
/*TEST 3*/
break; /*TEST 4*/
@@ -634,7 +634,7 @@ void foo()
//%CPP
void foo()
{
- while(true){
+ while (true){
break;
} /*TEST 6*/
}
@@ -650,10 +650,10 @@ int foo()
++i;
return i;
}
- catch(...){
+ catch (...){
}
}
- catch(...){
+ catch (...){
}
}
diff --git a/core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterCommentedTestSource.awts b/core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterCommentedTestSource.awts
index 87a1133feb..a91d64e3e9 100644
--- a/core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterCommentedTestSource.awts
+++ b/core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterCommentedTestSource.awts
@@ -1,45 +1,49 @@
//!CommentRecognition000
//%CPP
-class Klasse0
+class Class0
{
public:
- Klasse0(); /*
+ Class0(); /*
* Comment
*/
std::string toString();
+
private:
int i;
};
//=
-class Klasse0
+class Class0
{
public:
- Klasse0(); /*
+ Class0(); /*
* Comment
*/
std::string toString();
+
private:
int i;
};
//!CommentRecognition00
//%CPP
-class Klasse0
+class Class0
{
public:
- Klasse0(); //Comment
+ Class0(); //Comment
std::string toString();
+
private:
int i;
};
//=
-class Klasse0
+class Class0
{
public:
- Klasse0(); //Comment
+ Class0(); //Comment
std::string toString();
+
private:
int i;
};
@@ -47,12 +51,13 @@ private:
//!CommentRecognition0
//%CPP
//Comment1
-class Klasse0
+class Class0
{
//Comment2
public:
- Klasse0();
+ Class0();
std::string toString();
+
private:
int i;
};
@@ -131,6 +136,7 @@ public:
void lala();
//test
virtual ~test();
+
protected:
class test2
{
@@ -153,6 +159,7 @@ public:
void lala();
//test
virtual ~test();
+
protected:
class test2
{
@@ -175,6 +182,7 @@ public:
void lala();
//test
virtual ~test();
+
protected:
class test2
{
@@ -187,7 +195,7 @@ protected:
//%CPP
class test
{
- //Klasse...
+ //Class...
public:
test();
/*
@@ -196,6 +204,7 @@ public:
void lala();
//test
virtual ~test();
+
protected:
class test2
{
@@ -206,122 +215,133 @@ protected:
//!CommentRecognition1 - von CERP
//%CPP
-class Klasse1
+class Class1
{
//TEST
public:
- Klasse1();
+ Class1();
std::string toString();
+
private:
int i;
};
//!CommentRecognition2 - von CERP
//%CPP
-class Klasse1
+class Class1
{
public: //TEST
- Klasse1();
+ Class1();
std::string toString();
+
private:
int i;
};
//!CommentRecognition3 - von CERP
//%CPP
-class Klasse1
+class Class1
{
public:
//TEST
- Klasse1();
+ Class1();
std::string toString();
+
private:
int i;
};
//!CommentRecognition4 - von CERP
//%CPP
-class Klasse1
+class Class1
{
public:
- Klasse1();
+ Class1();
std::string toString();
+
private:
int i;
};
//!CommentRecognition5 - von CERP
//%CPP
-class Klasse1
+class Class1
{ //TEST
public:
- Klasse1();
+ Class1();
std::string toString();
+
private:
int i;
};
//=
-class Klasse1
+class Class1
{
//TEST
public:
- Klasse1();
+ Class1();
std::string toString();
+
private:
int i;
};
//!CommentRecognition6 - von CERP
//%CPP
-class Klasse1{ //TEST
+class Class1{ //TEST
public:
- Klasse1();
+ Class1();
std::string toString();
+
private:
int i;
};
//=
-class Klasse1
+class Class1
{
//TEST
public:
- Klasse1();
+ Class1();
std::string toString();
+
private:
int i;
};
//!CommentRecognition7 - von CERP
//%CPP
-class Klasse1
+class Class1
{//TEST
public:
- Klasse1();
+ Class1();
std::string toString();
+
private:
int i;
};
//=
-class Klasse1
+class Class1
{
//TEST
public:
- Klasse1();
+ Class1();
std::string toString();
+
private:
int i;
};
//!CommentRecognition8 - von CERP
//%CPP
-class Klasse1
+class Class1
{
public:
- Klasse1();
+ Class1();
std::string toString();
+
private:
int i;
int i = 5; //lala
@@ -329,75 +349,82 @@ private:
//!CommentRecognition9 - von CERP
//%CPP
-class Klasse1
+class Class1
{
/*TEST*/
public:
- Klasse1();
+ Class1();
std::string toString();
+
private:
int i;
};
//!CommentRecognition10 - von CERP
//%CPP
-class Klasse1{ /*TEST*/
+class Class1{ /*TEST*/
public:
- Klasse1();
+ Class1();
std::string toString();
+
private:
int i;
};
//=
-class Klasse1
+class Class1
{
/*TEST*/
public:
- Klasse1();
+ Class1();
std::string toString();
+
private:
int i;
};
//!CommentRecognition11 - von CERP
//%CPP
-class Klasse1
+class Class1
{
public: /*TEST*/
- Klasse1();
+ Class1();
std::string toString();
+
private:
int i;
};
//!CommentRecognition11b - von CERP
//%CPP
-class Klasse1
+class Class1
{
-public: /*TEST*/ Klasse1();
+public: /*TEST*/ Class1();
std::string toString();
+
private:
int i;
};
//=
-class Klasse1
+class Class1
{
public: /*TEST*/
- Klasse1();
+ Class1();
std::string toString();
+
private:
int i;
};
//!CommentRecognition12 - von CERP
//%CPP
-class Klasse1
+class Class1
{
public:
- Klasse1();
+ Class1();
std::string toString();
+
private:
int i;
int i = 5; /*TEST*/
@@ -405,25 +432,27 @@ private:
//!CommentRecognition13 - von CERP
//%CPP
-class Klasse1
+class Class1
{
/*
* TEST
*/
public:
- Klasse1();
+ Class1();
std::string toString();
+
private:
int i;
};
//!CommentRecognition14 - von CERP
//%CPP
-class Klasse1
+class Class1
{
public:
- Klasse1();
+ Class1();
std::string toString();
+
private:
int i;
int i = 5; /*
@@ -433,47 +462,51 @@ private:
//!CommentRecognition15 - von CERP
//%CPP
-class Klasse1
+class Class1
{
public: /*
* TEST
*/
- Klasse1();
+ Class1();
std::string toString();
+
private:
int i;
};
//!CommentRecognition16 - von CERP
//%CPP
-class Klasse1{ //Test mit
+class Class1{ //Test mit
//2 Zeilen
public:
- Klasse1();
+ Class1();
std::string toString();
+
private:
int i;
};
//=
-class Klasse1
+class Class1
{
//Test mit
//2 Zeilen
public:
- Klasse1();
+ Class1();
std::string toString();
+
private:
int i;
};
//!CommentRecognition17 - von CERP
//%CPP
-class Klasse1
+class Class1
{
public:
- Klasse1();
+ Class1();
std::string toString();
+
private:
int i;
int i = 5; //Test mit
@@ -482,48 +515,52 @@ private:
//!CommentRecognition18 - von CERP
//%CPP
-class Klasse1{
+class Class1{
//Test mit
//2 Zeilen
public:
- Klasse1();
+ Class1();
std::string toString();
+
private:
int i;
};
//=
-class Klasse1
+class Class1
{
//Test mit
//2 Zeilen
public:
- Klasse1();
+ Class1();
std::string toString();
+
private:
int i;
};
//!CommentRecognition19 - von CERP
//%CPP
-class Klasse1
+class Class1
{
//Test mit
//2 Zeilen
public:
- Klasse1();
+ Class1();
std::string toString();
+
private:
int i;
};
//!CommentRecognition20 - von CERP
//%CPP
-class Klasse1
+class Class1
{
public:
- Klasse1();
+ Class1();
std::string toString();
+
void inlineMethode()
{
int i = 0;
@@ -536,11 +573,12 @@ private:
//!CommentRecognition21 - von CERP
//%CPP
-class Klasse1
+class Class1
{
public:
- Klasse1();
+ Class1();
std::string toString();
+
void inlineMethode()
{
int i = 0; //TEST
@@ -552,11 +590,12 @@ public:
//!CommentRecognition22 - von CERP
//%CPP
-class Klasse1
+class Class1
{
public:
- Klasse1();
+ Class1();
std::string toString();
+
void inlineMethode()
{
int i = 0;
@@ -569,11 +608,12 @@ private:
//!CommentRecognition23 - von CERP
//%CPP
-class Klasse1
+class Class1
{
public:
- Klasse1();
+ Class1();
std::string toString();
+
//KommentarDavor
void inlineMethode()
{
@@ -587,11 +627,12 @@ private:
//!CommentRecognition24 - von CERP
//%CPP
-class Klasse1
+class Class1
{
public:
- Klasse1();
+ Class1();
std::string toString();
+
void inlineMethode()
{
int i = 0;
@@ -604,11 +645,12 @@ private:
//!CommentRecognition25 - von CERP
//%CPP
-class Klasse1
+class Class1
{
public:
- Klasse1();
+ Class1();
std::string toString();
+
void inlineMethode()
{
int i = 0;
@@ -622,11 +664,12 @@ private:
//!CommentRecognition26 - von CERP
//%CPP
-class Klasse1
+class Class1
{
public:
- Klasse1();
+ Class1();
std::string toString();
+
void inlineMethode()
{
int i = 0;
@@ -641,11 +684,12 @@ private:
//!CommentRecognition27 - von CERP
//%CPP
-class Klasse1
+class Class1
{
public:
- Klasse1();
+ Class1();
std::string toString();
+
void inlineMethode()
{
int i = 0;
@@ -658,11 +702,12 @@ private:
//!CommentRecognition28 - von CERP
//%CPP
-class Klasse1
+class Class1
{
public:
- Klasse1();
+ Class1();
std::string toString();
+
void inlineMethode()
{
int i = 0;
@@ -676,11 +721,12 @@ private:
//!CommentRecognition29 - von CERP
//%CPP
-class Klasse1
+class Class1
{
public:
- Klasse1();
+ Class1();
std::string toString();
+
void inlineMethode()
{
int i = 0;
@@ -695,11 +741,12 @@ private:
//!CommentRecognition30 - von CERP
//%CPP
-class Klasse1
+class Class1
{
public:
- Klasse1();
+ Class1();
std::string toString();
+
//TEST
void inlineMethode()
{
@@ -713,11 +760,12 @@ private:
//!CommentRecognition31 - von CERP
//%CPP
-class Klasse1
+class Class1
{
public:
- Klasse1();
+ Class1();
std::string toString();
+
/*TEST*/
void inlineMethode()
{
@@ -732,11 +780,12 @@ private:
//!CommentRecognition32 - von CERP
//%CPP
//Vorher
-class Klasse1 //Nachher
+class Class1 //Nachher
{
public:
- Klasse1();
+ Class1();
std::string toString();
+
void inlineMethode()
{
int i = 0;
@@ -750,11 +799,12 @@ private:
//!CommentRecognition33 - von CERP
//%CPP
//Vorher
-class Klasse1 /*Nachher*/
+class Class1 /*Nachher*/
{
public:
- Klasse1();
+ Class1();
std::string toString();
+
void inlineMethode()
{
int i = 0;
@@ -768,12 +818,13 @@ private:
//!CommentRecognition34 - von CERP
//%CPP
/*Vorher*/
-class Klasse1
+class Class1
{
/*Nachher*/
public:
- Klasse1();
+ Class1();
std::string toString();
+
void inlineMethode()
{
int i = 0;
@@ -787,12 +838,13 @@ private:
//!CommentRecognition35 - von CERP
//%CPP
/*Vorher*/
-class Klasse1
+class Class1
{
//Nachher
public:
- Klasse1();
+ Class1();
std::string toString();
+
void inlineMethode()
{
int i = 0;
@@ -808,12 +860,13 @@ private:
/*
* Vorher
*/
-class Klasse1
+class Class1
{
//Nachher
public:
- Klasse1();
+ Class1();
std::string toString();
+
void inlineMethode()
{
int i = 0;
@@ -826,11 +879,12 @@ private:
//!CommentRecognition37 - von CERP
//%CPP
-class Klasse1
+class Class1
{
public:
- Klasse1();
+ Class1();
std::string toString();
+
void inlineMethode()
{
int i = 0;
@@ -843,11 +897,12 @@ private:
//!CommentRecognition38 - von CERP
//%CPP
-class Klasse1
+class Class1
{
public:
- Klasse1();
+ Class1();
std::string toString();
+
void inlineMethode()
{
int i = 0;
@@ -860,11 +915,12 @@ private:
//!CommentRecognition39 - von CERP
//%CPP
-class Klasse1
+class Class1
{
public:
- Klasse1();
+ Class1();
std::string toString();
+
void inlineMethode()
{
int i = 0;
@@ -879,11 +935,12 @@ private:
//!CommentRecognition40 - von CERP
//%CPP
-class Klasse1
+class Class1
{
public:
- Klasse1();
+ Class1();
std::string toString();
+
void inlineMethode()
{
int i = 0;
@@ -899,11 +956,12 @@ private:
//!CommentRecognition41 - von CERP
//%CPP
-class Klasse1
+class Class1
{
public:
- Klasse1();
+ Class1();
std::string toString();
+
void inlineMethode()
{
int i = 0;
@@ -917,11 +975,12 @@ private:
//!CommentRecognition42 - von CERP
//%CPP
-class Klasse1
+class Class1
{
public:
- Klasse1();
+ Class1();
std::string toString();
+
void inlineMethode()
{
int i = 0;
@@ -935,7 +994,7 @@ private:
//!CommentRecognition43 - von CERP
//%CPP
-class Klasse1
+class Class1
{
private:
int i;
@@ -943,7 +1002,7 @@ private:
//!CommentRecognition44 - von CERP
//%CPP
-class Klasse1
+class Class1
{
private:
int i;
@@ -952,7 +1011,7 @@ private:
//!CommentRecognition44b - von CERP
//%CPP
-class Klasse1
+class Class1
{
private:
int i; //TEST
@@ -960,7 +1019,7 @@ private:
//!CommentRecognition44c - von CERP
//%CPP
-class Klasse1
+class Class1
{
private:
int i;
@@ -969,7 +1028,7 @@ private:
//!CommentRecognition44d - von CERP
//%CPP
-class Klasse1
+class Class1
{
private:
int i;
@@ -979,7 +1038,7 @@ private:
//!CommentRecognition45 - von CERP
//%CPP
-class Klasse1
+class Class1
{
private:
//TEST
@@ -988,7 +1047,7 @@ private:
//!CommentRecognition46 - von CERP
//%CPP
-class Klasse1
+class Class1
{
//TEST
private:
@@ -997,137 +1056,148 @@ private:
//!CommentRecognition47 - von CERP
//%CPP
-class Klasse1
+class Class1
{
public:
- Klasse1();
+ Class1();
std::string toString();
+
private: //TEST
int i;
};
//!CommentRecognition48 - von CERP
//%CPP
-class Klasse1
+class Class1
{
//TEST
public: /*TEST*/
- Klasse1();
+ Class1();
std::string toString();
+
private:
int i;
};
//!CommentRecognition48b - von CERP
//%CPP
-class Klasse1
+class Class1
{
//TEST
public: /*TEST*/
- Klasse1();
+ Class1();
std::string toString();
+
private:
int i;
};
//!CommentRecognition49 - von CERP
//%CPP
-class Klasse1
+class Class1
{
public:
- Klasse1(); //TEST1
+ Class1(); //TEST1
//TEST2
std::string toString();
+
private:
int i;
};
//!CommentRecognition50 - von CERP
//%CPP
-class Klasse1
+class Class1
{
public:
- Klasse1(); /*TEST1*/
+ Class1(); /*TEST1*/
/*TEST2*/
std::string toString();
+
private:
int i;
};
//!CommentRecognition51 - von CERP
//%CPP
-class Klasse1
+class Class1
{
public:
- Klasse1(); //TEST1
+ Class1(); //TEST1
/*TEST2*/
std::string toString();
+
private:
int i;
};
//!CommentRecognition52 - von CERP
//%CPP
-class Klasse1
+class Class1
{
public:
- Klasse1(); /*TEST1*/
+ Class1(); /*TEST1*/
//TEST2
std::string toString();
+
private:
int i;
};
//!CommentRecognition53 - von CERP
//%CPP
-class Klasse1
+class Class1
{
public:
- Klasse1(); /*TEST1*/
+ Class1(); /*TEST1*/
//TEST3
//TEST2
std::string toString();
+
private:
int i;
};
//!CommentRecognition54 - von CERP
//%CPP
-class Klasse1
+class Class1
{
public:
- Klasse1(); /*TEST1*/
+ Class1(); /*TEST1*/
/*TEST3*/
//TEST2
std::string toString();
+
private:
int i;
};
//!CommentRecognition55 - von CERP
//%CPP
-class Klasse1
+class Class1
{
public:
- Klasse1(); //TEST1
+ Class1(); //TEST1
/*
* TEST3
*/
std::string toString();
+
private:
int i;
};
//!CommentRecognition56 - von CERP
//%CPP
-class Klasse1
+class Class1
{
public:
- Klasse1(); /*
+ Class1(); /*
* TEST1
*/
//TEST2
std::string toString();
+
private:
int i;
};
@@ -1136,27 +1206,31 @@ private:
//%CPP
namespace testNamespace
{
- class Klasse1
- {
- public:
- Klasse1();
- std::string toString();
- private:
- int i;
- };
+
+class Class1
+{
+public:
+ Class1();
+ std::string toString();
+
+private:
+ int i;
+};
+
}
//!CommentRecognition58 - von CERP
//%CPP
-//Kommentar
+//Comment
namespace testNamespace
{
-class Klasse1
+class Class1
{
public:
- Klasse1();
+ Class1();
std::string toString();
+
private:
int i;
};
@@ -1164,224 +1238,264 @@ private:
}
//=
-//Kommentar
+//Comment
namespace testNamespace
{
- class Klasse1
- {
- public:
- Klasse1();
- std::string toString();
- private:
- int i;
- };
+
+class Class1
+{
+public:
+ Class1();
+ std::string toString();
+
+private:
+ int i;
+};
+
}
//!CommentRecognition59 - von CERP
//%CPP
-namespace testNamespace //Kommentar
+namespace testNamespace //Comment
{
- class Klasse1
- {
- public:
- Klasse1();
- std::string toString();
- private:
- int i;
- };
+
+class Class1
+{
+public:
+ Class1();
+ std::string toString();
+
+private:
+ int i;
+};
+
}
//!CommentRecognition60 - von CERP
//%CPP
-/*Kommentar*/
+/*Comment*/
namespace testNamespace
{
- class Klasse1
- {
- public:
- Klasse1();
- std::string toString();
- private:
- int i;
- };
+
+class Class1
+{
+public:
+ Class1();
+ std::string toString();
+
+private:
+ int i;
+};
+
}
//!CommentRecognition61 - von CERP
//%CPP
-namespace testNamespace /*Kommentar*/
+namespace testNamespace /*Comment*/
{
- class Klasse1
- {
- public:
- Klasse1();
- std::string toString();
- private:
- int i;
- };
+
+class Class1
+{
+public:
+ Class1();
+ std::string toString();
+
+private:
+ int i;
+};
+
}
//!CommentRecognition62 - von CERP
//%CPP
/*
- * Kommentar
+ * Comment
*/
namespace testNamespace
{
- class Klasse1
- {
- public:
- Klasse1();
- std::string toString();
- private:
- int i;
- };
+
+class Class1
+{
+public:
+ Class1();
+ std::string toString();
+
+private:
+ int i;
+};
+
}
//!CommentRecognition63 - von CERP
//%CPP
namespace testNamespace /*
- * Kommentar
+ * Comment
*/
{
- class Klasse1
- {
- public:
- Klasse1();
- std::string toString();
- private:
- int i;
- };
+
+class Class1
+{
+public:
+ Class1();
+ std::string toString();
+
+private:
+ int i;
+};
+
}
//!CommentRecognition64 - von CERP
//%CPP
namespace testNamespace
{
- class Klasse1
- {
- public:
- Klasse1();
- std::string toString();
- private:
- int i;
- };
-} //Kommentar
+
+class Class1
+{
+public:
+ Class1();
+ std::string toString();
+
+private:
+ int i;
+};
+
+} //Comment
//!CommentRecognition65 - von CERP
//%CPP
namespace testNamespace
{
- class Klasse1
- {
- public:
- Klasse1();
- std::string toString();
- private:
- int i;
- };
-} /*Kommentar*/
+
+class Class1
+{
+public:
+ Class1();
+ std::string toString();
+
+private:
+ int i;
+};
+
+} /*Comment*/
//!CommentRecognition66 - von CERP
//%CPP
namespace testNamespace
{
- class Klasse1
- {
- public:
- Klasse1();
- std::string toString();
- private:
- int i;
- };
+
+class Class1
+{
+public:
+ Class1();
+ std::string toString();
+
+private:
+ int i;
+};
+
} /*
- * Kommentar
+ * Comment
*/
//!CommentRecognition67 - von CERP
//%CPP
namespace testNamespace
{
- class Klasse1 //TEST
- {
- public:
- Klasse1();
- std::string toString();
- private:
- int i;
- };
+
+class Class1 //TEST
+{
+public:
+ Class1();
+ std::string toString();
+
+private:
+ int i;
+};
+
}
//!CommentRecognition68 - von CERP
//%CPP
namespace testNamespace
{
- class Klasse1
- {
- public:
- Klasse1();
- std::string toString();
- private:
- int i; //TEST
- };
+
+class Class1
+{
+public:
+ Class1();
+ std::string toString();
+
+private:
+ int i; //TEST
+};
+
}
//!CommentRecognition69 - von CERP
//%CPP
namespace testNamespace
{
- class Klasse1
- {
- public:
- Klasse1();
- std::string toString();
- private:
- int i;
- }; //TEST
+
+class Class1
+{
+public:
+ Class1();
+ std::string toString();
+
+private:
+ int i;
+}; //TEST
+
}
//!CommentRecognition100 - von CERP
//%CPP
-struct Klasse1
+struct Class1
{
public:
- Klasse1();
+ Class1();
std::string toString();
+
private:
int i;
};
//!CommentRecognition101 - von CERP
//%CPP
-//Kommentar
-struct Klasse1
+//Comment
+struct Class1
{
public:
- Klasse1();
+ Class1();
std::string toString();
+
private:
int i;
};
//!CommentRecognition102 - von CERP
//%CPP
-struct Klasse1
+struct Class1
{
- //Kommentar
+ //Comment
public:
- Klasse1();
+ Class1();
std::string toString();
+
private:
int i;
};
//!CommentRecognition103 - von CERP
//%CPP
-struct Klasse1
+struct Class1
{
- //Kommentar
+ //Comment
private:
- Klasse1();
+ Class1();
std::string toString();
+
protected:
int i;
};
@@ -1389,11 +1503,12 @@ protected:
//!CommentRecognition104 - von CERP
//%CPP
/*Davor*/
-struct Klasse1 //Kommentar
+struct Class1 //Comment
{
private:
- Klasse1();
+ Class1();
std::string toString();
+
protected:
int i;
};
diff --git a/core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterCommentedTestSource2.awts b/core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterCommentedTestSource2.awts
index 42b22752dd..5568c0a37d 100644
--- a/core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterCommentedTestSource2.awts
+++ b/core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterCommentedTestSource2.awts
@@ -1,6 +1,7 @@
//!Commented TemplateFunction1
//%CPP
-template<typename T> int tempFunct(T p)
+template<typename T>
+int tempFunct(T p)
{
++p;
//Kommentar
@@ -12,7 +13,8 @@ template<typename T> int tempFunct(T p)
//!Commented TemplateFunction2
//%CPP
//Kommentar
-template<typename T> int tempFunct(T p)
+template<typename T>
+int tempFunct(T p)
{
++p;
p + 4;
@@ -22,7 +24,8 @@ template<typename T> int tempFunct(T p)
//!Commented TemplateFunction3
//%CPP
-template<typename T> int tempFunct(T p)
+template<typename T>
+int tempFunct(T p)
{
++p;
p + 4;
diff --git a/core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterDeclSpecTestSource.awts b/core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterDeclSpecTestSource.awts
index ae154ea268..542373ff4c 100644
--- a/core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterDeclSpecTestSource.awts
+++ b/core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterDeclSpecTestSource.awts
@@ -7,9 +7,10 @@ inline int foo()
const int a = 1;
volatile int b = 3;
-typedef int *intp;
+typedef int* intp;
extern int b;
static int c;
+
int foo()
{
int i = 1;
@@ -43,7 +44,7 @@ public:
//!ElaboratedTypeSpecifier
//%CPP
-class A *A;
+class A* A;
enum Status{ good, bad};
enum Status stat;
union D
@@ -52,7 +53,7 @@ union D
int y;
};
union D d;
-struct S *S;
+struct S* S;
//!EnumeratioSpecifier
//%CPP
diff --git a/core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterDeclarationTestSource.awts b/core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterDeclarationTestSource.awts
index 4280ae8027..14653f5cc8 100644
--- a/core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterDeclarationTestSource.awts
+++ b/core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterDeclarationTestSource.awts
@@ -32,12 +32,14 @@ extern "C" typedef void FUNC();
//!NamespaceAlias
//%CPP
-namespace kurz = ziemlichlangernamespace;
+namespace kurz = somenamespace;
//!NamespaceDefinition
//%CPP
-namespace ziemlichlangernamespace
+namespace somenamespace
{
+
+
}
//!TemplateDeclaration
@@ -58,8 +60,9 @@ template<typename T> class MyQueue;
template<> class MyQueue<double>
{
std::vector<double> data;
+
public:
- void Add(const double& );
+ void Add(const double&);
void Remove();
void Print();
};
@@ -92,9 +95,11 @@ using namespace B;
class A
{
public:
- int hallo();
+ int hello();
+
protected:
int b, c;
+
private:
int p;
};
@@ -104,7 +109,7 @@ private:
//Comment
int i = 2;
-//!typename qualfier
+//!Typename qualifier
//%CPP
-typename T::A *a6;
+typename T::A* a6;
diff --git a/core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterDeclaratorTestSource.awts b/core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterDeclaratorTestSource.awts
index 0c541c209c..97c1ba19ac 100644
--- a/core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterDeclaratorTestSource.awts
+++ b/core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterDeclaratorTestSource.awts
@@ -1,22 +1,23 @@
//!DeclaratorTest
//%CPP
int sd;
-int *ip;
+int* ip;
int hs = 1;
-char & c;
+char& c;
+
void foo()
{
struct B
{
int f();
};
- int (B::* pb)() = &B::f;
+ int (B::*pb)() = &B::f;
}
//!ArrayDeclaratorTest
//%CPP
-int *pi[3];
+int* pi[3];
int (*p3i)[3];
//!FieldDeclaratorTest
@@ -30,38 +31,39 @@ struct Bit
//%C
int foo();
int bar(int a, int b);
-int fun(const char *a, ...);
-int fun3(int i, const char *a, ...);
+int fun(const char* a, ...);
+int fun3(int i, const char* a, ...);
//!CPPStandardFunctionDeclaratorTest
//%CPP
int foo();
int bar(int a, int b);
-int fun(const char *a, ...);
-int fun2(const char *a ...);
-int fun3(int i, const char *a, ...);
+int fun(const char* a, ...);
+int fun2(const char* a ...);
+int fun3(int i, const char* a, ...);
//= ,... is synonymous with ...
int foo();
int bar(int a, int b);
-int fun(const char *a, ...);
-int fun2(const char *a, ...);
-int fun3(int i, const char *a, ...);
+int fun(const char* a, ...);
+int fun2(const char* a, ...);
+int fun3(int i, const char* a, ...);
//!CPPFunctionDeclaratorTest
//%CPP
-char & operator [](unsigned int);
+char& operator [](unsigned int);
class TestClass
{
int alpha;
TestClass(int a);
- virtual void pure() =0;
+ virtual void pure() = 0;
};
+
TestClass::TestClass(int a)
:alpha(a)
{
}
-void undefPar(const char *c) throw (int);
+void undefPar(const char* c) throw (int);
int getV() const;
int vol() volatile;
@@ -72,15 +74,17 @@ class C
{
int i;
double d;
+
public:
C(int, double);
};
+
C::C(int ii, double id)
try
:i(f(ii)), d(id)
{
}
-catch(...){
+catch (...){
}
@@ -94,7 +98,7 @@ int b, a;
//!ICPPASTDeclarator with nested declarator being a variable
//%C
-int *(*var[3]);
+int* (*var[3]);
//!ICPPASTDeclarator with nested declarator and redundant parentheses
//%C
@@ -108,8 +112,8 @@ class Foo
};
//!ICPPASTReferenceOperator rvalue reference
//%CPP
-int && foo(int && a)
+int&& foo(int&& a)
{
- char && b;
+ char&& b;
}
diff --git a/core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterExpressionTestSource.awts b/core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterExpressionTestSource.awts
index 345c445398..b2d0faa9f8 100644
--- a/core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterExpressionTestSource.awts
+++ b/core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterExpressionTestSource.awts
@@ -4,10 +4,10 @@ int i = (int)'A';
//!CPPCastExpression
//%CPP
-TestClass *i = dynamic_cast<TestClass*>(tc);
-TestClass *i = static_cast<TestClass*>(tc);
-TestClass *i = reinterpret_cast<TestClass*>(tc);
-TestClass *i = const_cast<TestClass*>(tc);
+TestClass* i = dynamic_cast<TestClass*>(tc);
+TestClass* i = static_cast<TestClass*>(tc);
+TestClass* i = reinterpret_cast<TestClass*>(tc);
+TestClass* i = const_cast<TestClass*>(tc);
//!ArraySubscrition
//%C GNU
@@ -33,6 +33,7 @@ int i = 1 | x;
bool b = 1 && x;
bool b = 1 || x;
int i = x;
+
void foo()
{
i *= x;
@@ -131,7 +132,7 @@ string s = "abc";
//!CPPLiteralExpression
//%CPP
-TestClass *tc = this;
+TestClass* tc = this;
bool b = true;
bool b = false;
@@ -141,7 +142,7 @@ int i = ++a;
int i = --a;
int i = +a;
int i = -a;
-int *b = &a;
+int* b = &a;
int i = *b;
int i = ~b;
bool b = !false;
@@ -167,7 +168,7 @@ void rethrow()
int i = 1;
throw i;
}
- catch(int j){
+ catch (int j){
throw ;
}
}
@@ -191,7 +192,7 @@ void f()
//!CPPNewExpression
//%CPP
-TestClass *tc = new TestClass();
+TestClass* tc = new TestClass();
//!CPPSimpleTypeConstructorExpression
//%CPP
diff --git a/core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterNameTestSource.awts b/core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterNameTestSource.awts
index 11081af153..9117bb41bb 100644
--- a/core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterNameTestSource.awts
+++ b/core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterNameTestSource.awts
@@ -11,7 +11,7 @@ int TestClass::Hallo;
class Foo
{
public:
- char & operator [](unsigned int);
+ char& operator [](unsigned int);
};
//!ConversionName
diff --git a/core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterStatementTestSource.awts b/core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterStatementTestSource.awts
index 0d1dfe14ba..a322f51b19 100644
--- a/core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterStatementTestSource.awts
+++ b/core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterStatementTestSource.awts
@@ -2,7 +2,7 @@
//%CPP
void foo()
{
- while(true){
+ while (true){
break;
}
}
@@ -41,7 +41,7 @@ void foo()
//%CPP
void foo()
{
- while(true){
+ while (true){
continue;
}
}
@@ -62,7 +62,7 @@ void foo()
{
do{
continue;
- } while(true);
+ } while (true);
}
@@ -79,13 +79,13 @@ void foo()
//%CPP
void foo()
{
- for(int i = 0;i < 1;++i){
+ for (int i = 0;i < 1;++i){
break;
}
- for(;;){
+ for (;;){
break;
}
- for(;int c = f();){
+ for (;int c = f();){
c++;
}
}
@@ -96,7 +96,7 @@ void foo()
void foo()
{
int i;
- for(i = 0;i < 1;++i){
+ for (i = 0;i < 1;++i){
}
}
@@ -115,12 +115,12 @@ int f()
int f()
{
int i = 0;
- if(i < 1){
+ if (i < 1){
++i;
}else{
--i;
}
- if(int c = f()){
+ if (int c = f()){
c++;
}
return i;
@@ -131,7 +131,7 @@ int f()
//%CPP
int g()
{
- if(10 > 5)
+ if (10 > 5)
return 1;
return 0;
@@ -141,7 +141,7 @@ int g()
//%C
int g()
{
- if(10 > 5)
+ if (10 > 5)
return 1;
return 0;
@@ -240,14 +240,14 @@ int foo(int a)
//%CPP
void foo()
{
- while(true){
+ while (true){
break;
}
}
void fa()
{
- while(int i = f()){
+ while (int i = f()){
++i;
break;
}
@@ -255,7 +255,7 @@ void fa()
void fb()
{
- while(true);
+ while (true);
}
@@ -263,7 +263,7 @@ void fb()
//%C
void foo()
{
- while(true){
+ while (true){
break;
}
}
@@ -279,10 +279,10 @@ int foo()
++i;
return i;
}
- catch(...){
+ catch (...){
}
}
- catch(...){
+ catch (...){
}
}
@@ -293,7 +293,7 @@ int foo()
int foo()
{
int i = 1;
- if( i == ZWO)
+ if (i == ZWO)
{
}
}
@@ -301,7 +301,7 @@ int foo()
int foo()
{
int i = 1;
- if( i == ZWO)
+ if (i == ZWO)
{
}
}
@@ -309,5 +309,5 @@ int foo()
//!ArrayDeclarationStatementTest
//%CPP
-string *newElements = new string[m_capacity];
+string* newElements = new string[m_capacity];
diff --git a/core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterTemplateTestSource.awts b/core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterTemplateTestSource.awts
index c11a70ff3c..32ff7264c8 100644
--- a/core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterTemplateTestSource.awts
+++ b/core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterTemplateTestSource.awts
@@ -1,10 +1,11 @@
//![temp.names] examples abschnitt 4/1
//%CPP
-T *p1 = p->template alloc<100>();
+T* p1 = p->template alloc<100>();
//![temp.names] examples abschnitt 4/2, didn't work cause of Bug# 164482
//%CPP
-template<class T> void f(T *p)
+template<class T>
+void f(T* p)
{
T::template adjust<100>();
}
diff --git a/core/org.eclipse.cdt.core.tests/resources/rewrite/CommentHandlingTestSource.rts b/core/org.eclipse.cdt.core.tests/resources/rewrite/CommentHandlingTestSource.rts
index 07dac1713b..422b99ae02 100644
--- a/core/org.eclipse.cdt.core.tests/resources/rewrite/CommentHandlingTestSource.rts
+++ b/core/org.eclipse.cdt.core.tests/resources/rewrite/CommentHandlingTestSource.rts
@@ -148,6 +148,7 @@ class Klasse0
public:
Klasse0(); //Comment
std::string toString();
+
private:
int i;
};
@@ -170,6 +171,7 @@ class Klasse0
public:
Klasse1();
std::string toString();
+
private:
int i;
};
@@ -182,6 +184,7 @@ class Klasse0
public:
Klasse1();
std::string toString();
+
private:
int i;
}; = //Comment1
@@ -2779,26 +2782,26 @@ int foo = bar; = //Zweiteilig
//#org.eclipse.cdt.core.parser.tests.rewrite.comenthandler.CommentHandlingTest
//@Klasse1.h
//TEST 1
-namespace ziemlichlangernamespace
+namespace somenamespace
{
//TEST 2
} //TEST 3
//=
=>leading
-namespace ziemlichlangernamespace
+namespace somenamespace
{
//TEST 2
} = //TEST 1
=>trailing
-namespace ziemlichlangernamespace
+namespace somenamespace
{
//TEST 2
} = //TEST 3
=>freestanding
-namespace ziemlichlangernamespace
+namespace somenamespace
{
//TEST 2
} = //TEST 2
@@ -2807,7 +2810,7 @@ namespace ziemlichlangernamespace
//!CommentRecognition215 - von ASTWriter NamesapceDefinition
//#org.eclipse.cdt.core.parser.tests.rewrite.comenthandler.CommentHandlingTest
//@Klasse1.h
-namespace ziemlichlangernamespace
+namespace somenamespace
{
//TEST
}
@@ -2822,7 +2825,7 @@ void doIt(){
=>trailing
=>freestanding
-namespace ziemlichlangernamespace
+namespace somenamespace
{
//TEST
} = //TEST
@@ -2830,7 +2833,7 @@ namespace ziemlichlangernamespace
//!CommentRecognition216 - von ASTWriter NamesapceDefinition
//#org.eclipse.cdt.core.parser.tests.rewrite.comenthandler.CommentHandlingTest
//@Klasse1.h
-namespace ziemlichlangernamespace
+namespace somenamespace
{
int i = 0;
//TEST
@@ -2846,7 +2849,7 @@ void doIt(){
=>trailing
=>freestanding
-namespace ziemlichlangernamespace
+namespace somenamespace
{
int i = 0;
//TEST
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/ASTWriter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/ASTWriter.java
index 8752230ea2..5b7229e5de 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/ASTWriter.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/ASTWriter.java
@@ -8,10 +8,19 @@
*
* Contributors:
* Institute for Software - initial API and implementation
+ * Sergey Prigogin (Google)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.rewrite.astwriter;
+import org.eclipse.cdt.core.dom.ast.IASTASMDeclaration;
+import org.eclipse.cdt.core.dom.ast.IASTCompoundStatement;
+import org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition;
+import org.eclipse.cdt.core.dom.ast.IASTIfStatement;
import org.eclipse.cdt.core.dom.ast.IASTNode;
+import org.eclipse.cdt.core.dom.ast.IASTStatement;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNamespaceDefinition;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateDeclaration;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTVisibilityLabel;
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModificationStore;
import org.eclipse.cdt.internal.core.dom.rewrite.changegenerator.ChangeGeneratorWriterVisitor;
import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.ASTCommenter;
@@ -19,9 +28,7 @@ import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.NodeCommentMap;
/**
* ASTWriter main class. Generates source code from <code>IASTNode</code>.
- * Uses a <code>hangeGeneratorWriterVisitor</code> to generate the code for the given nodes.
- *
- * @see ChangeGeneratorWriterVisitor
+ * Uses a {@link ChangeGeneratorWriterVisitor} to generate the code for the given nodes.
*
* @author Emanuel Graf
*/
@@ -54,18 +61,13 @@ public class ASTWriter {
* @throws ProblemRuntimeException if the node or one of it's children is a <code>IASTProblemNode</code>.
*/
public String write(IASTNode rootNode) throws ProblemRuntimeException {
- return write(rootNode, null, new NodeCommentMap());
- }
-
- public String write(IASTNode rootNode, NodeCommentMap commentMap) {
- return write(rootNode, null, commentMap);
+ return write(rootNode, new NodeCommentMap());
}
/**
* Generates the source code representing this node including comments.
*
* @param rootNode Node to write.
- * @param fileScope
* @param commentMap Node Comment Map <code>ASTCommenter</code>
* @return A <code>String</code> representing the source code for the node.
* @throws ProblemRuntimeException if the node or one of it's children is
@@ -73,17 +75,95 @@ public class ASTWriter {
*
* @see ASTCommenter#getCommentedNodeMap(org.eclipse.cdt.core.dom.ast.IASTTranslationUnit)
*/
- public String write(IASTNode rootNode, String fileScope, NodeCommentMap commentMap)
+ public String write(IASTNode rootNode, NodeCommentMap commentMap)
throws ProblemRuntimeException {
- ChangeGeneratorWriterVisitor transformationVisitor = new ChangeGeneratorWriterVisitor(
- modificationStore, givenIndentation, fileScope, commentMap);
+ ChangeGeneratorWriterVisitor writer = new ChangeGeneratorWriterVisitor(
+ modificationStore, givenIndentation, null, commentMap);
if (rootNode != null) {
- rootNode.accept(transformationVisitor);
+ rootNode.accept(writer);
}
- return transformationVisitor.toString();
+ return writer.toString();
}
public void setModificationStore(ASTModificationStore modificationStore) {
this.modificationStore = modificationStore;
}
+
+ /**
+ * Returns <code>true</code> if the node should be separated by a blank line from the node
+ * before it.
+ *
+ * @param node The node.
+ * @return <code>true</code> if the node should be separated by a blank line from the node
+ * before it.
+ */
+ public static boolean requiresLeadingBlankLine(IASTNode node) {
+ if (node instanceof ICPPASTTemplateDeclaration) {
+ node = ((ICPPASTTemplateDeclaration) node).getDeclaration();
+ }
+ return node instanceof IASTASMDeclaration ||
+ node instanceof IASTFunctionDefinition ||
+ node instanceof ICPPASTVisibilityLabel;
+ }
+
+ /**
+ * Returns <code>true</code> if the node should be separated by a blank line from the node
+ * after it.
+ *
+ * @param node The node.
+ * @return <code>true</code> if the node should be separated by a blank line from the node
+ * after it.
+ */
+ public static boolean requiresTrailingBlankLine(IASTNode node) {
+ if (node instanceof ICPPASTNamespaceDefinition)
+ return true;
+ if (node instanceof IASTFunctionDefinition)
+ return true;
+ if (node instanceof IASTIfStatement) {
+ IASTIfStatement statement = ((IASTIfStatement) node);
+ IASTStatement lastClause = statement.getElseClause();
+ if (lastClause == null)
+ lastClause = statement.getThenClause();
+
+ if (!(lastClause instanceof IASTCompoundStatement) &&
+ !doNodesHaveSameOffset(lastClause, statement)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Returns <code>true</code> if there should be no blank line after this node even if a blank
+ * line is normally required before the subsequent node.
+ *
+ * @param node The node.
+ * @return <code>true</code> if there should be no blank line after this node.
+ */
+ public static boolean suppressesTrailingBlankLine(IASTNode node) {
+ return node instanceof ICPPASTVisibilityLabel;
+ }
+
+ /**
+ * Returns <code>true</code> if the two given nodes should be separated by a blank line.
+ *
+ * @param node1 The first node.
+ * @param node2 The second node.
+ * @return <code>true</code> if the blank line between the nodes is needed.
+ */
+ public static boolean requireBlankLineInBetween(IASTNode node1, IASTNode node2) {
+ if (requiresTrailingBlankLine(node1))
+ return true;
+
+ return !suppressesTrailingBlankLine(node1) && requiresLeadingBlankLine(node2);
+ }
+
+ /**
+ * Returns true if the two given nodes have the same offset. For nodes that are normally
+ * separated by other tokens this is an indication that they were produced by the same macro
+ * expansion.
+ */
+ private static boolean doNodesHaveSameOffset(IASTNode node1, IASTNode node2) {
+ return node1.getFileLocation().getNodeOffset() == node2.getFileLocation().getNodeOffset();
+ }
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/ASTWriterVisitor.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/ASTWriterVisitor.java
index 553d8907c6..16f9325785 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/ASTWriterVisitor.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/ASTWriterVisitor.java
@@ -9,6 +9,7 @@
* Contributors:
* Institute for Software - initial API and implementation
* Markus Schorn (Wind River Systems)
+ * Sergey Prigogin (Google)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.rewrite.astwriter;
@@ -38,15 +39,14 @@ import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.NodeCommentMap;
/**
* Visits all nodes, prints leading comments and handles macro expansions. The
- * source code generation is delegated to severals <code>NodeWriters</code>.
+ * source code generation is delegated to severals {@code NodeWriter}s.
*
- * @see NodeWriter
* @see MacroExpansionHandler
*
* @author Emanuel Graf IFS
*/
public class ASTWriterVisitor extends ASTVisitor {
- protected Scribe scribe = new Scribe();
+ protected final Scribe scribe = new Scribe();
protected NodeCommentMap commentMap;
protected ExpressionWriter expWriter;
protected DeclSpecWriter declSpecWriter;
@@ -57,6 +57,9 @@ public class ASTWriterVisitor extends ASTVisitor {
protected NameWriter nameWriter;
protected TemplateParameterWriter tempParameterWriter;
protected MacroExpansionHandler macroHandler;
+ private boolean insertLeadingBlankLine;
+ private boolean suppressLeadingBlankLine;
+ private boolean spaceNeededBeforeName;
{
shouldVisitExpressions = true;
@@ -83,6 +86,7 @@ public class ASTWriterVisitor extends ASTVisitor {
scribe.setGivenIndentation(givenIndentation);
init(commentMap);
this.commentMap = commentMap;
+ this.suppressLeadingBlankLine = true;
}
private void init(NodeCommentMap commentMap) {
@@ -135,6 +139,10 @@ public class ASTWriterVisitor extends ASTVisitor {
@Override
public int visit(IASTName name) {
+ if (spaceNeededBeforeName && name.getSimpleID().length != 0) {
+ scribe.printSpace();
+ spaceNeededBeforeName = false;
+ }
writeLeadingComments(name);
if (!macroHandler.checkisMacroExpansionNode(name)) {
nameWriter.writeName(name);
@@ -166,24 +174,31 @@ public class ASTWriterVisitor extends ASTVisitor {
@Override
public int visit(IASTStatement statement) {
+ insertBlankLineIfNeeded(statement);
writeLeadingComments(statement);
- if (macroHandler.isStatementWithMixedLocation(statement) &&
- !(statement instanceof IASTCompoundStatement)) {
- return statementWriter.writeMixedStatement(statement);
- }
- if (macroHandler.checkisMacroExpansionNode(statement)) {
- return ASTVisitor.PROCESS_SKIP;
+ try {
+ if (macroHandler.isStatementWithMixedLocation(statement) &&
+ !(statement instanceof IASTCompoundStatement)) {
+ return statementWriter.writeMixedStatement(statement);
+ }
+ if (macroHandler.checkisMacroExpansionNode(statement)) {
+ return ASTVisitor.PROCESS_SKIP;
+ }
+ return statementWriter.writeStatement(statement, true);
+ } finally {
+ setLeadingBlankLineFlags(statement);
}
- return statementWriter.writeStatement(statement, true);
}
@Override
public int visit(IASTDeclaration declaration) {
+ insertBlankLineIfNeeded(declaration);
writeLeadingComments(declaration);
if (!macroHandler.checkisMacroExpansionNode(declaration)) {
declarationWriter.writeDeclaration(declaration);
+ setLeadingBlankLineFlags(declaration);
}
- return ASTVisitor.PROCESS_SKIP;
+ return ASTVisitor.PROCESS_SKIP;
}
@Override
@@ -219,9 +234,7 @@ public class ASTWriterVisitor extends ASTVisitor {
parameterDeclaration.getDeclSpecifier().accept(this);
IASTDeclarator declarator = getParameterDeclarator(parameterDeclaration);
- if (getParameterName(declarator).toString().length() != 0) {
- scribe.printSpaces(1);
- }
+ spaceNeededBeforeName = true;
declarator.accept(this);
}
return ASTVisitor.PROCESS_SKIP;
@@ -237,9 +250,11 @@ public class ASTWriterVisitor extends ASTVisitor {
@Override
public int visit(ICPPASTNamespaceDefinition namespace) {
+ insertBlankLineIfNeeded(namespace);
writeLeadingComments(namespace);
if (!macroHandler.checkisMacroExpansionNode(namespace)) {
declarationWriter.writeDeclaration(namespace);
+ setLeadingBlankLineFlags(namespace);
}
return ASTVisitor.PROCESS_SKIP;
}
@@ -257,4 +272,38 @@ public class ASTWriterVisitor extends ASTVisitor {
scribe.cleanCache();
macroHandler.reset();
}
+
+ private void insertBlankLineIfNeeded(IASTNode node) {
+ if (!suppressLeadingBlankLine &&
+ (insertLeadingBlankLine || ASTWriter.requiresLeadingBlankLine(node))) {
+ scribe.newLine();
+ }
+ insertLeadingBlankLine = false;
+ suppressLeadingBlankLine = false;
+ }
+
+ private void setLeadingBlankLineFlags(IASTNode node) {
+ insertLeadingBlankLine = ASTWriter.requiresTrailingBlankLine(node);
+ suppressLeadingBlankLine = ASTWriter.suppressesTrailingBlankLine(node);
+ }
+
+ public boolean isSuppressLeadingBlankLine() {
+ return suppressLeadingBlankLine;
+ }
+
+ public void setSuppressLeadingBlankLine(boolean value) {
+ this.suppressLeadingBlankLine = value;
+ }
+
+ public boolean isSpaceNeededBeforeName() {
+ return spaceNeededBeforeName;
+ }
+
+ public void setSpaceNeededBeforeName(boolean value) {
+ this.spaceNeededBeforeName = value;
+ }
+
+ public void newLine() {
+ scribe.newLine();
+ }
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/DeclSpecWriter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/DeclSpecWriter.java
index 17c6eab08a..ba7fb2e862 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/DeclSpecWriter.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/DeclSpecWriter.java
@@ -11,7 +11,6 @@
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.rewrite.astwriter;
-import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier;
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
@@ -62,12 +61,12 @@ public class DeclSpecWriter extends NodeWriter {
private static final String ENUM = "enum "; //$NON-NLS-1$
private static final String _BOOL = "_Bool"; //$NON-NLS-1$
- public DeclSpecWriter(Scribe scribe, ASTVisitor visitor, NodeCommentMap commentMap) {
+ public DeclSpecWriter(Scribe scribe, ASTWriterVisitor visitor, NodeCommentMap commentMap) {
super(scribe, visitor, commentMap);
}
protected void writeDelcSpec(IASTDeclSpecifier declSpec) {
-// Write general DelcSpec Keywords
+ // Write general DelcSpec Keywords
writeDeclSpec(declSpec);
if (declSpec instanceof ICPPASTDeclSpecifier) {
writeCPPDeclSpec((ICPPASTDeclSpecifier) declSpec);
@@ -129,7 +128,6 @@ public class DeclSpecWriter extends NodeWriter {
break;
}
- System.err.println("Unknown specifier type: " + type); //$NON-NLS-1$
throw new IllegalArgumentException("Unknown specifier type: " + type); //$NON-NLS-1$
}
@@ -152,7 +150,7 @@ public class DeclSpecWriter extends NodeWriter {
}
private void writeNamedTypeSpecifier(ICPPASTNamedTypeSpecifier namedSpc) {
- if ( namedSpc.isTypename() ){
+ if (namedSpc.isTypename()) {
scribe.print(TYPENAME);
}
namedSpc.getName().accept(visitor);
@@ -179,8 +177,7 @@ public class DeclSpecWriter extends NodeWriter {
return CLASS_SPACE;
default:
- System.err.println("Unknown ElaboratedType: " + kind); //$NON-NLS-1$
- throw new IllegalArgumentException("Unknown ElaboratedType: " + kind); //$NON-NLS-1$
+ throw new IllegalArgumentException("Unknown elaborated type: " + kind); //$NON-NLS-1$
}
}
@@ -254,12 +251,13 @@ public class DeclSpecWriter extends NodeWriter {
hasTrailingComments = hasTrailingComments(baseSpecifiers[baseSpecifiers.length-1].getName());
}
}
- if (!hasTrailingComments){
+ if (!hasTrailingComments) {
scribe.newLine();
}
scribe.print('{');
scribe.newLine();
scribe.incrementIndentationLevel();
+ visitor.setSuppressLeadingBlankLine(true);
IASTDeclaration[] decls = getMembers(compDeclSpec);
if (decls.length > 0) {
@@ -306,8 +304,7 @@ public class DeclSpecWriter extends NodeWriter {
case ICPPASTCompositeTypeSpecifier.k_class:
return CLASS;
default:
- System.err.println("Unknow Specifiertype: " + key); //$NON-NLS-1$
- throw new IllegalArgumentException("Unknow Specifiertype: " + key); //$NON-NLS-1$
+ throw new IllegalArgumentException("Unknown type specifier: " + key); //$NON-NLS-1$
}
}
@@ -318,8 +315,7 @@ public class DeclSpecWriter extends NodeWriter {
case IASTCompositeTypeSpecifier.k_union:
return UNION;
default:
- System.err.println("Unknow Specifiertype: " + key); //$NON-NLS-1$
- throw new IllegalArgumentException("Unknow Specifiertype: " + key); //$NON-NLS-1$
+ throw new IllegalArgumentException("Unknown type specifier: " + key); //$NON-NLS-1$
}
}
@@ -368,7 +364,7 @@ public class DeclSpecWriter extends NodeWriter {
private void printQualifiers(IASTSimpleDeclSpecifier simpDeclSpec) {
if (simpDeclSpec.isSigned()) {
scribe.printStringSpace(SIGNED);
- } else if (simpDeclSpec.isUnsigned()){
+ } else if (simpDeclSpec.isUnsigned()) {
scribe.printStringSpace(UNSIGNED);
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/DeclarationWriter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/DeclarationWriter.java
index 6976f5fcf6..41ed66fc64 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/DeclarationWriter.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/DeclarationWriter.java
@@ -9,10 +9,10 @@
* Contributors:
* Institute for Software - initial API and implementation
* Markus Schorn (Wind River Systems)
+ * Sergey Prigogin (Google)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.rewrite.astwriter;
-import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTASMDeclaration;
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
@@ -47,7 +47,7 @@ import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.NodeCommentMap;
* @see IASTDeclaration
* @author Emanuel Graf IFS
*/
-public class DeclarationWriter extends NodeWriter{
+public class DeclarationWriter extends NodeWriter {
private static final String ASM_END = ")"; //$NON-NLS-1$
private static final String ASM_START = "asm("; //$NON-NLS-1$
private static final String TEMPLATE_DECLARATION = "template<"; //$NON-NLS-1$
@@ -57,7 +57,7 @@ public class DeclarationWriter extends NodeWriter{
private static final String USING = "using "; //$NON-NLS-1$
private boolean printSemicolon;
- public DeclarationWriter(Scribe scribe, ASTVisitor visitor, NodeCommentMap commentMap) {
+ public DeclarationWriter(Scribe scribe, ASTWriterVisitor visitor, NodeCommentMap commentMap) {
super(scribe, visitor, commentMap);
}
@@ -72,6 +72,7 @@ public class DeclarationWriter extends NodeWriter{
writeASMDeclatation((IASTASMDeclaration) declaration);
} else if (declaration instanceof IASTFunctionDefinition) {
writeFunctionDefinition((IASTFunctionDefinition) declaration);
+ addNewLine = false;
} else if (declaration instanceof IASTProblemDeclaration) {
throw new ProblemRuntimeException((IASTProblemDeclaration) declaration);
} else if (declaration instanceof IASTSimpleDeclaration) {
@@ -98,17 +99,17 @@ public class DeclarationWriter extends NodeWriter{
}
if (hasTrailingComments(declaration)) {
- writeTrailingComments(declaration, addNewLine);
- } else if (addNewLine) {
+ writeTrailingComments(declaration, false);
+ }
+ if (addNewLine) {
scribe.newLine();
}
if (hasFreestandingComments(declaration)) {
+ if (declaration instanceof IASTFunctionDefinition) {
+ scribe.newLine();
+ }
writeFreeStandingComments(declaration);
}
-
- if (declaration instanceof ICPPASTUsingDirective) {
- scribe.newLine();
- }
}
private void writeVisibilityLabel(ICPPASTVisibilityLabel visiblityLabel) {
@@ -181,17 +182,18 @@ public class DeclarationWriter extends NodeWriter{
if (!hasTrailingComments(namespaceDefinition.getName())) {
scribe.newLine();
}
- scribe.printLBrace();
- scribe.newLine();
+ scribe.print('{');
+ scribe.newLine(2);
writeDeclarationsInNamespace(namespaceDefinition, namespaceDefinition.getDeclarations());
if (hasFreestandingComments(namespaceDefinition)) {
writeFreeStandingComments(namespaceDefinition);
}
- scribe.printRBrace();
+ scribe.newLine();
+ scribe.print('}');
if (hasTrailingComments(namespaceDefinition)) {
writeTrailingComments(namespaceDefinition);
- }else{
+ } else {
scribe.newLine();
}
}
@@ -211,7 +213,7 @@ public class DeclarationWriter extends NodeWriter{
}
private void writeLinkageSpecification(ICPPASTLinkageSpecification linkageSpecification) {
- scribe.print( EXTERN);
+ scribe.print(EXTERN);
scribe.print(linkageSpecification.getLiteral());
scribe.printSpaces(1);
@@ -266,10 +268,10 @@ public class DeclarationWriter extends NodeWriter{
if (declSpecifier instanceof IASTSimpleDeclSpecifier) {
IASTSimpleDeclSpecifier simDeclSpec = (IASTSimpleDeclSpecifier) declSpecifier;
if (simDeclSpec.getType() != IASTSimpleDeclSpecifier.t_unspecified) {
- scribe.printSpace();
+ visitor.setSpaceNeededBeforeName(true);
}
- }else {
- scribe.printSpace();
+ } else {
+ visitor.setSpaceNeededBeforeName(true);
}
IASTDeclarator declarator = ASTQueries.findOutermostDeclarator(funcDef.getDeclarator());
declarator.accept(visitor);
@@ -325,10 +327,16 @@ public class DeclarationWriter extends NodeWriter{
}
if (decls.length > 0) {
- if (!noSpace) {
- scribe.printSpace();
+ if (decls.length == 1) {
+ if (!noSpace)
+ visitor.setSpaceNeededBeforeName(true);
+ decls[0].accept(visitor);
+ } else {
+ if (!noSpace) {
+ scribe.printSpace();
+ }
+ writeNodeList(decls);
}
- writeNodeList(decls);
}
printSemicolon();
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/DeclaratorWriter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/DeclaratorWriter.java
index 219af0c80e..4a9a8af385 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/DeclaratorWriter.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/DeclaratorWriter.java
@@ -12,7 +12,6 @@
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.rewrite.astwriter;
-import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTArrayDeclarator;
import org.eclipse.cdt.core.dom.ast.IASTArrayModifier;
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
@@ -40,14 +39,12 @@ import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.NodeCommentMap;
* @author Emanuel Graf IFS
*/
public class DeclaratorWriter extends NodeWriter {
- private static final String AMPERSAND_SPACE = "& "; //$NON-NLS-1$
- private static final String AMPERSAND_AMPERSAND_SPACE = "&& "; //$NON-NLS-1$
- private static final String STAR_SPACE = "* "; //$NON-NLS-1$
+ private static final String AMPERSAND_AMPERSAND = "&&"; //$NON-NLS-1$
private static final String PURE_VIRTUAL = " = 0"; //$NON-NLS-1$
private static final String MUTABLE = "mutable"; //$NON-NLS-1$
private static final String ARROW_OPERATOR = "->"; //$NON-NLS-1$
- public DeclaratorWriter(Scribe scribe, ASTVisitor visitor, NodeCommentMap commentMap) {
+ public DeclaratorWriter(Scribe scribe, ASTWriterVisitor visitor, NodeCommentMap commentMap) {
super(scribe, visitor, commentMap);
}
@@ -63,7 +60,8 @@ public class DeclaratorWriter extends NodeWriter {
} else {
writeDefaultDeclarator(declarator);
}
-
+
+ visitor.setSpaceNeededBeforeName(false);
if (hasTrailingComments(declarator)) {
writeTrailingComments(declarator, false);
}
@@ -119,6 +117,10 @@ public class DeclaratorWriter extends NodeWriter {
private void writeNestedDeclarator(IASTDeclarator funcDec) {
IASTDeclarator nestedDeclarator = funcDec.getNestedDeclarator();
if (nestedDeclarator != null) {
+ if (visitor.isSpaceNeededBeforeName()) {
+ scribe.printSpace();
+ visitor.setSpaceNeededBeforeName(false);
+ }
scribe.print('(');
nestedDeclarator.accept(visitor);
scribe.print(')');
@@ -160,10 +162,10 @@ public class DeclaratorWriter extends NodeWriter {
}
}
- protected void writeParameterDeclarations(IASTStandardFunctionDeclarator funcDec, IASTParameterDeclaration[] paraDecls) {
- writeNodeList(paraDecls);
+ protected void writeParameterDeclarations(IASTStandardFunctionDeclarator funcDec, IASTParameterDeclaration[] paramDecls) {
+ writeNodeList(paramDecls);
if (funcDec.takesVarArgs()) {
- if (paraDecls.length > 0) {
+ if (paramDecls.length > 0) {
scribe.print(COMMA_SPACE);
}
scribe.print(VAR_ARGS);
@@ -175,7 +177,7 @@ public class DeclaratorWriter extends NodeWriter {
ICPPASTPointerToMember pointerToMemberOp = (ICPPASTPointerToMember) operator;
if (pointerToMemberOp.getName() != null) {
pointerToMemberOp.getName().accept(visitor);
- scribe.print(STAR_SPACE);
+ scribe.print('*');
}
} else {
scribe.print('*');
@@ -198,9 +200,9 @@ public class DeclaratorWriter extends NodeWriter {
writePointer(pointOp);
} else if (operator instanceof ICPPASTReferenceOperator) {
if (((ICPPASTReferenceOperator) operator).isRValueReference()) {
- scribe.print(AMPERSAND_AMPERSAND_SPACE);
+ scribe.print(AMPERSAND_AMPERSAND);
} else {
- scribe.print(AMPERSAND_SPACE);
+ scribe.print('&');
}
}
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/ExpressionWriter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/ExpressionWriter.java
index 8676cae026..150f6c7454 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/ExpressionWriter.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/ExpressionWriter.java
@@ -12,7 +12,6 @@
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.rewrite.astwriter;
-import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTArraySubscriptExpression;
import org.eclipse.cdt.core.dom.ast.IASTBinaryExpression;
import org.eclipse.cdt.core.dom.ast.IASTCastExpression;
@@ -115,7 +114,7 @@ public class ExpressionWriter extends NodeWriter{
private static final String THIS = "this"; //$NON-NLS-1$
private final MacroExpansionHandler macroHandler;
- public ExpressionWriter(Scribe scribe, ASTVisitor visitor, MacroExpansionHandler macroHandler, NodeCommentMap commentMap) {
+ public ExpressionWriter(Scribe scribe, ASTWriterVisitor visitor, MacroExpansionHandler macroHandler, NodeCommentMap commentMap) {
super(scribe, visitor, commentMap);
this.macroHandler = macroHandler;
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/InitializerWriter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/InitializerWriter.java
index 37aaff78c0..7adc8fdce8 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/InitializerWriter.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/InitializerWriter.java
@@ -12,7 +12,6 @@
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.rewrite.astwriter;
-import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTEqualsInitializer;
import org.eclipse.cdt.core.dom.ast.IASTInitializer;
import org.eclipse.cdt.core.dom.ast.IASTInitializerClause;
@@ -36,7 +35,7 @@ import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.NodeCommentMap;
*/
public class InitializerWriter extends NodeWriter{
- public InitializerWriter(Scribe scribe, ASTVisitor visitor, NodeCommentMap commentMap) {
+ public InitializerWriter(Scribe scribe, ASTWriterVisitor visitor, NodeCommentMap commentMap) {
super(scribe, visitor, commentMap);
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/NameWriter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/NameWriter.java
index c5c2a05f1a..941931511c 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/NameWriter.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/NameWriter.java
@@ -7,11 +7,10 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Institute for Software - initial API and implementation
+ * Institute for Software - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.rewrite.astwriter;
-import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IBinding;
@@ -36,7 +35,7 @@ public class NameWriter extends NodeWriter {
* @param scribe
* @param visitor
*/
- public NameWriter(Scribe scribe, ASTVisitor visitor, NodeCommentMap commentMap) {
+ public NameWriter(Scribe scribe, ASTWriterVisitor visitor, NodeCommentMap commentMap) {
super(scribe, visitor, commentMap);
}
@@ -45,7 +44,7 @@ public class NameWriter extends NodeWriter {
writeTempalteId((ICPPASTTemplateId) name);
} else if (name instanceof ICPPASTConversionName) {
scribe.print(OPERATOR);
- ((ICPPASTConversionName)name).getTypeId().accept(visitor);
+ ((ICPPASTConversionName) name).getTypeId().accept(visitor);
} else if (name instanceof ICPPASTQualifiedName){
writeQualifiedName((ICPPASTQualifiedName) name);
} else {
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/NodeWriter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/NodeWriter.java
index 5c2b384974..627e8158a5 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/NodeWriter.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/NodeWriter.java
@@ -13,7 +13,6 @@ package org.eclipse.cdt.internal.core.dom.rewrite.astwriter;
import java.util.ArrayList;
-import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTComment;
import org.eclipse.cdt.core.dom.ast.IASTCopyLocation;
import org.eclipse.cdt.core.dom.ast.IASTNode;
@@ -28,7 +27,7 @@ import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.NodeCommentMap;
*/
public class NodeWriter {
protected Scribe scribe;
- protected ASTVisitor visitor;
+ protected ASTWriterVisitor visitor;
protected NodeCommentMap commentMap;
protected static final String COMMA_SPACE = ", "; //$NON-NLS-1$
protected static final String EQUALS = " = "; //$NON-NLS-1$
@@ -61,7 +60,7 @@ public class NodeWriter {
protected static final String COLON_COLON = "::"; //$NON-NLS-1$
protected static final String COLON_SPACE = ": "; //$NON-NLS-1$
- public NodeWriter(Scribe scribe, ASTVisitor visitor, NodeCommentMap commentMap) {
+ public NodeWriter(Scribe scribe, ASTWriterVisitor visitor, NodeCommentMap commentMap) {
super();
this.scribe = scribe;
this.visitor = visitor;
@@ -89,12 +88,17 @@ public class NodeWriter {
}
protected void writeTrailingComments(IASTNode node, boolean newLine) {
+ boolean first = true;
for (IASTComment comment : getTrailingComments(node)) {
- scribe.printSpace();
- scribe.print(comment.getComment());
- if (newLine) {
+ if (!first) {
scribe.newLine();
}
+ scribe.printSpace();
+ scribe.print(comment.getComment());
+ first = false;
+ }
+ if (newLine) {
+ scribe.newLine();
}
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/Scribe.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/Scribe.java
index 9751cefd6a..8bc32d8396 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/Scribe.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/Scribe.java
@@ -7,7 +7,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Institute for Software - initial API and implementation
+ * Institute for Software - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.rewrite.astwriter;
@@ -20,92 +20,93 @@ package org.eclipse.cdt.internal.core.dom.rewrite.astwriter;
*/
public class Scribe {
private int indentationLevel = 0;
- private int indentationSize = 4; //HSR tcorbat: could be a tab character too - this is not a very elegant solution
+ // Any positive indentation size is good enough since the code is going to be formatted anyway.
+ private int indentationSize = 4;
private StringBuilder buffer = new StringBuilder();
private boolean isAtLineBeginning = true;
private String newLine = System.getProperty("line.separator"); //$NON-NLS-1$
- private String givenIndentation = null;
+ private String givenIndentation;
+
+ private boolean skipLineBreaks;
+ private boolean skipSemicolons;
- private boolean noNewLine = false;
- private boolean noSemicolon = false;
-
public void newLine() {
- if (!noNewLine) {
+ if (!skipLineBreaks) {
isAtLineBeginning = true;
buffer.append(getNewline());
}
}
-
+
private void indent() {
if (givenIndentation != null) {
buffer.append(givenIndentation);
}
printSpaces(indentationLevel * indentationSize);
}
-
+
private void indentIfNewLine() {
if (isAtLineBeginning) {
isAtLineBeginning = false;
indent();
}
}
-
+
private String getNewline() {
return newLine;
}
-
+
public void print(String code) {
indentIfNewLine();
buffer.append(code);
}
-
+
public void println(String code) {
print(code);
newLine();
}
-
+
public void print(String code, String code2) {
print(code);
buffer.append(code2);
}
-
+
public void println(String code, String code2) {
print(code, code2);
newLine();
}
-
+
public void println(String code, char[] code2) {
print(code);
buffer.append(code2);
newLine();
}
-
+
public void printSpaces(int number) {
indentIfNewLine();
for (int i = 0; i < number; ++i) {
printSpace();
}
}
-
+
public void noSemicolon() {
- noSemicolon = true;
+ skipSemicolons = true;
}
-
+
public void printSemicolon() {
- if (!noSemicolon) {
+ if (!skipSemicolons) {
indentIfNewLine();
buffer.append(';');
} else {
- noSemicolon = false;
+ skipSemicolons = false;
}
}
-
+
@Override
public String toString() {
return buffer.toString();
}
-
- public void print (char code) {
+
+ public void print(char code) {
indentIfNewLine();
buffer.append(code);
}
@@ -114,19 +115,19 @@ public class Scribe {
indentIfNewLine();
buffer.append(code);
}
-
+
public void println(char[] code) {
print(code);
newLine();
}
-
+
public void printStringSpace(String code) {
print(code);
printSpace();
}
/**
- * Prints a { to the Buffer an increases the indentation level.
+ * Prints a { to the buffer an increases the indentation level.
*/
public void printLBrace() {
print('{');
@@ -134,31 +135,31 @@ public class Scribe {
}
/**
- * Prints a } to the Buffer an decrease the indentation level.
+ * Prints a } to the buffer an decrease the indentation level.
*/
public void printRBrace() {
--indentationLevel;
print('}');
}
-
+
public void incrementIndentationLevel() {
++indentationLevel;
}
-
+
public void decrementIndentationLevel() {
if (indentationLevel > 0) {
--indentationLevel;
}
}
-
+
protected void noNewLines() {
- noNewLine = true;
+ skipLineBreaks = true;
}
-
+
protected void newLines() {
- noNewLine = false;
+ skipLineBreaks = false;
}
-
+
public void newLine(int i) {
while (i > 0) {
newLine();
@@ -167,7 +168,7 @@ public class Scribe {
}
public void printSpace() {
- buffer.append(' ');
+ buffer.append(' ');
}
public String getGivenIndentation() {
@@ -179,6 +180,6 @@ public class Scribe {
}
public void cleanCache() {
- buffer = new StringBuilder();
+ buffer = new StringBuilder();
}
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/StatementWriter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/StatementWriter.java
index fbafe9bf15..ac8c6f21f3 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/StatementWriter.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/StatementWriter.java
@@ -56,17 +56,17 @@ import org.eclipse.core.resources.IFile;
public class StatementWriter extends NodeWriter {
private static final String DEFAULT = "default:"; //$NON-NLS-1$
private static final String CASE = "case "; //$NON-NLS-1$
- private static final String WHILE = "while("; //$NON-NLS-1$
+ private static final String WHILE = "while ("; //$NON-NLS-1$
private static final String TRY = "try "; //$NON-NLS-1$
- private static final String CATCH = "catch("; //$NON-NLS-1$
+ private static final String CATCH = "catch ("; //$NON-NLS-1$
private static final String RETURN = "return"; //$NON-NLS-1$
private static final String GOTO = "goto "; //$NON-NLS-1$
private static final String CONTINUE = "continue"; //$NON-NLS-1$
private static final String BREAK = "break"; //$NON-NLS-1$
private static final String ELSE = "else"; //$NON-NLS-1$
- private static final String IF = "if("; //$NON-NLS-1$
- private static final String FOR = "for("; //$NON-NLS-1$
- private static final String DO_WHILE = " while("; //$NON-NLS-1$
+ private static final String IF = "if ("; //$NON-NLS-1$
+ private static final String FOR = "for ("; //$NON-NLS-1$
+ private static final String DO_WHILE = " while ("; //$NON-NLS-1$
private static final String DO = "do"; //$NON-NLS-1$
private static final String SWITCH_BRACKET = "switch ("; //$NON-NLS-1$
private boolean compoundNoNewLine = false;
@@ -74,14 +74,15 @@ public class StatementWriter extends NodeWriter {
private boolean decrementIndentationLevelOneMore = false;
private final DeclarationWriter declWriter;
- public StatementWriter(Scribe scribe, ASTVisitor visitor, NodeCommentMap commentMap) {
+ public StatementWriter(Scribe scribe, ASTWriterVisitor visitor, NodeCommentMap commentMap) {
super(scribe, visitor, commentMap);
declWriter = new DeclarationWriter(scribe, visitor, commentMap);
}
/**
+ * Prints a statement.
*
- * @param statement
+ * @param statement the statement
* @param newLine if true print a newline if statement usually have one.
* @return {@link ASTVisitor#PROCESS_SKIP}
*/
@@ -132,7 +133,7 @@ public class StatementWriter extends NodeWriter {
writeIfStatement((IASTIfStatement) statement);
newLine = false;
} else if (statement instanceof IASTWhileStatement) {
- writeWhileStatement( (IASTWhileStatement) statement );
+ writeWhileStatement((IASTWhileStatement) statement);
newLine = false;
} else if (statement instanceof IASTForStatement) {
writeForStatement((IASTForStatement) statement);
@@ -173,12 +174,12 @@ public class StatementWriter extends NodeWriter {
scribe.printSemicolon();
}
- private void writeForStatement(IASTForStatement forStatment) {
+ private void writeForStatement(IASTForStatement forStatement) {
scribe.noNewLines();
scribe.print(FOR);
- writeStatement(forStatment.getInitializerStatement(),false);
- if (forStatment instanceof ICPPASTForStatement) {
- ICPPASTForStatement cppForStatment = (ICPPASTForStatement) forStatment;
+ writeStatement(forStatement.getInitializerStatement(),false);
+ if (forStatement instanceof ICPPASTForStatement) {
+ ICPPASTForStatement cppForStatment = (ICPPASTForStatement) forStatement;
IASTDeclaration cppConditionDeclaration = cppForStatment.getConditionDeclaration();
if (cppConditionDeclaration == null) {
visitNodeIfNotNull(cppForStatment.getConditionExpression());
@@ -187,17 +188,17 @@ public class StatementWriter extends NodeWriter {
cppConditionDeclaration.accept(visitor);
}
} else {
- if (forStatment.getConditionExpression() != null) {
- forStatment.getConditionExpression().accept(visitor);
+ if (forStatement.getConditionExpression() != null) {
+ forStatement.getConditionExpression().accept(visitor);
scribe.printSemicolon();
}
}
- visitNodeIfNotNull(forStatment.getIterationExpression());
+ visitNodeIfNotNull(forStatement.getIterationExpression());
scribe.print(')');
scribe.newLines();
nextCompoundNoNewLine();
- writeBodyStatement(forStatment.getBody(), false);
+ writeBodyStatement(forStatement.getBody(), false);
}
private void writeForStatement(ICPPASTRangeBasedForStatement forStatment) {
@@ -418,10 +419,9 @@ public class StatementWriter extends NodeWriter {
scribe.newLine();
statement.accept(visitor);
scribe.decrementIndentationLevel();
- scribe.newLine();
}
}
-
+
/**
* Write no new Line after the next Compound-Statement
*/
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/TemplateParameterWriter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/TemplateParameterWriter.java
index f1265c5bbd..64d1167957 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/TemplateParameterWriter.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/TemplateParameterWriter.java
@@ -11,7 +11,6 @@
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.rewrite.astwriter;
-import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTParameterDeclaration;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTSimpleTypeTemplateParameter;
@@ -35,7 +34,7 @@ public class TemplateParameterWriter extends NodeWriter {
* @param scribe
* @param visitor
*/
- public TemplateParameterWriter(Scribe scribe, ASTVisitor visitor, NodeCommentMap commentMap) {
+ public TemplateParameterWriter(Scribe scribe, ASTWriterVisitor visitor, NodeCommentMap commentMap) {
super(scribe, visitor, commentMap);
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/changegenerator/ASTModificationHelper.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/changegenerator/ASTModificationHelper.java
index df593865e1..74970f57e0 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/changegenerator/ASTModificationHelper.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/changegenerator/ASTModificationHelper.java
@@ -44,8 +44,7 @@ public class ASTModificationHelper {
T appendedTNode = cast(newNode, clazz);
if (appendedTNode != null) {
modifiedChildren.add(appendedTNode);
- }
- else if (newNode instanceof ContainerNode) {
+ } else if (newNode instanceof ContainerNode) {
ContainerNode nodeContainer = (ContainerNode) newNode;
for (IASTNode currentNode : nodeContainer.getNodes()) {
T tnode= cast(currentNode, clazz);
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/changegenerator/ChangeGenerator.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/changegenerator/ChangeGenerator.java
index eda395e181..d8d2b173c0 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/changegenerator/ChangeGenerator.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/changegenerator/ChangeGenerator.java
@@ -9,16 +9,23 @@
* Contributors:
* Institute for Software - initial API and implementation
* Markus Schorn (Wind River Systems)
+ * Sergey Prigogin (Google)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.rewrite.changegenerator;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
+import java.util.Map;
+import org.eclipse.cdt.core.CCorePlugin;
+import org.eclipse.cdt.core.ToolFactory;
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTArrayModifier;
import org.eclipse.cdt.core.dom.ast.IASTComment;
+import org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier;
+import org.eclipse.cdt.core.dom.ast.IASTCompoundStatement;
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
@@ -31,7 +38,10 @@ import org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration;
import org.eclipse.cdt.core.dom.ast.IASTStatement;
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNamespaceDefinition;
+import org.eclipse.cdt.core.formatter.CodeFormatter;
+import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModification;
+import org.eclipse.cdt.internal.core.dom.rewrite.ASTModification.ModificationKind;
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModificationMap;
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModificationStore;
import org.eclipse.cdt.internal.core.dom.rewrite.ASTRewriteAnalyzer;
@@ -41,16 +51,26 @@ import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.NodeCommentMap;
import org.eclipse.cdt.internal.core.dom.rewrite.util.FileContentHelper;
import org.eclipse.cdt.internal.core.dom.rewrite.util.FileHelper;
import org.eclipse.cdt.internal.core.resources.ResourceLookup;
+import org.eclipse.cdt.internal.formatter.CCodeFormatter;
import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.Document;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.jface.text.TextUtilities;
import org.eclipse.ltk.core.refactoring.Change;
import org.eclipse.ltk.core.refactoring.CompositeChange;
import org.eclipse.ltk.core.refactoring.TextFileChange;
import org.eclipse.text.edits.DeleteEdit;
import org.eclipse.text.edits.InsertEdit;
+import org.eclipse.text.edits.MalformedTreeException;
import org.eclipse.text.edits.MultiTextEdit;
import org.eclipse.text.edits.ReplaceEdit;
+import org.eclipse.text.edits.TextEdit;
import org.eclipse.text.edits.TextEditGroup;
public class ChangeGenerator extends ASTVisitor {
@@ -93,8 +113,10 @@ public class ChangeGenerator extends ASTVisitor {
initParentModList();
rootNode.accept(pathProvider);
for (IFile currentFile : changes.keySet()) {
+ MultiTextEdit edit = changes.get(currentFile);
+ edit = formatChangedCode(edit, currentFile);
TextFileChange subchange= ASTRewriteAnalyzer.createCTextFileChange(currentFile);
- subchange.setEdit(changes.get(currentFile));
+ subchange.setEdit(edit);
change.add(subchange);
}
}
@@ -130,6 +152,63 @@ public class ChangeGenerator extends ASTVisitor {
return modifiedNodeParent;
}
+ /**
+ * Applies the C++ code formatter to the code affected by refactoring.
+ *
+ * @param edit The text edit produced by refactoring.
+ * @param file The file being modified.
+ * @return The text edit containing formatted refactoring changes, or the original text edit
+ * in case of errors.
+ */
+ private MultiTextEdit formatChangedCode(MultiTextEdit edit, IFile file) {
+ String code;
+ try {
+ code = FileContentHelper.getContent(file, 0);
+ } catch (IOException e) {
+ CCorePlugin.log(e);
+ return edit;
+ } catch (CoreException e) {
+ CCorePlugin.log(e);
+ return edit;
+ }
+ IDocument document = new Document(code);
+ try {
+ TextEdit tempEdit = edit.copy();
+ tempEdit.apply(document, TextEdit.UPDATE_REGIONS);
+ TextEdit[] edits = tempEdit.getChildren();
+ IRegion[] regions = new IRegion[edits.length];
+ for (int i = 0; i < edits.length; i++) {
+ regions[i] = edits[i].getRegion();
+ }
+ ICProject project = CCorePlugin.getDefault().getCoreModel().create(file.getProject());
+ Map<String, String> options = project.getOptions(true);
+ CodeFormatter formatter = ToolFactory.createCodeFormatter(options);
+ code = document.get();
+ TextEdit[] formatEdits = formatter.format(CCodeFormatter.K_TRANSLATION_UNIT, code,
+ regions, TextUtilities.getDefaultLineDelimiter(document));
+ MultiTextEdit resultEdit = new MultiTextEdit();
+ edits = edit.getChildren();
+ for (int i = 0; i < edits.length; i++) {
+ IRegion region = regions[i];
+ int offset = region.getOffset();
+ TextEdit formatEdit = formatEdits[i];
+ formatEdit.moveTree(-offset);
+ document = new Document(code.substring(offset, offset + region.getLength()));
+ formatEdit.apply(document, TextEdit.NONE);
+ TextEdit textEdit = edits[i];
+ resultEdit.addChild(
+ new ReplaceEdit(textEdit.getOffset(), textEdit.getLength(), document.get()));
+ }
+ return resultEdit;
+ } catch (MalformedTreeException e) {
+ CCorePlugin.log(e);
+ return edit;
+ } catch (BadLocationException e) {
+ CCorePlugin.log(e);
+ return edit;
+ }
+ }
+
@Override
public int visit(IASTTranslationUnit translationUnit) {
if (hasChangedChild(translationUnit)) {
@@ -145,11 +224,6 @@ public class ChangeGenerator extends ASTVisitor {
return super.leave(tu);
}
- private int getOffsetForNodeFile(IASTNode rootNode) {
- Integer offset = sourceOffsets.get(rootNode.getFileLocation().getFileName());
- return offset == null ? 0 : offset.intValue();
- }
-
@Override
public int visit(IASTDeclaration declaration) {
if (hasChangedChild(declaration)) {
@@ -160,21 +234,113 @@ public class ChangeGenerator extends ASTVisitor {
}
private void synthTreatment(IASTNode synthNode) {
- synthTreatment(synthNode, null);
+ ChangeGeneratorWriterVisitor writer =
+ new ChangeGeneratorWriterVisitor(modificationStore, commentMap);
+ synthNode.accept(writer);
+ String synthSource = writer.toString();
+ createChange(synthNode, synthSource);
+
+ IASTFileLocation fileLocation = synthNode.getFileLocation();
+ int newOffset = fileLocation.getNodeOffset() + fileLocation.getNodeLength();
+ sourceOffsets.put(fileLocation.getFileName(), Integer.valueOf(newOffset));
}
- private void synthTreatment(IASTNode synthNode, String fileScope) {
- String indent = getIndent(synthNode);
- ASTWriter synthWriter = new ASTWriter(indent);
- synthWriter.setModificationStore(modificationStore);
+ private void handleAppends(IASTNode node) {
+ ChangeGeneratorWriterVisitor writer =
+ new ChangeGeneratorWriterVisitor(modificationStore, commentMap);
+ List<ASTModification> modifications = modificationParent.get(node);
+ ReplaceEdit anchor = getAppendAnchor(node);
+ Assert.isNotNull(anchor);
+ IASTNode precedingNode = getLastNodeBeforeAppendPoint(node);
+ if (precedingNode != null &&
+ ASTWriter.requireBlankLineInBetween(precedingNode, modifications.get(0).getNewNode())) {
+ writer.newLine();
+ }
+ for (ASTModification modification : modifications) {
+ IASTNode newNode = modification.getNewNode();
+ newNode.accept(writer);
+ }
+ String code = writer.toString();
+ IFile file = FileHelper.getFileFromNode(node);
+ MultiTextEdit parentEdit = getEdit(node, file);
+ ReplaceEdit edit = new ReplaceEdit(anchor.getOffset(), anchor.getLength(),
+ code + anchor.getText());
+ parentEdit.addChild(edit);
+ IASTFileLocation fileLocation = node.getFileLocation();
+ int newOffset = fileLocation.getNodeOffset() + fileLocation.getNodeLength();
+ sourceOffsets.put(fileLocation.getFileName(), Integer.valueOf(newOffset));
+ }
- String synthSource = synthWriter.write(synthNode, fileScope, commentMap);
+ private IASTNode getLastNodeBeforeAppendPoint(IASTNode node) {
+ IASTNode[] children;
+ if (node instanceof IASTCompositeTypeSpecifier) {
+ children = ((IASTCompositeTypeSpecifier) node).getDeclarations(true);
+ } else {
+ children = node.getChildren();
+ }
+ return children.length > 0 ? children[children.length - 1] : null;
+ }
- createChange(synthNode, synthSource);
+ private boolean isAppendable(Iterable<ASTModification> modifications) {
+ for (ASTModification modification : modifications) {
+ if (!isAppendable(modification))
+ return false;
+ }
+ return true;
+ }
- IASTFileLocation fileLocation = synthNode.getFileLocation();
- int newOffset = fileLocation.getNodeOffset() + fileLocation.getNodeLength();
- sourceOffsets.put(fileLocation.getFileName(), Integer.valueOf(newOffset));
+ private boolean isAppendable(ASTModification modification) {
+ if (modification.getKind() != ModificationKind.APPEND_CHILD)
+ return false;
+ IASTNode node = modification.getNewNode();
+ return node instanceof IASTDeclaration || node instanceof IASTStatement;
+ }
+
+ /**
+ * Returns a replace edit whose offset is the position where child appended nodes should be
+ * inserted at. The text contains the content of the code region that will be disturbed by
+ * the insertion.
+ * @param node The node to append children to.
+ * @return a ReplaceEdit object, or <code>null</code> if the node does not support appending
+ * children to it.
+ */
+ private ReplaceEdit getAppendAnchor(IASTNode node) {
+ if (!(node instanceof IASTCompositeTypeSpecifier ||
+ node instanceof IASTCompoundStatement ||
+ node instanceof ICPPASTNamespaceDefinition)) {
+ return null;
+ }
+ IFile file = FileHelper.getFileFromNode(node);
+ String code = originalCodeOfNode(node, file);
+ IASTFileLocation location = node.getFileLocation();
+ int pos = location.getNodeOffset() + location.getNodeLength();
+ int len = code.endsWith("}") ? 1 : 0; //$NON-NLS-1$
+ int startOfLine = skipPrecedingBlankLines(code, code.length() - len);
+ if (startOfLine < 0) {
+ // Include the closing brace in the region that will be reformatted.
+ return new ReplaceEdit(pos - len, len, code.substring(code.length() - len));
+ }
+ return new ReplaceEdit(location.getNodeOffset() + startOfLine, 0, ""); //$NON-NLS-1$
+ }
+
+ /**
+ * Skips blank lines preceding the given position.
+ * @param text the text to scan
+ * @param pos the position after that blank lines.
+ * @return the beginning of the first blank line, or -1 if the beginning of the line
+ * corresponding to the given position contains non-whitespace characters.
+ */
+ private int skipPrecedingBlankLines(String text, int pos) {
+ int lineStart = -1;
+ while (--pos >= 0) {
+ char c = text.charAt(pos);
+ if (c == '\n') {
+ lineStart = pos + 1;
+ } else if (!Character.isWhitespace(c)) {
+ break;
+ }
+ }
+ return lineStart;
}
private void synthTreatment(IASTTranslationUnit synthTU) {
@@ -182,11 +348,12 @@ public class ChangeGenerator extends ASTVisitor {
synthWriter.setModificationStore(modificationStore);
for (ASTModification modification : modificationParent.get(synthTU)) {
- IASTFileLocation targetLocation = modification.getTargetNode().getFileLocation();
+ IASTNode targetNode = modification.getTargetNode();
+ IASTFileLocation targetLocation = targetNode.getFileLocation();
String currentFile = targetLocation.getFileName();
IPath implPath = new Path(currentFile);
IFile relevantFile= ResourceLookup.selectFileForLocation(implPath, null);
- if (relevantFile == null || !relevantFile.exists()) { // if not in workspace or local file system
+ if (relevantFile == null || !relevantFile.exists()) { // If not in workspace or local file system
throw new UnhandledASTModificationException(modification);
}
MultiTextEdit edit;
@@ -196,7 +363,7 @@ public class ChangeGenerator extends ASTVisitor {
edit = new MultiTextEdit();
changes.put(relevantFile, edit);
}
- String newNodeCode = synthWriter.write(modification.getNewNode(), null, commentMap);
+ String newNodeCode = synthWriter.write(modification.getNewNode(), commentMap);
switch (modification.getKind()) {
case REPLACE:
@@ -204,18 +371,20 @@ public class ChangeGenerator extends ASTVisitor {
targetLocation.getNodeLength(), newNodeCode));
break;
case INSERT_BEFORE:
- edit.addChild(new InsertEdit(getOffsetIncludingComments(modification.getTargetNode()),
- newNodeCode));
+ if (ASTWriter.requireBlankLineInBetween(modification.getNewNode(), targetNode)) {
+ newNodeCode = newNodeCode + "\n"; //$NON-NLS-1$
+ }
+ edit.addChild(new InsertEdit(getOffsetIncludingComments(targetNode), newNodeCode));
break;
case APPEND_CHILD:
- if (modification.getTargetNode() instanceof IASTTranslationUnit &&
- ((IASTTranslationUnit)modification.getTargetNode()).getDeclarations().length > 0) {
- IASTTranslationUnit tu = (IASTTranslationUnit)modification.getTargetNode();
+ if (targetNode instanceof IASTTranslationUnit &&
+ ((IASTTranslationUnit) targetNode).getDeclarations().length > 0) {
+ IASTTranslationUnit tu = (IASTTranslationUnit) targetNode;
IASTDeclaration lastDecl = tu.getDeclarations()[tu.getDeclarations().length - 1];
targetLocation = lastDecl.getFileLocation();
}
String lineDelimiter = FileHelper.determineLineDelimiter(
- FileHelper.getFileFromNode(modification.getTargetNode()));
+ FileHelper.getFileFromNode(targetNode));
edit.addChild(new InsertEdit(targetLocation.getNodeOffset() + targetLocation.getNodeLength(),
lineDelimiter + lineDelimiter + newNodeCode));
break;
@@ -225,30 +394,32 @@ public class ChangeGenerator extends ASTVisitor {
private void createChange(IASTNode synthNode, String synthSource) {
IFile relevantFile = FileHelper.getFileFromNode(synthNode);
-
- String originalCode = originalCodeOfNode(synthNode);
+ String originalCode = originalCodeOfNode(synthNode, relevantFile);
CodeComparer codeComparer = new CodeComparer(originalCode, synthSource);
+ codeComparer.createChange(getEdit(synthNode, relevantFile), synthNode);
+ }
- MultiTextEdit edit;
- if (changes.containsKey(relevantFile)) {
- edit = changes.get(relevantFile);
- } else {
+ private MultiTextEdit getEdit(IASTNode modifiedNode, IFile file) {
+ MultiTextEdit edit = changes.get(file);
+ if (edit == null) {
edit = new MultiTextEdit();
- changes.put(relevantFile, edit);
+ changes.put(file, edit);
}
-
- codeComparer.createChange(edit, synthNode);
+ TextEditGroup editGroup = new TextEditGroup(Messages.ChangeGenerator_group);
+ for (ASTModification currentModification : modificationParent.get(modifiedNode)) {
+ if (currentModification.getAssociatedEditGroup() != null) {
+ editGroup = currentModification.getAssociatedEditGroup();
+ edit.addChildren(editGroup.getTextEdits());
+ break;
+ }
+ }
+ return edit;
}
- public String originalCodeOfNode(IASTNode node) {
- if (node.getFileLocation() != null) {
- IFile sourceFile = FileHelper.getFileFromNode(node);
- int nodeOffset = getOffsetIncludingComments(node);
- int nodeLength = getNodeLengthIncludingComments(node);
-
- return FileContentHelper.getContent(sourceFile, nodeOffset, nodeLength);
- }
- return null;
+ private String originalCodeOfNode(IASTNode node, IFile sourceFile) {
+ int nodeOffset = getOffsetIncludingComments(node);
+ int nodeLength = getNodeLengthIncludingComments(node);
+ return FileContentHelper.getContent(sourceFile, nodeOffset, nodeLength);
}
private int getNodeLengthIncludingComments(IASTNode node) {
@@ -290,23 +461,15 @@ public class ChangeGenerator extends ASTVisitor {
return nodeOffset;
}
- private String getIndent(IASTNode nextNode) {
- IASTFileLocation fileLocation = nextNode.getFileLocation();
- int length = fileLocation.getNodeOffset() - getOffsetForNodeFile(nextNode);
-
- String originalSource = FileContentHelper.getContent(FileHelper.getFileFromNode(nextNode),
- getOffsetForNodeFile(nextNode), length);
- StringBuilder indent = new StringBuilder(originalSource);
- indent.reverse();
- String lastline = indent.substring(0, Math.max(indent.indexOf("\n"), 0)); //$NON-NLS-1$
- if (lastline.trim().length() == 0) {
- return lastline;
- }
- return ""; //$NON-NLS-1$
+ private boolean hasChangedChild(IASTNode node) {
+ return modificationParent.containsKey(node);
}
- private boolean hasChangedChild(IASTNode parent) {
- return modificationParent.containsKey(parent);
+ private boolean hasAppendsOnly(IASTNode node) {
+ List<ASTModification> modifications = modificationParent.get(node);
+ if (modifications == null)
+ return false;
+ return isAppendable(modifications);
}
@Override
@@ -329,7 +492,7 @@ public class ChangeGenerator extends ASTVisitor {
@Override
public int visit(ICPPASTNamespaceDefinition namespaceDefinition) {
- if (hasChangedChild(namespaceDefinition)) {
+ if (hasChangedChild(namespaceDefinition) && !hasAppendsOnly(namespaceDefinition)) {
synthTreatment(namespaceDefinition);
return ASTVisitor.PROCESS_SKIP;
}
@@ -337,8 +500,16 @@ public class ChangeGenerator extends ASTVisitor {
}
@Override
+ public int leave(ICPPASTNamespaceDefinition namespaceDefinition) {
+ if (hasAppendsOnly(namespaceDefinition)) {
+ handleAppends(namespaceDefinition);
+ }
+ return super.leave(namespaceDefinition);
+ }
+
+ @Override
public int visit(IASTDeclSpecifier declSpec) {
- if (hasChangedChild(declSpec)) {
+ if (hasChangedChild(declSpec) && !hasAppendsOnly(declSpec)) {
synthTreatment(declSpec);
return ASTVisitor.PROCESS_SKIP;
}
@@ -346,6 +517,14 @@ public class ChangeGenerator extends ASTVisitor {
}
@Override
+ public int leave(IASTDeclSpecifier declSpec) {
+ if (hasAppendsOnly(declSpec)) {
+ handleAppends(declSpec);
+ }
+ return super.leave(declSpec);
+ }
+
+ @Override
public int visit(IASTExpression expression) {
if (hasChangedChild(expression)) {
synthTreatment(expression);
@@ -383,13 +562,21 @@ public class ChangeGenerator extends ASTVisitor {
@Override
public int visit(IASTStatement statement) {
- if (hasChangedChild(statement)) {
+ if (hasChangedChild(statement) && !hasAppendsOnly(statement)) {
synthTreatment(statement);
return ASTVisitor.PROCESS_SKIP;
}
return super.visit(statement);
}
+ @Override
+ public int leave(IASTStatement statement) {
+ if (hasAppendsOnly(statement)) {
+ handleAppends(statement);
+ }
+ return super.leave(statement);
+ }
+
class CodeComparer {
private final StringBuilder originalCode;
private final StringBuilder synthCode;
@@ -536,14 +723,6 @@ public class ChangeGenerator extends ASTVisitor {
protected void createChange(MultiTextEdit edit, IASTNode changedNode) {
int changeOffset = getOffsetIncludingComments(changedNode);
- TextEditGroup editGroup = new TextEditGroup(Messages.ChangeGenerator_group);
- for (ASTModification currentModification : modificationParent.get(changedNode)) {
- if (currentModification.getAssociatedEditGroup() != null) {
- editGroup = currentModification.getAssociatedEditGroup();
- edit.addChildren(editGroup.getTextEdits());
- break;
- }
- }
createChange(edit, changeOffset);
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/changegenerator/ModifiedASTDeclSpecWriter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/changegenerator/ModifiedASTDeclSpecWriter.java
index e6de9cb327..cd59141900 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/changegenerator/ModifiedASTDeclSpecWriter.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/changegenerator/ModifiedASTDeclSpecWriter.java
@@ -11,9 +11,9 @@
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.rewrite.changegenerator;
-import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier;
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
+import org.eclipse.cdt.internal.core.dom.rewrite.astwriter.ASTWriterVisitor;
import org.eclipse.cdt.internal.core.dom.rewrite.astwriter.DeclSpecWriter;
import org.eclipse.cdt.internal.core.dom.rewrite.astwriter.Scribe;
import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.NodeCommentMap;
@@ -21,8 +21,8 @@ import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.NodeCommentMap;
public class ModifiedASTDeclSpecWriter extends DeclSpecWriter {
private final ASTModificationHelper modificationHelper;
- public ModifiedASTDeclSpecWriter(Scribe scribe, ASTVisitor visitor, ModificationScopeStack stack,
- NodeCommentMap commentMap) {
+ public ModifiedASTDeclSpecWriter(Scribe scribe, ASTWriterVisitor visitor,
+ ModificationScopeStack stack, NodeCommentMap commentMap) {
super(scribe, visitor, commentMap);
this.modificationHelper = new ASTModificationHelper(stack);
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/changegenerator/ModifiedASTDeclarationWriter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/changegenerator/ModifiedASTDeclarationWriter.java
index 59e3953fad..0ea61f3aac 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/changegenerator/ModifiedASTDeclarationWriter.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/changegenerator/ModifiedASTDeclarationWriter.java
@@ -12,11 +12,11 @@
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.rewrite.changegenerator;
-import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConstructorChainInitializer;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDefinition;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNamespaceDefinition;
+import org.eclipse.cdt.internal.core.dom.rewrite.astwriter.ASTWriterVisitor;
import org.eclipse.cdt.internal.core.dom.rewrite.astwriter.DeclarationWriter;
import org.eclipse.cdt.internal.core.dom.rewrite.astwriter.Scribe;
import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.NodeCommentMap;
@@ -24,21 +24,26 @@ import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.NodeCommentMap;
public class ModifiedASTDeclarationWriter extends DeclarationWriter {
private final ASTModificationHelper modificationHelper;
- public ModifiedASTDeclarationWriter(Scribe scribe, ASTVisitor visitor, ModificationScopeStack stack, NodeCommentMap commentMap) {
+ public ModifiedASTDeclarationWriter(Scribe scribe, ASTWriterVisitor visitor,
+ ModificationScopeStack stack, NodeCommentMap commentMap) {
super(scribe, visitor, commentMap);
this.modificationHelper = new ASTModificationHelper(stack);
}
@Override
- protected void writeDeclarationsInNamespace(ICPPASTNamespaceDefinition namespaceDefinition, IASTDeclaration[] declarations) {
- IASTDeclaration[] modifiedDeclarations = modificationHelper.createModifiedChildArray(namespaceDefinition, declarations, IASTDeclaration.class, commentMap);
+ protected void writeDeclarationsInNamespace(ICPPASTNamespaceDefinition namespaceDefinition,
+ IASTDeclaration[] declarations) {
+ IASTDeclaration[] modifiedDeclarations = modificationHelper.createModifiedChildArray(
+ namespaceDefinition, declarations, IASTDeclaration.class, commentMap);
super.writeDeclarationsInNamespace(namespaceDefinition, modifiedDeclarations);
}
@Override
protected void writeCtorChainInitializer(ICPPASTFunctionDefinition funcDec,
ICPPASTConstructorChainInitializer[] ctorInitChain) {
- ICPPASTConstructorChainInitializer[] modifiedChainInitializer = modificationHelper.createModifiedChildArray(funcDec, ctorInitChain, ICPPASTConstructorChainInitializer.class, commentMap);
- super.writeCtorChainInitializer(funcDec, modifiedChainInitializer);
+ ICPPASTConstructorChainInitializer[] modifiedInitializer =
+ modificationHelper.createModifiedChildArray(funcDec, ctorInitChain,
+ ICPPASTConstructorChainInitializer.class, commentMap);
+ super.writeCtorChainInitializer(funcDec, modifiedInitializer);
}
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/changegenerator/ModifiedASTDeclaratorWriter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/changegenerator/ModifiedASTDeclaratorWriter.java
index cb764ab7ed..b5d416a772 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/changegenerator/ModifiedASTDeclaratorWriter.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/changegenerator/ModifiedASTDeclaratorWriter.java
@@ -12,7 +12,6 @@
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.rewrite.changegenerator;
-import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTArrayDeclarator;
import org.eclipse.cdt.core.dom.ast.IASTArrayModifier;
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
@@ -25,6 +24,7 @@ import org.eclipse.cdt.core.dom.ast.IASTStandardFunctionDeclarator;
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator;
import org.eclipse.cdt.core.dom.ast.gnu.c.ICASTKnRFunctionDeclarator;
+import org.eclipse.cdt.internal.core.dom.rewrite.astwriter.ASTWriterVisitor;
import org.eclipse.cdt.internal.core.dom.rewrite.astwriter.DeclaratorWriter;
import org.eclipse.cdt.internal.core.dom.rewrite.astwriter.Scribe;
import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.NodeCommentMap;
@@ -32,7 +32,7 @@ import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.NodeCommentMap;
public class ModifiedASTDeclaratorWriter extends DeclaratorWriter {
private final ASTModificationHelper modificationHelper;
- public ModifiedASTDeclaratorWriter(Scribe scribe, ASTVisitor visitor, ModificationScopeStack stack, NodeCommentMap commentMap) {
+ public ModifiedASTDeclaratorWriter(Scribe scribe, ASTWriterVisitor visitor, ModificationScopeStack stack, NodeCommentMap commentMap) {
super(scribe, visitor, commentMap);
this.modificationHelper = new ASTModificationHelper(stack);
}
@@ -40,29 +40,31 @@ public class ModifiedASTDeclaratorWriter extends DeclaratorWriter {
@Override
protected void writeParameterDeclarations(IASTStandardFunctionDeclarator funcDec,
IASTParameterDeclaration[] paraDecls) {
- IASTParameterDeclaration[] modifiedParameters = modificationHelper
- .createModifiedChildArray(funcDec, paraDecls, IASTParameterDeclaration.class,
- commentMap);
+ IASTParameterDeclaration[] modifiedParameters = modificationHelper.createModifiedChildArray(
+ funcDec, paraDecls, IASTParameterDeclaration.class, commentMap);
super.writeParameterDeclarations(funcDec, modifiedParameters);
}
@Override
- protected void writePointerOperators(IASTDeclarator declarator,IASTPointerOperator[] unmodifiedPointerOperations) {
+ protected void writePointerOperators(IASTDeclarator declarator,
+ IASTPointerOperator[] unmodifiedPointerOperations) {
IASTPointerOperator[] modifiedPointer = modificationHelper.createModifiedChildArray(
declarator, unmodifiedPointerOperations, IASTPointerOperator.class, commentMap);
super.writePointerOperators(declarator, modifiedPointer);
}
@Override
- protected void writeArrayModifiers(IASTArrayDeclarator arrDecl,
- IASTArrayModifier[] arrMods) {
- IASTArrayModifier[] modifiedModifiers = modificationHelper.createModifiedChildArray(arrDecl, arrMods, IASTArrayModifier.class, commentMap);
+ protected void writeArrayModifiers(IASTArrayDeclarator arrDecl, IASTArrayModifier[] arrMods) {
+ IASTArrayModifier[] modifiedModifiers = modificationHelper.createModifiedChildArray(arrDecl,
+ arrMods, IASTArrayModifier.class, commentMap);
super.writeArrayModifiers(arrDecl, modifiedModifiers);
}
@Override
- protected void writeExceptionSpecification(ICPPASTFunctionDeclarator funcDec, IASTTypeId[] exceptions ) {
- IASTTypeId[] modifiedExceptions = modificationHelper.createModifiedChildArray(funcDec, exceptions, IASTTypeId.class, commentMap);
+ protected void writeExceptionSpecification(ICPPASTFunctionDeclarator funcDec,
+ IASTTypeId[] exceptions) {
+ IASTTypeId[] modifiedExceptions = modificationHelper.createModifiedChildArray(funcDec,
+ exceptions, IASTTypeId.class, commentMap);
// it makes a difference whether the exception array is identical to
// ICPPASTFunctionDeclarator.NO_EXCEPTION_SPECIFICATION
if (modifiedExceptions.length == 0 &&
@@ -74,18 +76,18 @@ public class ModifiedASTDeclaratorWriter extends DeclaratorWriter {
}
@Override
- protected void writeKnRParameterDeclarations(
- ICASTKnRFunctionDeclarator knrFunct,
+ protected void writeKnRParameterDeclarations(ICASTKnRFunctionDeclarator knrFunct,
IASTDeclaration[] knrDeclarations) {
- IASTDeclaration[] modifiedDeclarations = modificationHelper.createModifiedChildArray(knrFunct, knrDeclarations, IASTDeclaration.class, commentMap);
-
+ IASTDeclaration[] modifiedDeclarations = modificationHelper.createModifiedChildArray(
+ knrFunct, knrDeclarations, IASTDeclaration.class, commentMap);
super.writeKnRParameterDeclarations(knrFunct, modifiedDeclarations);
}
@Override
- protected void writeKnRParameterNames(
- ICASTKnRFunctionDeclarator knrFunct, IASTName[] parameterNames) {
- IASTName[] modifiedNames = modificationHelper.createModifiedChildArray(knrFunct, parameterNames, IASTName.class, commentMap);
+ protected void writeKnRParameterNames(ICASTKnRFunctionDeclarator knrFunct,
+ IASTName[] parameterNames) {
+ IASTName[] modifiedNames = modificationHelper.createModifiedChildArray(knrFunct,
+ parameterNames, IASTName.class, commentMap);
super.writeKnRParameterNames(knrFunct, modifiedNames);
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/changegenerator/ModifiedASTExpressionWriter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/changegenerator/ModifiedASTExpressionWriter.java
index 08262e57d2..609182ec19 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/changegenerator/ModifiedASTExpressionWriter.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/changegenerator/ModifiedASTExpressionWriter.java
@@ -12,7 +12,6 @@
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.rewrite.changegenerator;
-import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTExpression;
import org.eclipse.cdt.core.dom.ast.IASTExpressionList;
import org.eclipse.cdt.core.dom.ast.IASTInitializer;
@@ -20,6 +19,7 @@ import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNewExpression;
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModification;
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModification.ModificationKind;
+import org.eclipse.cdt.internal.core.dom.rewrite.astwriter.ASTWriterVisitor;
import org.eclipse.cdt.internal.core.dom.rewrite.astwriter.ExpressionWriter;
import org.eclipse.cdt.internal.core.dom.rewrite.astwriter.MacroExpansionHandler;
import org.eclipse.cdt.internal.core.dom.rewrite.astwriter.Scribe;
@@ -28,7 +28,7 @@ import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.NodeCommentMap;
public class ModifiedASTExpressionWriter extends ExpressionWriter {
private final ASTModificationHelper modificationHelper;
- public ModifiedASTExpressionWriter(Scribe scribe, ASTVisitor visitor, MacroExpansionHandler macroHandler,
+ public ModifiedASTExpressionWriter(Scribe scribe, ASTWriterVisitor visitor, MacroExpansionHandler macroHandler,
ModificationScopeStack stack, NodeCommentMap commentMap) {
super(scribe, visitor, macroHandler, commentMap);
this.modificationHelper = new ASTModificationHelper(stack);
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/changegenerator/ModifiedASTStatementWriter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/changegenerator/ModifiedASTStatementWriter.java
index 0f5f049194..9977fbbf7e 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/changegenerator/ModifiedASTStatementWriter.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/changegenerator/ModifiedASTStatementWriter.java
@@ -11,10 +11,10 @@
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.rewrite.changegenerator;
-import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTCompoundStatement;
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
import org.eclipse.cdt.core.dom.ast.IASTStatement;
+import org.eclipse.cdt.internal.core.dom.rewrite.astwriter.ASTWriterVisitor;
import org.eclipse.cdt.internal.core.dom.rewrite.astwriter.Scribe;
import org.eclipse.cdt.internal.core.dom.rewrite.astwriter.StatementWriter;
import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.NodeCommentMap;
@@ -22,7 +22,7 @@ import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.NodeCommentMap;
public class ModifiedASTStatementWriter extends StatementWriter {
private final ASTModificationHelper modificationHelper;
- public ModifiedASTStatementWriter(Scribe scribe, ASTVisitor visitor, ModificationScopeStack stack, NodeCommentMap commentMap) {
+ public ModifiedASTStatementWriter(Scribe scribe, ASTWriterVisitor visitor, ModificationScopeStack stack, NodeCommentMap commentMap) {
super(scribe, visitor, commentMap);
this.modificationHelper = new ASTModificationHelper(stack);
}
diff --git a/core/org.eclipse.cdt.ui.tests/resources/refactoring/DefinitionFinder.rts b/core/org.eclipse.cdt.ui.tests/resources/refactoring/DefinitionFinder.rts
index 0fbde7fc77..32b1c87152 100644
--- a/core/org.eclipse.cdt.ui.tests/resources/refactoring/DefinitionFinder.rts
+++ b/core/org.eclipse.cdt.ui.tests/resources/refactoring/DefinitionFinder.rts
@@ -13,8 +13,6 @@ void foo();
//@A.cpp
#include "A.h"
-void foo()
-{
-
+void foo() {
}
diff --git a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ExtractConstant.rts b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ExtractConstant.rts
index 741b028f6a..5239119364 100644
--- a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ExtractConstant.rts
+++ b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ExtractConstant.rts
@@ -4,8 +4,7 @@
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
@@ -20,14 +19,13 @@ public:
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
int foo();
void bar();
- static const int theAnswer = 42;
+ static const int theAnswer = 42;
};
#endif /*A_H_*/
@@ -36,21 +34,17 @@ public:
//@A.cpp
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-int A::foo()
-{
- return /*$*/42/*$$*/; //Hallo
+int A::foo() {
+ return /*$*/42/*$$*/; //Hello
}
-void A::bar()
-{
+void A::bar() {
int a = 42;
int b = 42;
}
@@ -58,21 +52,17 @@ void A::bar()
//=
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-int A::foo()
-{
- return theAnswer; //Hallo
+int A::foo() {
+ return theAnswer; //Hello
}
-void A::bar()
-{
+void A::bar() {
int a = theAnswer;
int b = theAnswer;
}
@@ -83,8 +73,7 @@ void A::bar()
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
@@ -99,14 +88,13 @@ public:
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
int foo();
void bar();
- static const int theAnswer = 42;
+ static const int theAnswer = 42;
};
#endif /*A_H_*/
@@ -115,22 +103,18 @@ public:
//@A.cpp
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-int A::foo()
-{
+int A::foo() {
//Hallo
return /*$*/42/*$$*/;
}
-void A::bar()
-{
+void A::bar() {
int a = 42;
int b = 42;
}
@@ -138,22 +122,18 @@ void A::bar()
//=
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-int A::foo()
-{
+int A::foo() {
//Hallo
return theAnswer;
}
-void A::bar()
-{
+void A::bar() {
int a = theAnswer;
int b = theAnswer;
}
@@ -164,8 +144,7 @@ void A::bar()
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
@@ -180,14 +159,13 @@ public:
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
float foo();
void bar();
- static const float theAnswer = 42.0f;
+ static const float theAnswer = 42.0f;
};
#endif /*A_H_*/
@@ -196,21 +174,17 @@ public:
//@A.cpp
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-float A::foo()
-{
+float A::foo() {
return /*$*/42.0f/*$$*/;
}
-void A::bar()
-{
+void A::bar() {
float a = 42.0f;
float b = 42.0f;
}
@@ -218,21 +192,17 @@ void A::bar()
//=
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-float A::foo()
-{
+float A::foo() {
return theAnswer;
}
-void A::bar()
-{
+void A::bar() {
float a = theAnswer;
float b = theAnswer;
}
@@ -243,8 +213,7 @@ void A::bar()
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
@@ -259,14 +228,13 @@ public:
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
double foo();
void bar();
- static const double theAnswer = 42.0;
+ static const double theAnswer = 42.0;
};
#endif /*A_H_*/
@@ -275,21 +243,17 @@ public:
//@A.cpp
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-double A::foo()
-{
+double A::foo() {
return /*$*/42.0/*$$*/;
}
-void A::bar()
-{
+void A::bar() {
double a = 42.0;
double b = 42.0;
}
@@ -297,21 +261,17 @@ void A::bar()
//=
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-double A::foo()
-{
+double A::foo() {
return theAnswer;
}
-void A::bar()
-{
+void A::bar() {
double a = theAnswer;
double b = theAnswer;
}
@@ -322,8 +282,7 @@ void A::bar()
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
@@ -337,8 +296,7 @@ public:
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
@@ -351,51 +309,43 @@ public:
//@A.cpp
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-int A::foo()
-{
+int A::foo() {
return 42;
}
-int bar()
-{
+int bar() {
return /*$*/42/*$$*/;
}
-
//=
#include "A.h"
-namespace
-{
- const int theAnswer = 42;
+namespace {
+
+const int theAnswer = 42;
+
}
-A::A()
-{
+
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-int A::foo()
-{
+int A::foo() {
return theAnswer;
}
-int bar()
-{
+int bar() {
return theAnswer;
}
-
//!replaceNumberProtected
//#org.eclipse.cdt.ui.tests.refactoring.extractconstant.ExtractConstantRefactoringTest
//@.config
@@ -404,8 +354,7 @@ visibility=protected
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
@@ -418,14 +367,14 @@ public:
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
int foo();
+
protected:
- static const int theAnswer = 42;
+ static const int theAnswer = 42;
};
#endif /*A_H_*/
@@ -433,32 +382,26 @@ protected:
//@A.cpp
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-int A::foo()
-{
+int A::foo() {
return /*$*/42/*$$*/;
}
//=
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-int A::foo()
-{
+int A::foo() {
return theAnswer;
}
@@ -470,8 +413,7 @@ visibility=private
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
@@ -484,14 +426,14 @@ public:
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
int foo();
+
private:
- static const int theAnswer = 42;
+ static const int theAnswer = 42;
};
#endif /*A_H_*/
@@ -499,32 +441,26 @@ private:
//@A.cpp
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-int A::foo()
-{
+int A::foo() {
return /*$*/42/*$$*/;
}
//=
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-int A::foo()
-{
+int A::foo() {
return theAnswer;
}
@@ -535,18 +471,18 @@ filename=A.h
//@A.h
class X {
void method() {
- int a= /*$*/42/*$$*/;
+ int a = /*$*/42/*$$*/;
}
};
//=
class X {
void method() {
- int a= theAnswer;
- }
+ int a = theAnswer;
+ }
public:
- static const int theAnswer = 42;
+ static const int theAnswer = 42;
};
//!ExtractConstantString
@@ -556,30 +492,26 @@ visibility=private
filename=A.h
//@A.h
class X {
- void method()
- {
- char *a = /*$*/"sometext"/*$$*/;
- }
-
- void method2()
- {
- const char *b = "sometext";
- }
+ void method() {
+ char* a = /*$*/"sometext"/*$$*/;
+ }
+
+ void method2() {
+ const char* b = "sometext";
+ }
};
//=
class X {
- void method()
- {
- char *a = theAnswer;
- }
+ void method() {
+ char* a = theAnswer;
+ }
- void method2()
- {
- const char *b = theAnswer;
- }
+ void method2() {
+ const char* b = theAnswer;
+ }
- static const char *theAnswer = "sometext";
+ static const char* theAnswer = "sometext";
};
//!ExtractConstantWideString
@@ -589,31 +521,27 @@ visibility=private
filename=A.h
//@A.h
class X {
- void method()
- {
- wchar_t *a = /*$*/L"sometext"/*$$*/;
- }
-
- void method2()
- {
- const wchar_t *b = L"sometext";
- const char *c = "sometext";
- }
+ void method() {
+ wchar_t* a = /*$*/L"sometext"/*$$*/;
+ }
+
+ void method2() {
+ const wchar_t* b = L"sometext";
+ const char* c = "sometext";
+ }
};
//=
class X {
- void method()
- {
- wchar_t *a = theAnswer;
- }
-
- void method2()
- {
- const wchar_t *b = theAnswer;
- const char *c = "sometext";
- }
-
- static const wchar_t *theAnswer = L"sometext";
+ void method() {
+ wchar_t* a = theAnswer;
+ }
+
+ void method2() {
+ const wchar_t* b = theAnswer;
+ const char* c = "sometext";
+ }
+
+ static const wchar_t* theAnswer = L"sometext";
};
diff --git a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ExtractConstantHistory.rts b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ExtractConstantHistory.rts
index ad7301cdae..1083509645 100644
--- a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ExtractConstantHistory.rts
+++ b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ExtractConstantHistory.rts
@@ -4,8 +4,7 @@
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
@@ -19,14 +18,13 @@ public:
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
int foo();
void bar();
- static const int theAnswer = 42;
+ static const int theAnswer = 42;
};
#endif /*A_H_*/
@@ -34,21 +32,17 @@ public:
//@A.cpp
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-int A::foo()
-{
- return 42; //Hallo
+int A::foo() {
+ return 42; // Hello
}
-void A::bar()
-{
+void A::bar() {
int a = 42;
int b = 42;
}
@@ -56,21 +50,17 @@ void A::bar()
//=
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-int A::foo()
-{
- return theAnswer; //Hallo
+int A::foo() {
+ return theAnswer; // Hello
}
-void A::bar()
-{
+void A::bar() {
int a = theAnswer;
int b = theAnswer;
}
@@ -91,8 +81,7 @@ project="RegressionTestProject" selection="64,2" visibility="public"/>
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
@@ -105,14 +94,14 @@ public:
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
int foo();
+
protected:
- static const int theAnswer = 42;
+ static const int theAnswer = 42;
};
#endif /*A_H_*/
@@ -120,32 +109,26 @@ protected:
//@A.cpp
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-int A::foo()
-{
+int A::foo() {
return 42;
}
//=
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-int A::foo()
-{
+int A::foo() {
return theAnswer;
}
@@ -164,8 +147,7 @@ project="RegressionTestProject" selection="64,2" visibility="protected"/>
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
@@ -178,14 +160,14 @@ public:
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
int foo();
+
private:
- static const int theAnswer = 42;
+ static const int theAnswer = 42;
};
#endif /*A_H_*/
@@ -193,32 +175,26 @@ private:
//@A.cpp
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-int A::foo()
-{
+int A::foo() {
return 42;
}
//=
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-int A::foo()
-{
+int A::foo() {
return theAnswer;
}
diff --git a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ExtractExpression.rts b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ExtractExpression.rts
index ce5138b2e2..2381a7d751 100644
--- a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ExtractExpression.rts
+++ b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ExtractExpression.rts
@@ -6,43 +6,38 @@ filename=test.cpp
methodname=check
//@test.h
-class Test
-{
- void test();
+class Test {
+ void test();
};
//=
-class Test
-{
- void test();
- bool check();
+class Test {
+ void test();
+ bool check();
};
//@test.cpp
#include "test.h"
-void Test::test()
-{
- if(/*$*/5 == 3 + 2/*$$*/) {
+void Test::test() {
+ if (/*$*/5 == 3 + 2/*$$*/) {
//...
- }
+ }
}
//=
#include "test.h"
-bool Test::check()
-{
- return 5 == 3 + 2;
+bool Test::check() {
+ return 5 == 3 + 2;
}
-void Test::test()
-{
- if(check()) {
+void Test::test() {
+ if (check()) {
//...
- }
+ }
}
//!Extract boolean comparison from if-condition with parameter.
@@ -53,45 +48,40 @@ filename=test.cpp
methodname=check
//@test.h
-class Test
-{
- void test();
+class Test {
+ void test();
};
//=
-class Test
-{
- void test();
- bool check(int num);
+class Test {
+ void test();
+ bool check(int num);
};
//@test.cpp
#include "test.h"
-void Test::test()
-{
- int num = 1;
- if(/*$*/5 != 3 + num/*$$*/) {
+void Test::test() {
+ int num = 1;
+ if (/*$*/5 != 3 + num/*$$*/) {
//...
- }
+ }
}
//=
#include "test.h"
-bool Test::check(int num)
-{
- return 5 != 3 + num;
+bool Test::check(int num) {
+ return 5 != 3 + num;
}
-void Test::test()
-{
- int num = 1;
- if(check(num)) {
+void Test::test() {
+ int num = 1;
+ if (check(num)) {
//...
- }
+ }
}
//!Extract binary expression that results in a function with the same return type (BasicType) as the LHS.
@@ -102,43 +92,38 @@ filename=test.cpp
methodname=add
//@test.h
-class Test
-{
- void test();
+class Test {
+ void test();
};
//=
-class Test
-{
- void test();
- int add(int five, int six);
+class Test {
+ void test();
+ int add(int five, int six);
};
//@test.cpp
#include "test.h"
-void Test::test()
-{
+void Test::test() {
int five = 5;
int six = 6;
- int result = /*$*/five + six/*$$*/;
+ int result = /*$*/five + six/*$$*/;
}
//=
#include "test.h"
-int Test::add(int five, int six)
-{
- return five + six;
+int Test::add(int five, int six) {
+ return five + six;
}
-void Test::test()
-{
+void Test::test() {
int five = 5;
int six = 6;
- int result = add(five, six);
+ int result = add(five, six);
}
//!Extract binary expression that results in a function with the same return type (ClassType) as the LHS
@@ -151,45 +136,40 @@ methodname=cat
//@test.h
struct helper {};
-class Test
-{
- void test();
+class Test {
+ void test();
};
//=
struct helper {};
-class Test
-{
- void test();
- helper cat(helper s1, helper s2);
+class Test {
+ void test();
+ helper cat(helper s1, helper s2);
};
//@test.cpp
#include "test.h"
-void Test::test()
-{
+void Test::test() {
helper s1 = "a";
helper s2 = "b";
- helper result = /*$*/s1 + s2/*$$*/;
+ helper result = /*$*/s1 + s2/*$$*/;
}
//=
#include "test.h"
-helper Test::cat(helper s1, helper s2)
-{
- return s1 + s2;
+helper Test::cat(helper s1, helper s2) {
+ return s1 + s2;
}
-void Test::test()
-{
+void Test::test() {
helper s1 = "a";
helper s2 = "b";
- helper result = cat(s1, s2);
+ helper result = cat(s1, s2);
}
//!Extract binary expression that results in a function with the same return type (Typedef) as the LHS
@@ -203,9 +183,8 @@ methodname=cat
struct helper {};
typedef helper new_helper;
-class Test
-{
- void test();
+class Test {
+ void test();
};
@@ -213,36 +192,32 @@ class Test
struct helper {};
typedef helper new_helper;
-class Test
-{
- void test();
- new_helper cat(new_helper s1, new_helper s2);
+class Test {
+ void test();
+ new_helper cat(new_helper s1, new_helper s2);
};
//@test.cpp
#include "test.h"
-void Test::test()
-{
+void Test::test() {
new_helper s1 = "a";
new_helper s2 = "b";
- new_helper result = /*$*/s1 + s2/*$$*/;
+ new_helper result = /*$*/s1 + s2/*$$*/;
}
//=
#include "test.h"
-new_helper Test::cat(new_helper s1, new_helper s2)
-{
- return s1 + s2;
+new_helper Test::cat(new_helper s1, new_helper s2) {
+ return s1 + s2;
}
-void Test::test()
-{
+void Test::test() {
new_helper s1 = "a";
new_helper s2 = "b";
- new_helper result = cat(s1, s2);
+ new_helper result = cat(s1, s2);
}
//!Extract new-Expression
@@ -256,23 +231,20 @@ methodname=new_helper
struct helper {};
-int main(int argc, char** argv)
-{
- helper* h = /*$*/new helper/*$$*/;
+int main(int argc, char** argv) {
+ helper* h = /*$*/new helper/*$$*/;
return 0;
}
//=
struct helper {};
-helper *new_helper()
-{
- return new helper;
+helper* new_helper() {
+ return new helper;
}
-int main(int argc, char** argv)
-{
- helper* h = new_helper();
+int main(int argc, char** argv) {
+ helper* h = new_helper();
return 0;
}
//!Extract function call
@@ -285,33 +257,28 @@ methodname=join_with_world
//@test.cpp
class string {};
-string join(string s1, char* s2)
-{
- return s1 + " " + s2;
+string join(string s1, char* s2) {
+ return s1 + " " + s2;
}
-int main()
-{
- string hello = "Hello";
- cout << /*$*/join(hello, "World")/*$$*/ << endl;
+int main() {
+ string hello = "Hello";
+ cout << /*$*/join(hello, "World")/*$$*/ << endl;
}
//=
class string {};
-string join(string s1, char* s2)
-{
- return s1 + " " + s2;
+string join(string s1, char* s2) {
+ return s1 + " " + s2;
}
-string join_with_world(string hello)
-{
- return join(hello, "World");
+string join_with_world(string hello) {
+ return join(hello, "World");
}
-int main()
-{
- string hello = "Hello";
- cout << join_with_world(hello) << endl;
+int main() {
+ string hello = "Hello";
+ cout << join_with_world(hello) << endl;
}
//!Extract method call
//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest
@@ -321,40 +288,36 @@ filename=test.cpp
methodname=value_from
//@test.cpp
-struct other
-{
- bool value() {}
-};
-
-class Klass
-{
- void set(bool b){}
- void test()
- {
- other o;
- this->set(/*$*/o.value()/*$$*/);
+struct other {
+ bool value() {}
+};
+
+class Klass {
+ void set(bool b) {
+ }
+
+ void test() {
+ other o;
+ this->set(/*$*/o.value()/*$$*/);
}
};
//=
-struct other
-{
- bool value() {}
+struct other {
+ bool value() {}
};
-class Klass
-{
- void set(bool b){}
+class Klass {
+ void set(bool b) {
+ }
- bool value_from(other o)
- {
- return o.value();
- }
+ bool value_from(other o) {
+ return o.value();
+ }
- void test()
- {
- other o;
- this->set(value_from(o));
+ void test() {
+ other o;
+ this->set(value_from(o));
}
};
@@ -380,9 +343,8 @@ class Cursor{};
Cursor* contains(const Cursor& pos);
-Cursor *has(Cursor c)
-{
- return contains(c);
+Cursor* has(Cursor c) {
+ return contains(c);
}
int main() {
@@ -400,8 +362,7 @@ methodname=has
//@test.cpp
class Cursor{};
-Cursor* contains(const Cursor& pos)
-{
+Cursor* contains(const Cursor& pos) {
;
}
@@ -413,14 +374,12 @@ int main() {
//=
class Cursor{};
-Cursor* contains(const Cursor& pos)
-{
+Cursor* contains(const Cursor& pos) {
;
}
-Cursor *has(Cursor c)
-{
- return contains(c);
+Cursor* has(Cursor c) {
+ return contains(c);
}
int main() {
@@ -436,39 +395,34 @@ filename=test.cpp
methodname=greeting
//@test.h
-class Test
-{
+class Test {
void test();
};
//=
-class Test
-{
+class Test {
void test();
- const char greeting();
+ const char greeting();
};
//@test.cpp
#include "test.h"
-void Test::test()
-{
- char* hi = /*$*/"hello"/*$$*/;
+void Test::test() {
+ char* hi = /*$*/"hello"/*$$*/;
}
//=
#include "test.h"
-const char Test::greeting()
-{
- return "hello";
+const char Test::greeting() {
+ return "hello";
}
-void Test::test()
-{
- char* hi = greeting();
+void Test::test() {
+ char* hi = greeting();
}
//!Extract int constant
@@ -479,39 +433,34 @@ filename=test.cpp
methodname=size
//@test.h
-class Test
-{
+class Test {
void test();
};
//=
-class Test
-{
+class Test {
void test();
- int size();
+ int size();
};
//@test.cpp
#include "test.h"
-void Test::test()
-{
- int i = /*$*/42/*$$*/;
+void Test::test() {
+ int i = /*$*/42/*$$*/;
}
//=
#include "test.h"
-int Test::size()
-{
- return 42;
+int Test::size() {
+ return 42;
}
-void Test::test()
-{
- int i = size();
+void Test::test() {
+ int i = size();
}
//!Extract float constant
@@ -522,39 +471,34 @@ filename=test.cpp
methodname=certainty
//@test.h
-class Test
-{
+class Test {
void test();
};
//=
-class Test
-{
+class Test {
void test();
- float certainty();
+ float certainty();
};
//@test.cpp
#include "test.h"
-void Test::test()
-{
- float f = /*$*/0.42f/*$$*/;
+void Test::test() {
+ float f = /*$*/0.42f/*$$*/;
}
//=
#include "test.h"
-float Test::certainty()
-{
- return 0.42f;
+float Test::certainty() {
+ return 0.42f;
}
-void Test::test()
-{
- float f = certainty();
+void Test::test() {
+ float f = certainty();
}
//!Extract char constant
@@ -565,39 +509,34 @@ filename=test.cpp
methodname=newline
//@test.h
-class Test
-{
+class Test {
void test();
};
//=
-class Test
-{
+class Test {
void test();
- char newline();
+ char newline();
};
//@test.cpp
#include "test.h"
-void Test::test()
-{
- char nl = /*$*/'\n'/*$$*/;
+void Test::test() {
+ char nl = /*$*/'\n'/*$$*/;
}
//=
#include "test.h"
-char Test::newline()
-{
- return '\n';
+char Test::newline() {
+ return '\n';
}
-void Test::test()
-{
- char nl = newline();
+void Test::test() {
+ char nl = newline();
}
//!Extract boolean true constant
@@ -608,39 +547,34 @@ filename=test.cpp
methodname=valid
//@test.h
-class Test
-{
+class Test {
void test();
};
//=
-class Test
-{
+class Test {
void test();
- bool valid();
+ bool valid();
};
//@test.cpp
#include "test.h"
-void Test::test()
-{
- bool b = /*$*/true/*$$*/;
+void Test::test() {
+ bool b = /*$*/true/*$$*/;
}
//=
#include "test.h"
-bool Test::valid()
-{
- return true;
+bool Test::valid() {
+ return true;
}
-void Test::test()
-{
- bool b = valid();
+void Test::test() {
+ bool b = valid();
}
//!Extract boolean false constant
@@ -651,39 +585,34 @@ filename=test.cpp
methodname=invalid
//@test.h
-class Test
-{
+class Test {
void test();
};
//=
-class Test
-{
+class Test {
void test();
- bool invalid();
+ bool invalid();
};
//@test.cpp
#include "test.h"
-void Test::test()
-{
- bool b = /*$*/false/*$$*/;
+void Test::test() {
+ bool b = /*$*/false/*$$*/;
}
//=
#include "test.h"
-bool Test::invalid()
-{
- return false;
+bool Test::invalid() {
+ return false;
}
-void Test::test()
-{
- bool b = invalid();
+void Test::test() {
+ bool b = invalid();
}
//!Extract int constant
@@ -694,39 +623,34 @@ filename=test.cpp
methodname=size
//@test.h
-class Test
-{
+class Test {
void test();
};
//=
-class Test
-{
+class Test {
void test();
- int size();
+ int size();
};
//@test.cpp
#include "test.h"
-void Test::test()
-{
- int i = /*$*/42/*$$*/;
+void Test::test() {
+ int i = /*$*/42/*$$*/;
}
//=
#include "test.h"
-int Test::size()
-{
- return 42;
+int Test::size() {
+ return 42;
}
-void Test::test()
-{
- int i = size();
+void Test::test() {
+ int i = size();
}
//!Extract char constant
@@ -737,39 +661,34 @@ filename=test.cpp
methodname=newline
//@test.h
-class Test
-{
+class Test {
void test();
};
//=
-class Test
-{
+class Test {
void test();
- char newline();
+ char newline();
};
//@test.cpp
#include "test.h"
-void Test::test()
-{
- char nl = /*$*/'\n'/*$$*/;
+void Test::test() {
+ char nl = /*$*/'\n'/*$$*/;
}
//=
#include "test.h"
-char Test::newline()
-{
- return '\n';
+char Test::newline() {
+ return '\n';
}
-void Test::test()
-{
- char nl = newline();
+void Test::test() {
+ char nl = newline();
}
//!Extract boolean true constant
@@ -780,39 +699,34 @@ filename=test.cpp
methodname=valid
//@test.h
-class Test
-{
+class Test {
void test();
};
//=
-class Test
-{
+class Test {
void test();
- bool valid();
+ bool valid();
};
//@test.cpp
#include "test.h"
-void Test::test()
-{
- bool b = /*$*/true/*$$*/;
+void Test::test() {
+ bool b = /*$*/true/*$$*/;
}
//=
#include "test.h"
-bool Test::valid()
-{
- return true;
+bool Test::valid() {
+ return true;
}
-void Test::test()
-{
- bool b = valid();
+void Test::test() {
+ bool b = valid();
}
//!Extract boolean false constant
@@ -823,39 +737,34 @@ filename=test.cpp
methodname=invalid
//@test.h
-class Test
-{
+class Test {
void test();
};
//=
-class Test
-{
+class Test {
void test();
- bool invalid();
+ bool invalid();
};
//@test.cpp
#include "test.h"
-void Test::test()
-{
- bool b = /*$*/false/*$$*/;
+void Test::test() {
+ bool b = /*$*/false/*$$*/;
}
//=
#include "test.h"
-bool Test::invalid()
-{
- return false;
+bool Test::invalid() {
+ return false;
}
-void Test::test()
-{
- bool b = invalid();
+void Test::test() {
+ bool b = invalid();
}
//!Extract expresion with typdef Bug 331985
@@ -868,20 +777,19 @@ methodname=bar
//@test.cpp
typedef int& foo;
int test(foo s) {
- int a= /*$*/s + 1/*$$*/; // type of id-expression 's' is int, not 'foo' or 'int&'
+ int a = /*$*/s + 1/*$$*/; // type of id-expression 's' is int, not 'foo' or 'int&'
return a;
}
//=
typedef int& foo;
-int bar(foo s)
-{
- return s + 1;
+int bar(foo s) {
+ return s + 1;
}
int test(foo s) {
- int a= bar(s); // type of id-expression 's' is int, not 'foo' or 'int&'
+ int a = bar(s); // type of id-expression 's' is int, not 'foo' or 'int&'
return a;
}
@@ -895,21 +803,20 @@ methodname=bar
//@test.cpp
-void foo(){
+void foo() {
int x = 3;
- double y = /*$*/x + 2.5/*$$*/;
+ double y = /*$*/x + 2.5/*$$*/;
}
//=
-double bar(int x)
-{
- return x + 2.5;
+double bar(int x) {
+ return x + 2.5;
}
-void foo(){
+void foo() {
int x = 3;
- double y = bar(x);
+ double y = bar(x);
}
//! Extract macro
@@ -923,7 +830,7 @@ methodname=bar
#define five 5
#define ADD(a, b) a + b
-int main(){
+int main() {
int i = five; //comment3
i = /*$*/ADD(i, five)/*$$*/;
@@ -934,12 +841,11 @@ int main(){
#define five 5
#define ADD(a, b) a + b
-int bar(int & i)
-{
- return ADD(i, five);
+int bar(int& i) {
+ return ADD(i, five);
}
-int main(){
+int main() {
int i = five; //comment3
i = bar(i);
@@ -957,7 +863,7 @@ methodname=bar
#define five 5
#define ADD(a, b) a + b
-int main(){
+int main() {
int i = five; //comment3
i = /*$*/ADD(i, five)/*$$*/;
@@ -968,12 +874,11 @@ int main(){
#define five 5
#define ADD(a, b) a + b
-int bar(int & i)
-{
- return ADD(i, five);
+int bar(int& i) {
+ return ADD(i, five);
}
-int main(){
+int main() {
int i = five; //comment3
i = bar(i);
diff --git a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ExtractFunctionTemplates.rts b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ExtractFunctionTemplates.rts
index 06a356fc17..271a5091f2 100644
--- a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ExtractFunctionTemplates.rts
+++ b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ExtractFunctionTemplates.rts
@@ -1,34 +1,34 @@
//!Extract template function
//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest
//@A.cpp
-void test(){
+void test() {
}
+
template <typename T>
-int tempFunct(){
-
+int tempFunct() {
T i;
i = 0;
/*$*/i++;
- i+=3;/*$$*/
+ i += 3;/*$$*/
return 0;
}
//=
-void test(){
+void test() {
}
-template<typename T> void exp(T i)
-{
- i++;
- i += 3;
+
+template<typename T>
+void exp(T i) {
+ i++;
+ i += 3;
}
template <typename T>
-int tempFunct(){
-
+int tempFunct() {
T i;
i = 0;
- exp(i);
+ exp(i);
return 0;
}
@@ -36,39 +36,40 @@ int tempFunct(){
//!Extract template function with template parameter Bug #12
//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest
//@A.cpp
-void test(){
+void test() {
}
-template <typename T>
-int tempFunct(T p){
+template <typename T>
+int tempFunct(T p) {
/*$*/++p;
p + 4;/*$$*/
return 0;
}
//=
-void test(){
+void test() {
}
-template<typename T> void exp(T p)
-{
- ++p;
- p + 4;
+
+template<typename T>
+void exp(T p) {
+ ++p;
+ p + 4;
}
template <typename T>
-int tempFunct(T p){
- exp(p);
+int tempFunct(T p) {
+ exp(p);
return 0;
}
//!Extract template function with template type declaration Bug #11
//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest
//@A.cpp
-void test(){
+void test() {
}
-template <typename T>
-int tempFunct(){
+template <typename T>
+int tempFunct() {
/*$*/T p;
p = 0;
p + 4;/*$$*/
@@ -77,19 +78,19 @@ int tempFunct(){
}
//=
-void test(){
+void test() {
}
-template<typename T> T exp()
-{
- T p;
- p = 0;
- p + 4;
- return p;
+
+template<typename T>
+T exp() {
+ T p;
+ p = 0;
+ p + 4;
+ return p;
}
template <typename T>
-int tempFunct(){
-
+int tempFunct() {
T p = exp();
p + 2;
return 0;
diff --git a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ExtractLocalVariable.rts b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ExtractLocalVariable.rts
index 61431473ef..35bf54d93f 100644
--- a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ExtractLocalVariable.rts
+++ b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ExtractLocalVariable.rts
@@ -4,12 +4,11 @@
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
- A();
- virtual ~A();
- int foo();
+ A();
+ virtual ~A();
+ int foo();
};
#endif /*A_H_*/
@@ -18,12 +17,11 @@ public:
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
- A();
- virtual ~A();
- int foo();
+ A();
+ virtual ~A();
+ int foo();
};
#endif /*A_H_*/
@@ -31,34 +29,28 @@ public:
//@A.cpp
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-int A::foo()
-{
- return /*$*/42/*$$*/;
+int A::foo() {
+ return /*$*/42/*$$*/;
}
//=
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-int A::foo()
-{
- int i = 42;
- return i;
+int A::foo() {
+ int i = 42;
+ return i;
}
//!ExtractLocalVariableRefactoringTest char
@@ -67,12 +59,11 @@ int A::foo()
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
- A();
- virtual ~A();
- int foo();
+ A();
+ virtual ~A();
+ int foo();
};
#endif /*A_H_*/
@@ -81,12 +72,11 @@ public:
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
- A();
- virtual ~A();
- int foo();
+ A();
+ virtual ~A();
+ int foo();
};
#endif /*A_H_*/
@@ -94,34 +84,28 @@ public:
//@A.cpp
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-int A::foo()
-{
- return /*$*/'c'/*$$*/;
+int A::foo() {
+ return /*$*/'c'/*$$*/;
}
//=
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-int A::foo()
-{
- char temp = 'c';
- return temp;
+int A::foo() {
+ char temp = 'c';
+ return temp;
}
//!ExtractLocalVariableRefactoringTest float
@@ -130,12 +114,11 @@ int A::foo()
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
- A();
- virtual ~A();
- float foo();
+ A();
+ virtual ~A();
+ float foo();
};
#endif /*A_H_*/
@@ -144,12 +127,11 @@ public:
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
- A();
- virtual ~A();
- float foo();
+ A();
+ virtual ~A();
+ float foo();
};
#endif /*A_H_*/
@@ -157,34 +139,28 @@ public:
//@A.cpp
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-float A::foo()
-{
- return /*$*/42.0f/*$$*/;
+float A::foo() {
+ return /*$*/42.0f/*$$*/;
}
//=
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-float A::foo()
-{
- float f = 42.0f;
- return f;
+float A::foo() {
+ float f = 42.0f;
+ return f;
}
//!ExtractLocalVariableRefactoringTest double
@@ -193,12 +169,11 @@ float A::foo()
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
- A();
- virtual ~A();
- float foo();
+ A();
+ virtual ~A();
+ float foo();
};
#endif /*A_H_*/
@@ -207,12 +182,11 @@ public:
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
- A();
- virtual ~A();
- float foo();
+ A();
+ virtual ~A();
+ float foo();
};
#endif /*A_H_*/
@@ -220,34 +194,28 @@ public:
//@A.cpp
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-float A::foo()
-{
- return /*$*/42.0/*$$*/;
+float A::foo() {
+ return /*$*/42.0/*$$*/;
}
//=
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-float A::foo()
-{
- double f = 42.0;
- return f;
+float A::foo() {
+ double f = 42.0;
+ return f;
}
//!ExtractLocalVariableRefactoringTest parentheses
@@ -256,12 +224,11 @@ float A::foo()
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
- A();
- virtual ~A();
- int foo();
+ A();
+ virtual ~A();
+ int foo();
};
#endif /*A_H_*/
@@ -270,12 +237,11 @@ public:
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
- A();
- virtual ~A();
- int foo();
+ A();
+ virtual ~A();
+ int foo();
};
#endif /*A_H_*/
@@ -283,34 +249,28 @@ public:
//@A.cpp
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-int A::foo()
-{
- return /*$*/(42)/*$$*/;
+int A::foo() {
+ return /*$*/(42)/*$$*/;
}
//=
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-int A::foo()
-{
- int i = 42;
- return i;
+int A::foo() {
+ int i = 42;
+ return i;
}
//!ExtractLocalVariableRefactoringTest proposed name in scope
@@ -319,12 +279,11 @@ int A::foo()
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
- A();
- virtual ~A();
- int foo();
+ A();
+ virtual ~A();
+ int foo();
};
#endif /*A_H_*/
@@ -333,12 +292,11 @@ public:
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
- A();
- virtual ~A();
- int foo();
+ A();
+ virtual ~A();
+ int foo();
};
#endif /*A_H_*/
@@ -346,96 +304,94 @@ public:
//@A.cpp
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-int A::foo()
-{
- int x = 3;
- return /*$*/(x + 2)/*$$*/ * 15;
+int A::foo() {
+ int x = 3;
+ return /*$*/(x + 2)/*$$*/ * 15;
}
//=
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-int A::foo()
-{
- int x = 3;
- int i = x + 2;
- return i * 15;
+int A::foo() {
+ int x = 3;
+ int i = x + 2;
+ return i * 15;
}
//!Bug #277065 extract local variable fails to extract from for loop
//#org.eclipse.cdt.ui.tests.refactoring.extractlocalvariable.ExtractLocalVariableRefactoringTest
//@A.cpp
-void foo(){
- for(int n = /*$*/5 + 2/*$$*/; n < 10; ++n);
+void foo() {
+ for (int n = /*$*/5 + 2/*$$*/; n < 10; ++n)
+ ;
}
//=
-void foo(){
- int i = 5 + 2;
- for(int n = i; n < 10; ++n);
+void foo() {
+ int i = 5 + 2;
+ for (int n = i; n < 10; ++n)
+ ;
}
//!ExtractLocalVariableRefactoringTest expression
//#org.eclipse.cdt.ui.tests.refactoring.extractlocalvariable.ExtractLocalVariableRefactoringTest
//@A.cpp
-void foo(){
- int a = 0;
- float b = 0.1f;
- double c = /*$*/(a + b)/*$$*/ * 0.2;
+void foo() {
+ int a = 0;
+ float b = 0.1f;
+ double c = /*$*/(a + b)/*$$*/ * 0.2;
}
//=
-void foo(){
- int a = 0;
- float b = 0.1f;
- float a0 = a + b;
- double c = a0 * 0.2;
+void foo() {
+ int a = 0;
+ float b = 0.1f;
+ float a0 = a + b;
+ double c = a0 * 0.2;
}
//!ExtractLocalVariableRefactoringTest pointer
//#org.eclipse.cdt.ui.tests.refactoring.extractlocalvariable.ExtractLocalVariableRefactoringTest
//@A.cpp
-void foo(){
- int a[2];
- int b = */*$*/(a + 1)/*$$*/;
+void foo() {
+ int a[2];
+ int b = */*$*/(a + 1)/*$$*/;
}
//=
-void foo(){
- int a[2];
- int *i = a + 1;
- int b = *i;
+void foo() {
+ int a[2];
+ int* i = a + 1;
+ int b = *i;
}
//!ExtractLocalVariableRefactoringTest qualifiers
//#org.eclipse.cdt.ui.tests.refactoring.extractlocalvariable.ExtractLocalVariableRefactoringTest
//@A.cpp
-const volatile int *k;
-void foo(){
- /*$*/k;/*$$*/
+const volatile int* k;
+
+void foo() {
+ /*$*/k;/*$$*/
}
//=
-const volatile int *k;
-void foo(){
- const volatile int *k0 = k;
- k0;
+const volatile int* k;
+
+void foo() {
+ const volatile int* k0 = k;
+ k0;
}
//!ExtractLocalVariableRefactoringTest overloaded operators
@@ -443,24 +399,24 @@ void foo(){
//@A.cpp
class K {
public:
- bool operator+(int b) {return true;}
- float operator+(unsigned u) {return 1.0f;}
+ bool operator+(int b) { return true; }
+ float operator+(unsigned u) { return 1.0f; }
};
-void foo(){
- K k;
- /*$*/k+3u/*$$*/;
+void foo() {
+ K k;
+ /*$*/k+3u/*$$*/;
}
//=
class K {
public:
- bool operator+(int b) {return true;}
- float operator+(unsigned u) {return 1.0f;}
+ bool operator+(int b) { return true; }
+ float operator+(unsigned u) { return 1.0f; }
};
-void foo(){
- K k;
- float i = k + 3u;
- i;
+void foo() {
+ K k;
+ float i = k + 3u;
+ i;
}
//!Bug 318784 DeclarationGenerator fails for some cases
@@ -468,16 +424,16 @@ void foo(){
//@A.cpp
void func() {
- int *(*a)[2];
- /*$*/a/*$$*/;
+ int* (*a)[2];
+ /*$*/a/*$$*/;
}
//=
void func() {
- int *(*a)[2];
- int *(*a0)[2] = a;
- a0;
+ int* (*a)[2];
+ int* (*a0)[2] = a;
+ a0;
}
//!Bug 331963 Extract local variable doesn't put template type parameters
@@ -491,10 +447,8 @@ class Foo {
Foo<int> getFoo();
int main() {
-
- /*$*/getFoo()/*$$*/;
-
- return 0;
+ /*$*/getFoo()/*$$*/;
+ return 0;
}
//=
@@ -506,163 +460,163 @@ class Foo {
Foo<int> getFoo();
int main() {
- Foo<int> foo = getFoo();
- foo;
-
- return 0;
+ Foo<int> foo = getFoo();
+ foo;
+ return 0;
}
//!Bug 331963 Extract local variable doesn't put template type parameters Namespace
//#org.eclipse.cdt.ui.tests.refactoring.extractlocalvariable.ExtractLocalVariableRefactoringTest
//@A.cpp
-namespace bar{
+namespace bar {
+
template<class T>
class Foo {
};
+
}
bar::Foo<int> getFoo();
int main() {
-
- /*$*/getFoo()/*$$*/;
-
- return 0;
+ /*$*/getFoo()/*$$*/;
+ return 0;
}
//=
-namespace bar{
+namespace bar {
+
template<class T>
class Foo {
};
+
}
bar::Foo<int> getFoo();
int main() {
- bar::Foo<int> foo = getFoo();
- foo;
-
- return 0;
+ bar::Foo<int> foo = getFoo();
+ foo;
+ return 0;
}
//!Bug 330693 Improve suggested variable name in Extract Local Variable
//#org.eclipse.cdt.ui.tests.refactoring.extractlocalvariable.ExtractLocalVariableRefactoringTest
//@A.cpp
-struct Foo{
+struct Foo {
int getVarWithLongName();
};
-void bar(){
+void bar() {
Foo f;
/*$*/f.getVarWithLongName()/*$$*/;
}
//=
-struct Foo{
+struct Foo {
int getVarWithLongName();
};
-void bar(){
+void bar() {
Foo f;
- int varWithLongName = f.getVarWithLongName();
- varWithLongName;
+ int varWithLongName = f.getVarWithLongName();
+ varWithLongName;
}
//!Bug 330693 Improve suggested variable name in Extract Local Variable: name == prefix
//#org.eclipse.cdt.ui.tests.refactoring.extractlocalvariable.ExtractLocalVariableRefactoringTest
//@A.cpp
-struct Foo{
+struct Foo {
int get();
};
-void bar(){
+void bar() {
Foo f;
/*$*/f.get()/*$$*/;
}
//=
-struct Foo{
+struct Foo {
int get();
};
-void bar(){
+void bar() {
Foo f;
- int get = f.get();
- get;
+ int get = f.get();
+ get;
}
//!Bug 335202 Suggested name is wrong for nested function calls - outer function call
//#org.eclipse.cdt.ui.tests.refactoring.extractlocalvariable.ExtractLocalVariableRefactoringTest
//@A.cpp
-int getA(){
- return 0;
+int getA() {
+ return 0;
};
-int getB(int a){
- return a;
+int getB(int a) {
+ return a;
}
-void bar(){
- /*$*/getB(getA())/*$$*/;
+void bar() {
+ /*$*/getB(getA())/*$$*/;
}
//=
-int getA(){
- return 0;
+int getA() {
+ return 0;
};
-int getB(int a){
- return a;
+int getB(int a) {
+ return a;
}
-void bar(){
- int b = getB(getA());
- b;
+void bar() {
+ int b = getB(getA());
+ b;
}
//!Bug 335202 Suggested name is wrong for nested function calls - inner function call
//#org.eclipse.cdt.ui.tests.refactoring.extractlocalvariable.ExtractLocalVariableRefactoringTest
//@A.cpp
-int getA(){
- return 0;
+int getA() {
+ return 0;
};
-int getB(int a){
- return a;
+int getB(int a) {
+ return a;
}
-int getC(int a){
- return a;
+int getC(int a) {
+ return a;
}
-void bar(){
- getB(/*$*/getC(getA())/*$$*/);
+void bar() {
+ getB(/*$*/getC(getA())/*$$*/);
}
//=
-int getA(){
- return 0;
+int getA() {
+ return 0;
};
-int getB(int a){
- return a;
+int getB(int a) {
+ return a;
}
-int getC(int a){
- return a;
+int getC(int a) {
+ return a;
}
-void bar(){
- int c = getC(getA());
- getB(c);
+void bar() {
+ int c = getC(getA());
+ getB(c);
}
diff --git a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ExtractLocalVariableHistory.rts b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ExtractLocalVariableHistory.rts
index b01f409613..ecbc8bbafd 100644
--- a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ExtractLocalVariableHistory.rts
+++ b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ExtractLocalVariableHistory.rts
@@ -1,14 +1,16 @@
//!extract local variable from for loop
//#org.eclipse.cdt.ui.tests.refactoring.RefactoringHistoryTest
//@main.cpp
-void foo(){
- for(int n = 5 + 2; n < 10; ++n);
+void foo() {
+ for (int n = 5 + 2; n < 10; ++n)
+ ;
}
//=
-void foo(){
- int i = 5 + 2;
- for(int n = i; n < 10; ++n);
+void foo() {
+ int i = 5 + 2;
+ for (int n = i; n < 10; ++n)
+ ;
}
//@refScript.xml
@@ -17,5 +19,5 @@ void foo(){
<refactoring comment="Extract 5 + 2" description="Extract Local Variable Refactoring"
fileName="file:$$projectPath$$/main.cpp" flags="4"
id="org.eclipse.cdt.internal.ui.refactoring.extractlocalvariable.ExtractLocalVariableRefactoring"
- name="i" project="RegressionTestProject" selection="25,5"/>
+ name="i" project="RegressionTestProject" selection="27,5"/>
</session>
diff --git a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ExtractMethod.rts b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ExtractMethod.rts
index 8f91ea478c..c30d66c264 100644
--- a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ExtractMethod.rts
+++ b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ExtractMethod.rts
@@ -4,13 +4,12 @@
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
int foo();
-
+
private:
int help();
};
@@ -21,16 +20,15 @@ private:
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
int foo();
-
+
private:
int help();
- int exp();
+ int exp();
};
#endif /*A_H_*/
@@ -38,54 +36,47 @@ private:
//@A.cpp
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-int A::foo()
-{
+
+int A::foo() {
/*$*/int i = 2;
++i;
help();/*$$*/
return i;
}
-int A::help()
-{
+int A::help() {
return 42;
-}
+}
//=
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-int A::exp()
-{
- int i = 2;
- ++i;
- help();
- return i;
+
+int A::exp() {
+ int i = 2;
+ ++i;
+ help();
+ return i;
}
-int A::foo()
-{
+int A::foo() {
int i = exp();
return i;
}
-int A::help()
-{
+int A::help() {
return 42;
-}
+}
//!ExtractFunctionRefactoringTest with comment
//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest
@@ -93,13 +84,12 @@ int A::help()
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
int foo();
-
+
private:
int help();
};
@@ -110,16 +100,15 @@ private:
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
int foo();
-
+
private:
int help();
- void exp(int & i);
+ void exp(int& i);
};
#endif /*A_H_*/
@@ -127,15 +116,13 @@ private:
//@A.cpp
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-int A::foo()
-{
+
+int A::foo() {
int i = 2;
//comment
/*$*/++i;
@@ -143,40 +130,35 @@ int A::foo()
return i;
}
-int A::help()
-{
+int A::help() {
return 42;
-}
+}
//=
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-void A::exp(int & i)
-{
- //comment
- ++i;
- help();
+
+void A::exp(int& i) {
+ //comment
+ ++i;
+ help();
}
-int A::foo()
-{
+int A::foo() {
int i = 2;
//comment
- exp(i);
+ exp(i);
return i;
}
-int A::help()
-{
+int A::help() {
return 42;
-}
+}
//@.config
filename=A.cpp
@@ -188,8 +170,7 @@ returnparameterindex=0
//!Extract Function first extracted statement with leading comment
//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest
//@main.cpp
-int main(){
-
+int main() {
int i;
// Comment
/*$*/i= 7;/*$$*/
@@ -197,17 +178,15 @@ int main(){
}
//=
-void exp(int & i)
-{
- // Comment
- i = 7;
+void exp(int& i) {
+ // Comment
+ i = 7;
}
-int main(){
-
+int main() {
int i;
// Comment
- exp(i);
+ exp(i);
return i;
}
@@ -221,23 +200,20 @@ returnparameterindex=0
//!Extract Function last extracted statement with trailling comment
//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest
//@main.cpp
-int main(){
-
+int main() {
int i;
/*$*/i= 7;/*$$*/ // Comment
return i;
}
//=
-void exp(int & i)
-{
- i = 7; // Comment
+void exp(int& i) {
+ i = 7; // Comment
}
-int main(){
-
+int main() {
int i;
- exp(i); // Comment
+ exp(i); // Comment
return i;
}
@@ -256,13 +232,12 @@ fatalerror=true
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
int foo();
-
+
private:
int help();
};
@@ -272,16 +247,13 @@ private:
//@A.cpp
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-int A::foo()
-{
+int A::foo() {
/*$*/int o = 1;
int i = 2;
++i;
@@ -289,10 +261,11 @@ int A::foo()
help();/*$$*/
o++;
return i;
-}int A::help()
-{
+}
+
+int A::help() {
return 42;
-}
+}
//!ExtractFunctionRefactoringTest with named typed field
//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest
@@ -302,14 +275,13 @@ int A::foo()
#include "B.h"
-class A
-{
+class A {
public:
A();
virtual ~A();
void foo();
B b;
-
+
private:
int help();
};
@@ -322,17 +294,16 @@ private:
#include "B.h"
-class A
-{
+class A {
public:
A();
virtual ~A();
void foo();
B b;
-
+
private:
int help();
- void exp();
+ void exp();
};
#endif /*A_H_*/
@@ -340,56 +311,48 @@ private:
//@A.cpp
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-void A::foo()
-{
+
+void A::foo() {
/*$*/b = new B();
help();/*$$*/
}
-int A::help()
-{
+int A::help() {
return 42;
-}
+}
//=
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-void A::exp()
-{
- b = new B();
- help();
+
+void A::exp() {
+ b = new B();
+ help();
}
-void A::foo()
-{
- exp();
+void A::foo() {
+ exp();
}
-int A::help()
-{
+int A::help() {
return 42;
-}
+}
//@B.h
#ifndef B_H_
#define B_H_
-class B
-{
+class B {
public:
B();
virtual ~B();
@@ -405,14 +368,13 @@ public:
#include "B.h"
-class A
-{
+class A {
public:
A();
virtual ~A();
void foo();
B b;
-
+
private:
int help();
};
@@ -425,17 +387,16 @@ private:
#include "B.h"
-class A
-{
+class A {
public:
A();
virtual ~A();
void foo();
B b;
-
+
private:
int help();
- void exp();
+ void exp();
};
#endif /*A_H_*/
@@ -443,56 +404,48 @@ private:
//@A.cpp
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-void A::foo()
-{
+
+void A::foo() {
/*$*/b = new B();
help();/*$$*/
}
-int A::help()
-{
+int A::help() {
return 42;
-}
+}
//=
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-void A::exp()
-{
- b = new B();
- help();
+
+void A::exp() {
+ b = new B();
+ help();
}
-void A::foo()
-{
- exp();
+void A::foo() {
+ exp();
}
-int A::help()
-{
+int A::help() {
return 42;
-}
+}
//@B.h
#ifndef B_H_
#define B_H_
-class B
-{
+class B {
public:
B();
virtual ~B();
@@ -506,13 +459,12 @@ public:
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
int foo();
-
+
private:
int help();
};
@@ -523,16 +475,15 @@ private:
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
int foo();
-
+
private:
int help();
- void exp(int & i);
+ void exp(int& i);
};
#endif /*A_H_*/
@@ -542,15 +493,13 @@ private:
#define ZWO 2
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-int A::foo()
-{
+
+int A::foo() {
int i = 2;
/*$*/++i;
i += ZWO;
@@ -558,41 +507,36 @@ int A::foo()
return i;
}
-int A::help()
-{
+int A::help() {
return 42;
-}
+}
//=
#include "A.h"
#define ZWO 2
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-void A::exp(int & i)
-{
- ++i;
- i += ZWO;
- help();
+
+void A::exp(int& i) {
+ ++i;
+ i += ZWO;
+ help();
}
-int A::foo()
-{
+int A::foo() {
int i = 2;
- exp(i);
+ exp(i);
return i;
}
-int A::help()
-{
+int A::help() {
return 42;
-}
+}
//!ExtractFunctionRefactoringTest with FunctionStyleMacro
//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest
@@ -600,13 +544,12 @@ int A::help()
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
int foo();
-
+
private:
int help();
};
@@ -617,16 +560,15 @@ private:
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
int foo();
-
+
private:
int help();
- void exp(int & i);
+ void exp(int& i);
};
#endif /*A_H_*/
@@ -636,15 +578,13 @@ private:
#define ADD(a,b) a + b + 2
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-int A::foo()
-{
+
+int A::foo() {
int i = 2;
/*$*/++i;
i = ADD(i, 42);
@@ -652,41 +592,36 @@ int A::foo()
return i;
}
-int A::help()
-{
+int A::help() {
return 42;
-}
+}
//=
#include "A.h"
#define ADD(a,b) a + b + 2
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-void A::exp(int & i)
-{
- ++i;
- i = ADD(i, 42);
- help();
+
+void A::exp(int& i) {
+ ++i;
+ i = ADD(i, 42);
+ help();
}
-int A::foo()
-{
+int A::foo() {
int i = 2;
- exp(i);
+ exp(i);
return i;
}
-int A::help()
-{
+int A::help() {
return 42;
-}
+}
//!ExtractMethod with Pointer
//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest
@@ -694,13 +629,12 @@ int A::help()
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
int foo();
-
+
private:
int help();
};
@@ -711,16 +645,15 @@ private:
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
int foo();
-
+
private:
int help();
- void exp(int *& i);
+ void exp(int*& i);
};
#endif /*A_H_*/
@@ -728,51 +661,44 @@ private:
//@A.cpp
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-int A::foo()
-{
+
+int A::foo() {
int* i = new int(2);
/*$*/++*i;
help();/*$$*/
return *i;
}
-int A::help()
-{
+int A::help() {
return 42;
}
//=
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-void A::exp(int *& i)
-{
- ++*i;
- help();
+
+void A::exp(int*& i) {
+ ++*i;
+ help();
}
-int A::foo()
-{
+int A::foo() {
int* i = new int(2);
- exp(i);
+ exp(i);
return *i;
}
-int A::help()
-{
+int A::help() {
return 42;
}
@@ -782,13 +708,12 @@ int A::help()
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
int foo();
-
+
private:
int help();
};
@@ -799,16 +724,15 @@ private:
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
int foo();
-
+
private:
int help();
- void exp(int *& i);
+ void exp(int*& i);
};
#endif /*A_H_*/
@@ -816,15 +740,13 @@ private:
//@A.cpp
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-int A::foo()
-{
+
+int A::foo() {
int* i = new int(2);
/*$*/++*i;
help();
@@ -832,37 +754,32 @@ int A::foo()
return *i;
}
-int A::help()
-{
+int A::help() {
return 42;
}
//=
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-void A::exp(int *& i)
-{
- ++*i;
- help();
+
+void A::exp(int*& i) {
+ ++*i;
+ help();
}
-int A::foo()
-{
+int A::foo() {
int* i = new int(2);
- exp(i);
+ exp(i);
//A end-comment
return *i;
}
-int A::help()
-{
+int A::help() {
return 42;
}
@@ -872,13 +789,12 @@ int A::help()
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
int foo();
-
+
private:
int help();
};
@@ -889,16 +805,15 @@ private:
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
int foo();
-
+
private:
int help();
- void exp(int *& i);
+ void exp(int*& i);
};
#endif /*A_H_*/
@@ -906,15 +821,13 @@ private:
//@A.cpp
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-int A::foo()
-{
+
+int A::foo() {
//A beautiful comment
int* i = new int(2);
/*$*/++*i;
@@ -922,37 +835,32 @@ int A::foo()
return *i;
}
-int A::help()
-{
+int A::help() {
return 42;
}
//=
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-void A::exp(int *& i)
-{
- ++*i;
- help();
+
+void A::exp(int*& i) {
+ ++*i;
+ help();
}
-int A::foo()
-{
+int A::foo() {
//A beautiful comment
int* i = new int(2);
- exp(i);
+ exp(i);
return *i;
}
-int A::help()
-{
+int A::help() {
return 42;
}
@@ -965,13 +873,12 @@ returnvalue=true
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
int foo();
-
+
private:
int help();
};
@@ -982,16 +889,15 @@ private:
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
int foo();
-
+
private:
int help();
- int exp(int i);
+ int exp(int i);
};
#endif /*A_H_*/
@@ -999,54 +905,47 @@ private:
//@A.cpp
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-int A::foo()
-{
+
+int A::foo() {
int i = 2;
/*$*/++i;
help();/*$$*/
return i;
}
-int A::help()
-{
+int A::help() {
return 42;
-}
+}
//=
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-int A::exp(int i)
-{
- ++i;
- help();
- return i;
+
+int A::exp(int i) {
+ ++i;
+ help();
+ return i;
}
-int A::foo()
-{
+int A::foo() {
int i = 2;
- i = exp(i);
+ i = exp(i);
return i;
}
-int A::help()
-{
+int A::help() {
return 42;
-}
+}
//!ExtractFunctionRefactoringTest with Return Value and Ref Parameter
//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest
@@ -1057,13 +956,12 @@ returnvalue=true
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
int foo();
-
+
private:
int help();
};
@@ -1074,16 +972,15 @@ private:
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
int foo();
-
+
private:
int help();
- int exp(int i, int & b);
+ int exp(int i, int& b);
};
#endif /*A_H_*/
@@ -1091,15 +988,13 @@ private:
//@A.cpp
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-int A::foo()
-{
+
+int A::foo() {
int i = 2;
int b = i;
/*$*/++i;
@@ -1109,42 +1004,37 @@ int A::foo()
return i;
}
-int A::help()
-{
+int A::help() {
return 42;
-}
+}
//=
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-int A::exp(int i, int & b)
-{
- ++i;
- i = i + b;
- help();
- return i;
+
+int A::exp(int i, int& b) {
+ ++i;
+ i = i + b;
+ help();
+ return i;
}
-int A::foo()
-{
+int A::foo() {
int i = 2;
int b = i;
- i = exp(i, b);
+ i = exp(i, b);
++b;
return i;
}
-int A::help()
-{
+int A::help() {
return 42;
-}
+}
//!ExtractFunctionRefactoringTest with Return Value and Ref Parameter and some more not used aferwards
//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest
@@ -1155,13 +1045,12 @@ returnvalue=true
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
int foo();
-
+
private:
int help();
};
@@ -1172,16 +1061,15 @@ private:
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
int foo();
-
+
private:
int help();
- int exp(int i, B *b, int y, float & x);
+ int exp(int i, B* b, int y, float& x);
};
#endif /*A_H_*/
@@ -1189,15 +1077,13 @@ private:
//@A.cpp
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-int A::foo()
-{
+
+int A::foo() {
int i = 2;
float x = i;
B* b = new B();
@@ -1210,45 +1096,40 @@ int A::foo()
return i;
}
-int A::help()
-{
+int A::help() {
return 42;
-}
+}
//=
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-int A::exp(int i, B *b, int y, float & x)
-{
- ++i;
- b->hello(y);
- i = i + x;
- help();
- return i;
+
+int A::exp(int i, B* b, int y, float& x) {
+ ++i;
+ b->hello(y);
+ i = i + x;
+ help();
+ return i;
}
-int A::foo()
-{
+int A::foo() {
int i = 2;
float x = i;
B* b = new B();
int y = x + i;
- i = exp(i, b, y, x);
+ i = exp(i, b, y, x);
++x;
return i;
}
-int A::help()
-{
+int A::help() {
return 42;
-}
+}
//!ExtractFunctionRefactoringTest with Return Value take the second and Ref Parameter and some more not used aferwards
//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest
@@ -1261,13 +1142,12 @@ returnvalue=true
#include "B.h"
-class A
-{
+class A {
public:
A();
virtual ~A();
int foo();
-
+
private:
int help();
};
@@ -1280,16 +1160,15 @@ private:
#include "B.h"
-class A
-{
+class A {
public:
A();
virtual ~A();
int foo();
-
+
private:
int help();
- float exp(int & i, B *b, int y, float x);
+ float exp(int& i, B* b, int y, float x);
};
#endif /*A_H_*/
@@ -1297,15 +1176,13 @@ private:
//@A.cpp
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-int A::foo()
-{
+
+int A::foo() {
int i = 2;
float x = i;
B* b = new B();
@@ -1318,52 +1195,46 @@ int A::foo()
return i;
}
-int A::help()
-{
+int A::help() {
return 42;
-}
+}
//=
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-float A::exp(int & i, B *b, int y, float x)
-{
- ++i;
- b->hello(y);
- i = i + x;
- help();
- return x;
+
+float A::exp(int& i, B* b, int y, float x) {
+ ++i;
+ b->hello(y);
+ i = i + x;
+ help();
+ return x;
}
-int A::foo()
-{
+int A::foo() {
int i = 2;
float x = i;
B* b = new B();
int y = x + i;
- x = exp(i, b, y, x);
+ x = exp(i, b, y, x);
++x;
return i;
}
-int A::help()
-{
+int A::help() {
return 42;
-}
+}
//@B.h
#ifndef B_H_
#define B_H_
-class B
-{
+class B {
public:
B();
virtual ~B();
@@ -1383,13 +1254,12 @@ returnvalue=true
#include "B.h"
-class A
-{
+class A {
public:
A();
virtual ~A();
int foo();
-
+
private:
int help();
};
@@ -1402,16 +1272,15 @@ private:
#include "B.h"
-class A
-{
+class A {
public:
A();
virtual ~A();
int foo();
-
+
private:
int help();
- int exp(int i, B *& b, int & y, float & x);
+ int exp(int i, B*& b, int& y, float& x);
};
#endif /*A_H_*/
@@ -1419,15 +1288,13 @@ private:
//@A.cpp
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-int A::foo()
-{
+
+int A::foo() {
int i = 2;
float x = i;
B* b = new B();
@@ -1441,53 +1308,47 @@ int A::foo()
return i;
}
-int A::help()
-{
+int A::help() {
return 42;
-}
+}
//=
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-int A::exp(int i, B *& b, int & y, float & x)
-{
- ++i;
- b->hello(y);
- i = i + x;
- help();
- return i;
+
+int A::exp(int i, B*& b, int& y, float& x) {
+ ++i;
+ b->hello(y);
+ i = i + x;
+ help();
+ return i;
}
-int A::foo()
-{
+int A::foo() {
int i = 2;
float x = i;
B* b = new B();
int y = x + i;
- i = exp(i, b, y, x);
+ i = exp(i, b, y, x);
b->hello(y);
++x;
return i;
}
-int A::help()
-{
+int A::help() {
return 42;
-}
+}
//@B.h
#ifndef B_H_
#define B_H_
-class B
-{
+class B {
public:
B();
virtual ~B();
@@ -1507,13 +1368,12 @@ returnvalue=true
#include "B.h"
-class A
-{
+class A {
public:
A();
virtual ~A();
int foo();
-
+
private:
int help();
};
@@ -1526,16 +1386,15 @@ private:
#include "B.h"
-class A
-{
+class A {
public:
A();
virtual ~A();
int foo();
-
+
private:
int help();
- B *exp(int & i, B *b, int & y, float & x);
+ B* exp(int& i, B* b, int& y, float& x);
};
#endif /*A_H_*/
@@ -1543,15 +1402,13 @@ private:
//@A.cpp
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-int A::foo()
-{
+
+int A::foo() {
int i = 2;
float x = i;
B* b = new B();
@@ -1565,53 +1422,47 @@ int A::foo()
return i;
}
-int A::help()
-{
+int A::help() {
return 42;
-}
+}
//=
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-B *A::exp(int & i, B *b, int & y, float & x)
-{
- ++i;
- b->hello(y);
- i = i + x;
- help();
- return b;
+
+B* A::exp(int& i, B* b, int& y, float& x) {
+ ++i;
+ b->hello(y);
+ i = i + x;
+ help();
+ return b;
}
-int A::foo()
-{
+int A::foo() {
int i = 2;
float x = i;
B* b = new B();
int y = x + i;
- b = exp(i, b, y, x);
+ b = exp(i, b, y, x);
b->hello(y);
++x;
return i;
}
-int A::help()
-{
+int A::help() {
return 42;
-}
+}
//@B.h
#ifndef B_H_
#define B_H_
-class B
-{
+class B {
public:
B();
virtual ~B();
@@ -1626,13 +1477,12 @@ public:
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
int foo();
-
+
private:
int help();
};
@@ -1643,17 +1493,17 @@ private:
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
int foo();
-
+
private:
int help();
+
protected:
- void exp(int & i);
+ void exp(int& i);
};
#endif /*A_H_*/
@@ -1661,53 +1511,46 @@ protected:
//@A.cpp
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-int A::foo()
-{
+
+int A::foo() {
int i = 2;
/*$*/++i;
help();/*$$*/
return i;
}
-int A::help()
-{
+int A::help() {
return 42;
-}
+}
//=
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-void A::exp(int & i)
-{
- ++i;
- help();
+
+void A::exp(int& i) {
+ ++i;
+ help();
}
-int A::foo()
-{
+int A::foo() {
int i = 2;
- exp(i);
+ exp(i);
return i;
}
-int A::help()
-{
+int A::help() {
return 42;
-}
+}
//@.config
filename=A.cpp
@@ -1723,13 +1566,12 @@ visibility=protected
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
int foo();
-
+
private:
int help();
};
@@ -1740,14 +1582,13 @@ private:
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
int foo();
- void exp(int & i);
-
+ void exp(int& i);
+
private:
int help();
};
@@ -1757,53 +1598,46 @@ private:
//@A.cpp
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-int A::foo()
-{
+
+int A::foo() {
int i = 2;
/*$*/++i;
help();/*$$*/
return i;
}
-int A::help()
-{
+int A::help() {
return 42;
-}
+}
//=
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-void A::exp(int & i)
-{
- ++i;
- help();
+
+void A::exp(int& i) {
+ ++i;
+ help();
}
-int A::foo()
-{
+int A::foo() {
int i = 2;
- exp(i);
+ exp(i);
return i;
}
-int A::help()
-{
+int A::help() {
return 42;
-}
+}
//@.config
filename=A.cpp
@@ -1819,13 +1653,12 @@ visibility=public
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
int foo() const;
-
+
private:
int help();
};
@@ -1836,16 +1669,15 @@ private:
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
int foo() const;
-
+
private:
int help();
- void exp(int & i) const;
+ void exp(int& i) const;
};
#endif /*A_H_*/
@@ -1853,53 +1685,46 @@ private:
//@A.cpp
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-int A::foo() const
-{
+
+int A::foo() const {
int i = 2;
/*$*/++i;
help();/*$$*/
return i;
}
-int A::help()
-{
+int A::help() {
return 42;
-}
+}
//=
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-void A::exp(int & i) const
-{
- ++i;
- help();
+
+void A::exp(int& i) const {
+ ++i;
+ help();
}
-int A::foo() const
-{
+int A::foo() const {
int i = 2;
- exp(i);
+ exp(i);
return i;
}
-int A::help()
-{
+int A::help() {
return 42;
-}
+}
//@.config
filename=A.cpp
@@ -1908,59 +1733,53 @@ replaceduplicates=false
returnvalue=false
returnparameterindex=0
-//!don't return variables that aren't used
+//!Don't return variables that aren't used
//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest
//@.config
filename=main.h
methodname=loop
//@main.h
-void method()
-{
+void method() {
/*$*/for (int var = 0; var < 100; ++var) {
- if(var < 50)
+ if (var < 50)
continue;
}/*$$*/
}
//=
-void loop()
-{
- for(int var = 0;var < 100;++var){
- if(var < 50)
- continue;
-
- }
+void loop() {
+ for (int var = 0; var < 100; ++var) {
+ if (var < 50)
+ continue;
+ }
}
-void method()
-{
- loop();
+void method() {
+ loop();
}
-//!don't extract code that contains 'return'
+//!Don't extract code that contains 'return'
//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest
//@.config
filename=main.h
fatalerror=true
//@main.h
-void method()
-{
- /*$*/if(true)
+void method() {
+ /*$*/if (true)
return;/*$$*/
//unreachable
}
-//!test if we don't allow to extract 'continue' Bug #53
+//!Test if we don't allow to extract 'continue' Bug #53
//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest
//@.config
fatalerror=true
filename=A.h
//@A.h
-void function()
-{
+void function() {
for (int var = 0; var < 100; ++var) {
- /*$*/if(var < 50)
+ /*$*/if (var < 50)
continue;/*$$*/
}
}
@@ -1974,31 +1793,30 @@ methodname=runTest
#define ASSERTM(msg,cond) if (!(cond)) throw cute::test_failure((msg),__FILE__,__LINE__)
#define ASSERT(cond) ASSERTM(#cond, cond)
-void testFuerRainer(){
- int i=int();
- /*$*/++i;
- //Leading Comment
- ASSERT (i);
- //Trailling Comment
- --i;/*$$*/
+void testFuerRainer() {
+ int i = int();
+ /*$*/++i;
+ //Leading Comment
+ ASSERT(i);
+ //Trailling Comment
+ --i;/*$$*/
}
//=
#define ASSERTM(msg,cond) if (!(cond)) throw cute::test_failure((msg),__FILE__,__LINE__)
#define ASSERT(cond) ASSERTM(#cond, cond)
-void runTest(int i)
-{
- ++i;
- //Leading Comment
- ASSERT (i);
- //Trailling Comment
- --i;
+void runTest(int i) {
+ ++i;
+ //Leading Comment
+ ASSERT(i);
+ //Trailling Comment
+ --i;
}
-void testFuerRainer(){
- int i=int();
- runTest(i);
+void testFuerRainer() {
+ int i = int();
+ runTest(i);
}
//! Bug #124 with comments Extract Function with a Macro call in selected code "forgets" the macro
@@ -2010,27 +1828,26 @@ methodname=runTest
#define ASSERTM(msg,cond) if (!(cond)) throw cute::test_failure((msg),__FILE__,__LINE__)
#define ASSERT(cond) ASSERTM(#cond, cond)
-void testFuerRainer(){
- int i=int();
- /*$*/++i;
- ASSERT (i);
- --i;/*$$*/
+void testFuerRainer() {
+ int i = int();
+ /*$*/++i;
+ ASSERT(i);
+ --i;/*$$*/
}
//=
#define ASSERTM(msg,cond) if (!(cond)) throw cute::test_failure((msg),__FILE__,__LINE__)
#define ASSERT(cond) ASSERTM(#cond, cond)
-void runTest(int i)
-{
- ++i;
- ASSERT (i);
- --i;
+void runTest(int i) {
+ ++i;
+ ASSERT(i);
+ --i;
}
-void testFuerRainer(){
- int i=int();
- runTest(i);
+void testFuerRainer() {
+ int i = int();
+ runTest(i);
}
//! Bug #137 String Array problem in Extract Function
@@ -2045,7 +1862,7 @@ using namespace std;
int const INITIAL_CAPACITY = 10;
-int main(){
+int main() {
int m_capacity;
/*$*/m_capacity += INITIAL_CAPACITY;
string* newElements = new string[m_capacity];/*$$*/
@@ -2059,16 +1876,15 @@ using namespace std;
int const INITIAL_CAPACITY = 10;
-string *runTest(int m_capacity)
-{
- m_capacity += INITIAL_CAPACITY;
- string *newElements = new string[m_capacity];
- return newElements;
+string* runTest(int m_capacity) {
+ m_capacity += INITIAL_CAPACITY;
+ string* newElements = new string[m_capacity];
+ return newElements;
}
-int main(){
+int main() {
int m_capacity;
- string *newElements = runTest(m_capacity);
+ string* newElements = runTest(m_capacity);
newElements[0] = "s";
}
@@ -2081,13 +1897,11 @@ returnparameterindex=0
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
int foo(int& a);
-
};
#endif /*A_H_*/
@@ -2096,15 +1910,14 @@ public:
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
int foo(int& a);
-private:
- void exp(int & a, int b, int c);
+private:
+ void exp(int& a, int b, int c);
};
#endif /*A_H_*/
@@ -2112,15 +1925,13 @@ private:
//@A.cpp
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-int A::foo(int& a)
-{
+
+int A::foo(int& a) {
int b = 7;
int c = 8;
/*$*/a = b + c;/*$$*/
@@ -2129,26 +1940,23 @@ int A::foo(int& a)
//=
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-void A::exp(int & a, int b, int c)
-{
- a = b + c;
+
+void A::exp(int& a, int b, int c) {
+ a = b + c;
}
-int A::foo(int& a)
-{
+int A::foo(int& a) {
int b = 7;
int c = 8;
- exp(a, b, c);
+ exp(a, b, c);
return a;
}
-//!Bug 241717: Typdef causes void as return type
+//!Bug 241717: Typedef causes void as return type
//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest
//@.config
filename=Test.cpp
@@ -2156,9 +1964,7 @@ filename=Test.cpp
#ifndef TEST_H_
#define TEST_H_
-class RetValueType{
-
-
+class RetValueType {
};
typedef RetValueType RetType;
@@ -2176,9 +1982,7 @@ private:
#ifndef TEST_H_
#define TEST_H_
-class RetValueType{
-
-
+class RetValueType {
};
typedef RetValueType RetType;
@@ -2189,7 +1993,7 @@ public:
virtual ~Test();
private:
void test();
- RetType exp();
+ RetType exp();
};
#endif /* TEST_H_ */
@@ -2197,14 +2001,12 @@ private:
#include "Test.h"
Test::Test() {
-
}
Test::~Test() {
}
-void Test::test()
-{
+void Test::test() {
RetType v = /*$*/RetType()/*$$*/;
}
@@ -2212,19 +2014,16 @@ void Test::test()
#include "Test.h"
Test::Test() {
-
}
Test::~Test() {
}
-RetType Test::exp()
-{
- return RetType();
+RetType Test::exp() {
+ return RetType();
}
-void Test::test()
-{
+void Test::test() {
RetType v = exp();
}
@@ -2235,22 +2034,19 @@ filename=Test.cpp
methodname=startTag
//@testString.h
-namespace test{
-
- class string{
- public:
-
- friend string operator+(const string& lhs, const string& rhs)
- {
- return rhs;
- }
+namespace test {
+class string {
+public:
+ friend string operator+(const string& lhs, const string& rhs) {
+ return rhs;
+ }
- string operator+(const string& rhs){return rhs;}
- string(char* cp){}
- string(){};
+ string operator+(const string& rhs) { return rhs; }
+ string(char* cp) {}
+ string() {};
+};
- };
}
//@Test.cpp
@@ -2269,9 +2065,8 @@ int main() {
//=
#include "testString.h"
-test::string startTag(test::string & name)
-{
- return "<" + name + ">";
+test::string startTag(test::string& name) {
+ return "<" + name + ">";
}
test::string toXML() {
@@ -2291,24 +2086,22 @@ filename=Test.cpp
methodname=startTag
//@testString.h
-namespace test{
-
-class string2{
- public:
+namespace test {
- friend string2 operator+(const string2& lhs, const string2& rhs)
- {
- return rhs;
- }
+class string2 {
+public:
+ friend string2 operator+(const string2& lhs, const string2& rhs) {
+ return rhs;
+ }
+ string2 operator+(const string2& rhs) { return rhs; }
+ string2(char* cp) {}
+ string2() {};
- string2 operator+(const string2& rhs){return rhs;}
- string2(char* cp){}
- string2(){};
+};
- };
+typedef string2 string;
- typedef string2 string;
}
//@Test.cpp
@@ -2327,9 +2120,8 @@ int main() {
//=
#include "testString.h"
-test::string startTag(test::string & name)
-{
- return "<" + name + ">";
+test::string startTag(test::string& name) {
+ return "<" + name + ">";
}
test::string toXML() {
@@ -2349,22 +2141,19 @@ filename=Test.cpp
methodname=endTag
//@testString.h
-namespace test{
-
- class string{
- public:
-
- friend string operator+(const string& lhs, const string& rhs)
- {
- return rhs;
- }
+namespace test {
+class string {
+public:
+ friend string operator+(const string& lhs, const string& rhs) {
+ return rhs;
+ }
- string operator+(const string& rhs){return rhs;}
- string(char* cp){}
- string(){};
+ string operator+(const string& rhs) { return rhs; }
+ string(char* cp) {}
+ string() {};
+};
- };
}
//@Test.cpp
@@ -2383,9 +2172,8 @@ int main() {
//=
#include "testString.h"
-const char endTag(test::string name)
-{
- return "</" + name + ">";
+const char endTag(test::string name) {
+ return "</" + name + ">";
}
test::string toXML() {
@@ -2405,22 +2193,19 @@ filename=Test.cpp
methodname=exp
//@testString.h
-namespace test{
-
- class string{
- public:
-
- friend string operator+(const string& lhs, const string& rhs)
- {
- return rhs;
- }
+namespace test {
+class string {
+public:
+ friend string operator+(const string& lhs, const string& rhs) {
+ return rhs;
+ }
- string operator+(const string& rhs){return rhs;}
- string(char* cp){}
- string(){};
+ string operator+(const string& rhs) { return rhs; }
+ string(char* cp) {}
+ string() {};
+};
- };
}
//@Test.cpp
@@ -2439,9 +2224,8 @@ int main() {
//=
#include "testString.h"
-const char exp()
-{
- return ">" + "</";
+const char exp() {
+ return ">" + "</";
}
test::string toXML() {
@@ -2461,22 +2245,19 @@ filename=Test.cpp
methodname=endTag
//@testString.h
-namespace test{
-
- class string{
- public:
-
- friend string operator+(const string& lhs, const string& rhs)
- {
- return rhs;
- }
+namespace test {
+class string {
+public:
+ friend string operator+(const string& lhs, const string& rhs) {
+ return rhs;
+ }
- string operator+(const string& rhs){return rhs;}
- string(char* cp){}
- string(){};
+ string operator+(const string& rhs) { return rhs; }
+ string(char* cp) {}
+ string() {};
+};
- };
}
//@Test.cpp
@@ -2495,9 +2276,8 @@ int main() {
//=
#include "testString.h"
-const char endTag(test::string name)
-{
- return "</" + name + ">";
+const char endTag(test::string name) {
+ return "</" + name + ">";
}
test::string toXML() {
@@ -2517,22 +2297,19 @@ filename=Test.cpp
methodname=exp
//@testString.h
-namespace test{
-
- class string{
- public:
-
- friend string operator+(const string& lhs, const string& rhs)
- {
- return rhs;
- }
+namespace test {
+class string {
+public:
+ friend string operator+(const string& lhs, const string& rhs) {
+ return rhs;
+ }
- string operator+(const string& rhs){return rhs;}
- string(char* cp){}
- string(){};
+ string operator+(const string& rhs) { return rhs; }
+ string(char* cp) {}
+ string() {};
+};
- };
}
//@Test.cpp
@@ -2551,9 +2328,8 @@ int main() {
//=
#include "testString.h"
-const char exp()
-{
- return ">" + "</";
+const char exp() {
+ return ">" + "</";
}
test::string toXML() {
@@ -2572,27 +2348,23 @@ int main() {
filename=main.cpp
methodname=exp
//@main.cpp
-int main(int argc, char **argv) {
-
+int main(int argc, char** argv) {
/*$*/int a = 0;
{
a++;
}/*$$*/
-
}
//=
-void exp()
-{
- int a = 0;
- {
- a++;
- }
+void exp() {
+ int a = 0;
+ {
+ a++;
+ }
}
-int main(int argc, char **argv) {
- exp();
-
+int main(int argc, char** argv) {
+ exp();
}
//!Bug#264712 Refactor extract function deletes comments in header
@@ -2619,26 +2391,23 @@ methodname=exp
#include "classhelper.h"
-class Test
-{
+class Test {
public:
-
/**
* Small class with some comments
*/
Test();
- /** Calculate important things.
- * @returns the result of the calculation
- */
- int calculateStuff();
+ /** Calculate important things.
+ * @returns the result of the calculation
+ */
+ int calculateStuff();
private:
/**
* Retain a value for something.
*/
- int m_value;
-
+ int m_value;
};
#endif
@@ -2652,27 +2421,24 @@ class Test
#include "classhelper.h"
-class Test
-{
+class Test {
public:
-
/**
* Small class with some comments
*/
Test();
- /** Calculate important things.
- * @returns the result of the calculation
- */
- int calculateStuff();
+ /** Calculate important things.
+ * @returns the result of the calculation
+ */
+ int calculateStuff();
private:
/**
* Retain a value for something.
*/
- int m_value;
- int exp();
-
+ int m_value;
+ int exp();
};
#endif
@@ -2695,13 +2461,12 @@ int Test::calculateStuff() {
Test::Test() {}
-int Test::exp()
-{
- // refactor these lines to a new method:
- int result = m_value;
- result += 10;
- result *= 10;
- return result;
+int Test::exp() {
+ // refactor these lines to a new method:
+ int result = m_value;
+ result += 10;
+ result *= 10;
+ return result;
}
int Test::calculateStuff() {
@@ -2718,42 +2483,37 @@ methodname=exp
//@main.cpp
int myFunc() {
-return 5;
+ return 5;
}
int main() {
-
-int a = 0;
+ int a = 0;
/*$*/try {
- a = myFunc();
- }
- catch(const int & ){
- a = 3;
- }/*$$*/
- return a;
+ a = myFunc();
+ } catch (const int&) {
+ a = 3;
+ }/*$$*/
+ return a;
}
//=
int myFunc() {
-return 5;
+ return 5;
}
-void exp(int & a)
-{
- try {
- a = myFunc();
- }
- catch(const int & ){
- a = 3;
- }
+void exp(int& a) {
+ try {
+ a = myFunc();
+ } catch (const int&) {
+ a = 3;
+ }
}
int main() {
-
-int a = 0;
- exp(a);
- return a;
+ int a = 0;
+ exp(a);
+ return a;
}
//!Bug#282004 Refactor->Extract Function in C Project (not C++) won't extract parameters
@@ -2762,24 +2522,21 @@ int a = 0;
filename=main.c
methodname=exp
//@main.c
-int main()
-{
- int a,b;
- /*$*/b=a*2;/*$$*/
- return a;
+int main() {
+ int a,b;
+ /*$*/b=a*2;/*$$*/
+ return a;
}
//=
-void exp(int b, int *a)
-{
- b = a * 2;
+void exp(int b, int* a) {
+ b = a * 2;
}
-int main()
-{
- int a,b;
- exp(b, a);
- return a;
+int main() {
+ int a,b;
+ exp(b, a);
+ return a;
}
//!ExtractFunctionRefactoringTest virtual
@@ -2788,13 +2545,12 @@ int main()
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
int foo();
-
+
private:
int help();
};
@@ -2805,14 +2561,13 @@ private:
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
int foo();
- virtual void exp(int & i);
-
+ virtual void exp(int& i);
+
private:
int help();
};
@@ -2822,15 +2577,13 @@ private:
//@A.cpp
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-int A::foo()
-{
+
+int A::foo() {
int i = 2;
//comment
/*$*/++i;
@@ -2838,40 +2591,35 @@ int A::foo()
return i;
}
-int A::help()
-{
+int A::help() {
return 42;
-}
+}
//=
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-void A::exp(int & i)
-{
- //comment
- ++i;
- help();
+
+void A::exp(int& i) {
+ //comment
+ ++i;
+ help();
}
-int A::foo()
-{
+int A::foo() {
int i = 2;
//comment
- exp(i);
+ exp(i);
return i;
}
-int A::help()
-{
+int A::help() {
return 42;
-}
+}
//@.config
filename=A.cpp
@@ -2885,24 +2633,21 @@ visibility=public
//!Bug 288268: c-refactoring creates c++-parameters
//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest
//@main.c
-int main()
-{
- int a,b;
- /*$*/a = b*2;/*$$*/
- return a;
+int main() {
+ int a,b;
+ /*$*/a = b*2;/*$$*/
+ return a;
}
//=
-void test(int *a, int b)
-{
- a = b * 2;
+void test(int* a, int b) {
+ a = b * 2;
}
-int main()
-{
- int a,b;
- test(a, b);
- return a;
+int main() {
+ int a,b;
+ test(a, b);
+ return a;
}
//@.config
diff --git a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ExtractMethodDuplicates.rts b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ExtractMethodDuplicates.rts
index a3be46e65a..438d6b780b 100644
--- a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ExtractMethodDuplicates.rts
+++ b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ExtractMethodDuplicates.rts
@@ -6,13 +6,12 @@ replaceduplicates=true
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
int foo();
-
+
private:
int help();
};
@@ -23,16 +22,15 @@ private:
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
int foo();
-
+
private:
int help();
- void exp(int & i);
+ void exp(int& i);
};
#endif /*A_H_*/
@@ -40,56 +38,51 @@ private:
//@A.cpp
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
int i = 2;
++i;
help();
-}int A::foo()
-{
+}
+
+int A::foo() {
int i = 2;
/*$*/++i;
help();/*$$*/
return i;
}
-int A::help()
-{
+int A::help() {
return 42;
-}
+}
//=
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
int i = 2;
- exp(i);
-}void A::exp(int & i)
-{
- ++i;
- help();
+ exp(i);
}
-int A::foo()
-{
+void A::exp(int& i) {
+ ++i;
+ help();
+}
+
+int A::foo() {
int i = 2;
- exp(i);
+ exp(i);
return i;
}
-int A::help()
-{
+int A::help() {
return 42;
-}
+}
//!ExtractFunctionRefactoringTest duplicates with different Names
//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest
@@ -99,13 +92,12 @@ replaceduplicates=true
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
int foo();
-
+
private:
int help();
};
@@ -116,16 +108,15 @@ private:
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
int foo();
-
+
private:
int help();
- void exp(int & i);
+ void exp(int& i);
};
#endif /*A_H_*/
@@ -133,56 +124,51 @@ private:
//@A.cpp
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
int oo = 99;
++oo;
help();
-}int A::foo()
-{
+}
+
+int A::foo() {
int i = 2;
/*$*/++i;
help();/*$$*/
return i;
}
-int A::help()
-{
+int A::help() {
return 42;
-}
+}
//=
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
int oo = 99;
- exp(oo);
-}void A::exp(int & i)
-{
- ++i;
- help();
+ exp(oo);
}
-int A::foo()
-{
+void A::exp(int& i) {
+ ++i;
+ help();
+}
+
+int A::foo() {
int i = 2;
- exp(i);
+ exp(i);
return i;
}
-int A::help()
-{
+int A::help() {
return 42;
-}
+}
//!ExtractFunctionRefactoringTest dublicate with field
//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest
@@ -193,14 +179,13 @@ returnvalue=true
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
void foo();
int i;
-
+
private:
int help();
};
@@ -211,17 +196,16 @@ private:
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
void foo();
int i;
-
+
private:
int help();
- int exp(int j, int & a);
+ int exp(int j, int& a);
};
#endif /*A_H_*/
@@ -229,18 +213,17 @@ private:
//@A.cpp
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
int j = 0;
i++;
j++;
help();
-}void A::foo()
-{
+}
+
+void A::foo() {
int j = 0;
int a = 1;
/*$*/j++;
@@ -250,32 +233,29 @@ A::~A()
j++;
}
-int A::help()
-{
+int A::help() {
return 42;
-}
+}
//=
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
int j = 0;
i = exp(i, j);
-}int A::exp(int j, int & a)
-{
- j++;
- a++;
- help();
- return j;
}
-void A::foo()
-{
+int A::exp(int j, int& a) {
+ j++;
+ a++;
+ help();
+ return j;
+}
+
+void A::foo() {
int j = 0;
int a = 1;
j = exp(j, a);
@@ -283,10 +263,9 @@ void A::foo()
j++;
}
-int A::help()
-{
+int A::help() {
return 42;
-}
+}
//!ExtractFunctionRefactoringTest dublicate with field in marked scope
//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest
@@ -297,15 +276,14 @@ returnvalue=true
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
void foo();
int i;
int field;
-
+
private:
int help();
};
@@ -316,18 +294,17 @@ private:
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
void foo();
int i;
int field;
-
+
private:
int help();
- int exp(int j);
+ int exp(int j);
};
#endif /*A_H_*/
@@ -335,19 +312,18 @@ private:
//@A.cpp
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
int j = 0;
int a = 1;
a++;
j++;
help();
-}void A::foo()
-{
+}
+
+void A::foo() {
int j = 0;
/*$*/field++;
@@ -357,45 +333,41 @@ A::~A()
j++;
}
-int A::help()
-{
+int A::help() {
return 42;
-}
+}
//=
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
int j = 0;
int a = 1;
a++;
j++;
help();
-}int A::exp(int j)
-{
- field++;
- j++;
- help();
- return j;
}
-void A::foo()
-{
+int A::exp(int j) {
+ field++;
+ j++;
+ help();
+ return j;
+}
+
+void A::foo() {
int j = 0;
- j = exp(j);
+ j = exp(j);
field++;
j++;
}
-int A::help()
-{
+int A::help() {
return 42;
-}
+}
//!ExtractFunctionRefactoringTest duplicates with different Names and return type
//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest
@@ -406,13 +378,12 @@ returnvalue=true
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
int foo();
-
+
private:
int help();
};
@@ -423,16 +394,15 @@ private:
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
int foo();
-
+
private:
int help();
- int exp(int i, float & j);
+ int exp(int i, float& j);
};
#endif /*A_H_*/
@@ -440,20 +410,19 @@ private:
//@A.cpp
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
int oo = 99;
float blabla = 0;
++oo;
blabla += 1;
help();
blabla += 1;
-}int A::foo()
-{
+}
+
+int A::foo() {
int i = 2;
float j = 8989;
/*$*/++i;
@@ -463,45 +432,41 @@ A::~A()
return i;
}
-int A::help()
-{
+int A::help() {
return 42;
-}
+}
//=
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
int oo = 99;
float blabla = 0;
- oo = exp(oo, blabla);
+ oo = exp(oo, blabla);
blabla += 1;
-}int A::exp(int i, float & j)
-{
- ++i;
- j += 1;
- help();
- return i;
}
-int A::foo()
-{
+int A::exp(int i, float& j) {
+ ++i;
+ j += 1;
+ help();
+ return i;
+}
+
+int A::foo() {
int i = 2;
float j = 8989;
- i = exp(i, j);
+ i = exp(i, j);
j++;
return i;
}
-int A::help()
-{
+int A::help() {
return 42;
-}
+}
//!ExtractFunctionRefactoringTest duplicates with a lot of different Names an variable not used afterwards in the duplicate
//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest
@@ -511,13 +476,12 @@ replaceduplicates=true
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
int foo();
-
+
private:
int help();
};
@@ -528,16 +492,15 @@ private:
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
int foo();
-
+
private:
int help();
- void exp(int & i, float j);
+ void exp(int& i, float j);
};
#endif /*A_H_*/
@@ -545,19 +508,18 @@ private:
//@A.cpp
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
int oo = 99;
float blabla = 0;
++oo;
blabla += 1;
help();
-}int A::foo()
-{
+}
+
+int A::foo() {
int i = 2;
float j = 8989;
/*$*/++i;
@@ -566,42 +528,38 @@ A::~A()
return i;
}
-int A::help()
-{
+int A::help() {
return 42;
-}
+}
//=
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
int oo = 99;
float blabla = 0;
- exp(oo, blabla);
-}void A::exp(int & i, float j)
-{
- ++i;
- j += 1;
- help();
+ exp(oo, blabla);
}
-int A::foo()
-{
+void A::exp(int& i, float j) {
+ ++i;
+ j += 1;
+ help();
+}
+
+int A::foo() {
int i = 2;
float j = 8989;
- exp(i, j);
+ exp(i, j);
return i;
}
-int A::help()
-{
+int A::help() {
return 42;
-}
+}
//!ExtractFunctionRefactoringTest with duplicates name used afterwards in duplicate but not in original selection this is no dublicate
//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest
@@ -611,13 +569,12 @@ replaceduplicates=true
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
void foo();
-
+
private:
int help();
};
@@ -628,16 +585,15 @@ private:
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
void foo();
-
+
private:
int help();
- void exp(int i);
+ void exp(int i);
};
#endif /*A_H_*/
@@ -645,57 +601,52 @@ private:
//@A.cpp
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
int i = 2;
++i;// No Duplicate
help();
++i;// this is the reason
-}void A::foo()
-{
+}
+
+void A::foo() {
int i = 2;
/*$*/++i;
help();/*$$*/
}
-int A::help()
-{
+int A::help() {
return 42;
-}
+}
//=
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
int i = 2;
++i;// No Duplicate
help();
++i;// this is the reason
-}void A::exp(int i)
-{
- ++i;
- help();
}
-void A::foo()
-{
+void A::exp(int i) {
+ ++i;
+ help();
+}
+
+void A::foo() {
int i = 2;
- exp(i);
+ exp(i);
}
-int A::help()
-{
+int A::help() {
return 42;
-}
+}
//!ExtractFunctionRefactoringTest with Return Value and a lot Ref Parameter and a method call
//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest
@@ -708,13 +659,12 @@ returnvalue=true
#include "B.h"
-class A
-{
+class A {
public:
A();
virtual ~A();
int foo();
-
+
private:
int help();
};
@@ -727,16 +677,15 @@ private:
#include "B.h"
-class A
-{
+class A {
public:
A();
virtual ~A();
int foo();
-
+
private:
int help();
- int exp(int i, B *& b, int & y, float & x);
+ int exp(int i, B*& b, int& y, float& x);
};
#endif /*A_H_*/
@@ -744,12 +693,10 @@ private:
//@A.cpp
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
int i = 2;
float x = i;
B* b = new B();
@@ -761,8 +708,9 @@ A::~A()
b->hello(y);
++x;
i++;
-}int A::foo()
-{
+}
+
+int A::foo() {
int i = 2;
float x = i;
B* b = new B();
@@ -776,53 +724,49 @@ A::~A()
return i;
}
-int A::help()
-{
+int A::help() {
return 42;
-}
+}
//=
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
int i = 2;
float x = i;
B* b = new B();
int y = x + i;
- i = exp(i, b, y, x);
+ i = exp(i, b, y, x);
b->hello(y);
++x;
i++;
-}int A::exp(int i, B *& b, int & y, float & x)
-{
- ++i;
- b->hello(y);
- i = i + x;
- help();
- return i;
}
-int A::foo()
-{
+int A::exp(int i, B*& b, int& y, float& x) {
+ ++i;
+ b->hello(y);
+ i = i + x;
+ help();
+ return i;
+}
+
+int A::foo() {
int i = 2;
float x = i;
B* b = new B();
int y = x + i;
- i = exp(i, b, y, x);
+ i = exp(i, b, y, x);
b->hello(y);
++x;
return i;
}
-int A::help()
-{
+int A::help() {
return 42;
-}
+}
//@B.h
#ifndef B_H_
@@ -849,13 +793,12 @@ returnvalue=true
#include "B.h"
-class A
-{
+class A {
public:
A();
virtual ~A();
int foo();
-
+
private:
int help();
};
@@ -868,16 +811,15 @@ private:
#include "B.h"
-class A
-{
+class A {
public:
A();
virtual ~A();
int foo();
-
+
private:
int help();
- int exp(int i, B *& b, int & y, float x);
+ int exp(int i, B*& b, int& y, float x);
};
#endif /*A_H_*/
@@ -885,12 +827,10 @@ private:
//@A.cpp
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
int i = 2;
float x = i;
B* b = new B();
@@ -902,8 +842,9 @@ A::~A()
b->hello(y);
++x;
i++;
-}int A::foo()
-{
+}
+
+int A::foo() {
int i = 2;
float x = i;
B* b = new B();
@@ -916,20 +857,17 @@ A::~A()
return i;
}
-int A::help()
-{
+int A::help() {
return 42;
-}
+}
//=
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
int i = 2;
float x = i;
B* b = new B();
@@ -941,30 +879,29 @@ A::~A()
b->hello(y);
++x;
i++;
-}int A::exp(int i, B *& b, int & y, float x)
-{
- ++i;
- b->hello(y);
- i = i + x;
- help();
- return i;
}
-int A::foo()
-{
+int A::exp(int i, B*& b, int& y, float x) {
+ ++i;
+ b->hello(y);
+ i = i + x;
+ help();
+ return i;
+}
+
+int A::foo() {
int i = 2;
float x = i;
B* b = new B();
int y = x + i;
- i = exp(i, b, y, x);
+ i = exp(i, b, y, x);
b->hello(y);
return i;
}
-int A::help()
-{
+int A::help() {
return 42;
-}
+}
//@B.h
#ifndef B_H_
@@ -988,13 +925,12 @@ replaceduplicates=true
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
int foo();
-
+
private:
int help();
};
@@ -1005,16 +941,15 @@ private:
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
int foo();
-
+
private:
int help();
- void exp(int & i);
+ void exp(int& i);
};
#endif /*A_H_*/
@@ -1022,54 +957,49 @@ private:
//@A.cpp
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
int i = 2;
++i;
help();
-}int A::foo()
-{
+}
+
+int A::foo() {
int i = 2;
/*$*/++i;
help();/*$$*/
return i;
}
-int A::help()
-{
+int A::help() {
return 42;
-}
+}
//=
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
int i = 2;
- exp(i);
-}void A::exp(int & i)
-{
- ++i;
- help();
+ exp(i);
}
-int A::foo()
-{
+void A::exp(int& i) {
+ ++i;
+ help();
+}
+
+int A::foo() {
int i = 2;
- exp(i);
+ exp(i);
return i;
}
-int A::help()
-{
+int A::help() {
return 42;
-}
+}
diff --git a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ExtractMethodHistory.rts b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ExtractMethodHistory.rts
index 3196f88be8..34e7e83240 100644
--- a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ExtractMethodHistory.rts
+++ b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ExtractMethodHistory.rts
@@ -4,13 +4,12 @@
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
int foo();
-
+
private:
int help();
};
@@ -21,16 +20,15 @@ private:
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
int foo();
-
+
private:
int help();
- int exp();
+ int exp();
};
#endif /*A_H_*/
@@ -38,62 +36,55 @@ private:
//@A.cpp
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-int A::foo()
-{
+
+int A::foo() {
int i = 2;
++i;
help();
return i;
}
-int A::help()
-{
+int A::help() {
return 42;
-}
+}
//=
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-int A::exp()
-{
- int i = 2;
- ++i;
- help();
- return i;
+
+int A::exp() {
+ int i = 2;
+ ++i;
+ help();
+ return i;
}
-int A::foo()
-{
+int A::foo() {
int i = exp();
return i;
}
-int A::help()
-{
+int A::help() {
return 42;
-}
+}
//@refScript.xml
<?xml version="1.0" encoding="UTF-8"?>
<session version="1.0">
-<refactoring comment="Create method exp" description="Extract Method Refactoring"
- fileName="file:$$projectPath$$/A.cpp"
- flags="4" id="org.eclipse.cdt.internal.ui.refactoring.extractfunction.ExtractFunctionRefactoring"
- name="exp" project="RegressionTestProject" selection="56,25" visibility="private"/>
+<refactoring comment="Create method exp" description="Extract Method Refactoring"
+ fileName="file:$$projectPath$$/A.cpp"
+ flags="4" id="org.eclipse.cdt.internal.ui.refactoring.extractfunction.ExtractFunctionRefactoring"
+ name="exp" project="RegressionTestProject" selection="57,25" visibility="private"/>
</session>
@@ -103,13 +94,12 @@ int A::help()
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
int foo();
-
+
private:
int help();
};
@@ -120,16 +110,15 @@ private:
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
int foo();
-
+
private:
int help();
- void exp(int & i);
+ void exp(int& i);
};
#endif /*A_H_*/
@@ -137,15 +126,13 @@ private:
//@A.cpp
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-int A::foo()
-{
+
+int A::foo() {
int i = 2;
//comment
++i;
@@ -153,40 +140,35 @@ int A::foo()
return i;
}
-int A::help()
-{
+int A::help() {
return 42;
-}
+}
//=
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-void A::exp(int & i)
-{
- //comment
- ++i;
- help();
+
+void A::exp(int& i) {
+ //comment
+ ++i;
+ help();
}
-int A::foo()
-{
+int A::foo() {
int i = 2;
//comment
- exp(i);
+ exp(i);
return i;
}
-int A::help()
-{
+int A::help() {
return 42;
-}
+}
//@refScript.xml
<?xml version="1.0" encoding="UTF-8"?>
@@ -194,32 +176,29 @@ int A::help()
<refactoring comment="Create method exp" description="Extract Method Refactoring"
fileName="file:$$projectPath$$/A.cpp"
flags="4" id="org.eclipse.cdt.internal.ui.refactoring.extractfunction.ExtractFunctionRefactoring"
- name="exp" project="RegressionTestProject" selection="79,13" visibility="private"/>
+ name="exp" project="RegressionTestProject" selection="69,24" visibility="private"/>
</session>
//!Extract Function History first extracted statement with leading comment
//#org.eclipse.cdt.ui.tests.refactoring.RefactoringHistoryTest
//@main.cpp
-int main(){
-
+int main() {
int i;
// Comment
- i= 7;
+ i = 7;
return i;
}
//=
-void exp(int & i)
-{
- // Comment
- i = 7;
+void exp(int& i) {
+ // Comment
+ i = 7;
}
-int main(){
-
+int main() {
int i;
// Comment
- exp(i);
+ exp(i);
return i;
}
@@ -229,29 +208,26 @@ int main(){
<refactoring comment="Create method exp" description="Extract Method Refactoring"
fileName="file:$$projectPath$$/main.cpp"
flags="4" id="org.eclipse.cdt.internal.ui.refactoring.extractfunction.ExtractFunctionRefactoring"
- name="exp" project="RegressionTestProject" selection="35,5" visibility="private"/>
+ name="exp" project="RegressionTestProject" selection="34,6" visibility="private"/>
</session>
//!Extract Function History extracted statement with trailling comment
//#org.eclipse.cdt.ui.tests.refactoring.RefactoringHistoryTest
//@main.cpp
-int main(){
-
+int main() {
int i;
- i= 7; // Comment
+ i = 7; // Comment
return i;
}
//=
-void exp(int & i)
-{
- i = 7; // Comment
+void exp(int& i) {
+ i = 7; // Comment
}
-int main(){
-
+int main() {
int i;
- exp(i); // Comment
+ exp(i); // Comment
return i;
}
@@ -261,7 +237,7 @@ int main(){
<refactoring comment="Create method exp" description="Extract Method Refactoring"
fileName="file:$$projectPath$$/main.cpp"
flags="4" id="org.eclipse.cdt.internal.ui.refactoring.extractfunction.ExtractFunctionRefactoring"
- name="exp" project="RegressionTestProject" selection="23,5" visibility="private"/>
+ name="exp" project="RegressionTestProject" selection="22,6" visibility="private"/>
</session>
//!ExtractFunctionRefactoringTest duplicates with different Names History Test
@@ -270,13 +246,12 @@ int main(){
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
int foo();
-
+
private:
int help();
};
@@ -287,16 +262,15 @@ private:
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
int foo();
-
+
private:
int help();
- void exp(int & i);
+ void exp(int& i);
};
#endif /*A_H_*/
@@ -304,61 +278,56 @@ private:
//@A.cpp
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
int oo = 99;
++oo;
help();
-}int A::foo()
-{
+}
+
+int A::foo() {
int i = 2;
++i;
help();
return i;
}
-int A::help()
-{
+int A::help() {
return 42;
-}
+}
//=
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
int oo = 99;
- exp(oo);
-}void A::exp(int & i)
-{
- ++i;
- help();
+ exp(oo);
+}
+
+void A::exp(int& i) {
+ ++i;
+ help();
}
-int A::foo()
-{
+int A::foo() {
int i = 2;
- exp(i);
+ exp(i);
return i;
}
-int A::help()
-{
+int A::help() {
return 42;
-}
+}
//@refScript.xml
<?xml version="1.0" encoding="UTF-8"?>
<session version="1.0">
-<refactoring comment="Create method exp" description="Extract Method Refactoring"
+<refactoring comment="Create method exp" description="Extract Method Refactoring"
fileName="file:$$projectPath$$/A.cpp" flags="4" id="org.eclipse.cdt.internal.ui.refactoring.extractfunction.ExtractFunctionRefactoring"
- name="exp" project="RegressionTestProject" replaceDuplicates="true" selection="97,13" visibility="private"/>
+ name="exp" project="RegressionTestProject" replaceDuplicates="true" selection="99,13" visibility="private"/>
</session>
diff --git a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ExtractMethodPreprocessor.rts b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ExtractMethodPreprocessor.rts
index 572b4e2254..23d300881a 100644
--- a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ExtractMethodPreprocessor.rts
+++ b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ExtractMethodPreprocessor.rts
@@ -4,13 +4,12 @@
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
int foo();
-
+
private:
int help();
};
@@ -21,16 +20,15 @@ private:
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
int foo();
-
+
private:
int help();
- void exp(int & ii);
+ void exp(int& ii);
};
#endif /*A_H_*/
@@ -40,15 +38,13 @@ private:
#define ADD(a,ab) a + ab + 2 + a
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-int A::foo()
-{
+
+int A::foo() {
int ii = 2;
/*$*/++ii;
ii = ADD(ii, 42);
@@ -56,41 +52,36 @@ int A::foo()
return ii;
}
-int A::help()
-{
+int A::help() {
return 42;
-}
+}
//=
#include "A.h"
#define ADD(a,ab) a + ab + 2 + a
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-void A::exp(int & ii)
-{
- ++ii;
- ii = ADD(ii, 42);
- help();
+
+void A::exp(int& ii) {
+ ++ii;
+ ii = ADD(ii, 42);
+ help();
}
-int A::foo()
-{
+int A::foo() {
int ii = 2;
- exp(ii);
+ exp(ii);
return ii;
}
-int A::help()
-{
+int A::help() {
return 42;
-}
+}
//!Extract Method return value assinged to Macrocall Bug
//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest
@@ -101,14 +92,14 @@ returnparameterindex=1
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
int foo();
+
private:
- int help();
+ int help();
};
#endif /*A_H_*/
@@ -117,15 +108,15 @@ private:
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
int foo();
+
private:
- int help();
- int exp(int & i, int b);
+ int help();
+ int exp(int& i, int b);
};
#endif /*A_H_*/
@@ -135,62 +126,55 @@ private:
#define ADD(b) b = b + 2
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-int A::foo()
-{
+
+int A::foo() {
int i = 2;
int b = 42;
/*$*/++i;
- help();
- ADD(b);/*$$*/
+ help();
+ ADD(b);/*$$*/
b += 2;
return i;
}
-int A::help()
-{
+int A::help() {
return 42;
-}
+}
//=
#include "A.h"
#define ADD(b) b = b + 2
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-int A::exp(int & i, int b)
-{
- ++i;
- help();
- ADD(b);
- return b;
+
+int A::exp(int& i, int b) {
+ ++i;
+ help();
+ ADD(b);
+ return b;
}
-int A::foo()
-{
+int A::foo() {
int i = 2;
int b = 42;
- b = exp(i, b);
+ b = exp(i, b);
b += 2;
return i;
}
-int A::help()
-{
+int A::help() {
return 42;
-}
+}
//!Extract Method Methodlength with more than 1 Macrocall Bug
//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest
@@ -202,14 +186,14 @@ replaceduplicates=true
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
int foo();
+
private:
- int help();
+ int help();
};
#endif /*A_H_*/
@@ -218,15 +202,15 @@ private:
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
virtual ~A();
int foo();
+
private:
- int help();
- int exp(int bb);
+ int help();
+ int exp(int bb);
};
#endif /*A_H_*/
@@ -236,60 +220,53 @@ private:
#define ADD(b) b = b + 2
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-int A::foo()
-{
+
+int A::foo() {
int i = 2;
int bb = 42;
++i;
- /*$*/ADD(bb);
- ADD(bb);/*$$*/
+ /*$*/ADD(bb);
+ ADD(bb);/*$$*/
bb += 2;
return i;
}
-int A::help()
-{
+int A::help() {
return 42;
-}
+}
//=
#include "A.h"
#define ADD(b) b = b + 2
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
-int A::exp(int bb)
-{
- ADD(bb);
- ADD(bb);
- return bb;
+
+int A::exp(int bb) {
+ ADD(bb);
+ ADD(bb);
+ return bb;
}
-int A::foo()
-{
+int A::foo() {
int i = 2;
int bb = 42;
++i;
- bb = exp(bb);
+ bb = exp(bb);
bb += 2;
return i;
}
-int A::help()
-{
+int A::help() {
return 42;
-}
+}
diff --git a/core/org.eclipse.cdt.ui.tests/resources/refactoring/GenerateGettersAndSetters.rts b/core/org.eclipse.cdt.ui.tests/resources/refactoring/GenerateGettersAndSetters.rts
index bd0232174f..9da05e7a0a 100644
--- a/core/org.eclipse.cdt.ui.tests/resources/refactoring/GenerateGettersAndSetters.rts
+++ b/core/org.eclipse.cdt.ui.tests/resources/refactoring/GenerateGettersAndSetters.rts
@@ -7,12 +7,11 @@ inHeader=true
//@C.cpp
#include "C.h"
-int Person::SocSecNo(){
+int Person::SocSecNo() {
return socSecNo;
}
-int main(int argc, char **argv) {
-
+int main(int argc, char** argv) {
}
//=
@@ -21,40 +20,34 @@ int main(int argc, char **argv) {
#define C_H_
class Person {
-
private:
-
- int systemId;
+ int systemId;
protected:
-
- char *name;
+ char* name;
public:
+ const int socSecNo;
+
+ Person myFriend;
- const int socSecNo;
-
- Person myFriend;
+ Person(int socSecNo); // contructor
+ ~Person(); // destructor
- Person(int socSecNo); // contructor
+ char* Name();
- ~Person(); // destructor
+ void Print();
+ int /*$*/SocSecNo/*$$*/();
- char* Name();
-
- void Print();
-
- int /*$*/SocSecNo/*$$*/();
-
- int GetUniqueId();
-
- int getSystemId(){
+ int GetUniqueId();
+
+ int getSystemId() {
return systemId;
}
-
- void setSystemId(int systemId){
+
+ void setSystemId(int systemId) {
this->systemId = systemId;
}
};
@@ -67,44 +60,38 @@ int gooo = 1;
#define C_H_
class Person {
-
private:
-
- int systemId;
+ int systemId;
protected:
-
- char *name;
+ char* name;
public:
+ const int socSecNo;
- const int socSecNo;
-
- Person myFriend;
+ Person myFriend;
+ Person(int socSecNo); // contructor
- Person(int socSecNo); // contructor
+ ~Person(); // destructor
- ~Person(); // destructor
+ char* Name();
+ void Print();
- char* Name();
-
- void Print();
-
- int SocSecNo();
-
- int GetUniqueId();
- char *getName() const
- {
- return name;
- }
-
- int getSystemId(){
+ int SocSecNo();
+
+ int GetUniqueId();
+
+ char* getName() const {
+ return name;
+ }
+
+ int getSystemId() {
return systemId;
}
-
- void setSystemId(int systemId){
+
+ void setSystemId(int systemId) {
this->systemId = systemId;
}
};
@@ -121,12 +108,11 @@ inHeader=true
//@C.cpp
#include "C.h"
-int Person::SocSecNo(){
+int Person::SocSecNo() {
return socSecNo;
}
-int main(int argc, char **argv) {
-
+int main(int argc, char** argv) {
}
//=
@@ -135,44 +121,40 @@ int main(int argc, char **argv) {
#define C_H_
namespace Personal {
- class Person {
-
- private:
-
- int systemId;
-
- protected:
-
- char *name;
-
- public:
-
- const int socSecNo;
-
- Person myFriend;
-
-
- Person(int socSecNo); // contructor
-
- ~Person(); // destructor
-
-
- char* Name();
-
- void Print();
-
- int /*$*/SocSecNo/*$$*/();
-
- int GetUniqueId();
-
- int getSystemId(){
- return systemId;
- }
-
- void setSystemId(int systemId){
- this->systemId = systemId;
- }
- };
+
+class Person {
+private:
+ int systemId;
+
+protected:
+ char* name;
+
+public:
+ const int socSecNo;
+
+ Person myFriend;
+
+ Person(int socSecNo); // contructor
+
+ ~Person(); // destructor
+
+ char* Name();
+
+ void Print();
+
+ int /*$*/SocSecNo/*$$*/();
+
+ int GetUniqueId();
+
+ int getSystemId() {
+ return systemId;
+ }
+
+ void setSystemId(int systemId) {
+ this->systemId = systemId;
+ }
+};
+
}
int gooo = 1;
@@ -184,48 +166,44 @@ int gooo = 1;
#define C_H_
namespace Personal {
- class Person {
-
- private:
-
- int systemId;
-
- protected:
-
- char *name;
-
- public:
-
- const int socSecNo;
-
- Person myFriend;
-
-
- Person(int socSecNo); // contructor
-
- ~Person(); // destructor
-
-
- char* Name();
-
- void Print();
-
- int SocSecNo();
-
- int GetUniqueId();
- char *getName() const
- {
- return name;
- }
-
- int getSystemId(){
- return systemId;
- }
-
- void setSystemId(int systemId){
- this->systemId = systemId;
- }
- };
+
+class Person {
+private:
+ int systemId;
+
+protected:
+ char* name;
+
+public:
+ const int socSecNo;
+
+ Person myFriend;
+
+ Person(int socSecNo); // contructor
+
+ ~Person(); // destructor
+
+ char* Name();
+
+ void Print();
+
+ int SocSecNo();
+
+ int GetUniqueId();
+
+ char* getName() const {
+ return name;
+ }
+
+ int getSystemId() {
+ return systemId;
+ }
+
+ void setSystemId(int systemId) {
+ this->systemId = systemId;
+ }
+};
+
}
int gooo = 1;
@@ -241,12 +219,11 @@ inHeader=true
//@C.cpp
#include "C.h"
-int Person::SocSecNo(){
+int Person::SocSecNo() {
return socSecNo;
}
-int main(int argc, char **argv) {
-
+int main(int argc, char** argv) {
}
//=
@@ -255,40 +232,34 @@ int main(int argc, char **argv) {
#define C_H_
class Person {
-
private:
-
- int systemId;
+ int systemId;
protected:
-
- char *name;
+ char* name;
public:
+ const int socSecNo;
- const int socSecNo;
-
- Person myFriend;
+ Person myFriend;
+ Person(int socSecNo); // contructor
- Person(int socSecNo); // contructor
+ ~Person(); // destructor
- ~Person(); // destructor
+ char* Name();
+ void Print();
- char* Name();
-
- void Print();
-
- int /*$*/SocSecNo/*$$*/();
-
- int GetUniqueId();
-
- int getSystemId(){
+ int /*$*/SocSecNo/*$$*/();
+
+ int GetUniqueId();
+
+ int getSystemId() {
return systemId;
}
-
- void setSystemId(int systemId){
+
+ void setSystemId(int systemId) {
this->systemId = systemId;
}
};
@@ -302,44 +273,38 @@ int gooo = 1;
#define C_H_
class Person {
-
private:
-
- int systemId;
+ int systemId;
protected:
-
- char *name;
+ char* name;
public:
+ const int socSecNo;
- const int socSecNo;
-
- Person myFriend;
+ Person myFriend;
+ Person(int socSecNo); // contructor
- Person(int socSecNo); // contructor
+ ~Person(); // destructor
- ~Person(); // destructor
+ char* Name();
+ void Print();
- char* Name();
-
- void Print();
-
- int SocSecNo();
-
- int GetUniqueId();
- void setName(char *name)
- {
- this->name = name;
- }
-
- int getSystemId(){
+ int SocSecNo();
+
+ int GetUniqueId();
+
+ void setName(char* name) {
+ this->name = name;
+ }
+
+ int getSystemId() {
return systemId;
}
-
- void setSystemId(int systemId){
+
+ void setSystemId(int systemId) {
this->systemId = systemId;
}
};
@@ -358,12 +323,11 @@ inHeader=true
//@C.cpp
#include "C.h"
-int Person::SocSecNo(){
+int Person::SocSecNo() {
return socSecNo;
}
-int main(int argc, char **argv) {
-
+int main(int argc, char** argv) {
}
//=
@@ -372,40 +336,34 @@ int main(int argc, char **argv) {
#define C_H_
class Person {
-
private:
-
- int systemId;
+ int systemId;
protected:
-
- char *name;
+ char* name;
public:
+ const int socSecNo;
- const int socSecNo;
-
- Person myFriend;
+ Person myFriend;
+ Person(int socSecNo); // contructor
- Person(int socSecNo); // contructor
+ ~Person(); // destructor
- ~Person(); // destructor
+ char* Name();
+ void Print();
- char* Name();
-
- void Print();
-
- int /*$*/SocSecNo/*$$*/();
-
- int GetUniqueId();
-
- int getSystemId(){
+ int /*$*/SocSecNo/*$$*/();
+
+ int GetUniqueId();
+
+ int getSystemId() {
return systemId;
}
-
- void setSystemId(int systemId){
+
+ void setSystemId(int systemId) {
this->systemId = systemId;
}
};
@@ -419,49 +377,42 @@ int gooo = 1;
#define C_H_
class Person {
-
private:
-
- int systemId;
+ int systemId;
protected:
-
- char *name;
+ char* name;
public:
+ const int socSecNo;
- const int socSecNo;
-
- Person myFriend;
+ Person myFriend;
+ Person(int socSecNo); // contructor
- Person(int socSecNo); // contructor
+ ~Person(); // destructor
- ~Person(); // destructor
+ char* Name();
+ void Print();
- char* Name();
-
- void Print();
-
- int SocSecNo();
-
- int GetUniqueId();
- char *getName() const
- {
- return name;
- }
-
- void setName(char *name)
- {
- this->name = name;
- }
-
- int getSystemId(){
+ int SocSecNo();
+
+ int GetUniqueId();
+
+ char* getName() const {
+ return name;
+ }
+
+ void setName(char* name) {
+ this->name = name;
+ }
+
+ int getSystemId() {
return systemId;
}
-
- void setSystemId(int systemId){
+
+ void setSystemId(int systemId) {
this->systemId = systemId;
}
};
@@ -480,12 +431,11 @@ inHeader=true
//@C.cpp
#include "C.h"
-int Person::SocSecNo(){
+int Person::SocSecNo() {
return socSecNo;
}
-int main(int argc, char **argv) {
-
+int main(int argc, char** argv) {
}
//=
@@ -494,35 +444,28 @@ int main(int argc, char **argv) {
#define C_H_
class Person {
-
private:
-
- int systemId;
+ int systemId;
protected:
-
- char *name;
+ char* name;
public:
+ const int socSecNo;
- const int socSecNo;
-
- Person myFriend;
+ Person myFriend;
+ Person(int socSecNo); // contructor
- Person(int socSecNo); // contructor
+ ~Person(); // destructor
- ~Person(); // destructor
+ char* Name();
+ void Print();
- char* Name();
-
- void Print();
-
- int /*$*/SocSecNo/*$$*/();
-
- int GetUniqueId();
+ int /*$*/SocSecNo/*$$*/();
+ int GetUniqueId();
};
int gooo = 1;
@@ -534,54 +477,44 @@ int gooo = 1;
#define C_H_
class Person {
-
private:
-
- int systemId;
+ int systemId;
protected:
-
- char *name;
+ char* name;
public:
+ const int socSecNo;
- const int socSecNo;
-
- Person myFriend;
- char *getName() const
- {
- return name;
- }
-
- int getSystemId() const
- {
- return systemId;
- }
+ Person myFriend;
- void setName(char *name)
- {
- this->name = name;
- }
+ char* getName() const {
+ return name;
+ }
- void setSystemId(int systemId)
- {
- this->systemId = systemId;
- }
+ int getSystemId() const {
+ return systemId;
+ }
+ void setName(char* name) {
+ this->name = name;
+ }
- Person(int socSecNo); // contructor
+ void setSystemId(int systemId) {
+ this->systemId = systemId;
+ }
- ~Person(); // destructor
+ Person(int socSecNo); // contructor
+ ~Person(); // destructor
char* Name();
-
- void Print();
-
- int SocSecNo();
-
- int GetUniqueId();
+ void Print();
+
+ int SocSecNo();
+
+ int GetUniqueId();
};
int gooo = 1;
@@ -631,25 +564,22 @@ public:
virtual ~GaS();
bool ok;
void method2();
- int getI() const
- {
- return i;
- }
-
- bool isOk() const
- {
- return ok;
- }
-
- void setI(int i)
- {
- this->i = i;
- }
-
- void setOk(bool ok)
- {
- this->ok = ok;
- }
+
+ int getI() const {
+ return i;
+ }
+
+ bool isOk() const {
+ return ok;
+ }
+
+ void setI(int i) {
+ this->i = i;
+ }
+
+ void setOk(bool ok) {
+ this->ok = ok;
+ }
private:
int i;
@@ -670,7 +600,7 @@ inHeader=true
class Person {
private:
- int /*$*/id/*$$*/;
+ int /*$*/id/*$$*/;
};
#endif /*C_H_*/
@@ -681,17 +611,16 @@ private:
class Person {
private:
- int id;
+ int id;
+
public:
- int getId() const
- {
- return id;
- }
-
- void setId(int id)
- {
- this->id = id;
- }
+ int getId() const {
+ return id;
+ }
+
+ void setId(int id) {
+ this->id = id;
+ }
};
#endif /*C_H_*/
@@ -712,8 +641,7 @@ inHeader=true
#define TEST_H_
//comment1
-class test
-{
+class test {
int /*$*/i/*$$*/; //comment2
char* b;
//comment3
@@ -730,21 +658,19 @@ class test
#define TEST_H_
//comment1
-class test
-{
+class test {
int i; //comment2
char* b;
-public:
- int getI() const
- {
- return i;
- }
-
- void setI(int i)
- {
- this->i = i;
- }
//comment3
+
+public:
+ int getI() const {
+ return i;
+ }
+
+ void setI(int i) {
+ this->i = i;
+ }
};
#endif /* TEST_H_ */
@@ -763,8 +689,7 @@ fatalerror=true
#define TEST_H_
//comment1
-class test
-{
+class test {
void /*$*/test/*$$*/();
//comment3
};
@@ -796,28 +721,25 @@ getters=name
//@C.cpp
#include "C.h"
-int Person::SocSecNo(){
+int Person::SocSecNo() {
return socSecNo;
}
-int main(int argc, char **argv) {
-
+int main(int argc, char** argv) {
}
//=
#include "C.h"
-char *Person::getName() const
-{
- return name;
+char* Person::getName() const {
+ return name;
}
-int Person::SocSecNo(){
+int Person::SocSecNo() {
return socSecNo;
}
-int main(int argc, char **argv) {
-
+int main(int argc, char** argv) {
}
//@C.h
@@ -825,37 +747,31 @@ int main(int argc, char **argv) {
#define C_H_
class Person {
-
private:
-
- int systemId;
+ int systemId;
protected:
-
- char *name;
+ char* name;
public:
+ const int socSecNo;
+
+ Person myFriend;
- const int socSecNo;
-
- Person myFriend;
+ Person(int socSecNo); // contructor
+ ~Person(); // destructor
- Person(int socSecNo); // contructor
+ char* Name();
- ~Person(); // destructor
+ void Print();
+ int /*$*/SocSecNo/*$$*/();
+
+ int GetUniqueId();
- char* Name();
-
- void Print();
-
- int /*$*/SocSecNo/*$$*/();
-
- int GetUniqueId();
-
int getSystemId();
-
+
void setSystemId(int systemId);
};
@@ -867,38 +783,32 @@ int gooo = 1;
#define C_H_
class Person {
-
private:
-
- int systemId;
+ int systemId;
protected:
-
- char *name;
+ char* name;
public:
+ const int socSecNo;
- const int socSecNo;
-
- Person myFriend;
- char *getName() const;
+ Person myFriend;
+ char* getName() const;
+ Person(int socSecNo); // contructor
- Person(int socSecNo); // contructor
+ ~Person(); // destructor
- ~Person(); // destructor
+ char* Name();
+ void Print();
+
+ int SocSecNo();
+
+ int GetUniqueId();
- char* Name();
-
- void Print();
-
- int SocSecNo();
-
- int GetUniqueId();
-
int getSystemId();
-
+
void setSystemId(int systemId);
};
@@ -921,17 +831,17 @@ int Person::SocSecNo() {
} // namespace Personal
-int main(int argc, char **argv) {
+int main(int argc, char** argv) {
}
//=
#include "C.h"
namespace Personal {
- char *Person::getName() const
- {
- return name;
- }
+
+char* Person::getName() const {
+ return name;
+}
int Person::SocSecNo() {
return socSecNo;
@@ -939,7 +849,7 @@ int Person::SocSecNo() {
} // namespace Personal
-int main(int argc, char **argv) {
+int main(int argc, char** argv) {
}
//@C.h
@@ -947,44 +857,40 @@ int main(int argc, char **argv) {
#define C_H_
namespace Personal {
- class Person {
-
- private:
-
- int systemId;
-
- protected:
-
- char *name;
-
- public:
-
- const int socSecNo;
-
- Person myFriend;
-
-
- Person(int socSecNo); // contructor
-
- ~Person(); // destructor
-
-
- char* Name();
-
- void Print();
-
- int /*$*/SocSecNo/*$$*/();
-
- int GetUniqueId();
-
- int getSystemId(){
- return systemId;
- }
-
- void setSystemId(int systemId){
- this->systemId = systemId;
- }
- };
+
+class Person {
+private:
+ int systemId;
+
+protected:
+ char* name;
+
+public:
+ const int socSecNo;
+
+ Person myFriend;
+
+ Person(int socSecNo); // contructor
+
+ ~Person(); // destructor
+
+ char* Name();
+
+ void Print();
+
+ int /*$*/SocSecNo/*$$*/();
+
+ int GetUniqueId();
+
+ int getSystemId() {
+ return systemId;
+ }
+
+ void setSystemId(int systemId) {
+ this->systemId = systemId;
+ }
+};
+
}
int gooo = 1;
@@ -996,45 +902,41 @@ int gooo = 1;
#define C_H_
namespace Personal {
- class Person {
-
- private:
-
- int systemId;
-
- protected:
-
- char *name;
-
- public:
-
- const int socSecNo;
-
- Person myFriend;
-
-
- Person(int socSecNo); // contructor
-
- ~Person(); // destructor
-
-
- char* Name();
-
- void Print();
-
- int SocSecNo();
-
- int GetUniqueId();
- char *getName() const;
-
- int getSystemId(){
- return systemId;
- }
-
- void setSystemId(int systemId){
- this->systemId = systemId;
- }
- };
+
+class Person {
+private:
+ int systemId;
+
+protected:
+ char* name;
+
+public:
+ const int socSecNo;
+
+ Person myFriend;
+
+ Person(int socSecNo); // contructor
+
+ ~Person(); // destructor
+
+ char* Name();
+
+ void Print();
+
+ int SocSecNo();
+
+ int GetUniqueId();
+ char* getName() const;
+
+ int getSystemId() {
+ return systemId;
+ }
+
+ void setSystemId(int systemId) {
+ this->systemId = systemId;
+ }
+};
+
}
int gooo = 1;
@@ -1049,29 +951,26 @@ setters=name
//@C.cpp
#include "C.h"
-int Person::SocSecNo(){
+int Person::SocSecNo() {
return socSecNo;
}
-int main(int argc, char **argv) {
-
+int main(int argc, char** argv) {
}
//=
#include "C.h"
-void Person::setName(char *name)
-{
- this->name = name;
+void Person::setName(char* name) {
+ this->name = name;
}
-int Person::SocSecNo(){
+int Person::SocSecNo() {
return socSecNo;
}
-int main(int argc, char **argv) {
-
+int main(int argc, char** argv) {
}
@@ -1080,40 +979,34 @@ int main(int argc, char **argv) {
#define C_H_
class Person {
-
private:
-
- int systemId;
+ int systemId;
protected:
-
- char *name;
+ char* name;
public:
+ const int socSecNo;
- const int socSecNo;
-
- Person myFriend;
+ Person myFriend;
+ Person(int socSecNo); // contructor
- Person(int socSecNo); // contructor
+ ~Person(); // destructor
- ~Person(); // destructor
+ char* Name();
+ void Print();
- char* Name();
-
- void Print();
-
- int /*$*/SocSecNo/*$$*/();
-
- int GetUniqueId();
-
- int getSystemId(){
+ int /*$*/SocSecNo/*$$*/();
+
+ int GetUniqueId();
+
+ int getSystemId() {
return systemId;
}
-
- void setSystemId(int systemId){
+
+ void setSystemId(int systemId) {
this->systemId = systemId;
}
};
@@ -1127,41 +1020,35 @@ int gooo = 1;
#define C_H_
class Person {
-
private:
-
- int systemId;
+ int systemId;
protected:
-
- char *name;
+ char* name;
public:
+ const int socSecNo;
- const int socSecNo;
-
- Person myFriend;
+ Person myFriend;
+ Person(int socSecNo); // contructor
- Person(int socSecNo); // contructor
+ ~Person(); // destructor
- ~Person(); // destructor
+ char* Name();
+ void Print();
- char* Name();
-
- void Print();
-
- int SocSecNo();
-
- int GetUniqueId();
- void setName(char *name);
-
- int getSystemId(){
+ int SocSecNo();
+
+ int GetUniqueId();
+ void setName(char* name);
+
+ int getSystemId() {
return systemId;
}
-
- void setSystemId(int systemId){
+
+ void setSystemId(int systemId) {
this->systemId = systemId;
}
};
@@ -1179,33 +1066,29 @@ getters=name
//@C.cpp
#include "C.h"
-int Person::SocSecNo(){
+int Person::SocSecNo() {
return socSecNo;
}
-int main(int argc, char **argv) {
-
+int main(int argc, char** argv) {
}
//=
#include "C.h"
-char *Person::getName() const
-{
- return name;
+char* Person::getName() const {
+ return name;
}
-void Person::setName(char *name)
-{
- this->name = name;
+void Person::setName(char* name) {
+ this->name = name;
}
-int Person::SocSecNo(){
+int Person::SocSecNo() {
return socSecNo;
}
-int main(int argc, char **argv) {
-
+int main(int argc, char** argv) {
}
//@C.h
@@ -1213,40 +1096,34 @@ int main(int argc, char **argv) {
#define C_H_
class Person {
-
private:
-
- int systemId;
+ int systemId;
protected:
-
- char *name;
+ char* name;
public:
+ const int socSecNo;
- const int socSecNo;
-
- Person myFriend;
+ Person myFriend;
+ Person(int socSecNo); // contructor
- Person(int socSecNo); // contructor
+ ~Person(); // destructor
- ~Person(); // destructor
+ char* Name();
+ void Print();
- char* Name();
-
- void Print();
-
- int /*$*/SocSecNo/*$$*/();
-
- int GetUniqueId();
-
- int getSystemId(){
+ int /*$*/SocSecNo/*$$*/();
+
+ int GetUniqueId();
+
+ int getSystemId() {
return systemId;
}
-
- void setSystemId(int systemId){
+
+ void setSystemId(int systemId) {
this->systemId = systemId;
}
};
@@ -1261,42 +1138,36 @@ int gooo = 1;
#define C_H_
class Person {
-
private:
-
- int systemId;
+ int systemId;
protected:
-
- char *name;
+ char* name;
public:
+ const int socSecNo;
- const int socSecNo;
-
- Person myFriend;
+ Person myFriend;
+ Person(int socSecNo); // contructor
- Person(int socSecNo); // contructor
+ ~Person(); // destructor
- ~Person(); // destructor
+ char* Name();
+ void Print();
- char* Name();
-
- void Print();
-
- int SocSecNo();
-
- int GetUniqueId();
- char *getName() const;
- void setName(char *name);
-
- int getSystemId(){
+ int SocSecNo();
+
+ int GetUniqueId();
+ char* getName() const;
+ void setName(char* name);
+
+ int getSystemId() {
return systemId;
}
-
- void setSystemId(int systemId){
+
+ void setSystemId(int systemId) {
this->systemId = systemId;
}
};
@@ -1319,7 +1190,7 @@ infos=1
class Person {
private:
- int /*$*/id/*$$*/;
+ int /*$*/id/*$$*/;
};
#endif /*C_H_*/
@@ -1330,24 +1201,22 @@ private:
class Person {
private:
- int id;
+ int id;
+
public:
- int getId() const;
- void setId(int id);
+ int getId() const;
+ void setId(int id);
};
-int Person::getId() const
-{
- return id;
+int Person::getId() const {
+ return id;
}
-void Person::setId(int id)
-{
- this->id = id;
+void Person::setId(int id) {
+ this->id = id;
}
-
#endif /*C_H_*/
//!No Methods Implementation in CPP
@@ -1366,8 +1235,7 @@ infos=1
#define TEST_H_
//comment1
-class test
-{
+class test {
int /*$*/i/*$$*/; //comment2
char* b;
//comment3
@@ -1384,28 +1252,25 @@ class test
#define TEST_H_
//comment1
-class test
-{
+class test {
int i; //comment2
char* b;
-public:
- int getI() const;
- void setI(int i);
//comment3
+
+public:
+ int getI() const;
+ void setI(int i);
};
-int test::getI() const
-{
- return i;
+int test::getI() const {
+ return i;
}
-void test::setI(int i)
-{
- this->i = i;
+void test::setI(int i) {
+ this->i = i;
}
-
#endif /* TEST_H_ */
//!Bug 323780 "Generate Getters and Setters..." crashes
@@ -1419,64 +1284,60 @@ setters=testField
#ifndef TEST_H_
#define TEST_H_
-namespace foo
-{
- class Test
- {
- int /*$*/testField/*$$*/;
- void foo();
- };
-}
+namespace foo {
+
+class Test {
+ int /*$*/testField/*$$*/;
+ void foo();
+};
+
+} // namespace foo
#endif
//=
#ifndef TEST_H_
#define TEST_H_
-namespace foo
-{
- class Test
- {
- int testField;
- void foo();
- public:
- int getTestField() const;
- void setTestField(int testField);
- };
-}
+namespace foo {
+
+class Test {
+ int testField;
+ void foo();
+
+public:
+ int getTestField() const;
+ void setTestField(int testField);
+};
+
+} // namespace foo
#endif
//@Test.cpp
#include "Test.h"
-namespace foo
-{
-
- void Test::foo()
- {
-
- }
+namespace foo {
+
+void Test::foo() {
+}
+
}
//=
#include "Test.h"
-namespace foo
-{
- int Test::getTestField() const
- {
- return testField;
- }
-
- void Test::setTestField(int testField)
- {
- this->testField = testField;
- }
-
- void Test::foo()
- {
-
- }
+namespace foo {
+
+int Test::getTestField() const {
+ return testField;
+}
+
+void Test::setTestField(int testField) {
+ this->testField = testField;
+}
+
+void Test::foo() {
+}
+
}
//!Bug 337040 - Insert definition in empty implementation file (.cxx)
@@ -1490,8 +1351,7 @@ setters=testField
#ifndef TEST_H_
#define TEST_H_
-class Test
-{
+class Test {
int /*$*/testField/*$$*/;
};
@@ -1500,12 +1360,12 @@ class Test
#ifndef TEST_H_
#define TEST_H_
-class Test
-{
+class Test {
int testField;
+
public:
- int getTestField() const;
- void setTestField(int testField);
+ int getTestField() const;
+ void setTestField(int testField);
};
#endif
@@ -1513,18 +1373,13 @@ public:
//=
-
-
-int Test::getTestField() const
-{
- return testField;
+int Test::getTestField() const {
+ return testField;
}
-void Test::setTestField(int testField)
-{
- this->testField = testField;
+void Test::setTestField(int testField) {
+ this->testField = testField;
}
-
//!Bug 337040 - Insert definition in empty implementation file in complex directory structure
//#org.eclipse.cdt.ui.tests.refactoring.gettersandsetters.GenerateGettersAndSettersTest
//@.config
@@ -1536,8 +1391,7 @@ setters=testField
#ifndef TEST_H_
#define TEST_H_
-class Test
-{
+class Test {
int /*$*/testField/*$$*/;
};
@@ -1546,12 +1400,12 @@ class Test
#ifndef TEST_H_
#define TEST_H_
-class Test
-{
+class Test {
int testField;
+
public:
- int getTestField() const;
- void setTestField(int testField);
+ int getTestField() const;
+ void setTestField(int testField);
};
#endif
@@ -1559,18 +1413,13 @@ public:
//=
-
-
-int Test::getTestField() const
-{
- return testField;
+int Test::getTestField() const {
+ return testField;
}
-void Test::setTestField(int testField)
-{
- this->testField = testField;
+void Test::setTestField(int testField) {
+ this->testField = testField;
}
-
//@component_a/public_headers/Test.h
//=
diff --git a/core/org.eclipse.cdt.ui.tests/resources/refactoring/HideMethod.rts b/core/org.eclipse.cdt.ui.tests/resources/refactoring/HideMethod.rts
index a7633a3ad2..4184e0be14 100644
--- a/core/org.eclipse.cdt.ui.tests/resources/refactoring/HideMethod.rts
+++ b/core/org.eclipse.cdt.ui.tests/resources/refactoring/HideMethod.rts
@@ -8,11 +8,12 @@ filename=A.h
#include <iostream>
-class A{
+class A {
public:
- A();
- /*$*/void method2();/*$$*/
- std::string toString();
+ A();
+ /*$*/void method2();/*$$*/
+ std::string toString();
+
private:
int i;
};
@@ -25,13 +26,14 @@ private:
#include <iostream>
-class A{
+class A {
public:
- A();
- std::string toString();
+ A();
+ std::string toString();
+
private:
- int i;
- void method2();
+ int i;
+ void method2();
};
#endif /*A_H_*/
@@ -46,14 +48,15 @@ filename=A.h
#include <iostream>
-class A{
+class A {
public:
- A();
- //Kommentar
- /*$*/void method2();/*$$*/
- std::string toString();
+ A();
+ //Comment
+ /*$*/void method2();/*$$*/
+ std::string toString();
+
private:
- int i;
+ int i;
};
#endif /*A_H_*/
@@ -64,14 +67,15 @@ private:
#include <iostream>
-class A{
+class A {
public:
- A();
- std::string toString();
+ A();
+ std::string toString();
+
private:
- int i;
- //Kommentar
- void method2();
+ int i;
+ //Comment
+ void method2();
};
#endif /*A_H_*/
@@ -86,15 +90,15 @@ filename=A.h
#include <iostream>
-class A{
+class A {
public:
- A();
- /*Kommentar*/
- /*$*/void method2();/*$$*/
- std::string toString();
+ A();
+ /*Comment*/
+ /*$*/void method2();/*$$*/
+ std::string toString();
private:
- int i;
+ int i;
};
#endif /*A_H_*/
@@ -105,14 +109,15 @@ private:
#include <iostream>
-class A{
+class A {
public:
- A();
- std::string toString();
+ A();
+ std::string toString();
+
private:
- int i;
- /*Kommentar*/
- void method2();
+ int i;
+ /*Comment*/
+ void method2();
};
#endif /*A_H_*/
@@ -127,13 +132,14 @@ filename=A.h
#include <iostream>
-class A{
+class A {
public:
- A();
- /*$*/void method2();/*$$*///Kommentar
- std::string toString();
+ A();
+ /*$*/void method2();/*$$*///Comment
+ std::string toString();
+
private:
- int i;
+ int i;
};
#endif /*A_H_*/
@@ -144,13 +150,14 @@ private:
#include <iostream>
-class A{
+class A {
public:
- A();
- std::string toString();
+ A();
+ std::string toString();
+
private:
- int i;
- void method2(); //Kommentar
+ int i;
+ void method2(); //Comment
};
#endif /*A_H_*/
@@ -165,13 +172,14 @@ filename=A.h
#include <iostream>
-class A{
+class A {
public:
- A();
- /*$*/void method2();/*$$*//*Kommentar*/
- std::string toString();
+ A();
+ /*$*/void method2();/*$$*//*Comment*/
+ std::string toString();
+
private:
- int i;
+ int i;
};
#endif /*A_H_*/
@@ -182,13 +190,14 @@ private:
#include <iostream>
-class A{
+class A {
public:
- A();
- std::string toString();
+ A();
+ std::string toString();
+
private:
- int i;
- void method2(); /*Kommentar*/
+ int i;
+ void method2(); /*Comment*/
};
#endif /*A_H_*/
@@ -203,15 +212,16 @@ filename=A.h
#include <iostream>
-class A{
+class A {
public:
- A();
-
- //Kommentar
- /*$*/void method2();/*$$*/
- std::string toString();
+ A();
+
+ //Comment
+ /*$*/void method2();/*$$*/
+ std::string toString();
+
private:
- int i;
+ int i;
};
#endif /*A_H_*/
@@ -222,14 +232,15 @@ private:
#include <iostream>
-class A{
+class A {
public:
- A();
- std::string toString();
+ A();
+ std::string toString();
+
private:
- int i;
- //Kommentar
- void method2();
+ int i;
+ //Comment
+ void method2();
};
#endif /*A_H_*/
@@ -244,15 +255,16 @@ filename=A.h
#include <iostream>
-class A{
+class A {
public:
- A();
+ A();
+
+ /*Comment*/
+ /*$*/void method2();/*$$*/
+ std::string toString();
- /*Kommentar*/
- /*$*/void method2();/*$$*/
- std::string toString();
private:
- int i;
+ int i;
};
#endif /*A_H_*/
@@ -263,14 +275,15 @@ private:
#include <iostream>
-class A{
+class A {
public:
- A();
- std::string toString();
+ A();
+ std::string toString();
+
private:
- int i;
- /*Kommentar*/
- void method2();
+ int i;
+ /*Comment*/
+ void method2();
};
#endif /*A_H_*/
@@ -285,13 +298,14 @@ filename=A.h
#include <iostream>
-class A{
+class A {
public:
- A();
- /*$*/void method2();/*$$*///Kommentar
- std::string toString();
+ A();
+ /*$*/void method2();/*$$*///Comment
+ std::string toString();
+
private:
- int i;
+ int i;
};
#endif /*A_H_*/
@@ -302,13 +316,14 @@ private:
#include <iostream>
-class A{
+class A {
public:
- A();
- std::string toString();
+ A();
+ std::string toString();
+
private:
- int i;
- void method2(); //Kommentar
+ int i;
+ void method2(); //Comment
};
#endif /*A_H_*/
@@ -323,14 +338,15 @@ filename=A.h
#include <iostream>
-class A{
+class A {
public:
- A();
- /*$*/void method2();/*$$*//*Kommentar*/
+ A();
+ /*$*/void method2();/*$$*//*Comment*/
+
+ std::string toString();
- std::string toString();
private:
- int i;
+ int i;
};
#endif /*A_H_*/
@@ -340,13 +356,14 @@ private:
#include <iostream>
-class A{
+class A {
public:
- A();
- std::string toString();
+ A();
+ std::string toString();
+
private:
- int i;
- void method2(); /*Kommentar*/
+ int i;
+ void method2(); /*Comment*/
};
#endif /*A_H_*/
@@ -360,16 +377,17 @@ filename=A.h
#include <iostream>
-class A{
+class A {
public:
- A();
- /*
- * Kommentar
- */
- /*$*/void method2();/*$$*/
- std::string toString();
+ A();
+ /*
+ * Comment
+ */
+ /*$*/void method2();/*$$*/
+ std::string toString();
+
private:
- int i;
+ int i;
};
#endif /*A_H_*/
@@ -379,16 +397,17 @@ private:
#include <iostream>
-class A{
+class A {
public:
- A();
- std::string toString();
+ A();
+ std::string toString();
+
private:
- int i;
- /*
- * Kommentar
- */
- void method2();
+ int i;
+ /*
+ * Comment
+ */
+ void method2();
};
#endif /*A_H_*/
@@ -402,15 +421,16 @@ filename=A.h
#include <iostream>
-class A{
+class A {
public:
- A();
+ A();
/*$*/void method2();/*$$*/ /*
- * Kommentar
+ * Comment
*/
- std::string toString();
+ std::string toString();
+
private:
- int i;
+ int i;
};
#endif /*A_H_*/
@@ -421,15 +441,16 @@ private:
#include <iostream>
-class A{
+class A {
public:
- A();
- std::string toString();
+ A();
+ std::string toString();
+
private:
- int i;
- void method2(); /*
- * Kommentar
- */
+ int i;
+ void method2(); /*
+ * Comment
+ */
};
#endif /*A_H_*/
@@ -444,18 +465,19 @@ filename=A.h
#include <iostream>
-class A{
+class A {
public:
- A();
- /*
- * Davor
- */
- /*$*/void method2();/*$$*/ /*
- * Kommentar
+ A();
+ /*
+ * Davor
+ */
+ /*$*/void method2();/*$$*/ /*
+ * Comment
*/
- std::string toString();
+ std::string toString();
+
private:
- int i;
+ int i;
};
#endif /*A_H_*/
@@ -466,18 +488,19 @@ private:
#include <iostream>
-class A{
+class A {
public:
- A();
- std::string toString();
+ A();
+ std::string toString();
+
private:
- int i;
- /*
- * Davor
- */
- void method2(); /*
- * Kommentar
- */
+ int i;
+ /*
+ * Davor
+ */
+ void method2(); /*
+ * Comment
+ */
};
#endif /*A_H_*/
@@ -492,14 +515,15 @@ filename=A.h
#include <iostream>
-class A{
+class A {
public:
- A();
- /*123*/
- /*$*/void method2();/*$$*///TEST
- std::string toString();
+ A();
+ /*123*/
+ /*$*/void method2();/*$$*///TEST
+ std::string toString();
+
private:
- int i;
+ int i;
};
#endif /*A_H_*/
@@ -510,14 +534,15 @@ private:
#include <iostream>
-class A{
+class A {
public:
- A();
- std::string toString();
+ A();
+ std::string toString();
+
private:
- int i;
- /*123*/
- void method2(); //TEST
+ int i;
+ /*123*/
+ void method2(); //TEST
};
#endif /*A_H_*/
@@ -532,14 +557,15 @@ filename=A.h
#include <iostream>
-class A{
+class A {
public:
- A();
- /*123*/
- /*$*/void method2();/*$$*//*TEST*/
- std::string toString();
+ A();
+ /*123*/
+ /*$*/void method2();/*$$*//*TEST*/
+ std::string toString();
+
private:
- int i;
+ int i;
};
#endif /*A_H_*/
@@ -549,14 +575,15 @@ private:
#include <iostream>
-class A{
+class A {
public:
- A();
- std::string toString();
+ A();
+ std::string toString();
+
private:
- int i;
- /*123*/
- void method2(); /*TEST*/
+ int i;
+ /*123*/
+ void method2(); /*TEST*/
};
#endif /*A_H_*/
@@ -571,9 +598,9 @@ errors=1
#include <iostream>
-class A{
+class A {
private:
- /*$*/void method2();/*$$*/
+ /*$*/void method2();/*$$*/
};
#endif /*A_H_*/
@@ -584,9 +611,9 @@ private:
#include <iostream>
-class A{
+class A {
private:
- void method2();
+ void method2();
};
#endif /*A_H_*/
@@ -601,10 +628,10 @@ filename=A.h
#include <iostream>
-class A{
+class A {
public:
- /*$*/void method1();/*$$*/
- void method2();
+ /*$*/void method1();/*$$*/
+ void method2();
};
#endif /*A_H_*/
@@ -615,11 +642,12 @@ public:
#include <iostream>
-class A{
+class A {
public:
- void method2();
+ void method2();
+
private:
- void method1();
+ void method1();
};
#endif /*A_H_*/
@@ -634,9 +662,9 @@ filename=A.h
#include <iostream>
-class A{
+class A {
public:
- /*$*/void method1();/*$$*/void method2();
+ /*$*/void method1();/*$$*/void method2();
};
#endif /*A_H_*/
@@ -647,11 +675,12 @@ public:
#include <iostream>
-class A{
+class A {
public:
- void method2();
+ void method2();
+
private:
- void method1();
+ void method1();
};
#endif /*A_H_*/
@@ -666,11 +695,11 @@ filename=A.h
#include <iostream>
-class A{
+class A {
public:
- //Kommentar
- /*$*/void method1();/*$$*/
- void method2();
+ //Comment
+ /*$*/void method1();/*$$*/
+ void method2();
};
#endif /*A_H_*/
@@ -681,12 +710,13 @@ public:
#include <iostream>
-class A{
+class A {
public:
- void method2();
+ void method2();
+
private:
- //Kommentar
- void method1();
+ //Comment
+ void method1();
};
#endif /*A_H_*/
@@ -701,10 +731,10 @@ filename=A.h
#include <iostream>
-class A{
+class A {
public:
- //Kommentar
- /*$*/void method1();/*$$*/void method2();
+ //Comment
+ /*$*/void method1();/*$$*/void method2();
};
#endif /*A_H_*/
@@ -715,12 +745,13 @@ public:
#include <iostream>
-class A{
+class A {
public:
- void method2();
+ void method2();
+
private:
- //Kommentar
- void method1();
+ //Comment
+ void method1();
};
#endif /*A_H_*/
@@ -733,13 +764,14 @@ private:
#include <iostream>
-class A{
+class A {
public:
- A();
- void method2();
- std::string toString();
+ A();
+ void method2();
+ std::string toString();
+
private:
- int i;
+ int i;
};
#endif /*A_H_*/
@@ -750,13 +782,14 @@ private:
#include <iostream>
-class A{
+class A {
public:
- A();
- std::string toString();
+ A();
+ std::string toString();
+
private:
- int i;
- void method2();
+ int i;
+ void method2();
};
#endif /*A_H_*/
@@ -776,14 +809,15 @@ void A::/*$*/method2/*$$*/()
#include <iostream>
-class A{
+class A {
public:
- A();
- //TEST 1
- void method2(); //TEST 2
- std::string toString();
+ A();
+ //TEST 1
+ void method2(); //TEST 2
+ std::string toString();
+
private:
- int i;
+ int i;
};
#endif /*A_H_*/
@@ -794,14 +828,15 @@ private:
#include <iostream>
-class A{
+class A {
public:
- A();
- std::string toString();
+ A();
+ std::string toString();
+
private:
- int i;
- //TEST 1
- void method2(); //TEST 2
+ int i;
+ //TEST 1
+ void method2(); //TEST 2
};
#endif /*A_H_*/
@@ -823,14 +858,12 @@ filename=HideMethod.h
class HideMethod {
public:
- HideMethod();
- virtual ~HideMethod();
- void /*$*/methode2/*$$*/();
- void methode3()
- {
- methode2();
- }
-
+ HideMethod();
+ virtual ~HideMethod();
+ void /*$*/methode2/*$$*/();
+ void methode3() {
+ methode2();
+ }
};
#endif /* HIDEMETHOD_H_ */
@@ -841,16 +874,14 @@ public:
class HideMethod {
public:
- HideMethod();
- virtual ~HideMethod();
- void methode3()
- {
- methode2();
- }
+ HideMethod();
+ virtual ~HideMethod();
+ void methode3() {
+ methode2();
+ }
private:
- void methode2();
-
+ void methode2();
};
#endif /* HIDEMETHOD_H_ */
@@ -865,10 +896,10 @@ filename=HideMethod.h
class HideMethod {
public:
- HideMethod();
- virtual ~HideMethod();
- void /*$*/methode2/*$$*/();
- void methode3();
+ HideMethod();
+ virtual ~HideMethod();
+ void /*$*/methode2/*$$*/();
+ void methode3();
};
#endif /* HIDEMETHOD_H_ */
@@ -879,11 +910,12 @@ public:
class HideMethod {
public:
- HideMethod();
- virtual ~HideMethod();
- void methode3();
+ HideMethod();
+ virtual ~HideMethod();
+ void methode3();
+
private:
- void methode2();
+ void methode2();
};
#endif /* HIDEMETHOD_H_ */
@@ -947,7 +979,7 @@ public:
class test{
public:
- void call(){
+ void call() {
HideMethod hm;
hm.methode2();
}
@@ -964,13 +996,14 @@ public:
HideMethod();
virtual ~HideMethod();
void methode3();
+
private:
- void methode2();
+ void methode2();
};
class test{
public:
- void call(){
+ void call() {
HideMethod hm;
hm.methode2();
}
@@ -989,10 +1022,10 @@ warnings=1
class HideMethod {
public:
- HideMethod();
- virtual ~HideMethod();
- void /*$*/methode2/*$$*/();
- void methode3();
+ HideMethod();
+ virtual ~HideMethod();
+ void /*$*/methode2/*$$*/();
+ void methode3();
};
#endif /* HIDEMETHOD_H_ */
@@ -1003,11 +1036,12 @@ public:
class HideMethod {
public:
- HideMethod();
- virtual ~HideMethod();
- void methode3();
+ HideMethod();
+ virtual ~HideMethod();
+ void methode3();
+
private:
- void methode2();
+ void methode2();
};
#endif /* HIDEMETHOD_H_ */
@@ -1032,7 +1066,7 @@ void HideMethod::methode3() {
//do nothing
}
-int main(){
+int main() {
HideMethod hm;
hm.methode2();
}
@@ -1058,7 +1092,7 @@ void HideMethod::methode3() {
//do nothing
}
-int main(){
+int main() {
HideMethod hm;
hm.methode2();
}
@@ -1073,10 +1107,10 @@ filename=HideMethod.h
class HideMethod {
public:
- HideMethod();
- virtual ~HideMethod();
- void methode2();
- void methode3();
+ HideMethod();
+ virtual ~HideMethod();
+ void methode2();
+ void methode3();
};
#endif /* HIDEMETHOD_H_ */
@@ -1087,11 +1121,12 @@ public:
class HideMethod {
public:
- HideMethod();
- virtual ~HideMethod();
- void methode3();
+ HideMethod();
+ virtual ~HideMethod();
+ void methode3();
+
private:
- void methode2();
+ void methode2();
};
#endif /* HIDEMETHOD_H_ */
@@ -1146,7 +1181,7 @@ filename=A.h
#include <iostream>
-class A{
+class A {
public:
/*$*/void method2();/*$$*/
};
@@ -1159,7 +1194,7 @@ public:
#include <iostream>
-class A{
+class A {
public:
private:
void method2();
@@ -1178,7 +1213,7 @@ errors=1
#include <iostream>
-class A{
+class A {
/*$*/void method2();/*$$*/
};
@@ -1190,7 +1225,7 @@ class A{
#include <iostream>
-class A{
+class A {
void method2();
};
@@ -1206,7 +1241,7 @@ filename=A.h
#include <iostream>
-struct A{
+struct A {
/*$*/void method2();/*$$*/
};
@@ -1218,7 +1253,7 @@ struct A{
#include <iostream>
-struct A{
+struct A {
private:
void method2();
};
@@ -1230,40 +1265,33 @@ private:
//@.config
filename=A.cpp
//@A.cpp
-struct other
-{
- bool value() {return true;}
+struct other {
+ bool value() { return true; }
};
-class Klass
-{
+class Class {
public:
- void /*$*/set/*$$*/(bool b){}
- void test()
- {
- other o;
- this->set(o.value());
+ void /*$*/set/*$$*/(bool b) {}
+ void test() {
+ other o;
+ this->set(o.value());
}
};
//=
-struct other
-{
- bool value() {return true;}
+struct other {
+ bool value() { return true; }
};
-class Klass
-{
+class Class {
public:
- void test()
- {
- other o;
- this->set(o.value());
- }
+ void test() {
+ other o;
+ this->set(o.value());
+ }
private:
- void set(bool b)
- {
+ void set(bool b) {
}
};
@@ -1272,40 +1300,35 @@ private:
//@.config
filename=A.cpp
//@A.cpp
-struct other
-{
- bool value() {return true;}
+struct other {
+ bool value() { return true; }
};
-class Klass
-{
+class Class {
public:
- void set(bool b){}
- void test()
- {
- other o;
- this->/*$*/set/*$$*/(o.value());
+ void set(bool b) {
+ }
+
+ void test() {
+ other o;
+ this->/*$*/set/*$$*/(o.value());
}
};
//=
-struct other
-{
- bool value() {return true;}
+struct other {
+ bool value() { return true; }
};
-class Klass
-{
+class Class {
public:
- void test()
- {
- other o;
- this->set(o.value());
- }
+ void test() {
+ other o;
+ this->set(o.value());
+ }
private:
- void set(bool b)
- {
+ void set(bool b) {
}
};
@@ -1315,37 +1338,31 @@ private:
filename=A.cpp
warnings=1
//@A.cpp
-struct other
-{
- bool /*$*/value/*$$*/() {return true;}
+struct other {
+ bool /*$*/value/*$$*/() { return true; }
};
-class Klass
-{
+class Class {
public:
- void set(bool b){}
- void test()
- {
- other o;
- this->set(o.value());
+ void set(bool b) {}
+ void test() {
+ other o;
+ this->set(o.value());
}
};
//=
-struct other
-{
+struct other {
private:
- bool value() {return true;}
+ bool value() { return true; }
};
-class Klass
-{
+class Class {
public:
- void set(bool b){}
- void test()
- {
- other o;
- this->set(o.value());
+ void set(bool b) {}
+ void test() {
+ other o;
+ this->set(o.value());
}
};
@@ -1354,38 +1371,36 @@ public:
//@.config
filename=A.cpp
//@A.cpp
-struct other
-{
- bool value() {return true;}
+struct other {
+ bool value() { return true; }
};
-class Klass
-{
+class Class {
public:
- void set(bool b){}
- void /*$*/test/*$$*/()
- {
- other o;
- this->set(o.value());
+ void set(bool b) {
+ }
+
+ void /*$*/test/*$$*/() {
+ other o;
+ this->set(o.value());
}
};
//=
-struct other
-{
- bool value() {return true;}
+struct other {
+ bool value() { return true; }
};
-class Klass
-{
+class Class {
public:
- void set(bool b){}
+ void set(bool b) {
+ }
private:
- void test()
- {
- other o;
- this->set(o.value());
+
+ void test() {
+ other o;
+ this->set(o.value());
}
};
@@ -1395,14 +1410,14 @@ private:
filename=A.cpp
fatalerrors=1
//@A.cpp
-int /*$*/main/*$$*/(){
+int /*$*/main/*$$*/() {
int i = 2;
i++;
return 0;
}
//=
-int main(){
+int main() {
int i = 2;
i++;
return 0;
@@ -1413,22 +1428,20 @@ int main(){
//@.config
filename=A.h
//@A.h
-class Klass
-{
+class Class {
public:
- void /*$*/to_move()/*$$*/;
+ void /*$*/to_move()/*$$*/;
private:
- void just_private();
+ void just_private();
};
//=
-class Klass
-{
+class Class {
public:
private:
- void just_private();
- void to_move();
+ void just_private();
+ void to_move();
};
//!HideMethod several private sections
@@ -1436,23 +1449,23 @@ private:
//@.config
filename=A.h
//@A.h
-class Klass
-{
+class Class {
public:
- void /*$*/to_move()/*$$*/;
+ void /*$*/to_move()/*$$*/;
private:
- void just_private();
+ void just_private();
+
private:
};
//=
-class Klass
-{
+class Class {
public:
private:
- void just_private();
- void to_move();
+ void just_private();
+ void to_move();
+
private:
};
diff --git a/core/org.eclipse.cdt.ui.tests/resources/refactoring/HideMethodHistory.rts b/core/org.eclipse.cdt.ui.tests/resources/refactoring/HideMethodHistory.rts
index 70f04a80d9..de72504e59 100644
--- a/core/org.eclipse.cdt.ui.tests/resources/refactoring/HideMethodHistory.rts
+++ b/core/org.eclipse.cdt.ui.tests/resources/refactoring/HideMethodHistory.rts
@@ -6,11 +6,12 @@
#include <iostream>
-class A{
+class A {
public:
- A();
- void method2();
- std::string toString();
+ A();
+ void method2();
+ std::string toString();
+
private:
int i;
};
@@ -23,13 +24,14 @@ private:
#include <iostream>
-class A{
+class A {
public:
- A();
- std::string toString();
+ A();
+ std::string toString();
+
private:
- int i;
- void method2();
+ int i;
+ void method2();
};
#endif /*A_H_*/
@@ -40,5 +42,5 @@ private:
<refactoring comment="Hide Method method2" description="Hide Method Refactoring"
fileName="file:$$projectPath$$/A.h" flags="2"
id="org.eclipse.cdt.internal.ui.refactoring.hidemethod.HideMethodRefactoring"
- project="RegressionTestProject" selection="83,7"/>
+ project="RegressionTestProject" selection="78,7"/>
</session>
diff --git a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ImplementMethod.rts b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ImplementMethod.rts
index 7fc4d475cc..6c7a13181c 100644
--- a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ImplementMethod.rts
+++ b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ImplementMethod.rts
@@ -15,12 +15,10 @@ public:
bool a(int = 100) const;
};
-inline bool X::a(int int1) const
-{
+inline bool X::a(int int1) const {
}
-
//!Param const and reference and pointer two params
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
//@.config
@@ -38,37 +36,34 @@ public:
bool xy(int, int i) const;
};
-inline bool X::xy(int int1, int i) const
-{
+inline bool X::xy(int int1, int i) const {
}
-
//!Test if TemplateMethod stays in header
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
//@.config
filename=A.h
infos=1
//@A.h
-template<class T> class A
-{
+template<class T>
+class A {
public:
- /*$*/void test();/*$$*/
+ /*$*/void test();/*$$*/
};
//=
-template<class T> class A
-{
+template<class T>
+class A {
public:
- void test();
+ void test();
};
-template<class T> inline void A<T>::test()
-{
+template<class T>
+inline void A<T>::test() {
}
-
//@A.cpp
#include "A.h"
@@ -81,45 +76,42 @@ template<class T> inline void A<T>::test()
filename=A.h
infos=1
//@A.h
-template<class T> class A
-{
+template<class T>
+class A {
public:
- A();
- /*$*/void test();/*$$*/
+ A();
+ /*$*/void test();/*$$*/
};
-template<class T> A<T>::A()
-{
+template<class T>
+A<T>::A() {
}
//=
-template<class T> class A
-{
+template<class T>
+class A {
public:
- A();
- void test();
+ A();
+ void test();
};
-template<class T> A<T>::A()
-{
+template<class T>
+A<T>::A() {
}
-template<class T> inline void A<T>::test()
-{
+template<class T>
+inline void A<T>::test() {
}
-
//!member class
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
//@.config
filename=A.h
//@A.h
-class Demo
-{
- class SubClass
- {
+class Demo {
+ class SubClass {
/*$*/void test();/*$$*/
};
};
@@ -131,102 +123,88 @@ class Demo
//=
#include "A.h"
-
-
-void Demo::SubClass::test()
-{
+void Demo::SubClass::test() {
}
-
-//!method declared in otherwise empty class without cpp file
+//!Method declared in otherwise empty class without cpp file
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
//@.config
filename=A.h
infos=1
//@A.h
-class A
-{
+class A {
public:
- /*$*/void test();/*$$*/
+ /*$*/void test();/*$$*/
};
//=
-class A
-{
+class A {
public:
- void test();
+ void test();
};
-inline void A::test()
-{
+inline void A::test() {
}
-
-//!method declared in otherwise empty class
+//!Method declared in otherwise empty class
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
//@.config
filename=A.h
//@A.h
-class A
-{
+class A {
public:
- /*$*/void test();/*$$*/
+ /*$*/void test();/*$$*/
};
//=
-class A
-{
+class A {
public:
- void test();
+ void test();
};
//@A.cpp
//=
-
-
-void A::test()
-{
+void A::test() {
}
-
-//!implement in existing namespace
+//!Implement in existing namespace
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
//@.config
filename=A.h
//@A.h
-namespace NameSpace
-{
- class ClassInNamespace
- {
- public:
- int test();
- /*$*/void test2();/*$$*/
- };
+namespace Namespace {
+
+class ClassInNamespace {
+public:
+ int test();
+ /*$*/void test2();/*$$*/
+};
+
}
//@A.cpp
#include "A.h"
-namespace NameSpace
-{
- int ClassInNamespace::test()
- {
- return 5;
- }
+namespace Namespace {
+
+int ClassInNamespace::test() {
+ return 5;
+}
+
}
//=
#include "A.h"
-namespace NameSpace
-{
- int ClassInNamespace::test()
- {
- return 5;
- }
+namespace Namespace {
+
+int ClassInNamespace::test() {
+ return 5;
+}
+
+void ClassInNamespace::test2() {
+}
- void ClassInNamespace::test2()
- {}
}
//!virtual method in the middle of con/destructor, without parameters and void return value
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
@@ -236,8 +214,7 @@ filename=A.h
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
/*$*/virtual void foo();/*$$*/
@@ -248,30 +225,25 @@ public:
//@A.cpp
#include "A.h"
-A::A()
-{
+A::A() {
}
-A::~A()
-{
+A::~A() {
}
//=
#include "A.h"
-A::A()
-{
+A::A() {
}
-void A::foo()
-{
+void A::foo() {
}
-A::~A()
-{
+A::~A() {
}
-//!implement a function at start of source file
+//!Implement a function at start of source file
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
//@.config
filename=A.h
@@ -279,18 +251,15 @@ filename=A.h
/*$*/void function();/*$$*/
void function_with_impl();
//@A.cpp
-void function_with_impl()
-{
+void function_with_impl() {
}
//=
-void function()
-{
+void function() {
}
-void function_with_impl()
-{
+void function_with_impl() {
}
-//!method at end, without parameters and void return value
+//!Method at end, without parameters and void return value
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
//@.config
filename=A.h
@@ -298,8 +267,7 @@ filename=A.h
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
/*$*/void foo();/*$$*/
@@ -309,24 +277,20 @@ public:
//@A.cpp
#include "A.h"
-A::A()
-{
+A::A() {
}
//=
#include "A.h"
-A::A()
-{
+A::A() {
}
-void A::foo()
-{
+void A::foo() {
}
-
-//!method at beginning, without parameters, void return value and const
+//!Method at beginning, without parameters, void return value and const
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
//@.config
filename=A.h
@@ -334,8 +298,7 @@ filename=A.h
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
/*$*/void foo() const;/*$$*/
A();
@@ -345,22 +308,19 @@ public:
//@A.cpp
#include "A.h"
-A::A()
-{
+A::A() {
}
//=
#include "A.h"
-void A::foo() const
-{
+void A::foo() const {
}
-A::A()
-{
+A::A() {
}
-//!method with int return value
+//!Method with int return value
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
//@.config
filename=A.h
@@ -368,8 +328,7 @@ filename=A.h
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
/*$*/int foo();/*$$*/
@@ -379,24 +338,20 @@ public:
//@A.cpp
#include "A.h"
-A::A()
-{
+A::A() {
}
//=
#include "A.h"
-A::A()
-{
+A::A() {
}
-int A::foo()
-{
+int A::foo() {
}
-
-//!method with two int parameters
+//!Method with two int parameters
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
//@.config
filename=A.h
@@ -404,8 +359,7 @@ filename=A.h
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
/*$*/int foo(int param1, int param2);/*$$*/
@@ -415,59 +369,49 @@ public:
//@A.cpp
#include "A.h"
-A::A()
-{
+A::A() {
}
//=
#include "A.h"
-A::A()
-{
+A::A() {
}
-int A::foo(int param1, int param2)
-{
+int A::foo(int param1, int param2) {
}
-
-//!method defined in header
+//!Method defined in header
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
//@.config
filename=A.h
infos=1
//@A.h
-class A
-{
+class A {
public:
- A();
- /*$*/void test();/*$$*/
+ A();
+ /*$*/void test();/*$$*/
};
-A::A()
-{
+A::A() {
}
//=
-class A
-{
+class A {
public:
- A();
- void test();
+ A();
+ void test();
};
-A::A()
-{
+A::A() {
}
-inline void A::test()
-{
+inline void A::test() {
}
-
-//!implement a function at end of source file
+//!Implement a function at end of source file
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
//@.config
filename=A.h
@@ -475,113 +419,111 @@ filename=A.h
void function_with_impl();
/*$*/void function();/*$$*/
//@A.cpp
-void function_with_impl()
-{
+void function_with_impl() {
}
//=
-void function_with_impl()
-{
+void function_with_impl() {
}
-void function()
-{
+void function() {
}
-
-//!implement with namespace
+//!Implement with namespace
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
//@.config
filename=A.h
//@A.h
-namespace NameSpace
-{
- class ClassInNamespace
- {
- public:
- int other_test();
- /*$*/void test();/*$$*/
- };
+namespace Namespace {
+
+class ClassInNamespace {
+public:
+ int other_test();
+ /*$*/void test();/*$$*/
+};
+
}
//@A.cpp
#include "A.h"
-void NameSpace::ClassInNamespace::other_test()
-{
+void Namespace::ClassInNamespace::other_test() {
}
//=
#include "A.h"
-void NameSpace::ClassInNamespace::other_test()
-{
+void Namespace::ClassInNamespace::other_test() {
}
-void NameSpace::ClassInNamespace::test()
-{
+void Namespace::ClassInNamespace::test() {
}
-
-//!implement function within namespace
+//!Implement function within namespace
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
//@.config
filename=A.h
//@A.h
namespace OuterSpace {
- namespace NameSpace
- {
- int test();
- /*$*/int test2();/*$$*/
- }
+namespace Namespace {
+
+int test();
+/*$*/int test2();/*$$*/
+
+}
}
//@A.cpp
#include "A.h"
namespace OuterSpace {
- int NameSpace::test()
- {
- }
+
+int Namespace::test() {
+}
+
}
//=
#include "A.h"
namespace OuterSpace {
- int NameSpace::test()
- {
- }
- int NameSpace::test2()
- {}
+int Namespace::test() {
+}
+
+int Namespace::test2() {
+}
+
}
-//!implement function within namespaces
+//!Implement function within namespaces
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
//@.config
filename=A.h
//@A.h
namespace OuterSpace {
- namespace NameSpace
- {
- int test();
- /*$*/int test2();/*$$*/
- }
+namespace Namespace {
+
+int test();
+/*$*/int test2();/*$$*/
+
+}
}
//@A.cpp
#include "A.h"
namespace OuterSpace {
- namespace NameSpace {
- int test()
- {
- }
- }
+namespace Namespace {
+
+int test() {
+}
+
+}
}
//=
#include "A.h"
namespace OuterSpace {
- namespace NameSpace {
- int test()
- {
- }
+namespace Namespace {
+
+int test() {
+}
- int test2()
- {}
- }
+int test2() {
+}
+
+}
}
//!class template member functions with multiple templates
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
@@ -589,43 +531,41 @@ namespace OuterSpace {
filename=A.h
infos=1
//@A.h
-template<class T, class U> class A
-{
+template<class T, class U>
+class A {
public:
- A();
- /*$*/void test();/*$$*/
+ A();
+ /*$*/void test();/*$$*/
};
-template<class T, class U> A<T,U>::A()
-{
+template<class T, class U>
+A<T,U>::A() {
}
//=
-template<class T, class U> class A
-{
+template<class T, class U>
+class A {
public:
- A();
- void test();
+ A();
+ void test();
};
-template<class T, class U> A<T,U>::A()
-{
+template<class T, class U>
+A<T,U>::A() {
}
-template<class T, class U> inline void A<T,U>::test()
-{
+template<class T, class U>
+inline void A<T, U>::test() {
}
-
//!with default parameters
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
//@.config
filename=A.h
//@A.h
-class Class
-{
+class Class {
public:
/*$*/void test(int param1, int param2 = 5, int param3 = 10);/*$$*/
};
@@ -637,20 +577,15 @@ public:
//=
#include "A.h"
-
-
-void Class::test(int param1, int param2, int param3)
-{
+void Class::test(int param1, int param2, int param3) {
}
-
//!static method
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
//@.config
filename=A.h
//@A.h
-class Class
-{
+class Class {
public:
/*$*/static void test();/*$$*/
};
@@ -662,12 +597,8 @@ public:
//=
#include "A.h"
-
-
-void Class::test()
-{
+void Class::test() {
}
-
//! Bug 238253 Pointer refence of the return value lost
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
//@.config
@@ -686,21 +617,16 @@ public:
//=
#include "A.h"
-
-
-int *TestClass::get(char *val)
-{
+int* TestClass::get(char* val) {
}
-
//! Bug 238554 void parameters
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
//@.config
filename=A.h
//@A.h
-class Test
-{
- public:
+class Test {
+public:
/*$*/void doNothing(void);/*$$*/
};
@@ -711,12 +637,8 @@ class Test
//=
#include "A.h"
-
-
-void Test::doNothing(void)
-{
+void Test::doNothing(void) {
}
-
//! Bug 282989 Refactor->Implement method option doesn't qualify the name in the method definition with a fully qualified container class name
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
//@.config
@@ -726,10 +648,12 @@ infos=1
#ifndef TESTCLASS_H_
#define TESTCLASS_H_
-namespace nspace{
+namespace nspace {
+
class TestClass {
-void /*$*/testMethod()/*$$*/;
+ void /*$*/testMethod()/*$$*/;
};
+
}
#endif /* TESTCLASS_H_ */
@@ -738,16 +662,16 @@ void /*$*/testMethod()/*$$*/;
#ifndef TESTCLASS_H_
#define TESTCLASS_H_
-namespace nspace{
+namespace nspace {
+
class TestClass {
-void testMethod();
+ void testMethod();
};
-}
-inline void nspace::TestClass::testMethod()
-{
}
+inline void nspace::TestClass::testMethod() {
+}
#endif /* TESTCLASS_H_ */
@@ -768,6 +692,7 @@ public:
A();
~A();
void testmethod(int x);
+
protected:
class B {
public:
@@ -810,12 +735,10 @@ A::~A() {
}
}
-void n1::n2::A::B::testmethod2()
-{
+void n1::n2::A::B::testmethod2() {
}
-
//!Bug 337040 - Insert definition in empty implementation file (.cxx)
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
//@.config
@@ -832,12 +755,8 @@ public:
//=
-
-
-void TestClass::foo()
-{
+void TestClass::foo() {
}
-
//!Bug 355006 - NPE implementing template function
//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest
//@.config
@@ -845,15 +764,14 @@ filename=A.h
infos=1
//@A.h
-/*$*/template<typename T> void func(T&);/*$$*/
-
+/*$*/template<typename T>
+void func(T&);/*$$*/
//=
-template<typename T> void func(T&);
+template<typename T>
+void func(T&);
-template<typename T> inline void func(T& )
-{
+template<typename T>
+inline void func(T&) {
}
-
-
diff --git a/core/org.eclipse.cdt.ui.tests/resources/refactoring/NewCreationTest.rts b/core/org.eclipse.cdt.ui.tests/resources/refactoring/NewCreationTest.rts
index 998e7a844d..61c750b2d6 100644
--- a/core/org.eclipse.cdt.ui.tests/resources/refactoring/NewCreationTest.rts
+++ b/core/org.eclipse.cdt.ui.tests/resources/refactoring/NewCreationTest.rts
@@ -6,7 +6,7 @@ newfilecreation=true
newfiles=A.cpp
//@A.h
void /*$*/freefunction/*$$*/() {
- return;
+ return;
}
//=
void freefunction();
@@ -17,9 +17,8 @@ void freefunction();
#include "A.h"
-void freefunction()
-{
- return;
+void freefunction() {
+ return;
}
//!FreefunctionFromImplToHeader
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
@@ -28,9 +27,8 @@ filename=A.cpp
newfilecreation=true
newfiles=A.h
//@A.cpp
-void /*$*/freefunction/*$$*/()
-{
- return;
+void /*$*/freefunction/*$$*/() {
+ return;
}
//=
#include "A.h"
@@ -40,8 +38,7 @@ void /*$*/freefunction/*$$*/()
//=
-void freefunction()
-{
- return;
+void freefunction() {
+ return;
}
diff --git a/core/org.eclipse.cdt.ui.tests/resources/refactoring/NewImplementRefactoring.rts b/core/org.eclipse.cdt.ui.tests/resources/refactoring/NewImplementRefactoring.rts
index 1b8b79b102..95e338f8e9 100644
--- a/core/org.eclipse.cdt.ui.tests/resources/refactoring/NewImplementRefactoring.rts
+++ b/core/org.eclipse.cdt.ui.tests/resources/refactoring/NewImplementRefactoring.rts
@@ -7,16 +7,14 @@ filename=A.h
using namespace std;
class A {
- int /*$*/member/*$$*/();
+ int /*$*/member/*$$*/();
};
//=
#include<iostream>
using namespace std;
class A {
- int member()
- {
- return int();
- }
-
+ int member() {
+ return int();
+ }
}; \ No newline at end of file
diff --git a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleCommentsClassToHeader.rts b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleCommentsClassToHeader.rts
index 6f9e5856cc..61351a117f 100644
--- a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleCommentsClassToHeader.rts
+++ b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleCommentsClassToHeader.rts
@@ -4,208 +4,190 @@
filename=A.h
//@A.h
class A {
- void /*$*/member/*$$*/()
- {
- // return comment
- return;
- }
+ void /*$*/member/*$$*/() {
+ // return comment
+ return;
+ }
};
//=
class A {
- void member();
+ void member();
};
-inline void A::member()
-{
- // return comment
- return;
+inline void A::member() {
+ // return comment
+ return;
}
-
//!ClassToHeaderTopCommentOrder
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
//@.config
filename=A.h
//@A.h
class A {
- // First Top Comment
- // Second Top Comment
- void /*$*/member/*$$*/()
- {
- return;
- }
+ // First Top Comment
+ // Second Top Comment
+ void /*$*/member/*$$*/() {
+ return;
+ }
};
//=
class A {
- // First Top Comment
- // Second Top Comment
- void member();
+ // First Top Comment
+ // Second Top Comment
+ void member();
};
-inline void A::member()
-{
- return;
+inline void A::member() {
+ return;
}
-
//!ClassToHeaderCatchComment
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
//@.config
filename=A.h
//@A.h
class A {
- void /*$*/member/*$$*/() try
- {
- return;
- } catch (int i) {
- // catch comment
- }
+ void /*$*/member/*$$*/() try
+ {
+ return;
+ }
+ catch (int i) {
+ // catch comment
+ }
};
//=
class A {
- void member();
+ void member();
};
inline void A::member()
-try
-{
- return;
+try {
+ return;
}
-catch(int i){
- // catch comment
+catch (int i) {
+ // catch comment
}
-
//!ClassToHeaderTopComment
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
//@.config
filename=A.h
//@A.h
class A {
- // Top comment
- void /*$*/member/*$$*/()
- {
- return;
- }
+ // Top comment
+ void /*$*/member/*$$*/() {
+ return;
+ }
};
//=
class A {
- // Top comment
- void member();
+ // Top comment
+ void member();
};
-inline void A::member()
-{
- return;
+inline void A::member() {
+ return;
}
-
//!ClassToHeaderTemplateTopComment
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
//@.config
filename=A.h
//@A.h
class A {
- // Top comment
- template<typename T>
- T /*$*/member/*$$*/()
- {
- return T();
- }
+ // Top comment
+ template<typename T>
+ T /*$*/member/*$$*/() {
+ return T();
+ }
};
//=
class A {
- // Top comment
- template<typename T>
- T member();
+ // Top comment
+ template<typename T>
+ T member();
};
// Top comment
-template<typename T> inline T A::member()
-{
- return T();
+template<typename T>
+inline T A::member() {
+ return T();
}
-
//!ClassToHeaderTrailingComment
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
//@.config
filename=A.h
//@A.h
class A {
- void /*$*/member/*$$*/()
- {
- return;
- } // Trailing comment
+ void /*$*/member/*$$*/() {
+ return;
+ } // Trailing comment
};
//=
class A {
- void member();
+ void member();
};
-inline void A::member()
-{
- return;
+inline void A::member() {
+ return;
} // Trailing comment
-
//!ClassToHeaderTrailingCommentWithTryBlock
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
//@.config
filename=A.h
//@A.h
class A {
- void /*$*/member/*$$*/() try
- {
- return;
- } catch (int e) {
- } // Trailing comment
+ void /*$*/member/*$$*/()
+ try {
+ return;
+ }
+ catch (int e) {
+ } // Trailing comment
};
//=
class A {
- void member();
+ void member();
};
inline void A::member()
-try
-{
- return;
+try {
+ return;
}
-catch(int e){
+catch (int e) {
}
- // Trailing comment
-
+// Trailing comment
//!ClassToHeaderTrailingMultipleCommentsInTryBlock
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
//@.config
filename=A.h
//@A.h
class A {
- int /*$*/member/*$$*/() try
- {
- // aans
- } /* one */ catch (int i) {
- // zwaa
- } /* two */ catch (int j) {
- // draa
- } /* three */
+ int /*$*/member/*$$*/()
+ try {
+ // aans
+ } /* one */ catch (int i) {
+ // zwaa
+ } /* two */ catch (int j) {
+ // draa
+ } /* three */
};
//=
class A {
- int member();
+ int member();
};
inline int A::member()
-try
-{
- // aans
+try {
+ // aans
} /* one */
-catch(int i){
- // zwaa
+catch (int i) {
+ // zwaa
}
- /* two */catch(int j){
- // draa
+/* two */catch (int j) {
+ // draa
}
- /* three */
-
+/* three */
diff --git a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleCommentsHeaderToClass.rts b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleCommentsHeaderToClass.rts
index e3c4166f07..61c768a4c0 100644
--- a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleCommentsHeaderToClass.rts
+++ b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleCommentsHeaderToClass.rts
@@ -5,21 +5,21 @@ filename=A.h
//@A.h
template<typename T>
class A {
- T /*$*/member/*$$*/();
+ T /*$*/member/*$$*/();
};
-template<typename T> inline T A<T>::member() {
- // body comment
- return T();
+template<typename T>
+inline T A<T>::member() {
+ // body comment
+ return T();
}
//=
template<typename T>
class A {
- T member()
- {
- // body comment
- return T();
- }
+ T member() {
+ // body comment
+ return T();
+ }
};
@@ -32,27 +32,25 @@ template<typename T>
class A {
// First comment
// Second comment
- T /*$*/member/*$$*/();
+ T /*$*/member/*$$*/();
};
// Third comment
// Fourth comment
template<typename T>
-inline T A<T>::member()
-{
- return T();
+inline T A<T>::member() {
+ return T();
}
//=
template<typename T>
class A {
// Third comment
- // Fourth comment
- // First comment
- // Second comment
- T member()
- {
- return T();
- }
+ // Fourth comment
+ // First comment
+ // Second comment
+ T member() {
+ return T();
+ }
};
@@ -65,32 +63,35 @@ filename=A.h
//@A.h
template<typename T>
class A {
- T /*$*/member/*$$*/();
+ T /*$*/member/*$$*/();
};
-template<typename T> inline T A<T>::member() try {
- // body comment
- return T();
-} catch(int e) {
- // Catch 1
-} catch(int e) {
- // Catch 2
+template<typename T>
+inline T A<T>::member()
+try {
+ // body comment
+ return T();
+}
+catch (int e) {
+ // Catch 1
+}
+catch (int e) {
+ // Catch 2
}
//=
template<typename T>
class A {
- T member()
- try
- {
- // body comment
- return T();
- }
- catch(int e){
- // Catch 1
- }
- catch(int e){
- // Catch 2
- }
+ T member()
+ try {
+ // body comment
+ return T();
+ }
+ catch (int e) {
+ // Catch 1
+ }
+ catch (int e) {
+ // Catch 2
+ }
};
@@ -101,29 +102,27 @@ filename=A.h
//@A.h
template<typename S, typename T>
class A {
- // Top Comment
- template<typename U, typename V>
- T /*$*/member/*$$*/();
+ // Top Comment
+ template<typename U, typename V>
+ T /*$*/member/*$$*/();
};
// 2nd Top Comment
template<typename S, typename T>
template<typename U, typename V>
inline T A<S, T>::member() {
- // body comment
- return T();
+ // body comment
+ return T();
}
//=
template<typename S, typename T>
class A {
- // Top Comment
- template<typename U, typename V>
- T member()
- {
- // body comment
- return T();
- }
-
+ // Top Comment
+ template<typename U, typename V>
+ T member() {
+ // body comment
+ return T();
+ }
};
@@ -136,21 +135,21 @@ filename=A.h
//@A.h
template<typename T>
class A {
- T /*$*/member/*$$*/();
+ T /*$*/member/*$$*/();
};
// Top comment
-template<typename T> inline T A<T>::member() {
- return T();
+template<typename T>
+inline T A<T>::member() {
+ return T();
}
//=
template<typename T>
class A {
- // Top comment
- T member()
- {
- return T();
- }
+ // Top comment
+ T member() {
+ return T();
+ }
};
diff --git a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleCommentsHeaderToImpl.rts b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleCommentsHeaderToImpl.rts
index a5c548880a..7ac828d6e9 100644
--- a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleCommentsHeaderToImpl.rts
+++ b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleCommentsHeaderToImpl.rts
@@ -4,16 +4,16 @@
filename=A.h
//@A.h
class A {
- void /*$*/member/*$$*/();
+ void /*$*/member/*$$*/();
};
inline void A::member() {
- // body comment
- return;
+ // body comment
+ return;
}
//=
class A {
- void member();
+ void member();
};
@@ -22,30 +22,27 @@ class A {
//=
#include "A.h"
-
-void A::member()
-{
- // body comment
- return;
+void A::member() {
+ // body comment
+ return;
}
-
//!HeaderToImplTryCatchComment
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
//@.config
filename=A.h
//@A.h
class A {
- void /*$*/member/*$$*/();
+ void /*$*/member/*$$*/();
};
inline void A::member() try {
- // body comment
- return;
+ // body comment
+ return;
} catch /*1*/ (int e) { /*2*/ }
catch /*3*/ (int e) { /*4*/ }
//=
class A {
- void member();
+ void member();
};
@@ -54,37 +51,34 @@ class A {
//=
#include "A.h"
-
void A::member()
-try
-{
- // body comment
- return;
+try {
+ // body comment
+ return;
}
-catch(/*1*/int e){
- /*2*/
+catch (/*1*/int e) {
+ /*2*/
}
-catch(/*3*/int e){
- /*4*/
+catch (/*3*/int e) {
+ /*4*/
}
-
//!HeaderToImplTopComment
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
//@.config
filename=A.h
//@A.h
class A {
- void /*$*/member/*$$*/();
+ void /*$*/member/*$$*/();
};
// Top comment
inline void A::member() {
- // body comment
- return;
+ // body comment
+ return;
}
//=
class A {
- void member();
+ void member();
};
@@ -94,14 +88,11 @@ class A {
//=
#include "A.h"
-
// Top comment
-void A::member()
-{
- // body comment
- return;
+void A::member() {
+ // body comment
+ return;
}
-
//!HeaderToImplFreeFuncTopComment
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
//@.config
@@ -109,7 +100,7 @@ filename=A.h
//@A.h
// Definition comment
void /*$*/member/*$$*/() {
- return;
+ return;
}
//=
// Definition comment
@@ -121,11 +112,7 @@ void member();
//=
#include "A.h"
-
-
// Definition comment
-void member()
-{
- return;
+void member() {
+ return;
}
-
diff --git a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleCommentsImplToHeader.rts b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleCommentsImplToHeader.rts
index 46e3366650..62f1a398f6 100644
--- a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleCommentsImplToHeader.rts
+++ b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleCommentsImplToHeader.rts
@@ -5,10 +5,9 @@ filename=A.cpp
//@A.cpp
#include "A.h"
-void A::/*$*/member/*$$*/()
-{
- // body comment
- return;
+void A::/*$*/member/*$$*/() {
+ // body comment
+ return;
}
//=
#include "A.h"
@@ -16,15 +15,14 @@ void A::/*$*/member/*$$*/()
//@A.h
class A {
- void member();
+ void member();
};
//=
class A {
- void member()
- {
- // body comment
- return;
- }
+ void member() {
+ // body comment
+ return;
+ }
};
//!ImplToHeaderTopComment
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
@@ -34,9 +32,8 @@ filename=A.cpp
#include "A.h"
// Definition comment
-void A::/*$*/member/*$$*/()
-{
- return;
+void A::/*$*/member/*$$*/() {
+ return;
}
//=
#include "A.h"
@@ -45,15 +42,14 @@ void A::/*$*/member/*$$*/()
//@A.h
class A {
- void member();
+ void member();
};
//=
class A {
- // Definition comment
- void member()
- {
- return;
- }
+ // Definition comment
+ void member() {
+ return;
+ }
};
//!ImplToHeaderTryCatchComment
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
@@ -63,9 +59,8 @@ filename=A.cpp
#include "A.h"
// Definition comment
-void A::/*$*/member/*$$*/() try
-{
- return;
+void A::/*$*/member/*$$*/() try {
+ return;
} /*1*/ catch (int e) { /*2*/ } /*3*/ catch (int e) { /*4*/ }
//=
#include "A.h"
@@ -74,22 +69,21 @@ void A::/*$*/member/*$$*/() try
//@A.h
class A {
- void member();
+ void member();
};
//=
class A {
- // Definition comment
- void member()
- try
- {
- return;
- } /*1*/
- catch(int e){
- /*2*/
- }
- /*3*/catch(int e){
- /*4*/
- }
+ // Definition comment
+ void member()
+ try {
+ return;
+ } /*1*/
+ catch (int e) {
+ /*2*/
+ }
+ /*3*/catch (int e) {
+ /*4*/
+ }
};
//!ImplToHeaderBodyCommentWithoutDeclaration
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
@@ -98,10 +92,9 @@ filename=A.cpp
//@A.cpp
#include "A.h"
-void /*$*/member/*$$*/()
-{
- // body comment
- return;
+void /*$*/member/*$$*/() {
+ // body comment
+ return;
}
//=
#include "A.h"
@@ -111,14 +104,10 @@ void /*$*/member/*$$*/()
//=
-
-
-void member()
-{
- // body comment
- return;
+void member() {
+ // body comment
+ return;
}
-
//!ImplToHeaderTopCommentWithoutDeclaration
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
//@.config
@@ -127,10 +116,9 @@ filename=A.cpp
#include "A.h"
// Top comment
-void /*$*/member/*$$*/()
-{
- // body comment
- return;
+void /*$*/member/*$$*/() {
+ // body comment
+ return;
}
//=
#include "A.h"
@@ -141,12 +129,8 @@ void /*$*/member/*$$*/()
//=
-
-
// Top comment
-void member()
-{
- // body comment
- return;
+void member() {
+ // body comment
+ return;
}
-
diff --git a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleCtorDtorRefactoring.rts b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleCtorDtorRefactoring.rts
index 8e84291e3d..04ec07acf6 100644
--- a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleCtorDtorRefactoring.rts
+++ b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleCtorDtorRefactoring.rts
@@ -7,36 +7,34 @@ filename=A.h
class A {
private:
- int a;
- int b;
+ int a;
+ int b;
+
public:
- /*$*/A/*$$*/(int x, int y)
- :a(x), b(y)
- {}
- ~A()
- {
- }
+ /*$*/A/*$$*/(int x, int y) :
+ a(x), b(y) {
+ }
+ ~A() {
+ }
};
//=
#include <iostream>
class A {
private:
- int a;
- int b;
+ int a;
+ int b;
+
public:
- A(int x, int y);
- ~A()
- {
- }
+ A(int x, int y);
+ ~A() {
+ }
};
-inline A::A(int x, int y)
-:a(x), b(y)
-{
+inline A::A(int x, int y) :
+ a(x), b(y) {
}
-
//!TestConstructorToggleInHeaderToImplementation
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
//@.config
@@ -46,31 +44,30 @@ filename=A.h
class A {
private:
- int a;
- int b;
+ int a;
+ int b;
+
public:
- A(int x, int y);
- ~A()
- {
- }
+ A(int x, int y);
+ ~A() {
+ }
};
-inline A::/*$*/A/*$$*/(int x, int y)
-:a(x), b(y)
-{
+inline A::/*$*/A/*$$*/(int x, int y) :
+ a(x), b(y) {
}
//=
#include <iostream>
class A {
private:
- int a;
- int b;
+ int a;
+ int b;
+
public:
- A(int x, int y);
- ~A()
- {
- }
+ A(int x, int y);
+ ~A() {
+ }
};
@@ -78,21 +75,19 @@ public:
#include "A.h"
int main() {
- return 0;
+ return 0;
}
//=
#include "A.h"
int main() {
- return 0;
+ return 0;
}
-A::A(int x, int y)
-:a(x), b(y)
-{
+A::A(int x, int y) :
+ a(x), b(y) {
}
-
//!TestConstructorToggleInImplementationToClass
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
//@.config
@@ -100,13 +95,12 @@ filename=A.cpp
//@A.cpp
#include "A.h"
-A::/*$*/A/*$$*/(int x, int y)
-:a(x), b(y)
-{
+A::/*$*/A/*$$*/(int x, int y) :
+ a(x), b(y) {
}
int main() {
- return 0;
+ return 0;
}
//=
#include "A.h"
@@ -114,28 +108,25 @@ int main() {
int main() {
- return 0;
+ return 0;
}
//@A.h
#include <iostream>
class A {
- A(int x, int y);
- ~A()
- {
- }
+ A(int x, int y);
+ ~A() {
+ }
};
//=
#include <iostream>
class A {
- A(int x, int y)
- :a(x), b(y)
- {
- }
- ~A()
- {
- }
+ A(int x, int y) :
+ a(x), b(y) {
+ }
+ ~A() {
+ }
};
//!TestDestructorToggleInClassToInHeader
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
@@ -146,28 +137,28 @@ filename=A.h
class A {
private:
- int a;
- int b;
+ int a;
+ int b;
+
public:
- /*$*/~A/*$$*/()
- {}
+ /*$*/~A/*$$*/() {
+ }
};
//=
#include <iostream>
class A {
private:
- int a;
- int b;
+ int a;
+ int b;
+
public:
- ~A();
+ ~A();
};
-inline A::~A()
-{
+inline A::~A() {
}
-
//!TestDestructorToggleInHeaderToImplementation
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
//@.config
@@ -177,24 +168,25 @@ filename=A.h
class A {
private:
- int a;
- int b;
+ int a;
+ int b;
+
public:
- ~A();
+ ~A();
};
-inline /*$*/A::~A/*$$*/()
-{
+inline /*$*/A::~A/*$$*/() {
}
//=
#include <iostream>
class A {
private:
- int a;
- int b;
+ int a;
+ int b;
+
public:
- ~A();
+ ~A();
};
@@ -202,20 +194,18 @@ public:
#include "A.h"
int main() {
- return 0;
+ return 0;
}
//=
#include "A.h"
int main() {
- return 0;
+ return 0;
}
-A::~A()
-{
+A::~A() {
}
-
//!TestDestructorToggleInImplementationToClass
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
//@.config
@@ -223,15 +213,14 @@ filename=A.cpp
//@A.cpp
#include "A.h"
-/*$*/A::~A/*$$*/()
-{
- int x;
- int y;
- return;
+/*$*/A::~A/*$$*/() {
+ int x;
+ int y;
+ return;
}
int main() {
- return 0;
+ return 0;
}
//=
#include "A.h"
@@ -239,28 +228,27 @@ int main() {
int main() {
- return 0;
+ return 0;
}
//@A.h
#include <iostream>
class A {
- A(int x, int y)
- :a(x), b(y)
- {}
- ~A();
+ A(int x, int y) :
+ a(x), b(y) {
+ }
+ ~A();
};
//=
#include <iostream>
class A {
- A(int x, int y)
- :a(x), b(y)
- {}
- ~A()
- {
- int x;
- int y;
- return;
- }
+ A(int x, int y) :
+ a(x), b(y) {
+ }
+ ~A() {
+ int x;
+ int y;
+ return;
+ }
};
diff --git a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleDefaultParameterRefactoring.rts b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleDefaultParameterRefactoring.rts
index 53c44c6cd8..d1d2fa2b71 100644
--- a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleDefaultParameterRefactoring.rts
+++ b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleDefaultParameterRefactoring.rts
@@ -6,24 +6,21 @@ filename=A.h
#include <iostream>
class A {
- void /*$*/member/*$$*/(int a=0, int b=0)
- {
- return;
- }
+ void /*$*/member/*$$*/(int a = 0, int b = 0) {
+ return;
+ }
};
//=
#include <iostream>
class A {
- void member(int a=0, int b=0);
+ void member(int a = 0, int b = 0);
};
-inline void A::member(int a, int b)
-{
- return;
+inline void A::member(int a, int b) {
+ return;
}
-
//!TestDefaultParameterInitializerInHeaderToImplementation
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
//@.config
@@ -32,18 +29,17 @@ filename=A.h
#include <iostream>
class A {
- void member(int a=0, int b=0);
+ void member(int a = 0, int b = 0);
};
-inline void /*$*/A::member/*$$*/(int a, int b)
-{
- return;
+inline void /*$*/A::member/*$$*/(int a, int b) {
+ return;
}
//=
#include <iostream>
class A {
- void member(int a=0, int b=0);
+ void member(int a = 0, int b = 0);
};
@@ -51,21 +47,19 @@ class A {
#include "A.h"
int main() {
- return 0;
+ return 0;
}
//=
#include "A.h"
int main() {
- return 0;
+ return 0;
}
-void A::member(int a, int b)
-{
- return;
+void A::member(int a, int b) {
+ return;
}
-
//!TestDefaultParameterInitializerInImplementationToClass
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
//@.config
@@ -73,36 +67,32 @@ filename=A.cpp
//@A.cpp
#include "A.h"
-void A::/*$*/member/*$$*/(int a, int b)
-{
- return;
+void A::/*$*/member/*$$*/(int a, int b) {
+ return;
}
-int main()
-{
- return 0;
+int main() {
+ return 0;
}
//=
#include "A.h"
-int main()
-{
- return 0;
+int main() {
+ return 0;
}
//@A.h
#include <iostream>
class A {
- void member(int a = 0, int b = 0);
+ void member(int a = 0, int b = 0);
};
//=
#include <iostream>
class A {
- void member(int a = 0, int b = 0)
- {
- return;
- }
+ void member(int a = 0, int b = 0) {
+ return;
+ }
}; \ No newline at end of file
diff --git a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleDifferentSelections.rts b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleDifferentSelections.rts
index f885a69243..535e98acf1 100644
--- a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleDifferentSelections.rts
+++ b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleDifferentSelections.rts
@@ -6,18 +6,17 @@ filename=A.cpp
#include "A.h"
int main() {
- return 0;
+ return 0;
}
-void N::A::/*$*/foo/*$$*/()
-{
- return;
+void N::A::/*$*/foo/*$$*/() {
+ return;
}
//=
#include "A.h"
int main() {
- return 0;
+ return 0;
}
@@ -26,21 +25,24 @@ int main() {
#include <exception>
namespace N {
- class A {
- void foo();
- };
+
+class A {
+ void foo();
+};
+
}
//=
#include <iostream>
#include <exception>
namespace N {
- class A {
- void foo()
- {
- return;
- }
- };
+
+class A {
+ void foo() {
+ return;
+ }
+};
+
}
//!TestImplementationToClassWithDeclarationSelected
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
@@ -51,9 +53,11 @@ filename=A.h
#include <exception>
namespace N {
- class A {
- void /*$*/foo/*$$*/();
- };
+
+class A {
+ void /*$*/foo/*$$*/();
+};
+
}
//=
@@ -61,28 +65,30 @@ namespace N {
#include <exception>
namespace N {
- class A {
- void foo()
- {
- return;
- }
- };
+
+class A {
+ void foo() {
+ return;
+ }
+};
+
}
//@A.cpp
#include "A.h"
int main() {
- return 0;
+ return 0;
}
-void N::A::foo()
-{
- return;
+
+void N::A::foo() {
+ return;
}
//=
#include "A.h"
int main() {
- return 0;
+ return 0;
}
+
diff --git a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleErrorRefactoring.rts b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleErrorRefactoring.rts
index bdeca96e7c..307f138e3e 100644
--- a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleErrorRefactoring.rts
+++ b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleErrorRefactoring.rts
@@ -7,11 +7,11 @@ fatalerror=true
class A {
public:
- void foo()
- {
- }
+ void foo() {
+ }
+
private:
- int /*$*/x/*$$*/;
+ int /*$*/x/*$$*/;
};
//!TestNotSupportedNoDefinition
@@ -23,14 +23,13 @@ fatalerror=true
class A {
public:
- void /*$*/foo/*$$*/();
+ void /*$*/foo/*$$*/();
};
//@A.cpp
#include "A.h"
-int main()
-{
- return 0;
+int main() {
+ return 0;
}
//!TestNotSupportedNoTranslationunit
@@ -42,7 +41,7 @@ fatalerror=true
class A {
public:
- void /*$*/foo/*$$*/();
+ void /*$*/foo/*$$*/();
};
//!TestMultipleDeclarations
@@ -54,15 +53,14 @@ fatalerror=true
#include <iostream>
class A {
- void /*$*/foo/*$$*/();
- void foo();
+ void /*$*/foo/*$$*/();
+ void foo();
};
//@A.cpp
#include "A.h"
-int main()
-{
- return 0;
+int main() {
+ return 0;
}
//!TestMultipledefinitions
@@ -73,28 +71,23 @@ fatalerror=true
#include <iostream>
class A {
- void foo();
- void /*$*/foo/*$$*/()
- {
- return;
- }
+ void foo();
+ void /*$*/foo/*$$*/() {
+ return;
+ }
};
-void blah()
-{
-
+void blah() {
}
-inline void A::foo()
-{
- return;
+inline void A::foo() {
+ return;
}
//@A.cpp
#include "A.h"
-int main()
-{
- return 0;
+int main() {
+ return 0;
}
//!TestNotSupportedNestedFunctions
@@ -105,9 +98,8 @@ fatalerror=true
#include <iostream>
class A {
- void foo()
- {
- void /*$*/bar/*$$*/() {
- }
- }
+ void foo() {
+ void /*$*/bar/*$$*/() {
+ }
+ }
}; \ No newline at end of file
diff --git a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleFreeFunction.rts b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleFreeFunction.rts
index 1166da4888..57cf41340c 100644
--- a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleFreeFunction.rts
+++ b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleFreeFunction.rts
@@ -7,57 +7,55 @@ filename=A.h
class A {
private:
- int a;
- int b;
+ int a;
+ int b;
+
public:
- A(int x, int y)
- :a(x), b(y)
- {}
- ~A()
- {
- }
+ A(int x, int y) :
+ a(x), b(y) {
+ }
+ ~A() {
+ }
};
-int /*$*/freeFunction/*$$*/(int *a, int & b) {
- return 42;
+int /*$*/freeFunction/*$$*/(int* a, int& b) {
+ return 42;
}
//=
#include <iostream>
class A {
private:
- int a;
- int b;
+ int a;
+ int b;
+
public:
- A(int x, int y)
- :a(x), b(y)
- {}
- ~A()
- {
- }
+ A(int x, int y) :
+ a(x), b(y) {
+ }
+ ~A() {
+ }
};
-int freeFunction(int *a, int & b);
+int freeFunction(int* a, int& b);
//@A.cpp
#include "A.h"
int main() {
- return 0;
+ return 0;
}
//=
#include "A.h"
int main() {
- return 0;
+ return 0;
}
-int freeFunction(int *a, int & b)
-{
- return 42;
+int freeFunction(int* a, int& b) {
+ return 42;
}
-
//!TestFreeFunctionToggleFromImplementationToHeaderWithDeclaration
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
//@.config
@@ -66,18 +64,17 @@ filename=A.cpp
#include "A.h"
int main() {
- return 0;
+ return 0;
}
-int /*$*/freeFunction/*$$*/(int *a, int & b)
-{
- return 42;
+int /*$*/freeFunction/*$$*/(int* a, int& b) {
+ return 42;
}
//=
#include "A.h"
int main() {
- return 0;
+ return 0;
}
@@ -86,40 +83,38 @@ int main() {
class A {
private:
- int a;
- int b;
+ int a;
+ int b;
+
public:
- A(int x, int y)
- :a(x), b(y)
- {}
- ~A()
- {
- }
+ A(int x, int y) :
+ a(x), b(y) {
+ }
+ ~A() {
+ }
};
-int freeFunction(int *a, int & b);
+int freeFunction(int* a, int& b);
//=
#include <iostream>
class A {
private:
- int a;
- int b;
+ int a;
+ int b;
+
public:
- A(int x, int y)
- :a(x), b(y)
- {}
- ~A()
- {
- }
+ A(int x, int y) :
+ a(x), b(y) {
+ }
+ ~A() {
+ }
};
-int freeFunction(int *a, int & b)
-{
- return 42;
+int freeFunction(int* a, int& b) {
+ return 42;
}
-
//!TestFreeFunctionToggleFromImplementationToHeaderWithOutDeclaration
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
//@.config
@@ -128,20 +123,20 @@ filename=A.cpp
#include "A.h"
int main() {
- return 0;
+ return 0;
}
-int /*$*/freeFunction/*$$*/(int *a, int & b)
+int /*$*/freeFunction/*$$*/(int* a, int& b)
try {
- return 42;
-} catch (std::exception & e)
-{
+ return 42;
+}
+catch (std::exception& e) {
}
//=
#include "A.h"
int main() {
- return 0;
+ return 0;
}
@@ -150,15 +145,15 @@ int main() {
class A {
private:
- int a;
- int b;
+ int a;
+ int b;
+
public:
- A(int x, int y)
- :a(x), b(y)
- {}
- ~A()
- {
- }
+ A(int x, int y) :
+ a(x), b(y) {
+ }
+ ~A() {
+ }
};
//=
@@ -166,35 +161,32 @@ public:
class A {
private:
- int a;
- int b;
+ int a;
+ int b;
+
public:
- A(int x, int y)
- :a(x), b(y)
- {}
- ~A()
- {
- }
+ A(int x, int y) :
+ a(x), b(y) {
+ }
+ ~A() {
+ }
};
-int freeFunction(int *a, int & b)
-try
-{
- return 42;
+int freeFunction(int* a, int& b)
+try {
+ return 42;
}
-catch(std::exception & e){
+catch (std::exception& e) {
}
-
//!TestFreeFunction
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
//@.config
filename=A.h
//@A.h
-int /*$*/freeFunction/*$$*/()
-{
- return 42;
+int /*$*/freeFunction/*$$*/() {
+ return 42;
}
//=
int freeFunction();
@@ -204,12 +196,9 @@ int freeFunction();
//=
#include "A.h"
-
-int freeFunction()
-{
- return 42;
+int freeFunction() {
+ return 42;
}
-
//!TestQualifiedNameToggle
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
//@.config
@@ -218,18 +207,15 @@ fatalerror=true
//@A.cpp
#include "A.h"
-int /*$*/A::freefunction/*$$*/()
-{
- return 42;
+int /*$*/A::freefunction/*$$*/() {
+ return 42;
}
//=
#include "A.h"
-int A::freefunction()
-{
- return 42;
+int A::freefunction() {
+ return 42;
}
-
//!TestNamespacedFreeFunction
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
//@.config
@@ -241,10 +227,11 @@ filename=A.h
#include <iostream>
namespace N {
- void /*$*/freefunction/*$$*/()
- {
- return;
- }
+
+void /*$*/freefunction/*$$*/() {
+ return;
+}
+
}
#endif /* A_H_ */
@@ -255,7 +242,9 @@ namespace N {
#include <iostream>
namespace N {
- void freefunction();
+
+void freefunction();
+
}
#endif /* A_H_ */
@@ -263,21 +252,20 @@ namespace N {
#include "A.h"
int main() {
- return 0;
+ return 0;
}
//=
#include "A.h"
int main() {
- return 0;
+ return 0;
}
-namespace N
-{
- void freefunction()
- {
- return;
- }
+namespace N {
+
+void freefunction() {
+ return;
+}
}
diff --git a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleNamespaceRefactoring.rts b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleNamespaceRefactoring.rts
index 568bf32d6b..598bf314c0 100644
--- a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleNamespaceRefactoring.rts
+++ b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleNamespaceRefactoring.rts
@@ -7,24 +7,28 @@ filename=A.h
#include <exception>
namespace N {
- class A {
- void /*$*/foo/*$$*/() {
- return;
- }
- };
+
+class A {
+ void /*$*/foo/*$$*/() {
+ return;
+ }
+};
+
}
//=
#include <iostream>
#include <exception>
namespace N {
- class A {
- void foo();
- };
- inline void A::foo()
- {
- return;
- }
+
+class A {
+ void foo();
+};
+
+inline void A::foo() {
+ return;
+}
+
}
//!TestSimpleNamespaceInHeaderToImplementationWithinNSDefinition
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
@@ -35,42 +39,45 @@ filename=A.h
#include <exception>
namespace N {
- class A {
- void foo();
- };
- inline void A::/*$*/foo/*$$*/()
- {
- return;
- }
+
+class A {
+ void foo();
+};
+
+inline void A::/*$*/foo/*$$*/() {
+ return;
+}
+
}
//=
#include <iostream>
#include <exception>
namespace N {
- class A {
- void foo();
- };
+
+class A {
+ void foo();
+};
+
}
//@A.cpp
#include "A.h"
int main() {
- return 0;
+ return 0;
}
//=
#include "A.h"
int main() {
- return 0;
+ return 0;
}
-namespace N
-{
- void A::foo()
- {
- return;
- }
+namespace N {
+
+void A::foo() {
+ return;
+}
}
@@ -83,13 +90,14 @@ filename=A.h
#include <exception>
namespace N {
- class A {
- void foo();
- };
- inline void A::/*$*/foo/*$$*/()
- {
- return;
- }
+
+class A {
+ void foo();
+};
+
+inline void A::/*$*/foo/*$$*/() {
+ return;
+}
}
//=
@@ -97,34 +105,33 @@ namespace N {
#include <exception>
namespace N {
- class A {
- void foo();
- };
+
+class A {
+ void foo();
+};
}
//@A.cpp
#include "A.h"
int main() {
- return 0;
+ return 0;
}
-namespace N
-{
+namespace N {
}
//=
#include "A.h"
int main() {
- return 0;
+ return 0;
}
-namespace N
-{
- void A::foo()
- {
- return;
- }
+namespace N {
+
+void A::foo() {
+ return;
+}
}
//!TestSimpleNamespaceInHeaderToImplementationWithNamespaceQualifiedName
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
@@ -135,23 +142,26 @@ filename=A.h
#include <exception>
namespace N {
- class A {
- void foo();
- };
+
+class A {
+ void foo();
+};
+
}
-inline void /*$*/N::A::foo/*$$*/()
-{
- return;
+inline void /*$*/N::A::foo/*$$*/() {
+ return;
}
//=
#include <iostream>
#include <exception>
namespace N {
- class A {
- void foo();
- };
+
+class A {
+ void foo();
+};
+
}
@@ -159,21 +169,20 @@ namespace N {
#include "A.h"
int main() {
- return 0;
+ return 0;
}
//=
#include "A.h"
int main() {
- return 0;
+ return 0;
}
-namespace N
-{
- void A::foo()
- {
- return;
- }
+namespace N {
+
+void A::foo() {
+ return;
+}
}
@@ -184,42 +193,42 @@ filename=A.cpp
//@A.cpp
#include "A.h"
-void /*$*/N::A::foo/*$$*/()
-{
- return;
+void /*$*/N::A::foo/*$$*/() {
+ return;
}
-int main()
-{
- return 0;
+int main() {
+ return 0;
}
//=
#include "A.h"
-int main()
-{
- return 0;
+int main() {
+ return 0;
}
//@A.h
#include <iostream>
namespace N {
- class A {
- void foo();
- };
+
+class A {
+ void foo();
+};
+
}
//=
#include <iostream>
namespace N {
- class A {
- void foo()
- {
- return;
- }
- };
+
+class A {
+ void foo() {
+ return;
+ }
+};
+
}
//!TestRemoveEmptyNamespaceFromImplentation
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
@@ -229,10 +238,11 @@ filename=A.cpp
#include "A.h"
namespace N {
- void /*$*/A::foo/*$$*/()
- {
- return;
- }
+
+void /*$*/A::foo/*$$*/() {
+ return;
+}
+
}
//=
#include "A.h"
@@ -242,18 +252,21 @@ namespace N {
#include <iostream>
namespace N {
- class A {
- void foo();
- };
+
+class A {
+ void foo();
+};
+
}
//=
#include <iostream>
namespace N {
- class A {
- void foo()
- {
- return;
- }
- };
-} \ No newline at end of file
+
+class A {
+ void foo() {
+ return;
+ }
+};
+
+}
diff --git a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleNestedRefactoring.rts b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleNestedRefactoring.rts
index 012f07668e..d73288018e 100644
--- a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleNestedRefactoring.rts
+++ b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleNestedRefactoring.rts
@@ -6,27 +6,25 @@ filename=A.h
#include <iostream>
class A {
- class B {
- void /*$*/member/*$$*/(int a, int b) {
- return;
- }
- };
+ class B {
+ void /*$*/member/*$$*/(int a, int b) {
+ return;
+ }
+ };
};
//=
#include <iostream>
class A {
- class B {
- void member(int a, int b);
- };
+ class B {
+ void member(int a, int b);
+ };
};
-inline void A::B::member(int a, int b)
-{
- return;
+inline void A::B::member(int a, int b) {
+ return;
}
-
//!TestNestedClassInHeaderToImplementation
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
//@.config
@@ -35,46 +33,41 @@ filename=A.h
#include <iostream>
class A {
- class B {
- void member(int a, int b);
- };
+ class B {
+ void member(int a, int b);
+ };
};
-inline void A::B::/*$*/member/*$$*/(int a, int b)
-{
- return;
+inline void A::B::/*$*/member/*$$*/(int a, int b) {
+ return;
}
//=
#include <iostream>
class A {
- class B {
- void member(int a, int b);
- };
+ class B {
+ void member(int a, int b);
+ };
};
//@A.cpp
#include "A.h"
-int main()
-{
- return 0;
+int main() {
+ return 0;
}
//=
#include "A.h"
-int main()
-{
- return 0;
+int main() {
+ return 0;
}
-void A::B::member(int a, int b)
-{
- return;
+void A::B::member(int a, int b) {
+ return;
}
-
//!TestNestedClassInImplementationToClass
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
//@.config
@@ -82,21 +75,18 @@ filename=A.cpp
//@A.cpp
#include "A.h"
-int main()
-{
- return 0;
+int main() {
+ return 0;
}
-void A::B::/*$*/member/*$$*/(int a, int b)
-{
- return;
+void A::B::/*$*/member/*$$*/(int a, int b) {
+ return;
}
//=
#include "A.h"
-int main()
-{
- return 0;
+int main() {
+ return 0;
}
@@ -104,18 +94,17 @@ int main()
#include <iostream>
class A {
- class B {
- void member(int a, int b);
- };
+ class B {
+ void member(int a, int b);
+ };
};
//=
#include <iostream>
class A {
- class B {
- void member(int a, int b)
- {
- return;
- }
- };
+ class B {
+ void member(int a, int b) {
+ return;
+ }
+ };
};
diff --git a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleOrdering.rts b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleOrdering.rts
index 005ad09617..6c1ccc5b5f 100644
--- a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleOrdering.rts
+++ b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleOrdering.rts
@@ -7,46 +7,38 @@ filename=A.h
class A {
public:
- void func1();
- void /*$*/func2/*$$*/()
- {
- }
- void func3();
- void func4()
- {
- }
+ void func1();
+ void /*$*/func2/*$$*/() {
+ }
+ void func3();
+ void func4() {
+ }
};
-inline void A::func1()
-{
+inline void A::func1() {
}
-inline void A::func3()
-{
+inline void A::func3() {
}
//=
#include <iostream>
class A {
public:
- void func1();
- void func2();
- void func3();
- void func4()
- {
- }
+ void func1();
+ void func2();
+ void func3();
+ void func4() {
+ }
};
-inline void A::func1()
-{
+inline void A::func1() {
}
-inline void A::func2()
-{
+inline void A::func2() {
}
-inline void A::func3()
-{
+inline void A::func3() {
}
//!TestCorrectOrderingInHeaderToImplementation
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
@@ -57,17 +49,15 @@ filename=A.h
class A {
public:
- void func1();
- void func2();
- void func3();
- void func4()
- {
- }
+ void func1();
+ void func2();
+ void func3();
+ void func4() {
+ }
};
-inline void A::/*$*/func2/*$$*/()
-{
- return;
+inline void A::/*$*/func2/*$$*/() {
+ return;
}
//=
@@ -75,12 +65,11 @@ inline void A::/*$*/func2/*$$*/()
class A {
public:
- void func1();
- void func2();
- void func3();
- void func4()
- {
- }
+ void func1();
+ void func2();
+ void func3();
+ void func4() {
+ }
};
@@ -88,41 +77,34 @@ public:
//@A.cpp
#include "A.h"
-int main()
-{
- return 0;
+int main() {
+ return 0;
}
-void A::func1()
-{
- return;
+void A::func1() {
+ return;
}
-void A::func3()
-{
- return;
+void A::func3() {
+ return;
}
//=
#include "A.h"
-int main()
-{
- return 0;
+int main() {
+ return 0;
}
-void A::func1()
-{
- return;
+void A::func1() {
+ return;
}
-void A::func2()
-{
- return;
+void A::func2() {
+ return;
}
-void A::func3()
-{
- return;
+void A::func3() {
+ return;
}
//!TestCorrectTemplateOrderingInClassToInHeader
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
@@ -134,21 +116,20 @@ filename=A.h
template <typename T>
class A {
public:
- void func1();
- void /*$*/func2/*$$*/()
- {
- }
- void func3();
- void func4()
- {
- }
+ void func1();
+ void /*$*/func2/*$$*/() {
+ }
+ void func3();
+ void func4() {
+ }
};
-template<typename T> inline void A<T>::func1()
-{
+template<typename T>
+inline void A<T>::func1() {
}
-template<typename T> inline void A<T>::func3()
-{
+
+template<typename T>
+inline void A<T>::func3() {
}
//=
#include <iostream>
@@ -156,23 +137,23 @@ template<typename T> inline void A<T>::func3()
template <typename T>
class A {
public:
- void func1();
- void func2();
- void func3();
- void func4()
- {
- }
+ void func1();
+ void func2();
+ void func3();
+ void func4() {
+ }
};
-template<typename T> inline void A<T>::func1()
-{
+template<typename T>
+inline void A<T>::func1() {
}
-template<typename T> inline void A<T>::func2()
-{
+
+template<typename T>
+inline void A<T>::func2() {
}
-template<typename T> inline void A<T>::func3()
-{
+template<typename T>
+inline void A<T>::func3() {
}
//!TestCorrectTemplateOrderingInHeaderToInClass
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
@@ -184,22 +165,23 @@ filename=A.h
template <typename T>
class A {
public:
- void func1();
- void func2();
- void func3();
- void func4()
- {
- }
+ void func1();
+ void func2();
+ void func3();
+ void func4() {
+ }
};
-template<typename T> inline void A<T>::func1()
-{
+template<typename T>
+inline void A<T>::func1() {
}
-template<typename T> inline void A<T>::/*$*/func2/*$$*/()
-{
+
+template<typename T>
+inline void A<T>::/*$*/func2/*$$*/() {
}
-template<typename T> inline void A<T>::func3()
-{
+
+template<typename T>
+inline void A<T>::func3() {
}
//=
#include <iostream>
@@ -207,20 +189,20 @@ template<typename T> inline void A<T>::func3()
template <typename T>
class A {
public:
- void func1();
- void func2()
- {
- }
- void func3();
- void func4()
- {
- }
+ void func1();
+ void func2() {
+ }
+ void func3();
+ void func4() {
+ }
};
-template<typename T> inline void A<T>::func1()
-{
+template<typename T>
+inline void A<T>::func1() {
}
-template<typename T> inline void A<T>::func3()
-{
+
+
+template<typename T>
+inline void A<T>::func3() {
}
diff --git a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleSelection.rts b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleSelection.rts
index f8cb1c31fb..8551a6ca67 100644
--- a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleSelection.rts
+++ b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleSelection.rts
@@ -4,153 +4,132 @@
filename=A.h
//@A.h
class A {
- void me/*$*//*$$*/mber()
- {
- return;
- }
+ void me/*$*//*$$*/mber() {
+ return;
+ }
};
//=
class A {
- void member();
+ void member();
};
-inline void A::member()
-{
- return;
+inline void A::member() {
+ return;
}
-
//!TestSubstringSelection
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
//@.config
filename=A.h
//@A.h
class A {
- void m/*$*/e/*$$*/mber()
- {
- return;
- }
+ void m/*$*/e/*$$*/mber() {
+ return;
+ }
};
//=
class A {
- void member();
+ void member();
};
-inline void A::member()
-{
- return;
+inline void A::member() {
+ return;
}
-
//!TestBodySelection
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
//@.config
filename=A.h
//@A.h
class A {
- void member()
- {
- r/*$*//*$$*/eturn;
- }
+ void member() {
+ r/*$*//*$$*/eturn;
+ }
};
//=
class A {
- void member();
+ void member();
};
-inline void A::member()
-{
- return;
+inline void A::member() {
+ return;
}
-
//!TestBodySelectionWithConfusingName
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
//@.config
filename=A.h
//@A.h
class A {
- void member()
- {
- int /*$*/abcd/*$$*/ = 42;
- return;
- }
+ void member() {
+ int /*$*/abcd/*$$*/ = 42;
+ return;
+ }
};
//=
class A {
- void member();
+ void member();
};
-inline void A::member()
-{
- int abcd = 42;
- return;
+inline void A::member() {
+ int abcd = 42;
+ return;
}
-
//!TestLeftBorderSelection
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
//@.config
filename=A.h
//@A.h
class A {
- /*$*//*$$*/void member()
- {
- return;
- }
+ /*$*//*$$*/void member() {
+ return;
+ }
};
//=
class A {
- void member();
+ void member();
};
-inline void A::member()
-{
- return;
+inline void A::member() {
+ return;
}
-
//!TestRightBorderSelection
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
//@.config
filename=A.h
//@A.h
class A {
- void member()
- {
- return;
- }/*$*//*$$*/
+ void member() {
+ return;
+ }/*$*//*$$*/
};
//=
class A {
- void member();
+ void member();
};
-inline void A::member()
-{
- return;
+inline void A::member() {
+ return;
}
-
//!TestOverlappingSelection
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
//@.config
filename=A.h
//@A.h
class A {
- vo/*$*/id member()
- {
- ret/*$$*/urn;
- }
+ vo/*$*/id member() {
+ ret/*$$*/urn;
+ }
};
//=
class A {
- void member();
+ void member();
};
-inline void A::member()
-{
- return;
+inline void A::member() {
+ return;
}
-
diff --git a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleSimpleFunctionRefactoring.rts b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleSimpleFunctionRefactoring.rts
index a2f96afc6a..b92b03b8a8 100644
--- a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleSimpleFunctionRefactoring.rts
+++ b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleSimpleFunctionRefactoring.rts
@@ -7,29 +7,28 @@ filename=A.h
class A {
public:
- int /*$*/function/*$$*/()
- {
- return 0;
- }
+ int /*$*/function/*$$*/() {
+ return 0;
+ }
+
private:
- int a;
+ int a;
};
//=
#include <iostream>
class A {
public:
- int function();
+ int function();
+
private:
- int a;
+ int a;
};
-inline int A::function()
-{
- return 0;
+inline int A::function() {
+ return 0;
}
-
//!TestSimpleFunctionInHeaderToImplementation
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
//@.config
@@ -39,23 +38,24 @@ filename=A.h
class A {
public:
- int function();
+ int function();
+
private:
- int a;
+ int a;
};
-inline int A::/*$*/function/*$$*/()
-{
- return 0;
+inline int A::/*$*/function/*$$*/() {
+ return 0;
}
//=
#include <iostream>
class A {
public:
- int function();
+ int function();
+
private:
- int a;
+ int a;
};
@@ -63,21 +63,19 @@ private:
#include "A.h"
int main() {
- return 0;
+ return 0;
}
//=
#include "A.h"
int main() {
- return 0;
+ return 0;
}
-int A::function()
-{
- return 0;
+int A::function() {
+ return 0;
}
-
//!TestSimpleFunctionInImplementationToInClass
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
//@.config
@@ -85,44 +83,42 @@ filename=A.cpp
//@A.cpp
#include "A.h"
-int A::/*$*/function/*$$*/()
-{
- return 0;
+int A::/*$*/function/*$$*/() {
+ return 0;
}
-int main()
-{
- return 0;
+int main() {
+ return 0;
}
//=
#include "A.h"
-int main()
-{
- return 0;
+int main() {
+ return 0;
}
//@A.h
#include <iostream>
class A {
public:
- int function();
+ int function();
+
private:
- int a;
+ int a;
};
//=
#include <iostream>
class A {
public:
- int function()
- {
- return 0;
- }
+ int function() {
+ return 0;
+ }
+
private:
- int a;
+ int a;
};
//!TestDifferentParameterNames
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
@@ -131,36 +127,35 @@ filename=MyClass.cpp
//@MyClass.cpp
#include "MyClass.h"
-myClass::/*$*/myClass/*$$*/(int implname) : fVal(implname) {}
+myClass::/*$*/myClass/*$$*/(int implname) :
+ fVal(implname) {
+}
-int main()
-{
- return 0;
+int main() {
+ return 0;
}
//=
#include "MyClass.h"
-int main()
-{
- return 0;
+int main() {
+ return 0;
}
//@MyClass.h
struct myClass {
- int fVal;
- myClass(int headername);
+ int fVal;
+ myClass(int headername);
};
//=
struct myClass {
- int fVal;
- myClass(int implname)
- :fVal(implname)
- {
- }
+ int fVal;
+ myClass(int implname) :
+ fVal(implname) {
+ }
};
//!TestMissingParameterNames
@@ -170,35 +165,34 @@ filename=MyClass.cpp
//@MyClass.cpp
#include "MyClass.h"
-myClass::/*$*/myClass/*$$*/(int implname) : fVal(implname) {}
+myClass::/*$*/myClass/*$$*/(int implname) :
+ fVal(implname) {
+}
-int main()
-{
- return 0;
+int main() {
+ return 0;
}
//=
#include "MyClass.h"
-int main()
-{
- return 0;
+int main() {
+ return 0;
}
//@MyClass.h
struct myClass {
- int fVal;
- myClass(int);
+ int fVal;
+ myClass(int);
};
//=
struct myClass {
- int fVal;
- myClass(int implname)
- :fVal(implname)
- {
- }
+ int fVal;
+ myClass(int implname) :
+ fVal(implname) {
+ }
};
diff --git a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleTemplateRefactoring.rts b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleTemplateRefactoring.rts
index 5d50b808b0..19c4330b51 100644
--- a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleTemplateRefactoring.rts
+++ b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleTemplateRefactoring.rts
@@ -7,29 +7,27 @@ filename=A.h
template <typename T, typename U>
class A {
- class B {
- T /*$*/member/*$$*/()
- {
- return T();
- }
- };
+ class B {
+ T /*$*/member/*$$*/() {
+ return T();
+ }
+ };
};
//=
#include <iostream>
template <typename T, typename U>
class A {
- class B {
- T member();
- };
+ class B {
+ T member();
+ };
};
-template<typename T, typename U> inline T A<T,U>::B::member()
-{
- return T();
+template<typename T, typename U>
+inline T A<T, U>::B::member() {
+ return T();
}
-
//!TestTemplateFunctionInHeaderToInClass
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
//@.config
@@ -39,28 +37,25 @@ filename=A.h
template <typename T>
class A {
- class B {
- T member();
- };
-
+ class B {
+ T member();
+ };
};
-template<typename T> inline T A<T>::B::/*$*/member/*$$*/()
-{
- return T();
+template<typename T>
+inline T A<T>::B::/*$*/member/*$$*/() {
+ return T();
}
//=
#include <iostream>
template <typename T>
class A {
- class B {
- T member()
- {
- return T();
- }
- };
-
+ class B {
+ T member() {
+ return T();
+ }
+ };
};
@@ -70,85 +65,76 @@ class A {
filename=A.h
//@A.h
class A {
- tem/*$*/plate/*$$*/<typename T>
- T foo() {
- return T();
- }
+ tem/*$*/plate/*$$*/<typename T>
+ T foo() {
+ return T();
+ }
};
//=
class A {
- template<typename T>
- T foo();
+ template<typename T>
+ T foo();
};
-template<typename T> inline T A::foo()
-{
- return T();
+template<typename T>
+inline T A::foo() {
+ return T();
}
-
//!TestComplexTemplateFunctionFromInClassToInheader
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
//@.config
filename=A.h
//@A.h
template<typename T, typename S>
-class A
-{
+class A {
public:
- template<typename U, typename V>
- void /*$*/foo/*$$*/(const U & u, const V &v)
- {
- return;
- }
+ template<typename U, typename V>
+ void /*$*/foo/*$$*/(const U& u, const V& v) {
+ return;
+ }
};
//=
template<typename T, typename S>
-class A
-{
+class A {
public:
- template<typename U, typename V>
- void foo(const U & u, const V &v);
+ template<typename U, typename V>
+ void foo(const U& u, const V& v);
};
-template<typename T, typename S> template<typename U, typename V> inline void A<T,S>::foo(const U & u, const V & v)
-{
- return;
+template<typename T, typename S>
+template<typename U, typename V>
+inline void A<T, S>::foo(const U& u, const V& v) {
+ return;
}
-
//!TestComplexTemplateFunctionFromInHeaderToInClass
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
//@.config
filename=A.h
//@A.h
template<typename T, typename S>
-class A
-{
+class A {
public:
- template<typename U, typename V>
- void /*$*/foo/*$$*/(const U & u, const V &v);
-
+ template<typename U, typename V>
+ void /*$*/foo/*$$*/(const U& u, const V& v);
};
-template<typename T, typename S> template<typename U, typename V> inline void A<T,S>::foo(const U & u, const V & v)
-{
- return;
+template<typename T, typename S>
+template<typename U, typename V>
+inline void A<T,S>::foo(const U& u, const V& v) {
+ return;
}
//=
template<typename T, typename S>
-class A
-{
+class A {
public:
- template<typename U, typename V>
- void foo(const U & u, const V &v)
- {
- return;
- }
-
-
+ template<typename U, typename V>
+ void foo(const U& u, const V& v) {
+ return;
+ }
};
diff --git a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleTryCatchRefactoring.rts b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleTryCatchRefactoring.rts
index 41aec3dac9..30a83009e4 100644
--- a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleTryCatchRefactoring.rts
+++ b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleTryCatchRefactoring.rts
@@ -7,33 +7,30 @@ filename=A.h
#include <exception>
class A {
- void /*$*/member/*$$*/(int a, int b)
- try
- {
- return;
- } catch (std::exception & e1)
- {
- return;
- }
+ void /*$*/member/*$$*/(int a, int b)
+ try {
+ return;
+ }
+ catch (std::exception& e1){
+ return;
+ }
};
//=
#include <iostream>
#include <exception>
class A {
- void member(int a, int b);
+ void member(int a, int b);
};
inline void A::member(int a, int b)
-try
-{
- return;
+try {
+ return;
}
-catch(std::exception & e1){
- return;
+catch (std::exception& e1) {
+ return;
}
-
//!TestTryCatchFromInHeaderToImplementation
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
//@.config
@@ -43,23 +40,22 @@ filename=A.h
#include <exception>
class A {
- void member(int a, int b);
+ void member(int a, int b);
};
inline void /*$*/A::member/*$$*/(int a, int b)
-try
-{
- return;
+try {
+ return;
}
-catch(std::exception & e1){
- return;
+catch (std::exception& e1) {
+ return;
}
//=
#include <iostream>
#include <exception>
class A {
- void member(int a, int b);
+ void member(int a, int b);
};
@@ -67,25 +63,23 @@ class A {
#include "A.h"
int main() {
- return 0;
+ return 0;
}
//=
#include "A.h"
int main() {
- return 0;
+ return 0;
}
void A::member(int a, int b)
-try
-{
- return;
+try {
+ return;
}
-catch(std::exception & e1){
- return;
+catch (std::exception& e1) {
+ return;
}
-
//!TestTryCatchFromInImplementationToClass
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
//@.config
@@ -95,18 +89,15 @@ filename=A.cpp
#include "A.h"
void A::/*$*/member/*$$*/()
-try
-{
- return;
+try {
+ return;
}
-catch(std::exception & e1)
-{
- return;
+catch (std::exception& e1) {
+ return;
}
-int main()
-{
- return 0;
+int main() {
+ return 0;
}
//=
#include <exception>
@@ -114,28 +105,26 @@ int main()
-int main()
-{
- return 0;
+int main() {
+ return 0;
}
//@A.h
#include <iostream>
class A {
- void member();
+ void member();
};
//=
#include <iostream>
class A {
- void member()
- try
- {
- return;
- }
- catch(std::exception & e1){
- return;
- }
+ void member()
+ try {
+ return;
+ }
+ catch (std::exception& e1) {
+ return;
+ }
};
//!TestMultipleTryCatchFromInClassToInHeader
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
@@ -146,39 +135,36 @@ filename=A.h
#include <exception>
class A {
- void /*$*/member/*$$*/(int a, int b)
- try
- {
- return;
- } catch (std::exception & e1)
- {
- return;
- } catch (std::exception & e2)
- {
- return;
- }
+ void /*$*/member/*$$*/(int a, int b)
+ try {
+ return;
+ }
+ catch (std::exception& e1) {
+ return;
+ }
+ catch (std::exception& e2) {
+ return;
+ }
};
//=
#include <iostream>
#include <exception>
class A {
- void member(int a, int b);
+ void member(int a, int b);
};
inline void A::member(int a, int b)
-try
-{
- return;
+try {
+ return;
}
-catch(std::exception & e1){
- return;
+catch (std::exception& e1) {
+ return;
}
-catch(std::exception & e2){
- return;
+catch (std::exception& e2) {
+ return;
}
-
//!TestMultipleTryCatchFromInHeaderToImplementation
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
//@.config
@@ -188,26 +174,25 @@ filename=A.h
#include <exception>
class A {
- void member(int a, int b);
+ void member(int a, int b);
};
inline void /*$*/A::member/*$$*/(int a, int b)
-try
-{
- return;
+try {
+ return;
}
-catch(std::exception & e1){
- return;
+catch (std::exception& e1) {
+ return;
}
-catch(std::exception & e2){
- return;
+catch (std::exception& e2) {
+ return;
}
//=
#include <iostream>
#include <exception>
class A {
- void member(int a, int b);
+ void member(int a, int b);
};
@@ -215,28 +200,26 @@ class A {
#include "A.h"
int main() {
- return 0;
+ return 0;
}
//=
#include "A.h"
int main() {
- return 0;
+ return 0;
}
void A::member(int a, int b)
-try
-{
- return;
+try {
+ return;
}
-catch(std::exception & e1){
- return;
+catch (std::exception& e1) {
+ return;
}
-catch(std::exception & e2){
- return;
+catch (std::exception& e2) {
+ return;
}
-
//!TestMultipleTryCatchFromInImplementationToClass
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
//@.config
@@ -246,22 +229,18 @@ filename=A.cpp
#include "A.h"
void A::/*$*/member/*$$*/()
-try
-{
- return;
+try {
+ return;
}
-catch(std::exception & e1)
-{
- return;
+catch (std::exception& e1) {
+ return;
}
-catch(std::exception & e2)
-{
- return;
+catch (std::exception& e2) {
+ return;
}
-int main()
-{
- return 0;
+int main() {
+ return 0;
}
//=
#include <exception>
@@ -269,29 +248,27 @@ int main()
-int main()
-{
- return 0;
+int main() {
+ return 0;
}
//@A.h
#include <iostream>
class A {
- void member();
+ void member();
};
//=
#include <iostream>
class A {
- void member()
- try
- {
- return;
- }
- catch(std::exception & e1){
- return;
- }
- catch(std::exception & e2){
- return;
- }
+ void member()
+ try {
+ return;
+ }
+ catch (std::exception& e1) {
+ return;
+ }
+ catch (std::exception& e2) {
+ return;
+ }
}; \ No newline at end of file
diff --git a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleVirtualFunction.rts b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleVirtualFunction.rts
index 9c1ef038bf..8a51d64b8c 100644
--- a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleVirtualFunction.rts
+++ b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ToggleVirtualFunction.rts
@@ -5,23 +5,20 @@ filename=A.h
//@A.h
class A {
- virtual int /*$*/foo/*$$*/()
- {
- return 0;
- }
+ virtual int /*$*/foo/*$$*/() {
+ return 0;
+ }
};
//=
class A {
- virtual int foo();
+ virtual int foo();
};
-inline int A::foo()
-{
- return 0;
+inline int A::foo() {
+ return 0;
}
-
//!TestVirtualSpecifierFromInHeaderToImplementation
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
//%CPP
@@ -30,41 +27,36 @@ filename=A.h
//@A.h
class A {
- virtual int /*$*/foo/*$$*/();
+ virtual int /*$*/foo/*$$*/();
};
-inline int A::foo()
-{
- return 0;
+inline int A::foo() {
+ return 0;
}
//=
class A {
- virtual int foo();
+ virtual int foo();
};
//@A.cpp
#include "A.h"
-int main()
-{
- return 0;
+int main() {
+ return 0;
}
//=
#include "A.h"
-int main()
-{
- return 0;
+int main() {
+ return 0;
}
-int A::foo()
-{
- return 0;
+int A::foo() {
+ return 0;
}
-
//!TestVirtualSpecifierFromImplementationToHeader
//#org.eclipse.cdt.ui.tests.refactoring.togglefunction.ToggleRefactoringTest
//@.config
@@ -72,34 +64,30 @@ filename=A.h
//@A.h
class A {
- virtual int /*$*/foo/*$$*/();
+ virtual int /*$*/foo/*$$*/();
};
//=
class A {
- virtual int foo()
- {
- return 0;
- }
+ virtual int foo() {
+ return 0;
+ }
};
//@A.cpp
#include "A.h"
-int main()
-{
- return 0;
+int main() {
+ return 0;
}
-int A::foo()
-{
- return 0;
+int A::foo() {
+ return 0;
}
//=
#include "A.h"
-int main()
-{
- return 0;
+int main() {
+ return 0;
}
diff --git a/core/org.eclipse.cdt.ui.tests/resources/refactoring/TranslationunitHelper.rts b/core/org.eclipse.cdt.ui.tests/resources/refactoring/TranslationunitHelper.rts
index 9f0ee14716..721fed9933 100644
--- a/core/org.eclipse.cdt.ui.tests/resources/refactoring/TranslationunitHelper.rts
+++ b/core/org.eclipse.cdt.ui.tests/resources/refactoring/TranslationunitHelper.rts
@@ -7,8 +7,7 @@ offset=27
#ifndef A_H_
#define A_H_
-class A
-{
+class A {
public:
A();
void foo();
@@ -25,8 +24,7 @@ offset=0
//@A.h
typedef int nummere;
-class A
-{
+class A {
public:
A();
};
diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/extractfunction/ExtractFunctionTestSuite.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/extractfunction/ExtractFunctionTestSuite.java
index 0f9339b18a..46d16bd045 100644
--- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/extractfunction/ExtractFunctionTestSuite.java
+++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/extractfunction/ExtractFunctionTestSuite.java
@@ -29,7 +29,7 @@ public class ExtractFunctionTestSuite extends TestSuite {
suite.addTest(RefactoringTester.suite("ExtractMethodPreprocessorRefactoringTests", "resources/refactoring/ExtractMethodPreprocessor.rts"));
suite.addTest(RefactoringTester.suite("Extract Function Templates Tests", "resources/refactoring/ExtractFunctionTemplates.rts"));
suite.addTest(RefactoringTester.suite("Extract Method History Test", "resources/refactoring/ExtractMethodHistory.rts"));
- suite.addTest(RefactoringTester.suite("Extract Function Dublicates Test", "resources/refactoring/ExtractMethodDuplicates.rts"));
+ suite.addTest(RefactoringTester.suite("Extract Function Duplicates Test", "resources/refactoring/ExtractMethodDuplicates.rts"));
return suite;
}
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/extractfunction/ExtractFunctionRefactoring.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/extractfunction/ExtractFunctionRefactoring.java
index 650042f777..e53a3e7f3f 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/extractfunction/ExtractFunctionRefactoring.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/extractfunction/ExtractFunctionRefactoring.java
@@ -885,7 +885,7 @@ public class ExtractFunctionRefactoring extends CRefactoring {
arguments.put(CRefactoringDescription.SELECTION, region.getOffset() + "," + region.getLength()); //$NON-NLS-1$
arguments.put(ExtractFunctionRefactoringDescription.NAME, info.getMethodName());
arguments.put(ExtractFunctionRefactoringDescription.VISIBILITY, info.getVisibility().toString());
- arguments.put(ExtractFunctionRefactoringDescription.REPLACE_DUBLICATES, Boolean.toString(info.isReplaceDuplicates()));
+ arguments.put(ExtractFunctionRefactoringDescription.REPLACE_DUPLICATES, Boolean.toString(info.isReplaceDuplicates()));
return arguments;
}
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/extractfunction/ExtractFunctionRefactoringDescription.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/extractfunction/ExtractFunctionRefactoringDescription.java
index ab64145602..4a9f4da9d9 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/extractfunction/ExtractFunctionRefactoringDescription.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/extractfunction/ExtractFunctionRefactoringDescription.java
@@ -32,7 +32,7 @@ import org.eclipse.cdt.internal.ui.refactoring.utils.VisibilityEnum;
public class ExtractFunctionRefactoringDescription extends CRefactoringDescription {
protected static final String NAME = "name"; //$NON-NLS-1$
protected static final String VISIBILITY = "visibility"; //$NON-NLS-1$
- protected static final String REPLACE_DUBLICATES = "replaceDuplicates"; //$NON-NLS-1$
+ protected static final String REPLACE_DUPLICATES = "replaceDuplicates"; //$NON-NLS-1$
public ExtractFunctionRefactoringDescription(String project, String description,
String comment, Map<String, String> arguments) {
@@ -47,7 +47,7 @@ public class ExtractFunctionRefactoringDescription extends CRefactoringDescripti
info.setMethodName(arguments.get(NAME));
info.setVisibility(VisibilityEnum.getEnumForStringRepresentation(arguments.get(VISIBILITY)));
- info.setReplaceDuplicates(Boolean.parseBoolean(arguments.get(REPLACE_DUBLICATES)));
+ info.setReplaceDuplicates(Boolean.parseBoolean(arguments.get(REPLACE_DUPLICATES)));
proj = getCProject();
file = getFile();

Back to the top