1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-22 06:02:11 +02:00

Bug 461435 - Added options to format pointers in methods

Rules used:
1) Default is right alignment to be compliant with built-in formatter
rules;
2) Pointer with declarator without name will be always left alignment
unless there's a nested declarator;
3) Return value of methods/functions is always left alignment;
4) If left alignment is selected, if space after comma is selected too
for a declaration list, space is always forced after the comma.

Change-Id: I82d5ad130e665e5357644cc59655a558f3fb732f
Signed-off-by: Marco Stornelli <marco.stornelli@gmail.com>
This commit is contained in:
Marco Stornelli 2019-04-12 18:15:16 +02:00
parent 826a0b2c0e
commit f893b77dba
26 changed files with 456 additions and 251 deletions

View file

@ -140,7 +140,7 @@ public class CatchByReferenceQuickFixTest extends QuickFixTestCase {
String result = runQuickFixOneFile(); String result = runQuickFixOneFile();
setPlaceConstRight(before); setPlaceConstRight(before);
assertContainedIn("catch (C const &)", result); //$NON-NLS-1$ assertContainedIn("catch (C const&)", result); //$NON-NLS-1$
} }
} }

View file

@ -63,7 +63,7 @@ public class CreateLocalVariableQuickFixTest extends QuickFixTestCase {
public void testString() throws Exception { public void testString() throws Exception {
loadcode(getAboveComment()); loadcode(getAboveComment());
String result = runQuickFixOneFile(); String result = runQuickFixOneFile();
assertContainedIn("const char* aString;", result); //$NON-NLS-1$ assertContainedIn("const char *aString;", result); //$NON-NLS-1$
} }
// void func() { // void func() {
@ -72,7 +72,7 @@ public class CreateLocalVariableQuickFixTest extends QuickFixTestCase {
public void testWString() throws Exception { public void testWString() throws Exception {
loadcode(getAboveComment()); loadcode(getAboveComment());
String result = runQuickFixOneFile(); String result = runQuickFixOneFile();
assertContainedIn("const wchar_t* aWString;", result); //$NON-NLS-1$ assertContainedIn("const wchar_t *aWString;", result); //$NON-NLS-1$
} }
// void func() { // void func() {

View file

@ -59,9 +59,9 @@ public class InsertBeforeTests extends ChangeGeneratorTest {
return new TestSuite(InsertBeforeTests.class); return new TestSuite(InsertBeforeTests.class);
} }
//int* pi[3]; //int *pi[3];
//int* pi[5][3]; //int *pi[5][3];
public void testArrayModifier() throws Exception { public void testArrayModifier() throws Exception {
compareResult(new ASTVisitor() { compareResult(new ASTVisitor() {
{ {
@ -84,9 +84,9 @@ public class InsertBeforeTests extends ChangeGeneratorTest {
}); });
} }
//int* values = new int[5]; //int *values = new int[5];
//int* values = new int[6][5]; //int *values = new int[6][5];
public void testArraySizeExpression() throws Exception { public void testArraySizeExpression() throws Exception {
compareResult(new ASTVisitor() { compareResult(new ASTVisitor() {
{ {

View file

@ -543,7 +543,7 @@ public class DefaultCodeFormatterConstants {
* @see #NEXT_LINE * @see #NEXT_LINE
* @see #NEXT_LINE_SHIFTED * @see #NEXT_LINE_SHIFTED
* @see #NEXT_LINE_ON_WRAP * @see #NEXT_LINE_ON_WRAP
* @since 6.7 * @since 6.8
*/ */
public static final String FORMATTER_BRACE_POSITION_FOR_LINKAGE_DECLARATION = CCorePlugin.PLUGIN_ID public static final String FORMATTER_BRACE_POSITION_FOR_LINKAGE_DECLARATION = CCorePlugin.PLUGIN_ID
+ ".formatter.brace_position_for_linkage_declaration"; //$NON-NLS-1$ + ".formatter.brace_position_for_linkage_declaration"; //$NON-NLS-1$
@ -760,7 +760,7 @@ public class DefaultCodeFormatterConstants {
* </pre> * </pre>
* @see #TRUE * @see #TRUE
* @see #FALSE * @see #FALSE
* @since 6.7 * @since 6.8
*/ */
public static final String FORMATTER_INDENT_BODY_DECLARATIONS_COMPARE_TO_LINKAGE = CCorePlugin.PLUGIN_ID public static final String FORMATTER_INDENT_BODY_DECLARATIONS_COMPARE_TO_LINKAGE = CCorePlugin.PLUGIN_ID
+ ".formatter.indent_body_declarations_compare_to_linkage"; //$NON-NLS-1$ + ".formatter.indent_body_declarations_compare_to_linkage"; //$NON-NLS-1$
@ -941,6 +941,7 @@ public class DefaultCodeFormatterConstants {
* </pre> * </pre>
* @see CCorePlugin#INSERT * @see CCorePlugin#INSERT
* @see CCorePlugin#DO_NOT_INSERT * @see CCorePlugin#DO_NOT_INSERT
* @since 6.8
*/ */
public static final String FORMATTER_INSERT_NEW_LINE_AFTER_COLON_IN_CONSTRUCTOR_INITIALIZER_LIST = CCorePlugin.PLUGIN_ID public static final String FORMATTER_INSERT_NEW_LINE_AFTER_COLON_IN_CONSTRUCTOR_INITIALIZER_LIST = CCorePlugin.PLUGIN_ID
+ ".formatter.insert_new_line_after_colon_in_constructor_initializer_list"; //$NON-NLS-1$ + ".formatter.insert_new_line_after_colon_in_constructor_initializer_list"; //$NON-NLS-1$
@ -2004,6 +2005,58 @@ public class DefaultCodeFormatterConstants {
*/ */
public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_METHOD_DECLARATION = CCorePlugin.PLUGIN_ID public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_METHOD_DECLARATION = CCorePlugin.PLUGIN_ID
+ ".formatter.insert_space_before_opening_brace_in_method_declaration"; //$NON-NLS-1$ + ".formatter.insert_space_before_opening_brace_in_method_declaration"; //$NON-NLS-1$
/**
* <pre>
* FORMATTER / Option to insert a space before a pointer in a method declaration
* - option id: "org.eclipse.cdt.core.formatter.insert_space_before_pointer_in_method_declaration"
* - possible values: { INSERT, DO_NOT_INSERT }
* - default: INSERT
* </pre>
* @see CCorePlugin#INSERT
* @see CCorePlugin#DO_NOT_INSERT
* @since 6.8
*/
public static final String FORMATTER_INSERT_SPACE_BEFORE_POINTER_IN_METHOD_DECLARATION = CCorePlugin.PLUGIN_ID
+ ".formatter.insert_space_before_pointer_in_method_declaration"; //$NON-NLS-1$
/**
* <pre>
* FORMATTER / Option to insert a space after a pointer in a method declaration
* - option id: "org.eclipse.cdt.core.formatter.insert_space_after_pointer_in_method_declaration"
* - possible values: { INSERT, DO_NOT_INSERT }
* - default: INSERT
* </pre>
* @see CCorePlugin#INSERT
* @see CCorePlugin#DO_NOT_INSERT
* @since 6.8
*/
public static final String FORMATTER_INSERT_SPACE_AFTER_POINTER_IN_METHOD_DECLARATION = CCorePlugin.PLUGIN_ID
+ ".formatter.insert_space_after_pointer_in_method_declaration"; //$NON-NLS-1$
/**
* <pre>
* FORMATTER / Option to insert a space after a pointer in a declarator list
* - option id: "org.eclipse.cdt.core.formatter.insert_space_after_pointer_in_declarator_list"
* - possible values: { INSERT, DO_NOT_INSERT }
* - default: INSERT
* </pre>
* @see CCorePlugin#INSERT
* @see CCorePlugin#DO_NOT_INSERT
* @since 6.8
*/
public static final String FORMATTER_INSERT_SPACE_AFTER_POINTER_IN_DECLARATOR_LIST = CCorePlugin.PLUGIN_ID
+ ".formatter.insert_space_after_pointer_in_declarator_list"; //$NON-NLS-1$
/**
* <pre>
* FORMATTER / Option to insert a space before a pointer in a declarator list
* - option id: "org.eclipse.cdt.core.formatter.insert_space_before_pointer_in_declarator_list"
* - possible values: { INSERT, DO_NOT_INSERT }
* - default: INSERT
* </pre>
* @see CCorePlugin#INSERT
* @see CCorePlugin#DO_NOT_INSERT
* @since 6.8
*/
public static final String FORMATTER_INSERT_SPACE_BEFORE_POINTER_IN_DECLARATOR_LIST = CCorePlugin.PLUGIN_ID
+ ".formatter.insert_space_before_pointer_in_declarator_list"; //$NON-NLS-1$
/** /**
* <pre> * <pre>
* FORMATTER / Option to insert a space before the opening brace in a switch statement * FORMATTER / Option to insert a space before the opening brace in a switch statement
@ -2049,7 +2102,7 @@ public class DefaultCodeFormatterConstants {
* </pre> * </pre>
* @see CCorePlugin#INSERT * @see CCorePlugin#INSERT
* @see CCorePlugin#DO_NOT_INSERT * @see CCorePlugin#DO_NOT_INSERT
* @since 6.7 * @since 6.8
*/ */
public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_LINKAGE_DECLARATION = CCorePlugin.PLUGIN_ID public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_LINKAGE_DECLARATION = CCorePlugin.PLUGIN_ID
+ ".formatter.insert_space_before_opening_brace_in_linkage_declaration"; //$NON-NLS-1$ + ".formatter.insert_space_before_opening_brace_in_linkage_declaration"; //$NON-NLS-1$

View file

@ -168,6 +168,8 @@ public class DefaultCodeFormatterOptions {
public boolean insert_space_after_comma_in_method_invocation_arguments; public boolean insert_space_after_comma_in_method_invocation_arguments;
public boolean insert_space_after_comma_in_method_declaration_parameters; public boolean insert_space_after_comma_in_method_declaration_parameters;
public boolean insert_space_after_comma_in_method_declaration_throws; public boolean insert_space_after_comma_in_method_declaration_throws;
public boolean insert_space_after_pointer_in_declarator_list;
public boolean insert_space_before_pointer_in_declarator_list;
public boolean insert_space_after_comma_in_declarator_list; public boolean insert_space_after_comma_in_declarator_list;
public boolean insert_space_after_comma_in_expression_list; public boolean insert_space_after_comma_in_expression_list;
public boolean insert_space_after_comma_in_base_types; public boolean insert_space_after_comma_in_base_types;
@ -234,6 +236,8 @@ public class DefaultCodeFormatterOptions {
public boolean insert_space_before_opening_brace_in_initializer_list; public boolean insert_space_before_opening_brace_in_initializer_list;
public boolean insert_space_before_opening_brace_in_block; public boolean insert_space_before_opening_brace_in_block;
public boolean insert_space_before_opening_brace_in_method_declaration; public boolean insert_space_before_opening_brace_in_method_declaration;
public boolean insert_space_before_pointer_in_method_declaration;
public boolean insert_space_after_pointer_in_method_declaration;
public boolean insert_space_before_opening_brace_in_type_declaration; public boolean insert_space_before_opening_brace_in_type_declaration;
public boolean insert_space_before_opening_brace_in_namespace_declaration; public boolean insert_space_before_opening_brace_in_namespace_declaration;
/** /**
@ -646,6 +650,15 @@ public class DefaultCodeFormatterOptions {
options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_METHOD_DECLARATION, options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_METHOD_DECLARATION,
this.insert_space_before_opening_brace_in_method_declaration ? CCorePlugin.INSERT this.insert_space_before_opening_brace_in_method_declaration ? CCorePlugin.INSERT
: CCorePlugin.DO_NOT_INSERT); : CCorePlugin.DO_NOT_INSERT);
options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_POINTER_IN_METHOD_DECLARATION,
this.insert_space_before_pointer_in_method_declaration ? CCorePlugin.INSERT
: CCorePlugin.DO_NOT_INSERT);
options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_POINTER_IN_METHOD_DECLARATION,
this.insert_space_after_pointer_in_method_declaration ? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_POINTER_IN_DECLARATOR_LIST,
this.insert_space_after_pointer_in_declarator_list ? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_POINTER_IN_DECLARATOR_LIST,
this.insert_space_before_pointer_in_declarator_list ? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_TYPE_DECLARATION, options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_TYPE_DECLARATION,
this.insert_space_before_opening_brace_in_type_declaration ? CCorePlugin.INSERT this.insert_space_before_opening_brace_in_type_declaration ? CCorePlugin.INSERT
: CCorePlugin.DO_NOT_INSERT); : CCorePlugin.DO_NOT_INSERT);
@ -1847,6 +1860,30 @@ public class DefaultCodeFormatterOptions {
this.insert_space_before_opening_brace_in_method_declaration = CCorePlugin.INSERT this.insert_space_before_opening_brace_in_method_declaration = CCorePlugin.INSERT
.equals(insertSpaceBeforeOpeningBraceInMethodDeclarationOption); .equals(insertSpaceBeforeOpeningBraceInMethodDeclarationOption);
} }
final Object insertSpaceBeforePointerInMethodDeclarationOption = settings
.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_POINTER_IN_METHOD_DECLARATION);
if (insertSpaceBeforePointerInMethodDeclarationOption != null) {
this.insert_space_before_pointer_in_method_declaration = CCorePlugin.INSERT
.equals(insertSpaceBeforePointerInMethodDeclarationOption);
}
final Object insertSpaceAfterPointerInMethodDeclarationOption = settings
.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_POINTER_IN_METHOD_DECLARATION);
if (insertSpaceAfterPointerInMethodDeclarationOption != null) {
this.insert_space_after_pointer_in_method_declaration = CCorePlugin.INSERT
.equals(insertSpaceAfterPointerInMethodDeclarationOption);
}
final Object insertSpaceAfterPointerInDeclaratorListOption = settings
.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_POINTER_IN_DECLARATOR_LIST);
if (insertSpaceAfterPointerInDeclaratorListOption != null) {
this.insert_space_after_pointer_in_declarator_list = CCorePlugin.INSERT
.equals(insertSpaceAfterPointerInDeclaratorListOption);
}
final Object insertSpaceBeforePointerInDeclaratorListOption = settings
.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_POINTER_IN_DECLARATOR_LIST);
if (insertSpaceBeforePointerInDeclaratorListOption != null) {
this.insert_space_before_pointer_in_declarator_list = CCorePlugin.INSERT
.equals(insertSpaceBeforePointerInDeclaratorListOption);
}
final Object insertSpaceBeforeOpeningBraceInTypeDeclarationOption = settings final Object insertSpaceBeforeOpeningBraceInTypeDeclarationOption = settings
.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_TYPE_DECLARATION); .get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_TYPE_DECLARATION);
if (insertSpaceBeforeOpeningBraceInTypeDeclarationOption != null) { if (insertSpaceBeforeOpeningBraceInTypeDeclarationOption != null) {
@ -2259,6 +2296,10 @@ public class DefaultCodeFormatterOptions {
this.insert_space_before_opening_brace_in_initializer_list = true; this.insert_space_before_opening_brace_in_initializer_list = true;
this.insert_space_before_opening_brace_in_block = true; this.insert_space_before_opening_brace_in_block = true;
this.insert_space_before_opening_brace_in_method_declaration = true; this.insert_space_before_opening_brace_in_method_declaration = true;
this.insert_space_before_pointer_in_method_declaration = true;
this.insert_space_after_pointer_in_method_declaration = false;
this.insert_space_before_pointer_in_declarator_list = true;
this.insert_space_after_pointer_in_declarator_list = false;
this.insert_space_before_opening_brace_in_switch = true; this.insert_space_before_opening_brace_in_switch = true;
this.insert_space_before_opening_brace_in_type_declaration = true; this.insert_space_before_opening_brace_in_type_declaration = true;
this.insert_space_before_opening_brace_in_namespace_declaration = true; this.insert_space_before_opening_brace_in_namespace_declaration = true;

View file

@ -303,7 +303,7 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
@Override @Override
public void run() { public void run() {
boolean needSpace = skipConstVolatileRestrict(); boolean needSpace = skipConstVolatileRestrict(true);
int token = peekNextToken(); int token = peekNextToken();
// Ref-qualifier. // Ref-qualifier.
if (token == Token.tAMPER || token == Token.tAND) { if (token == Token.tAMPER || token == Token.tAND) {
@ -830,9 +830,10 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
if (name != null && name.getSimpleID().length != 0 || nestedDecl != null) { if (name != null && name.getSimpleID().length != 0 || nestedDecl != null) {
if (node.getPropertyInParent() != IASTDeclarator.NESTED_DECLARATOR && isFirstDeclarator(node)) { if (node.getPropertyInParent() != IASTDeclarator.NESTED_DECLARATOR && isFirstDeclarator(node)) {
// Preserve non-space between pointer operator and name or nested declarator. // Preserve non-space between pointer operator and name or nested declarator.
if (pointerOperators.length == 0 || scribe.printComment()) { if (pointerOperators.length == 0) {
scribe.space(); scribe.space();
} } else
scribe.printComment();
} }
if (name != null) if (name != null)
name.accept(this); name.accept(this);
@ -1544,11 +1545,11 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
} }
} }
private boolean skipConstVolatileRestrict() { private boolean skipConstVolatileRestrict(boolean spaceBefore) {
boolean skipped = false; boolean skipped = false;
int token = peekNextToken(); int token = peekNextToken();
while (token == Token.t_const || token == Token.t_volatile || token == Token.t_restrict) { while (token == Token.t_const || token == Token.t_volatile || token == Token.t_restrict) {
scribe.printNextToken(token, true); scribe.printNextToken(token, spaceBefore);
token = peekNextToken(); token = peekNextToken();
skipped = true; skipped = true;
} }
@ -1642,6 +1643,61 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
} }
} }
/**
* Align pointers according to user formatter rule. Pointers (or references) can be
* left, center or right alignment. Pointers with implicit name will be always left
* aligned unless they have nested declarators.
* @param pointers The list of all pointers
* @param pointer The pointer to be formatted
* @param token The token to be used: and, amper, star.
*/
private boolean alignPointer(IASTPointerOperator[] pointers, IASTPointerOperator pointer, int token) {
boolean firstPtr = pointer == pointers[0];
boolean lastPtr = pointers.length == 1 || pointer == pointers[pointers.length - 1];
TrailingTokenFormatter tailFormatter = null;
IASTNode parent = pointer.getParent();
boolean needSpace = false;
if (parent instanceof IASTFunctionDeclarator) {
tailFormatter = new TrailingTokenFormatter(token, pointer.getParent(), false, true);
tailFormatter.run();
} else {
if (parent instanceof IASTDeclarator) {
char[] simpleId = ((IASTDeclarator) parent).getName().getSimpleID();
IASTDeclarator nested = ((IASTDeclarator) parent).getNestedDeclarator();
if ((simpleId == null || simpleId.length == 0) && nested == null) {
needSpace = true;
tailFormatter = new TrailingTokenFormatter(token, pointer.getParent(), false, false);
tailFormatter.run();
return needSpace;
}
}
if (parent != null && parent.getParent() instanceof IASTParameterDeclaration) {
needSpace = this.preferences.insert_space_after_pointer_in_method_declaration && lastPtr;
tailFormatter = new TrailingTokenFormatter(token, pointer.getParent(),
this.preferences.insert_space_before_pointer_in_method_declaration && firstPtr,
this.preferences.insert_space_after_pointer_in_method_declaration && lastPtr);
tailFormatter.run();
} else if (parent != null && parent.getParent() instanceof IASTSimpleDeclaration) {
needSpace = this.preferences.insert_space_after_pointer_in_declarator_list && lastPtr;
IASTSimpleDeclaration simple = (IASTSimpleDeclaration) parent.getParent();
IASTDeclarator[] declarators = simple.getDeclarators();
boolean first = declarators.length == 0 || declarators[0].getPointerOperators() == pointers;
tailFormatter = new TrailingTokenFormatter(token, pointer.getParent(),
first ? this.preferences.insert_space_before_pointer_in_declarator_list && firstPtr
: (this.preferences.insert_space_before_pointer_in_declarator_list
|| this.preferences.insert_space_after_comma_in_declarator_list) && firstPtr,
this.preferences.insert_space_after_pointer_in_declarator_list && lastPtr);
tailFormatter.run();
} else
scribe.printNextToken(token, false);
}
return needSpace;
}
/**
* Format pointers operators
* @param pointers The list of pointers
*/
private void formatPointers(IASTPointerOperator[] pointers) { private void formatPointers(IASTPointerOperator[] pointers) {
for (IASTPointerOperator pointer : pointers) { for (IASTPointerOperator pointer : pointers) {
if (scribe.printComment()) { if (scribe.printComment()) {
@ -1652,9 +1708,9 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
} }
if (pointer instanceof ICPPASTReferenceOperator) { if (pointer instanceof ICPPASTReferenceOperator) {
if (((ICPPASTReferenceOperator) pointer).isRValueReference()) { if (((ICPPASTReferenceOperator) pointer).isRValueReference()) {
scribe.printNextToken(Token.tAND, false); alignPointer(pointers, pointer, Token.tAND);
} else { } else {
scribe.printNextToken(Token.tAMPER, false); alignPointer(pointers, pointer, Token.tAMPER);
} }
} else if (pointer instanceof ICPPASTPointerToMember) { } else if (pointer instanceof ICPPASTPointerToMember) {
final ICPPASTPointerToMember ptrToMember = (ICPPASTPointerToMember) pointer; final ICPPASTPointerToMember ptrToMember = (ICPPASTPointerToMember) pointer;
@ -1663,12 +1719,12 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
name.accept(this); name.accept(this);
} }
scribe.printNextToken(Token.tSTAR, false); scribe.printNextToken(Token.tSTAR, false);
if (skipConstVolatileRestrict()) { if (skipConstVolatileRestrict(false)) {
scribe.space(); scribe.space();
} }
} else { } else {
scribe.printNextToken(Token.tSTAR, false); boolean needSpace = alignPointer(pointers, pointer, Token.tSTAR);
if (skipConstVolatileRestrict()) { if (skipConstVolatileRestrict(needSpace)) {
scribe.space(); scribe.space();
} }
} }

View file

@ -1,7 +1,7 @@
void f(const int * const); void f(const int* const);
void f(const int * const) { void f(const int* const) {
} }
@ -11,7 +11,7 @@ int main(int argc, char **argv) {
const int j { 8 }; const int j { 8 };
const int * const klz; const int *const klz;
const int l { 2 }; const int l { 2 };
@ -25,4 +25,4 @@ int main(int argc, char **argv) {
using const_int = int; using const_int = int;
const const_int s = 7; const const_int s = 7;
} }

View file

@ -26,4 +26,4 @@ int main(int argc, char **argv) {
using const_int = int; using const_int = int;
const_int const s = 7; const_int const s = 7;
} }

View file

@ -1,7 +1,7 @@
void f(int const * const); void f(int const* const);
void f(int const * const) { void f(int const* const) {
} }
@ -11,7 +11,7 @@ int main(int argc, char **argv) {
int const j { 8 }; int const j { 8 };
int const * const klz; int const *const klz;
int const l { 2 }; int const l { 2 };
@ -23,4 +23,4 @@ int main(int argc, char **argv) {
using int_const = int; using int_const = int;
int_const const r = 7; int_const const r = 7;
} }

View file

@ -24,4 +24,4 @@ int main(int argc, char **argv) {
using int_const = int; using int_const = int;
const int_const r = 7; const int_const r = 7;
} }

View file

@ -24,8 +24,8 @@ AClass::AClass(int x) throw (int) :
int main(int argc, char **argv) { int main(int argc, char **argv) {
} }
// handling of string concat // handling of string concat
char* s1 = "this " "is " "one " "string."; char *s1 = "this " "is " "one " "string.";
char* s2 = "this " "is " char *s2 = "this " "is "
"one " "string."; "one " "string.";
// macro definition with line comment // macro definition with line comment
#define ID(x) x // identity #define ID(x) x // identity

View file

@ -7,17 +7,17 @@ public:
Point(double x, double y) : Point(double x, double y) :
x(x), y(y) { x(x), y(y) {
} }
double distance(const Point& other) const; double distance(const Point &other) const;
int compareX(const Point& other) const; int compareX(const Point &other) const;
double x; double x;
double y; double y;
}; };
double Point::distance(const Point& other) const { double Point::distance(const Point &other) const {
double dx = x - other.x; double dx = x - other.x;
double dy = y - other.y; double dy = y - other.y;
return sqrt(dx * dx + dy * dy); return sqrt(dx * dx + dy * dy);
} }
int Point::compareX(const Point& other) const { int Point::compareX(const Point &other) const {
if (x < other.x) { if (x < other.x) {
return -1; return -1;
} else if (x > other.x) { } else if (x > other.x) {

View file

@ -8,9 +8,9 @@ struct SimpleStruct {
float floatNum; float floatNum;
}; };
void SimpleStruct_construct(struct SimpleStruct * const s); void SimpleStruct_construct(struct SimpleStruct *const s);
int SimpleStruct_doSomething(const struct SimpleStruct * const s); int SimpleStruct_doSomething(const struct SimpleStruct *const s);
#endif /* SIMPLE_H */ #endif /* SIMPLE_H */
@ -34,14 +34,14 @@ const SimpleStruct array[] = { { SIZEOF(simpleStruct, num),
// single line outside scope // single line outside scope
void SimpleStruct_construct(struct SimpleStruct * const s) { void SimpleStruct_construct(struct SimpleStruct *const s) {
// single line // single line
s->num = 1; s->num = 1;
s->name = "boo"; s->name = "boo";
s->floatNum = 1.5; s->floatNum = 1.5;
} }
int ConnectParams_doSomething(const struct SimpleStruct * const s) { int ConnectParams_doSomething(const struct SimpleStruct *const s) {
/* /*
* multiline * multiline
*/ */

View file

@ -13,16 +13,16 @@ class Foo {
// TEMPLATE_STRUCT // TEMPLATE_STRUCT
template<class Key, class Value, class SortAlgorithm = DefaultSort> template<class Key, class Value, class SortAlgorithm = DefaultSort>
struct Map { struct Map {
Key* keys; Key *keys;
Value* values; Value *values;
SortAlgorithm* sortAlgorithm; SortAlgorithm *sortAlgorithm;
Map(); Map();
}; };
// TEMPLATE_CLASS // TEMPLATE_CLASS
template<class T> class nonVector { template<class T> class nonVector {
private: private:
T* head; T *head;
public: public:
nonVector() { nonVector() {
@ -65,7 +65,7 @@ template<class Bar> void Foo::fum(int i) {
} }
// TEMPLATE_VARIABLES // TEMPLATE_VARIABLES
template<bool threads, int inst> char* default_alloc_template<threads, inst>::S_start_free = template<bool threads, int inst> char *default_alloc_template<threads, inst>::S_start_free =
0; 0;
// an instantiation, not a template: // an instantiation, not a template:

View file

@ -554,24 +554,24 @@ public class ExtractConstantRefactoringTest extends RefactoringTestBase {
//A.h //A.h
//class X { //class X {
// void method() { // void method() {
// char* a = /*$*/"sometext"/*$$*/; // char *a = /*$*/"sometext"/*$$*/;
// } // }
// //
// void method2() { // void method2() {
// const char* b = "sometext"; // const char *b = "sometext";
// } // }
//}; //};
//==================== //====================
//class X { //class X {
// void method() { // void method() {
// char* a = EXTRACTED; // char *a = EXTRACTED;
// } // }
// //
// void method2() { // void method2() {
// const char* b = EXTRACTED; // const char *b = EXTRACTED;
// } // }
// //
// static const char* EXTRACTED = "sometext"; // static const char *EXTRACTED = "sometext";
//}; //};
public void testString() throws Exception { public void testString() throws Exception {
assertRefactoringSuccess(); assertRefactoringSuccess();
@ -580,26 +580,26 @@ public class ExtractConstantRefactoringTest extends RefactoringTestBase {
//A.h //A.h
//class X { //class X {
// void method() { // void method() {
// wchar_t* a = /*$*/L"sometext"/*$$*/; // wchar_t *a = /*$*/L"sometext"/*$$*/;
// } // }
// //
// void method2() { // void method2() {
// const wchar_t* b = L"sometext"; // const wchar_t *b = L"sometext";
// const char* c = "sometext"; // const char *c = "sometext";
// } // }
//}; //};
//==================== //====================
//class X { //class X {
// void method() { // void method() {
// wchar_t* a = EXTRACTED; // wchar_t *a = EXTRACTED;
// } // }
// //
// void method2() { // void method2() {
// const wchar_t* b = EXTRACTED; // const wchar_t *b = EXTRACTED;
// const char* c = "sometext"; // const char *c = "sometext";
// } // }
// //
// static const wchar_t* EXTRACTED = L"sometext"; // static const wchar_t *EXTRACTED = L"sometext";
//}; //};
public void testExtractConstantWideString() throws Exception { public void testExtractConstantWideString() throws Exception {
assertRefactoringSuccess(); assertRefactoringSuccess();

View file

@ -782,7 +782,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
// //
//private: //private:
// int help(); // int help();
// void extracted(int* j); // void extracted(int *j);
//}; //};
// //
//#endif /*A_H_*/ //#endif /*A_H_*/
@ -815,7 +815,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
//A::~A() { //A::~A() {
//} //}
// //
//void A::extracted(int* j) { //void A::extracted(int *j) {
// ++*j; // ++*j;
// help(); // help();
//} //}
@ -850,7 +850,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
// int j; // int j;
//}; //};
// //
//int extracted(const struct A* a) { //int extracted(const struct A *a) {
// return a->i + a->j; // return a->i + a->j;
//} //}
// //
@ -872,7 +872,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
// return i - j; // return i - j;
//} //}
//==================== //====================
//void swap(int* i, int* j) { //void swap(int *i, int *j) {
// int k = *i; // int k = *i;
// *i = *j; // *i = *j;
// *j = k; // *j = k;
@ -907,7 +907,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
//==================== //====================
//#include "A.h" //#include "A.h"
// //
//int extracted(A b, A* a) { //int extracted(A b, A *a) {
// return a->method() + b.const_method(); // return a->method() + b.const_method();
//} //}
// //
@ -923,14 +923,14 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
//A.h //A.h
//class A { //class A {
//public: //public:
// A(int i, const char* s); // A(int i, const char *s);
// int method(); // int method();
//}; //};
//A.cpp //A.cpp
//#include "A.h" //#include "A.h"
// //
//void test(int i, const char* s) { //void test(int i, const char *s) {
// /*$*/A a(i, s);/*$$*/ // /*$*/A a(i, s);/*$$*/
// if (i != 0) // if (i != 0)
// a.method(); // a.method();
@ -938,12 +938,12 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
//==================== //====================
//#include "A.h" //#include "A.h"
// //
//A extracted(int i, const char* s) { //A extracted(int i, const char *s) {
// A a(i, s); // A a(i, s);
// return a; // return a;
//} //}
// //
//void test(int i, const char* s) { //void test(int i, const char *s) {
// A a = extracted(i, s); // A a = extracted(i, s);
// if (i != 0) // if (i != 0)
// a.method(); // a.method();
@ -979,7 +979,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
// //
//private: //private:
// int help(); // int help();
// void extracted(int& i); // void extracted(int &i);
//}; //};
// //
//#endif /*A_H_*/ //#endif /*A_H_*/
@ -1012,7 +1012,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
//A::~A() { //A::~A() {
//} //}
// //
//void A::extracted(int& i) { //void A::extracted(int &i) {
// ++i; // ++i;
// help(); // help();
//} //}
@ -1143,7 +1143,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
// //
//private: //private:
// int help(); // int help();
// int extracted(int i, int y, float x, B* b); // int extracted(int i, int y, float x, B *b);
//}; //};
// //
//#endif /*A_H_*/ //#endif /*A_H_*/
@ -1160,7 +1160,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
//int A::foo() { //int A::foo() {
// int i = 2; // int i = 2;
// float x = i; // float x = i;
// B* b = new B(); // B *b = new B();
// int y = x + i; // int y = x + i;
// /*$*/++i; // /*$*/++i;
// b->hello(y); // b->hello(y);
@ -1182,7 +1182,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
//A::~A() { //A::~A() {
//} //}
// //
//int A::extracted(int i, int y, float x, B* b) { //int A::extracted(int i, int y, float x, B *b) {
// ++i; // ++i;
// b->hello(y); // b->hello(y);
// i = i + x; // i = i + x;
@ -1193,7 +1193,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
//int A::foo() { //int A::foo() {
// int i = 2; // int i = 2;
// float x = i; // float x = i;
// B* b = new B(); // B *b = new B();
// int y = x + i; // int y = x + i;
// i = extracted(i, y, x, b); // i = extracted(i, y, x, b);
// ++x; // ++x;
@ -1238,7 +1238,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
// //
//private: //private:
// int help(); // int help();
// bool extracted(bool y, float x, int& i, B* b); // bool extracted(bool y, float x, int &i, B *b);
//}; //};
// //
//#endif /*A_H_*/ //#endif /*A_H_*/
@ -1255,7 +1255,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
//int A::foo() { //int A::foo() {
// int i = 2; // int i = 2;
// float x = i; // float x = i;
// B* b = new B(); // B *b = new B();
// bool y = false; // bool y = false;
// /*$*/++i; // /*$*/++i;
// b->hello(y); // b->hello(y);
@ -1279,7 +1279,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
//A::~A() { //A::~A() {
//} //}
// //
//bool A::extracted(bool y, float x, int& i, B* b) { //bool A::extracted(bool y, float x, int &i, B *b) {
// ++i; // ++i;
// b->hello(y); // b->hello(y);
// y = !y; // y = !y;
@ -1291,7 +1291,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
//int A::foo() { //int A::foo() {
// int i = 2; // int i = 2;
// float x = i; // float x = i;
// B* b = new B(); // B *b = new B();
// bool y = false; // bool y = false;
// y = extracted(y, x, i, b); // y = extracted(y, x, i, b);
// b->hello(y); // b->hello(y);
@ -1350,7 +1350,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
// //
//private: //private:
// int help(); // int help();
// float extracted(int& i, int y, float x, B* b); // float extracted(int &i, int y, float x, B *b);
//}; //};
// //
//#endif /*A_H_*/ //#endif /*A_H_*/
@ -1367,7 +1367,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
//int A::foo() { //int A::foo() {
// int i = 2; // int i = 2;
// float x = i; // float x = i;
// B* b = new B(); // B *b = new B();
// int y = x + i; // int y = x + i;
// /*$*/++i; // /*$*/++i;
// b->hello(y); // b->hello(y);
@ -1389,7 +1389,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
//A::~A() { //A::~A() {
//} //}
// //
//float A::extracted(int& i, int y, float x, B* b) { //float A::extracted(int &i, int y, float x, B *b) {
// ++i; // ++i;
// b->hello(y); // b->hello(y);
// i = i + x; // i = i + x;
@ -1400,7 +1400,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
//int A::foo() { //int A::foo() {
// int i = 2; // int i = 2;
// float x = i; // float x = i;
// B* b = new B(); // B *b = new B();
// int y = x + i; // int y = x + i;
// x = extracted(i, y, x, b); // x = extracted(i, y, x, b);
// ++x; // ++x;
@ -1459,7 +1459,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
// //
//private: //private:
// int help(); // int help();
// B* extracted(int& i, int y, float x, B* b); // B* extracted(int &i, int y, float x, B *b);
//}; //};
// //
//#endif /*A_H_*/ //#endif /*A_H_*/
@ -1499,7 +1499,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
//A::~A() { //A::~A() {
//} //}
// //
//B* A::extracted(int& i, int y, float x, B* b) { //B* A::extracted(int &i, int y, float x, B *b) {
// ++i; // ++i;
// b->hello(y); // b->hello(y);
// i = i + x; // i = i + x;
@ -1885,7 +1885,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
//==================== //====================
//void print(int i, double a, double b); //void print(int i, double a, double b);
// //
//extracted(double x, int i, double* y, double* s) { //extracted(double x, int i, double *y, double *s) {
// x *= x; // x *= x;
// *y *= i; // *y *= i;
// *s += x / *y; // *s += x / *y;
@ -1972,7 +1972,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
// goto loop4; // goto loop4;
//} //}
//==================== //====================
//int extracted(int a, int b, int* c, int* d) { //int extracted(int a, int b, int *c, int *d) {
// a++; // a++;
// b++; // b++;
// *c++; // *c++;
@ -2107,7 +2107,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
//int main() { //int main() {
// int m_capacity; // int m_capacity;
// /*$*/m_capacity += INITIAL_CAPACITY; // /*$*/m_capacity += INITIAL_CAPACITY;
// string* newElements = new string[m_capacity];/*$$*/ // string *newElements = new string[m_capacity];/*$$*/
// newElements[0] = "s"; // newElements[0] = "s";
//} //}
//==================== //====================
@ -2119,13 +2119,13 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
// //
//string* runTest(int m_capacity) { //string* runTest(int m_capacity) {
// m_capacity += INITIAL_CAPACITY; // m_capacity += INITIAL_CAPACITY;
// string* newElements = new string[m_capacity]; // string *newElements = new string[m_capacity];
// return newElements; // return newElements;
//} //}
// //
//int main() { //int main() {
// int m_capacity; // int m_capacity;
// string* newElements = runTest(m_capacity); // string *newElements = runTest(m_capacity);
// newElements[0] = "s"; // newElements[0] = "s";
//} //}
public void testStringArray() throws Exception { public void testStringArray() throws Exception {
@ -2141,7 +2141,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
//public: //public:
// A(); // A();
// virtual ~A(); // virtual ~A();
// int foo(int& a); // int foo(int &a);
//}; //};
// //
//#endif /*A_H_*/ //#endif /*A_H_*/
@ -2153,10 +2153,10 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
//public: //public:
// A(); // A();
// virtual ~A(); // virtual ~A();
// int foo(int& a); // int foo(int &a);
// //
//private: //private:
// void extracted(int b, int c, int& a); // void extracted(int b, int c, int &a);
//}; //};
// //
//#endif /*A_H_*/ //#endif /*A_H_*/
@ -2170,7 +2170,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
//A::~A() { //A::~A() {
//} //}
// //
//int A::foo(int& a) { //int A::foo(int &a) {
// int b = 7; // int b = 7;
// int c = 8; // int c = 8;
// /*$*/a = b + c;/*$$*/ // /*$*/a = b + c;/*$$*/
@ -2185,11 +2185,11 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
//A::~A() { //A::~A() {
//} //}
// //
//void A::extracted(int b, int c, int& a) { //void A::extracted(int b, int c, int &a) {
// a = b + c; // a = b + c;
//} //}
// //
//int A::foo(int& a) { //int A::foo(int &a) {
// int b = 7; // int b = 7;
// int c = 8; // int c = 8;
// extracted(b, c, a); // extracted(b, c, a);
@ -2301,7 +2301,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
//==================== //====================
//#include "Test.h" //#include "Test.h"
// //
//const A::B* extracted(A* x, const char* y) { //const A::B* extracted(A *x, const char *y) {
// return x->m(y); // return x->m(y);
//} //}
// //
@ -3051,7 +3051,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
// //
//private: //private:
// int help(); // int help();
// int extracted(int j, int& a); // int extracted(int j, int &a);
//}; //};
// //
//#endif /*A_H_*/ //#endif /*A_H_*/
@ -3093,7 +3093,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
// i = extracted(i, j); // i = extracted(i, j);
//} //}
// //
//int A::extracted(int j, int& a) { //int A::extracted(int j, int &a) {
// j++; // j++;
// a++; // a++;
// help(); // help();
@ -3241,7 +3241,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
// //
//private: //private:
// int help(); // int help();
// int extracted(int i, float& j); // int extracted(int i, float &j);
//}; //};
// //
//#endif /*A_H_*/ //#endif /*A_H_*/
@ -3287,7 +3287,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
// blabla += 1; // blabla += 1;
//} //}
// //
//int A::extracted(int i, float& j) { //int A::extracted(int i, float &j) {
// ++i; // ++i;
// j += 1; // j += 1;
// help(); // help();
@ -3425,7 +3425,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
// //
//private: //private:
// int help(); // int help();
// void extracted(int& i, float j); // void extracted(int &i, float j);
//}; //};
// //
//#endif /*A_H_*/ //#endif /*A_H_*/
@ -3468,7 +3468,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
// extracted(oo, blabla); // extracted(oo, blabla);
//} //}
// //
//void A::extracted(int& i, float j) { //void A::extracted(int &i, float j) {
// ++i; // ++i;
// j += 1; // j += 1;
// help(); // help();
@ -3604,7 +3604,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
// //
//private: //private:
// int help(); // int help();
// int extracted(int i, int y, float x, B* b); // int extracted(int i, int y, float x, B *b);
//}; //};
// //
//#endif /*A_H_*/ //#endif /*A_H_*/
@ -3618,7 +3618,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
//A::~A() { //A::~A() {
// int i = 2; // int i = 2;
// float x = i; // float x = i;
// B* b = new B(); // B *b = new B();
// int y = x + i; // int y = x + i;
// ++i; // ++i;
// b->hello(y); // b->hello(y);
@ -3632,7 +3632,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
//int A::foo() { //int A::foo() {
// int i = 2; // int i = 2;
// float x = i; // float x = i;
// B* b = new B(); // B *b = new B();
// int y = x + i; // int y = x + i;
// /*$*/++i; // /*$*/++i;
// b->hello(y); // b->hello(y);
@ -3655,7 +3655,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
//A::~A() { //A::~A() {
// int i = 2; // int i = 2;
// float x = i; // float x = i;
// B* b = new B(); // B *b = new B();
// int y = x + i; // int y = x + i;
// i = extracted(i, y, x, b); // i = extracted(i, y, x, b);
// b->hello(y); // b->hello(y);
@ -3663,7 +3663,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
// i++; // i++;
//} //}
// //
//int A::extracted(int i, int y, float x, B* b) { //int A::extracted(int i, int y, float x, B *b) {
// ++i; // ++i;
// b->hello(y); // b->hello(y);
// i = i + x; // i = i + x;
@ -3674,7 +3674,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
//int A::foo() { //int A::foo() {
// int i = 2; // int i = 2;
// float x = i; // float x = i;
// B* b = new B(); // B *b = new B();
// int y = x + i; // int y = x + i;
// i = extracted(i, y, x, b); // i = extracted(i, y, x, b);
// b->hello(y); // b->hello(y);
@ -3733,7 +3733,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
// //
//private: //private:
// int help(); // int help();
// int extracted(int i, int y, float x, B* b); // int extracted(int i, int y, float x, B *b);
//}; //};
// //
//#endif /*A_H_*/ //#endif /*A_H_*/
@ -3747,7 +3747,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
//A::~A() { //A::~A() {
// int i = 2; // int i = 2;
// float x = i; // float x = i;
// B* b = new B(); // B *b = new B();
// int y = x + i; // int y = x + i;
// ++i; // ++i;
// b->hello(y); // b->hello(y);
@ -3761,7 +3761,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
//int A::foo() { //int A::foo() {
// int i = 2; // int i = 2;
// float x = i; // float x = i;
// B* b = new B(); // B *b = new B();
// int y = x + i; // int y = x + i;
// /*$*/++i; // /*$*/++i;
// b->hello(y); // b->hello(y);
@ -3783,7 +3783,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
//A::~A() { //A::~A() {
// int i = 2; // int i = 2;
// float x = i; // float x = i;
// B* b = new B(); // B *b = new B();
// int y = x + i; // int y = x + i;
// i = extracted(i, y, x, b); // i = extracted(i, y, x, b);
// b->hello(y); // b->hello(y);
@ -3791,7 +3791,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
// i++; // i++;
//} //}
// //
//int A::extracted(int i, int y, float x, B* b) { //int A::extracted(int i, int y, float x, B *b) {
// ++i; // ++i;
// b->hello(y); // b->hello(y);
// i = i + x; // i = i + x;
@ -3802,7 +3802,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
//int A::foo() { //int A::foo() {
// int i = 2; // int i = 2;
// float x = i; // float x = i;
// B* b = new B(); // B *b = new B();
// int y = x + i; // int y = x + i;
// i = extracted(i, y, x, b); // i = extracted(i, y, x, b);
// b->hello(y); // b->hello(y);
@ -4143,7 +4143,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
// //
//private: //private:
// int help(); // int help();
// int extracted(int& i, int b); // int extracted(int &i, int b);
//}; //};
// //
//#endif /*A_H_*/ //#endif /*A_H_*/
@ -4183,7 +4183,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
//A::~A() { //A::~A() {
//} //}
// //
//int A::extracted(int& i, int b) { //int A::extracted(int &i, int b) {
// ++i; // ++i;
// help(); // help();
// ADD(b); // ADD(b);

View file

@ -86,7 +86,7 @@ public class ExtractLocalVariableRefactoringTest extends RefactoringTestBase {
//} //}
//==================== //====================
//const char* foo() { //const char* foo() {
// const char* helloWorld = "Hello World!"; // const char *helloWorld = "Hello World!";
// return helloWorld; // return helloWorld;
//} //}
public void testStringLiteral() throws Exception { public void testStringLiteral() throws Exception {
@ -269,7 +269,7 @@ public class ExtractLocalVariableRefactoringTest extends RefactoringTestBase {
//==================== //====================
//void foo() { //void foo() {
// int a[2]; // int a[2];
// int* i = a + 1; // int *i = a + 1;
// int b = *i; // int b = *i;
//} //}
public void testPointer() throws Exception { public void testPointer() throws Exception {
@ -277,16 +277,16 @@ public class ExtractLocalVariableRefactoringTest extends RefactoringTestBase {
} }
//A.cpp //A.cpp
//const volatile int* k; //const volatile int *k;
// //
//void foo() { //void foo() {
// /*$*/k;/*$$*/ // /*$*/k;/*$$*/
//} //}
//==================== //====================
//const volatile int* k; //const volatile int *k;
// //
//void foo() { //void foo() {
// const volatile int* k0 = k; // const volatile int *k0 = k;
// k0; // k0;
//} //}
public void testQualifiers() throws Exception { public void testQualifiers() throws Exception {
@ -328,7 +328,7 @@ public class ExtractLocalVariableRefactoringTest extends RefactoringTestBase {
// //
//void func() { //void func() {
// int* (*a)[2]; // int* (*a)[2];
// int* (*a0)[2] = a; // int *(*a0)[2] = a;
// a0; // a0;
//} //}
public void testArrayOfFunctionPointers_Bug318784() throws Exception { public void testArrayOfFunctionPointers_Bug318784() throws Exception {

View file

@ -303,7 +303,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
// int systemId; // int systemId;
// //
//protected: //protected:
// char* name; // char *name;
// //
//public: //public:
// const int socSecNo; // const int socSecNo;
@ -314,7 +314,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
// //
// ~Person(); // destructor // ~Person(); // destructor
// //
// char* Name(); // char *Name();
// //
// void Print(); // void Print();
// //
@ -343,7 +343,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
// int systemId; // int systemId;
// //
//protected: //protected:
// char* name; // char *name;
// //
//public: //public:
// const int socSecNo; // const int socSecNo;
@ -354,7 +354,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
// //
// ~Person(); // destructor // ~Person(); // destructor
// //
// char* Name(); // char *Name();
// //
// void Print(); // void Print();
// //
@ -370,7 +370,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
// this->systemId = systemId; // this->systemId = systemId;
// } // }
// //
// void setName(char* name) { // void setName(char *name) {
// this->name = name; // this->name = name;
// } // }
//}; //};
@ -386,7 +386,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
// return socSecNo; // return socSecNo;
//} //}
// //
//int main(int argc, char** argv) { //int main(int argc, char **argv) {
//} //}
//==================== //====================
public void testOneSetterSelection() throws Exception { public void testOneSetterSelection() throws Exception {
@ -403,7 +403,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
// int systemId; // int systemId;
// //
//protected: //protected:
// char* name; // char *name;
// //
//public: //public:
// const int socSecNo; // const int socSecNo;
@ -414,7 +414,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
// //
// ~Person(); // destructor // ~Person(); // destructor
// //
// char* Name(); // char *Name();
// //
// void Print(); // void Print();
// //
@ -443,7 +443,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
// int systemId; // int systemId;
// //
//protected: //protected:
// char* name; // char *name;
// //
//public: //public:
// const int socSecNo; // const int socSecNo;
@ -454,7 +454,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
// //
// ~Person(); // destructor // ~Person(); // destructor
// //
// char* Name(); // char *Name();
// //
// void Print(); // void Print();
// //
@ -474,7 +474,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
// return name; // return name;
// } // }
// //
// void setName(char* name) { // void setName(char *name) {
// this->name = name; // this->name = name;
// } // }
//}; //};
@ -490,7 +490,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
// return socSecNo; // return socSecNo;
//} //}
// //
//int main(int argc, char** argv) { //int main(int argc, char **argv) {
//} //}
//==================== //====================
public void testGetterAndSetterSelection() throws Exception { public void testGetterAndSetterSelection() throws Exception {
@ -508,7 +508,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
// int systemId; // int systemId;
// //
//protected: //protected:
// char* name; // char *name;
// //
//public: //public:
// const int socSecNo; // const int socSecNo;
@ -519,7 +519,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
// //
// ~Person(); // destructor // ~Person(); // destructor
// //
// char* Name(); // char *Name();
// //
// void Print(); // void Print();
// //
@ -540,7 +540,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
// int systemId; // int systemId;
// //
//protected: //protected:
// char* name; // char *name;
// //
//public: //public:
// const int socSecNo; // const int socSecNo;
@ -551,7 +551,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
// //
// ~Person(); // destructor // ~Person(); // destructor
// //
// char* Name(); // char *Name();
// //
// void Print(); // void Print();
// //
@ -563,7 +563,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
// return name; // return name;
// } // }
// //
// void setName(char* name) { // void setName(char *name) {
// this->name = name; // this->name = name;
// } // }
// //
@ -587,7 +587,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
// return socSecNo; // return socSecNo;
//} //}
// //
//int main(int argc, char** argv) { //int main(int argc, char **argv) {
//} //}
//==================== //====================
public void testMultipleSelection() throws Exception { public void testMultipleSelection() throws Exception {
@ -781,9 +781,9 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
//#define A_H_ //#define A_H_
// //
//struct FullName { //struct FullName {
// const char* first; // const char *first;
// const char* last; // const char *last;
// FullName(const FullName& other); // FullName(const FullName &other);
// ~FullName(); // ~FullName();
//}; //};
// //
@ -803,7 +803,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
// //
// ~Person(); // destructor // ~Person(); // destructor
// //
// char* Name(); // char *Name();
// //
// void Print(); // void Print();
// //
@ -824,9 +824,9 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
//#define A_H_ //#define A_H_
// //
//struct FullName { //struct FullName {
// const char* first; // const char *first;
// const char* last; // const char *last;
// FullName(const FullName& other); // FullName(const FullName &other);
// ~FullName(); // ~FullName();
//}; //};
// //
@ -846,7 +846,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
// //
// ~Person(); // destructor // ~Person(); // destructor
// //
// char* Name(); // char *Name();
// //
// void Print(); // void Print();
// //
@ -858,7 +858,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
// //
// void setSystemId(int systemId); // void setSystemId(int systemId);
// const FullName& getName() const; // const FullName& getName() const;
// void setName(const FullName& name); // void setName(const FullName &name);
//}; //};
// //
//int gooo = 1; //int gooo = 1;
@ -872,7 +872,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
// return socSecNo; // return socSecNo;
//} //}
// //
//int main(int argc, char** argv) { //int main(int argc, char **argv) {
//} //}
//==================== //====================
//#include "A.h" //#include "A.h"
@ -881,7 +881,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
// return name; // return name;
//} //}
// //
//void Person::setName(const FullName& name) { //void Person::setName(const FullName &name) {
// this->name = name; // this->name = name;
//} //}
// //
@ -889,7 +889,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
// return socSecNo; // return socSecNo;
//} //}
// //
//int main(int argc, char** argv) { //int main(int argc, char **argv) {
//} //}
public void testPassByReferenceSeparateDefinition() throws Exception { public void testPassByReferenceSeparateDefinition() throws Exception {
definitionSeparate = true; definitionSeparate = true;
@ -1034,7 +1034,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
// int systemId; // int systemId;
// //
//protected: //protected:
// char* name; // char *name;
// //
//public: //public:
// const int socSecNo; // const int socSecNo;
@ -1045,7 +1045,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
// //
// ~Person(); // destructor // ~Person(); // destructor
// //
// char* Name(); // char *Name();
// //
// void Print(); // void Print();
// //
@ -1074,7 +1074,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
// int systemId; // int systemId;
// //
//protected: //protected:
// char* name; // char *name;
// //
//public: //public:
// const int socSecNo; // const int socSecNo;
@ -1085,7 +1085,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
// //
// ~Person(); // destructor // ~Person(); // destructor
// //
// char* Name(); // char *Name();
// //
// void Print(); // void Print();
// //
@ -1101,7 +1101,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
// this->systemId = systemId; // this->systemId = systemId;
// } // }
// //
// void setName(char* name); // void setName(char *name);
//}; //};
// //
//int gooo = 1; //int gooo = 1;
@ -1115,12 +1115,12 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
// return socSecNo; // return socSecNo;
//} //}
// //
//int main(int argc, char** argv) { //int main(int argc, char **argv) {
//} //}
//==================== //====================
//#include "A.h" //#include "A.h"
// //
//void Person::setName(char* name) { //void Person::setName(char *name) {
// this->name = name; // this->name = name;
//} //}
// //
@ -1128,7 +1128,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
// return socSecNo; // return socSecNo;
//} //}
// //
//int main(int argc, char** argv) { //int main(int argc, char **argv) {
//} //}
public void testOneSetterSelectionSeparateDefinition() throws Exception { public void testOneSetterSelectionSeparateDefinition() throws Exception {
definitionSeparate = true; definitionSeparate = true;
@ -1145,7 +1145,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
// int systemId; // int systemId;
// //
//protected: //protected:
// char* name; // char *name;
// //
//public: //public:
// const int socSecNo; // const int socSecNo;
@ -1156,7 +1156,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
// //
// ~Person(); // destructor // ~Person(); // destructor
// //
// char* Name(); // char *Name();
// //
// void Print(); // void Print();
// //
@ -1185,7 +1185,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
// int systemId; // int systemId;
// //
//protected: //protected:
// char* name; // char *name;
// //
//public: //public:
// const int socSecNo; // const int socSecNo;
@ -1196,7 +1196,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
// //
// ~Person(); // destructor // ~Person(); // destructor
// //
// char* Name(); // char *Name();
// //
// void Print(); // void Print();
// //
@ -1213,7 +1213,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
// } // }
// //
// char* getName() const; // char* getName() const;
// void setName(char* name); // void setName(char *name);
//}; //};
// //
//int gooo = 1; //int gooo = 1;
@ -1227,7 +1227,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
// return socSecNo; // return socSecNo;
//} //}
// //
//int main(int argc, char** argv) { //int main(int argc, char **argv) {
//} //}
//==================== //====================
//#include "A.h" //#include "A.h"
@ -1236,7 +1236,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
// return name; // return name;
//} //}
// //
//void Person::setName(char* name) { //void Person::setName(char *name) {
// this->name = name; // this->name = name;
//} //}
// //
@ -1244,7 +1244,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
// return socSecNo; // return socSecNo;
//} //}
// //
//int main(int argc, char** argv) { //int main(int argc, char **argv) {
//} //}
public void testSelectionWithSeparateDefinition() throws Exception { public void testSelectionWithSeparateDefinition() throws Exception {
definitionSeparate = true; definitionSeparate = true;
@ -1618,7 +1618,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
// return b; // return b;
// } // }
// //
// void setB(int* b) { // void setB(int *b) {
// this->b = b; // this->b = b;
// } // }
// //

View file

@ -615,7 +615,7 @@ public class ImplementMethodRefactoringTest extends RefactoringTestBase {
// //
//class TestClass { //class TestClass {
//public: //public:
// /*$*/int* get(char* val);/*$$*/ // /*$*/int* get(char *val);/*$$*/
//}; //};
// //
@ -624,7 +624,7 @@ public class ImplementMethodRefactoringTest extends RefactoringTestBase {
//==================== //====================
//#include "A.h" //#include "A.h"
// //
//int* TestClass::get(char* val) { //int* TestClass::get(char *val) {
//} //}
public void testPointerReturnValue_Bug238253() throws Exception { public void testPointerReturnValue_Bug238253() throws Exception {
assertRefactoringSuccess(); assertRefactoringSuccess();

View file

@ -700,7 +700,7 @@ public class IncludeOrganizerTest extends IncludesTestBase {
//namespace ns3 { //namespace ns3 {
//namespace ns2 { //namespace ns2 {
//namespace ns1 { //namespace ns1 {
//C * f(const A &a, B *b); //C* f(const A &a, B *b);
//} /* namespace ns1 */ //} /* namespace ns1 */
//} /* namespace ns2 */ //} /* namespace ns2 */
//} /* namespace ns3 */ //} /* namespace ns3 */

View file

@ -137,7 +137,7 @@ public class OverrideMethodsRefactoringTest extends RefactoringTestBase {
//class Base { //class Base {
//public: //public:
// virtual ~Base(); // virtual ~Base();
// virtual void baseFunc(Base* ptr) const = 0; // virtual void baseFunc(Base *ptr) const = 0;
//}; //};
//}; //};
//namespace SECOND { //namespace SECOND {
@ -152,14 +152,14 @@ public class OverrideMethodsRefactoringTest extends RefactoringTestBase {
//class Base { //class Base {
//public: //public:
// virtual ~Base(); // virtual ~Base();
// virtual void baseFunc(Base* ptr) const = 0; // virtual void baseFunc(Base *ptr) const = 0;
//}; //};
//}; //};
//namespace SECOND { //namespace SECOND {
//class X: public FIRST::Base { //class X: public FIRST::Base {
//public: //public:
// X(); // X();
// virtual void baseFunc(FIRST::Base* ptr) const; // virtual void baseFunc(FIRST::Base *ptr) const;
//}; //};
//}; //};
@ -168,7 +168,7 @@ public class OverrideMethodsRefactoringTest extends RefactoringTestBase {
//==================== //====================
//#include "A.h" //#include "A.h"
// //
//void SECOND::X::baseFunc(FIRST::Base* ptr) const { //void SECOND::X::baseFunc(FIRST::Base *ptr) const {
//} //}
public void testWithMixedNamespaceHeaderAndSource() throws Exception { public void testWithMixedNamespaceHeaderAndSource() throws Exception {
selectedMethods = new String[] { "baseFunc(FIRST::Base *)const" }; selectedMethods = new String[] { "baseFunc(FIRST::Base *)const" };
@ -538,7 +538,7 @@ public class OverrideMethodsRefactoringTest extends RefactoringTestBase {
//class Base { //class Base {
//public: //public:
// virtual ~Base(); // virtual ~Base();
// virtual void* baseFunc(void* ptr) const = 0; // virtual void* baseFunc(void *ptr) const = 0;
//}; //};
//class X: public Base { //class X: public Base {
//public: //public:
@ -549,12 +549,12 @@ public class OverrideMethodsRefactoringTest extends RefactoringTestBase {
//class Base { //class Base {
//public: //public:
// virtual ~Base(); // virtual ~Base();
// virtual void* baseFunc(void* ptr) const = 0; // virtual void* baseFunc(void *ptr) const = 0;
//}; //};
//class X: public Base { //class X: public Base {
//public: //public:
// X(); // X();
// virtual void* baseFunc(void* ptr) const; // virtual void* baseFunc(void *ptr) const;
//}; //};
//A.cpp //A.cpp
@ -562,7 +562,7 @@ public class OverrideMethodsRefactoringTest extends RefactoringTestBase {
//==================== //====================
//#include "A.h" //#include "A.h"
// //
//void* X::baseFunc(void* ptr) const { //void* X::baseFunc(void *ptr) const {
//} //}
public void testWithPointers() throws Exception { public void testWithPointers() throws Exception {
selectedMethods = new String[] { "baseFunc(void *)const" }; selectedMethods = new String[] { "baseFunc(void *)const" };
@ -573,7 +573,7 @@ public class OverrideMethodsRefactoringTest extends RefactoringTestBase {
//class Base { //class Base {
//public: //public:
// virtual ~Base(); // virtual ~Base();
// virtual void* baseFunc(void* ptr) const = 0, method2(); // virtual void* baseFunc(void *ptr) const = 0, method2();
//}; //};
//class X: public Base { //class X: public Base {
//public: //public:
@ -584,12 +584,12 @@ public class OverrideMethodsRefactoringTest extends RefactoringTestBase {
//class Base { //class Base {
//public: //public:
// virtual ~Base(); // virtual ~Base();
// virtual void* baseFunc(void* ptr) const = 0, method2(); // virtual void* baseFunc(void *ptr) const = 0, method2();
//}; //};
//class X: public Base { //class X: public Base {
//public: //public:
// X(); // X();
// virtual void* baseFunc(void* ptr) const; // virtual void* baseFunc(void *ptr) const;
//}; //};
//A.cpp //A.cpp
@ -597,7 +597,7 @@ public class OverrideMethodsRefactoringTest extends RefactoringTestBase {
//==================== //====================
//#include "A.h" //#include "A.h"
// //
//void* X::baseFunc(void* ptr) const { //void* X::baseFunc(void *ptr) const {
//} //}
public void testWithMultipleMethodsOnSameLine() throws Exception { public void testWithMultipleMethodsOnSameLine() throws Exception {
selectedMethods = new String[] { "baseFunc(void *)const" }; selectedMethods = new String[] { "baseFunc(void *)const" };

View file

@ -632,7 +632,7 @@ public class ToggleRefactoringTest extends RefactoringTestBase {
//class A { //class A {
//public: //public:
// template<typename U, typename V> // template<typename U, typename V>
// void /*$*/foo/*$$*/(const U& u, const V& v) { // void /*$*/foo/*$$*/(const U &u, const V &v) {
// return; // return;
// } // }
//}; //};
@ -641,12 +641,12 @@ public class ToggleRefactoringTest extends RefactoringTestBase {
//class A { //class A {
//public: //public:
// template<typename U, typename V> // template<typename U, typename V>
// void foo(const U& u, const V& v); // void foo(const U &u, const V &v);
//}; //};
// //
//template<typename T, typename S> //template<typename T, typename S>
//template<typename U, typename V> //template<typename U, typename V>
//inline void A<T, S>::foo(const U& u, const V& v) { //inline void A<T, S>::foo(const U &u, const V &v) {
// return; // return;
//} //}
public void testTestComplexTemplateFunctionFromInClassToInHeader() throws Exception { public void testTestComplexTemplateFunctionFromInClassToInHeader() throws Exception {
@ -663,7 +663,7 @@ public class ToggleRefactoringTest extends RefactoringTestBase {
// //
//template<typename T, typename S> //template<typename T, typename S>
//template<typename U, typename V> //template<typename U, typename V>
//inline void A<T,S>::foo(const U& u, const V& v) { //inline void A<T,S>::foo(const U &u, const V &v) {
// return; // return;
//} //}
//==================== //====================
@ -671,7 +671,7 @@ public class ToggleRefactoringTest extends RefactoringTestBase {
//class A { //class A {
//public: //public:
// template<typename U, typename V> // template<typename U, typename V>
// void foo(const U& u, const V& v) { // void foo(const U &u, const V &v) {
// return; // return;
// } // }
//}; //};
@ -959,7 +959,7 @@ public class ToggleRefactoringTest extends RefactoringTestBase {
// try { // try {
// return; // return;
// } // }
// catch (std::exception& e1){ // catch (std::exception &e1){
// return; // return;
// } // }
//}; //};
@ -975,7 +975,7 @@ public class ToggleRefactoringTest extends RefactoringTestBase {
//try { //try {
// return; // return;
//} //}
//catch (std::exception& e1) { //catch (std::exception &e1) {
// return; // return;
//} //}
public void testTestTryCatchFromInClassToInHeader() throws Exception { public void testTestTryCatchFromInClassToInHeader() throws Exception {
@ -1022,7 +1022,7 @@ public class ToggleRefactoringTest extends RefactoringTestBase {
//try { //try {
// return; // return;
//} //}
//catch (std::exception& e1) { //catch (std::exception &e1) {
// return; // return;
//} //}
public void testTestTryCatchFromInHeaderToImplementation() throws Exception { public void testTestTryCatchFromInHeaderToImplementation() throws Exception {
@ -1066,7 +1066,7 @@ public class ToggleRefactoringTest extends RefactoringTestBase {
// try { // try {
// return; // return;
// } // }
// catch (std::exception& e1) { // catch (std::exception &e1) {
// return; // return;
// } // }
//}; //};
@ -1083,10 +1083,10 @@ public class ToggleRefactoringTest extends RefactoringTestBase {
// try { // try {
// return; // return;
// } // }
// catch (std::exception& e1) { // catch (std::exception &e1) {
// return; // return;
// } // }
// catch (std::exception& e2) { // catch (std::exception &e2) {
// return; // return;
// } // }
//}; //};
@ -1102,10 +1102,10 @@ public class ToggleRefactoringTest extends RefactoringTestBase {
//try { //try {
// return; // return;
//} //}
//catch (std::exception& e1) { //catch (std::exception &e1) {
// return; // return;
//} //}
//catch (std::exception& e2) { //catch (std::exception &e2) {
// return; // return;
//} //}
public void testTestMultipleTryCatchFromInClassToInHeader() throws Exception { public void testTestMultipleTryCatchFromInClassToInHeader() throws Exception {
@ -1155,10 +1155,10 @@ public class ToggleRefactoringTest extends RefactoringTestBase {
//try { //try {
// return; // return;
//} //}
//catch (std::exception& e1) { //catch (std::exception &e1) {
// return; // return;
//} //}
//catch (std::exception& e2) { //catch (std::exception &e2) {
// return; // return;
//} //}
public void testTestMultipleTryCatchFromInHeaderToImplementation() throws Exception { public void testTestMultipleTryCatchFromInHeaderToImplementation() throws Exception {
@ -1205,10 +1205,10 @@ public class ToggleRefactoringTest extends RefactoringTestBase {
// try { // try {
// return; // return;
// } // }
// catch (std::exception& e1) { // catch (std::exception &e1) {
// return; // return;
// } // }
// catch (std::exception& e2) { // catch (std::exception &e2) {
// return; // return;
// } // }
//}; //};
@ -1787,7 +1787,7 @@ public class ToggleRefactoringTest extends RefactoringTestBase {
// } // }
//}; //};
// //
//int freeFunction(int* a, int& b); //int freeFunction(int *a, int &b);
//A.cpp //A.cpp
//#include "A.h" //#include "A.h"
@ -1802,7 +1802,7 @@ public class ToggleRefactoringTest extends RefactoringTestBase {
// return 0; // return 0;
//} //}
// //
//int freeFunction(int* a, int& b) { //int freeFunction(int *a, int &b) {
// return 42; // return 42;
//} //}
public void testTestFreeFunctionToggleFromHeaderToImplementation() throws Exception { public void testTestFreeFunctionToggleFromHeaderToImplementation() throws Exception {
@ -1842,7 +1842,7 @@ public class ToggleRefactoringTest extends RefactoringTestBase {
// } // }
//}; //};
// //
//int freeFunction(int* a, int& b); //int freeFunction(int *a, int &b);
//==================== //====================
//#include <iostream> //#include <iostream>
// //
@ -1859,7 +1859,7 @@ public class ToggleRefactoringTest extends RefactoringTestBase {
// } // }
//}; //};
// //
//int freeFunction(int* a, int& b) { //int freeFunction(int *a, int &b) {
// return 42; // return 42;
//} //}
public void testTestFreeFunctionToggleFromImplementationToHeaderWithDeclaration() throws Exception { public void testTestFreeFunctionToggleFromImplementationToHeaderWithDeclaration() throws Exception {
@ -1917,11 +1917,11 @@ public class ToggleRefactoringTest extends RefactoringTestBase {
// } // }
//}; //};
// //
//int freeFunction(int* a, int& b) //int freeFunction(int *a, int &b)
//try { //try {
// return 42; // return 42;
//} //}
//catch (std::exception& e) { //catch (std::exception &e) {
//} //}
public void testTestFreeFunctionToggleFromImplementationToHeaderWithOutDeclaration() throws Exception { public void testTestFreeFunctionToggleFromImplementationToHeaderWithOutDeclaration() throws Exception {
assertRefactoringSuccess(); assertRefactoringSuccess();

View file

@ -142,7 +142,7 @@ public class CodeFormatterTest extends BaseUITestCase {
//pvar; //pvar;
//int var; //int var;
//int* pvar; //int *pvar;
public void testSpaceBetweenTypeAndIdentifier_Bug194603() throws Exception { public void testSpaceBetweenTypeAndIdentifier_Bug194603() throws Exception {
assertFormatterResult(); assertFormatterResult();
} }
@ -229,7 +229,7 @@ public class CodeFormatterTest extends BaseUITestCase {
//}; //};
// //
//void test() { //void test() {
// ClassWithALongName* variable_with_a_long_name; // ClassWithALongName *variable_with_a_long_name;
// for (ClassWithALongName::Iterator iter_for_class_with_a_long_name = // for (ClassWithALongName::Iterator iter_for_class_with_a_long_name =
// variable_with_a_long_name->getIterator(); // variable_with_a_long_name->getIterator();
// !iter_for_class_with_a_long_name.isDone(); // !iter_for_class_with_a_long_name.isDone();
@ -416,7 +416,7 @@ public class CodeFormatterTest extends BaseUITestCase {
// return 2; // return 2;
//} //}
//int main(int argc, char const int* argv[]) //int main(int argc, char const int *argv[])
//try { //try {
// for (int i = 1; i < argc; ++i) { // for (int i = 1; i < argc; ++i) {
// } // }
@ -434,7 +434,7 @@ public class CodeFormatterTest extends BaseUITestCase {
//int main(int argc, char const int * argv[]) { try { for (int i = 1; i < argc; ++i) { } return 0; } catch (float e) { return 1; } catch (...) { return 2; } } //int main(int argc, char const int * argv[]) { try { for (int i = 1; i < argc; ++i) { } return 0; } catch (float e) { return 1; } catch (...) { return 2; } }
//int main(int argc, char const int * argv[]) { //int main(int argc, char const int *argv[]) {
// try { // try {
// for (int i = 1; i < argc; ++i) { // for (int i = 1; i < argc; ++i) {
// } // }
@ -556,7 +556,7 @@ public class CodeFormatterTest extends BaseUITestCase {
//void f() { //void f() {
// int *px = ::new int(0); // int *px = ::new int(0);
// int* py[] = new int[5](0, 1, 2, 3, 4); // int *py[] = new int[5](0, 1, 2, 3, 4);
// int *pz[] = new (px) int(0); // int *pz[] = new (px) int(0);
// delete[] py; // delete[] py;
// ::delete px; // ::delete px;
@ -600,11 +600,11 @@ public class CodeFormatterTest extends BaseUITestCase {
//static void* h(); //static void* h();
//int* (*a) [2]; //int* (*a) [2];
//static void *f() { //static void* f() {
//} //}
//static void * g(); //static void* g();
//static void* h(); //static void* h();
//int* (*a)[2]; //int *(*a)[2];
public void testSpaceBetweenDeclSpecAndDeclarator() throws Exception { public void testSpaceBetweenDeclSpecAndDeclarator() throws Exception {
assertFormatterResult(); assertFormatterResult();
} }
@ -701,7 +701,7 @@ public class CodeFormatterTest extends BaseUITestCase {
//}; //};
// //
//void test() { //void test() {
// ClassWithALongName* variable_with_a_long_name = // ClassWithALongName *variable_with_a_long_name =
// variable_with_a_long_name->methodWithAQuiteLongName(); // variable_with_a_long_name->methodWithAQuiteLongName();
// variable_with_a_long_name = // variable_with_a_long_name =
// variable_with_a_long_name->methodWithAQuiteLongName(); // variable_with_a_long_name->methodWithAQuiteLongName();
@ -731,8 +731,8 @@ public class CodeFormatterTest extends BaseUITestCase {
//}; //};
// //
//void test() { //void test() {
// ClassWithALongName* variable_with_a_long_name; // ClassWithALongName *variable_with_a_long_name;
// ClassWithALongName* another_variable = variable_with_a_long_name // ClassWithALongName *another_variable = variable_with_a_long_name
// ->methodWithALongName()->anotherMethodWithALongName(); // ->methodWithALongName()->anotherMethodWithALongName();
//} //}
public void testMemberAccess() throws Exception { public void testMemberAccess() throws Exception {
@ -831,7 +831,7 @@ public class CodeFormatterTest extends BaseUITestCase {
// EAbout // EAbout
// }; // };
// //
//CActiveScheduler* scheduler = new (ELeave) CActiveScheduler(); //CActiveScheduler *scheduler = new (ELeave) CActiveScheduler();
public void testFormatterRegressions_Bug225858() throws Exception { public void testFormatterRegressions_Bug225858() throws Exception {
fOptions.putAll(DefaultCodeFormatterOptions.getWhitesmithsSettings().getMap()); fOptions.putAll(DefaultCodeFormatterOptions.getWhitesmithsSettings().getMap());
assertFormatterResult(); assertFormatterResult();
@ -1044,14 +1044,14 @@ public class CodeFormatterTest extends BaseUITestCase {
// if (D::iterator it = m.find(e)) // if (D::iterator it = m.find(e))
// m.erase(it); // m.erase(it);
//} //}
//T* A::b(T* t) { //T* A::b(T *t) {
// S::iterator it = m.find(t); // S::iterator it = m.find(t);
// if (!it) // if (!it)
// return NULL; // return NULL;
// else // else
// return *it; // return *it;
//} //}
//M* A::c(M* tm) { //M* A::c(M *tm) {
// N::iterator it = myN.find(tm); // N::iterator it = myN.find(tm);
// if (!it) // if (!it)
// return NULL; // return NULL;
@ -1087,13 +1087,13 @@ public class CodeFormatterTest extends BaseUITestCase {
//void f3(const char* long_parameter_name,int very_loooooooooooong_parameter_name,int very_loong_parameter_name) ; //void f3(const char* long_parameter_name,int very_loooooooooooong_parameter_name,int very_loong_parameter_name) ;
//void f4(const char* long_parameter_name, int very_loooooooooooong_parameter_name,int very_looong_parameter_name) ; //void f4(const char* long_parameter_name, int very_loooooooooooong_parameter_name,int very_looong_parameter_name) ;
//void f1(const char* long_parameter_name, int very_looooooooooong_parameter_name, //void f1(const char *long_parameter_name, int very_looooooooooong_parameter_name,
// int another_parameter_name); // int another_parameter_name);
//void f2(const char* long_parameter_name, //void f2(const char *long_parameter_name,
// int very_loooooooooooong_parameter_name, int another_parameter_name); // int very_loooooooooooong_parameter_name, int another_parameter_name);
//void f3(const char* long_parameter_name, //void f3(const char *long_parameter_name,
// int very_loooooooooooong_parameter_name, int very_loong_parameter_name); // int very_loooooooooooong_parameter_name, int very_loong_parameter_name);
//void f4(const char* long_parameter_name, //void f4(const char *long_parameter_name,
// int very_loooooooooooong_parameter_name, // int very_loooooooooooong_parameter_name,
// int very_looong_parameter_name); // int very_looong_parameter_name);
public void testFunctionDeclaration() throws Exception { public void testFunctionDeclaration() throws Exception {
@ -1108,11 +1108,11 @@ public class CodeFormatterTest extends BaseUITestCase {
//const char* function_name2(const char* parameter_name, const char* another_parameter_name, //const char* function_name2(const char* parameter_name, const char* another_parameter_name,
//int very_looooooooooooooooooooooooong_parameter_name); //int very_looooooooooooooooooooooooong_parameter_name);
//const char* function_name1(const char* parameter_name, //const char* function_name1(const char *parameter_name,
// const char* another_parameter_name, // const char *another_parameter_name,
// int very_loooooooooooooooooooooooong_parameter_name); // int very_loooooooooooooooooooooooong_parameter_name);
//const char* function_name2( //const char* function_name2(
// const char* parameter_name, const char* another_parameter_name, // const char *parameter_name, const char *another_parameter_name,
// int very_looooooooooooooooooooooooong_parameter_name); // int very_looooooooooooooooooooooooong_parameter_name);
public void testFunctionDeclarationFallbackFormat() throws Exception { public void testFunctionDeclarationFallbackFormat() throws Exception {
fOptions.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, CCorePlugin.SPACE); fOptions.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, CCorePlugin.SPACE);
@ -1131,8 +1131,8 @@ public class CodeFormatterTest extends BaseUITestCase {
//#define ABSTRACT = 0 //#define ABSTRACT = 0
// //
//class A { //class A {
// virtual bool function_with_a_loooooong_name(const char* parameter) ABSTRACT; // virtual bool function_with_a_loooooong_name(const char *parameter) ABSTRACT;
// virtual bool function_with_a_looooooong_name(const char* parameter) // virtual bool function_with_a_looooooong_name(const char *parameter)
// ABSTRACT; // ABSTRACT;
//}; //};
public void testFunctionDeclarationTrailingMacro_1() throws Exception { public void testFunctionDeclarationTrailingMacro_1() throws Exception {
@ -1168,9 +1168,9 @@ public class CodeFormatterTest extends BaseUITestCase {
//void f1(const char* long_parameter_name,int very_looooooooong_parameter_name){} //void f1(const char* long_parameter_name,int very_looooooooong_parameter_name){}
//void f2(const char* long_parameter_name,int very_loooooooooong_parameter_name){} //void f2(const char* long_parameter_name,int very_loooooooooong_parameter_name){}
//void f1(const char* long_parameter_name, int very_looooooooong_parameter_name) { //void f1(const char *long_parameter_name, int very_looooooooong_parameter_name) {
//} //}
//void f2(const char* long_parameter_name, //void f2(const char *long_parameter_name,
// int very_loooooooooong_parameter_name) { // int very_loooooooooong_parameter_name) {
//} //}
public void testFunctionDefinition() throws Exception { public void testFunctionDefinition() throws Exception {
@ -1322,14 +1322,14 @@ public class CodeFormatterTest extends BaseUITestCase {
assertFormatterResult(); assertFormatterResult();
} }
//void function(const char* s); //void function(const char *s);
// //
//void test() { //void test() {
//function("string literal" //function("string literal"
//"continuation of the string literal"); //"continuation of the string literal");
//} //}
//void function(const char* s); //void function(const char *s);
// //
//void test() { //void test() {
// function("string literal" // function("string literal"
@ -1548,9 +1548,9 @@ public class CodeFormatterTest extends BaseUITestCase {
assertFormatterResult(); assertFormatterResult();
} }
//char *b, * const a; //char *b, *const a;
//char *b, * const a; //char *b, *const a;
public void testPreserveSpaceBetweenPointerModifierAndIdentifier_Bug243056() throws Exception { public void testPreserveSpaceBetweenPointerModifierAndIdentifier_Bug243056() throws Exception {
assertFormatterResult(); assertFormatterResult();
} }
@ -2204,7 +2204,7 @@ public class CodeFormatterTest extends BaseUITestCase {
//#define new new(__FILE__, __LINE__) //#define new new(__FILE__, __LINE__)
//void func() { //void func() {
// char* a = new char[10]; // char *a = new char[10];
//} //}
public void testPlacementNewAsMacro_Bug298593() throws Exception { public void testPlacementNewAsMacro_Bug298593() throws Exception {
assertFormatterResult(); assertFormatterResult();
@ -2227,7 +2227,7 @@ public class CodeFormatterTest extends BaseUITestCase {
//if (x == 0) x = 5;} //if (x == 0) x = 5;}
//void f() { //void f() {
// w_char* p = L"wide string literal"; // w_char *p = L"wide string literal";
// int x = 0; // int x = 0;
// if (x == 0) // if (x == 0)
// x = 5; // x = 5;
@ -2305,7 +2305,7 @@ public class CodeFormatterTest extends BaseUITestCase {
//void f() { //void f() {
// int array[5] = { 1, 2, 3, 4, 5 }; // int array[5] = { 1, 2, 3, 4, 5 };
// for (int& x : array) // for (int &x : array)
// x *= 2; // x *= 2;
//} //}
public void testRangeBasedFor_Bug328472() throws Exception { public void testRangeBasedFor_Bug328472() throws Exception {
@ -2506,7 +2506,7 @@ public class CodeFormatterTest extends BaseUITestCase {
//} //}
//class Stream { //class Stream {
// Stream& operator<<(const char* s); // Stream& operator<<(const char *s);
//}; //};
// //
//class Voidifier { //class Voidifier {
@ -2544,7 +2544,7 @@ public class CodeFormatterTest extends BaseUITestCase {
//} //}
//class Stream { //class Stream {
// Stream& operator<<(const char* s); // Stream& operator<<(const char *s);
//}; //};
// //
//class Voidifier { //class Voidifier {
@ -2568,7 +2568,7 @@ public class CodeFormatterTest extends BaseUITestCase {
} }
//class Stream { //class Stream {
//Stream& operator<<(const char* s); //Stream& operator<<(const char *s);
//}; //};
//const char* function(); //const char* function();
// //
@ -2578,7 +2578,7 @@ public class CodeFormatterTest extends BaseUITestCase {
//} //}
//class Stream { //class Stream {
// Stream& operator<<(const char* s); // Stream& operator<<(const char *s);
//}; //};
//const char* function(); //const char* function();
// //
@ -2595,7 +2595,7 @@ public class CodeFormatterTest extends BaseUITestCase {
} }
//class Stream { //class Stream {
//Stream& operator<<(const char* s); //Stream& operator<<(const char *s);
//Stream& operator<<(int i); //Stream& operator<<(int i);
//}; //};
// //
@ -2608,7 +2608,7 @@ public class CodeFormatterTest extends BaseUITestCase {
//} //}
//class Stream { //class Stream {
// Stream& operator<<(const char* s); // Stream& operator<<(const char *s);
// Stream& operator<<(int i); // Stream& operator<<(int i);
//}; //};
// //
@ -2727,7 +2727,7 @@ public class CodeFormatterTest extends BaseUITestCase {
// //
//#define MY_MACRO(a) (a) ? (void) 0 : Voidifier() & GetStream() << " " //#define MY_MACRO(a) (a) ? (void) 0 : Voidifier() & GetStream() << " "
// //
//void test(const char* variable_with_a_loooong_name) { //void test(const char *variable_with_a_loooong_name) {
// MY_MACRO(loooooooooooong_name(loooong_name, // MY_MACRO(loooooooooooong_name(loooong_name,
// very_loooooooooooooooooooooooong_name)) // very_loooooooooooooooooooooooong_name))
// << variable_with_a_loooong_name; // << variable_with_a_loooong_name;
@ -2961,7 +2961,7 @@ public class CodeFormatterTest extends BaseUITestCase {
//struct { //struct {
// int n; // int n;
//}* l; //} *l;
//void f(int p0, int p1) { //void f(int p0, int p1) {
// f((p0 + 2), l->n); // f((p0 + 2), l->n);
//} //}
@ -3830,7 +3830,7 @@ public class CodeFormatterTest extends BaseUITestCase {
// } // }
//}; //};
////explicit instantiation ////explicit instantiation
//template bool data::operator< <int>(int const &) const; //template bool data::operator< <int>(int const&) const;
//class data { //class data {
//public: //public:
@ -3839,7 +3839,7 @@ public class CodeFormatterTest extends BaseUITestCase {
// } // }
//}; //};
////explicit instantiation ////explicit instantiation
//template bool data::operator< <int>(int const &) const; //template bool data::operator< <int>(int const&) const;
public void testTemplateInstantiationOperatorLesser_Bug540252() throws Exception { public void testTemplateInstantiationOperatorLesser_Bug540252() throws Exception {
assertFormatterResult(); assertFormatterResult();
} }
@ -3865,7 +3865,7 @@ public class CodeFormatterTest extends BaseUITestCase {
//void func() { //void func() {
// try { // try {
// WW("1") << "2"; // WW("1") << "2";
// } catch (const std::exception& e) { // } catch (const std::exception &e) {
// std::cout << "blah...." << std::endl; // std::cout << "blah...." << std::endl;
// } // }
//} //}

View file

@ -87,6 +87,8 @@ final class FormatterMessages extends NLS {
public static String WhiteSpaceTabPage_after_opening_brace; public static String WhiteSpaceTabPage_after_opening_brace;
public static String WhiteSpaceTabPage_after_closing_brace; public static String WhiteSpaceTabPage_after_closing_brace;
public static String WhiteSpaceTabPage_before_opening_brace; public static String WhiteSpaceTabPage_before_opening_brace;
public static String WhiteSpaceTabPage_before_pointer;
public static String WhiteSpaceTabPage_after_pointer;
public static String WhiteSpaceTabPage_before_closing_brace; public static String WhiteSpaceTabPage_before_closing_brace;
public static String WhiteSpaceTabPage_between_empty_braces; public static String WhiteSpaceTabPage_between_empty_braces;
public static String WhiteSpaceTabPage_after_opening_paren; public static String WhiteSpaceTabPage_after_opening_paren;
@ -128,6 +130,7 @@ final class FormatterMessages extends NLS {
public static String WhiteSpaceOptions_prefix_operator; public static String WhiteSpaceOptions_prefix_operator;
public static String WhiteSpaceOptions_postfix_operator; public static String WhiteSpaceOptions_postfix_operator;
public static String WhiteSpaceOptions_opening_paren; public static String WhiteSpaceOptions_opening_paren;
public static String WhiteSpaceOptions_pointer;
public static String WhiteSpaceOptions_catch; public static String WhiteSpaceOptions_catch;
public static String WhiteSpaceOptions_for; public static String WhiteSpaceOptions_for;
public static String WhiteSpaceOptions_if; public static String WhiteSpaceOptions_if;
@ -170,6 +173,8 @@ final class FormatterMessages extends NLS {
public static String WhiteSpaceOptions_case; public static String WhiteSpaceOptions_case;
public static String WhiteSpaceOptions_default; public static String WhiteSpaceOptions_default;
public static String WhiteSpaceOptions_statements; public static String WhiteSpaceOptions_statements;
public static String WhiteSpaceOptions_before_pointer;
public static String WhiteSpaceOptions_after_pointer;
public static String WhiteSpaceOptions_before_opening_paren; public static String WhiteSpaceOptions_before_opening_paren;
public static String WhiteSpaceOptions_after_opening_paren; public static String WhiteSpaceOptions_after_opening_paren;
public static String WhiteSpaceOptions_before_closing_paren; public static String WhiteSpaceOptions_before_closing_paren;

View file

@ -92,6 +92,8 @@ WhiteSpaceTabPage_after_closing_brace=after closing brace
WhiteSpaceTabPage_before_opening_brace=before opening brace WhiteSpaceTabPage_before_opening_brace=before opening brace
WhiteSpaceTabPage_before_closing_brace=before closing brace WhiteSpaceTabPage_before_closing_brace=before closing brace
WhiteSpaceTabPage_between_empty_braces=between empty braces WhiteSpaceTabPage_between_empty_braces=between empty braces
WhiteSpaceTabPage_before_pointer=before pointers
WhiteSpaceTabPage_after_pointer=after pointers
WhiteSpaceTabPage_after_opening_paren=after opening parenthesis WhiteSpaceTabPage_after_opening_paren=after opening parenthesis
WhiteSpaceTabPage_after_closing_paren=after closing parenthesis WhiteSpaceTabPage_after_closing_paren=after closing parenthesis
@ -139,6 +141,10 @@ WhiteSpaceOptions_unary_operator=Unary operator
WhiteSpaceOptions_prefix_operator=Prefix operator WhiteSpaceOptions_prefix_operator=Prefix operator
WhiteSpaceOptions_postfix_operator=Postfix operator WhiteSpaceOptions_postfix_operator=Postfix operator
WhiteSpaceOptions_pointer=Pointer
WhiteSpaceOptions_before_pointer=Before pointer
WhiteSpaceOptions_after_pointer=After pointer
WhiteSpaceOptions_opening_paren=Opening parenthesis WhiteSpaceOptions_opening_paren=Opening parenthesis
WhiteSpaceOptions_catch='catch' WhiteSpaceOptions_catch='catch'
WhiteSpaceOptions_for='for' WhiteSpaceOptions_for='for'

View file

@ -177,7 +177,8 @@ public final class WhiteSpaceOptions {
private final PreviewSnippet METHOD_DECL_PREVIEW = new PreviewSnippet(CodeFormatter.K_CLASS_BODY_DECLARATIONS, private final PreviewSnippet METHOD_DECL_PREVIEW = new PreviewSnippet(CodeFormatter.K_CLASS_BODY_DECLARATIONS,
"void foo() throw(E0, E1) {}" + //$NON-NLS-1$ "void foo() throw(E0, E1) {}" + //$NON-NLS-1$
"void bar(int x, int y) throw() {}"); //$NON-NLS-1$ "void bar(int x, int y) throw() {}" + //$NON-NLS-1$
"void* baz(int* x, int& y) {return 0;}"); //$NON-NLS-1$
private final PreviewSnippet INITIALIZER_LIST_PREVIEW = new PreviewSnippet(CodeFormatter.K_STATEMENTS, private final PreviewSnippet INITIALIZER_LIST_PREVIEW = new PreviewSnippet(CodeFormatter.K_STATEMENTS,
"int array[]= {1, 2, 3};"); //$NON-NLS-1$ "int array[]= {1, 2, 3};"); //$NON-NLS-1$
@ -213,7 +214,7 @@ public final class WhiteSpaceOptions {
"a= 0, b= 1, c= 2, d= 3;"); //$NON-NLS-1$ "a= 0, b= 1, c= 2, d= 3;"); //$NON-NLS-1$
private final PreviewSnippet DECLARATOR_LIST_PREVIEW = new PreviewSnippet(CodeFormatter.K_STATEMENTS, private final PreviewSnippet DECLARATOR_LIST_PREVIEW = new PreviewSnippet(CodeFormatter.K_STATEMENTS,
"int a=0,b=1,c=2,d=3;"); //$NON-NLS-1$ "int a=0,b=1,c=2,d=3;\nint *e, *f;"); //$NON-NLS-1$
private final PreviewSnippet BLOCK_PREVIEW = new PreviewSnippet(CodeFormatter.K_STATEMENTS, private final PreviewSnippet BLOCK_PREVIEW = new PreviewSnippet(CodeFormatter.K_STATEMENTS,
"if (true) { return 1; } else { return 2; }"); //$NON-NLS-1$ "if (true) { return 1; } else { return 2; }"); //$NON-NLS-1$
@ -242,6 +243,13 @@ public final class WhiteSpaceOptions {
InnerNode element; InnerNode element;
element = new InnerNode(null, workingValues, FormatterMessages.WhiteSpaceOptions_pointer);
createBeforePointerTree(workingValues,
createChild(element, workingValues, FormatterMessages.WhiteSpaceOptions_before));
createAfterPointerTree(workingValues,
createChild(element, workingValues, FormatterMessages.WhiteSpaceOptions_after));
roots.add(element);
element = new InnerNode(null, workingValues, FormatterMessages.WhiteSpaceOptions_opening_paren); element = new InnerNode(null, workingValues, FormatterMessages.WhiteSpaceOptions_opening_paren);
createBeforeOpenParenTree(workingValues, createBeforeOpenParenTree(workingValues,
createChild(element, workingValues, FormatterMessages.WhiteSpaceOptions_before)); createChild(element, workingValues, FormatterMessages.WhiteSpaceOptions_before));
@ -344,6 +352,12 @@ public final class WhiteSpaceOptions {
InnerNode parent; InnerNode parent;
parent = createParentNode(roots, workingValues, FormatterMessages.WhiteSpaceOptions_before_pointer);
createBeforePointerTree(workingValues, parent);
parent = createParentNode(roots, workingValues, FormatterMessages.WhiteSpaceOptions_after_pointer);
createAfterPointerTree(workingValues, parent);
parent = createParentNode(roots, workingValues, FormatterMessages.WhiteSpaceOptions_before_opening_paren); parent = createParentNode(roots, workingValues, FormatterMessages.WhiteSpaceOptions_before_opening_paren);
createBeforeOpenParenTree(workingValues, parent); createBeforeOpenParenTree(workingValues, parent);
@ -675,6 +689,25 @@ public final class WhiteSpaceOptions {
PAREN_EXPR_PREVIEW); PAREN_EXPR_PREVIEW);
} }
private void createBeforePointerTree(Map<String, String> workingValues, final InnerNode parent) {
createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_function,
DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_POINTER_IN_METHOD_DECLARATION,
METHOD_DECL_PREVIEW);
createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_declarator_list,
DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_POINTER_IN_DECLARATOR_LIST,
DECLARATOR_LIST_PREVIEW);
}
private void createAfterPointerTree(Map<String, String> workingValues, final InnerNode parent) {
createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_function,
DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_POINTER_IN_METHOD_DECLARATION,
METHOD_DECL_PREVIEW);
createOption(parent, workingValues, FormatterMessages.WhiteSpaceTabPage_declarator_list,
DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_POINTER_IN_DECLARATOR_LIST,
DECLARATOR_LIST_PREVIEW);
}
private void createBeforeOpenParenTree(Map<String, String> workingValues, final InnerNode parent) { private void createBeforeOpenParenTree(Map<String, String> workingValues, final InnerNode parent) {
createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_catch, createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_catch,
@ -956,7 +989,12 @@ public final class WhiteSpaceOptions {
createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_before_opening_brace, createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_before_opening_brace,
DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_METHOD_DECLARATION, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_METHOD_DECLARATION,
METHOD_DECL_PREVIEW); METHOD_DECL_PREVIEW);
createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_before_pointer,
DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_POINTER_IN_METHOD_DECLARATION,
METHOD_DECL_PREVIEW);
createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_after_pointer,
DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_POINTER_IN_METHOD_DECLARATION,
METHOD_DECL_PREVIEW);
createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_before_comma_in_params, createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_before_comma_in_params,
DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_METHOD_DECLARATION_PARAMETERS, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_METHOD_DECLARATION_PARAMETERS,
METHOD_DECL_PREVIEW); METHOD_DECL_PREVIEW);
@ -1020,6 +1058,12 @@ public final class WhiteSpaceOptions {
createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_declarator_list_after_comma, createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_declarator_list_after_comma,
DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_DECLARATOR_LIST, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_DECLARATOR_LIST,
DECLARATOR_LIST_PREVIEW); DECLARATOR_LIST_PREVIEW);
createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_before_pointer,
DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_POINTER_IN_DECLARATOR_LIST,
DECLARATOR_LIST_PREVIEW);
createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_after_pointer,
DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_POINTER_IN_DECLARATOR_LIST,
DECLARATOR_LIST_PREVIEW);
return root; return root;
} }