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:
parent
826a0b2c0e
commit
f893b77dba
26 changed files with 456 additions and 251 deletions
|
@ -140,7 +140,7 @@ public class CatchByReferenceQuickFixTest extends QuickFixTestCase {
|
|||
String result = runQuickFixOneFile();
|
||||
setPlaceConstRight(before);
|
||||
|
||||
assertContainedIn("catch (C const &)", result); //$NON-NLS-1$
|
||||
assertContainedIn("catch (C const&)", result); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ public class CreateLocalVariableQuickFixTest extends QuickFixTestCase {
|
|||
public void testString() throws Exception {
|
||||
loadcode(getAboveComment());
|
||||
String result = runQuickFixOneFile();
|
||||
assertContainedIn("const char* aString;", result); //$NON-NLS-1$
|
||||
assertContainedIn("const char *aString;", result); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
// void func() {
|
||||
|
@ -72,7 +72,7 @@ public class CreateLocalVariableQuickFixTest extends QuickFixTestCase {
|
|||
public void testWString() throws Exception {
|
||||
loadcode(getAboveComment());
|
||||
String result = runQuickFixOneFile();
|
||||
assertContainedIn("const wchar_t* aWString;", result); //$NON-NLS-1$
|
||||
assertContainedIn("const wchar_t *aWString;", result); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
// void func() {
|
||||
|
|
|
@ -59,9 +59,9 @@ public class InsertBeforeTests extends ChangeGeneratorTest {
|
|||
return new TestSuite(InsertBeforeTests.class);
|
||||
}
|
||||
|
||||
//int* pi[3];
|
||||
//int *pi[3];
|
||||
|
||||
//int* pi[5][3];
|
||||
//int *pi[5][3];
|
||||
public void testArrayModifier() throws Exception {
|
||||
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 {
|
||||
compareResult(new ASTVisitor() {
|
||||
{
|
||||
|
|
|
@ -543,7 +543,7 @@ public class DefaultCodeFormatterConstants {
|
|||
* @see #NEXT_LINE
|
||||
* @see #NEXT_LINE_SHIFTED
|
||||
* @see #NEXT_LINE_ON_WRAP
|
||||
* @since 6.7
|
||||
* @since 6.8
|
||||
*/
|
||||
public static final String FORMATTER_BRACE_POSITION_FOR_LINKAGE_DECLARATION = CCorePlugin.PLUGIN_ID
|
||||
+ ".formatter.brace_position_for_linkage_declaration"; //$NON-NLS-1$
|
||||
|
@ -760,7 +760,7 @@ public class DefaultCodeFormatterConstants {
|
|||
* </pre>
|
||||
* @see #TRUE
|
||||
* @see #FALSE
|
||||
* @since 6.7
|
||||
* @since 6.8
|
||||
*/
|
||||
public static final String FORMATTER_INDENT_BODY_DECLARATIONS_COMPARE_TO_LINKAGE = CCorePlugin.PLUGIN_ID
|
||||
+ ".formatter.indent_body_declarations_compare_to_linkage"; //$NON-NLS-1$
|
||||
|
@ -941,6 +941,7 @@ public class DefaultCodeFormatterConstants {
|
|||
* </pre>
|
||||
* @see CCorePlugin#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
|
||||
+ ".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
|
||||
+ ".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>
|
||||
* FORMATTER / Option to insert a space before the opening brace in a switch statement
|
||||
|
@ -2049,7 +2102,7 @@ public class DefaultCodeFormatterConstants {
|
|||
* </pre>
|
||||
* @see CCorePlugin#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
|
||||
+ ".formatter.insert_space_before_opening_brace_in_linkage_declaration"; //$NON-NLS-1$
|
||||
|
|
|
@ -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_declaration_parameters;
|
||||
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_expression_list;
|
||||
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_block;
|
||||
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_namespace_declaration;
|
||||
/**
|
||||
|
@ -646,6 +650,15 @@ public class DefaultCodeFormatterOptions {
|
|||
options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_METHOD_DECLARATION,
|
||||
this.insert_space_before_opening_brace_in_method_declaration ? CCorePlugin.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,
|
||||
this.insert_space_before_opening_brace_in_type_declaration ? CCorePlugin.INSERT
|
||||
: CCorePlugin.DO_NOT_INSERT);
|
||||
|
@ -1847,6 +1860,30 @@ public class DefaultCodeFormatterOptions {
|
|||
this.insert_space_before_opening_brace_in_method_declaration = CCorePlugin.INSERT
|
||||
.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
|
||||
.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_TYPE_DECLARATION);
|
||||
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_block = 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_type_declaration = true;
|
||||
this.insert_space_before_opening_brace_in_namespace_declaration = true;
|
||||
|
|
|
@ -303,7 +303,7 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
|
|||
|
||||
@Override
|
||||
public void run() {
|
||||
boolean needSpace = skipConstVolatileRestrict();
|
||||
boolean needSpace = skipConstVolatileRestrict(true);
|
||||
int token = peekNextToken();
|
||||
// Ref-qualifier.
|
||||
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 (node.getPropertyInParent() != IASTDeclarator.NESTED_DECLARATOR && isFirstDeclarator(node)) {
|
||||
// Preserve non-space between pointer operator and name or nested declarator.
|
||||
if (pointerOperators.length == 0 || scribe.printComment()) {
|
||||
if (pointerOperators.length == 0) {
|
||||
scribe.space();
|
||||
}
|
||||
} else
|
||||
scribe.printComment();
|
||||
}
|
||||
if (name != null)
|
||||
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;
|
||||
int token = peekNextToken();
|
||||
while (token == Token.t_const || token == Token.t_volatile || token == Token.t_restrict) {
|
||||
scribe.printNextToken(token, true);
|
||||
scribe.printNextToken(token, spaceBefore);
|
||||
token = peekNextToken();
|
||||
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) {
|
||||
for (IASTPointerOperator pointer : pointers) {
|
||||
if (scribe.printComment()) {
|
||||
|
@ -1652,9 +1708,9 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
|
|||
}
|
||||
if (pointer instanceof ICPPASTReferenceOperator) {
|
||||
if (((ICPPASTReferenceOperator) pointer).isRValueReference()) {
|
||||
scribe.printNextToken(Token.tAND, false);
|
||||
alignPointer(pointers, pointer, Token.tAND);
|
||||
} else {
|
||||
scribe.printNextToken(Token.tAMPER, false);
|
||||
alignPointer(pointers, pointer, Token.tAMPER);
|
||||
}
|
||||
} else if (pointer instanceof ICPPASTPointerToMember) {
|
||||
final ICPPASTPointerToMember ptrToMember = (ICPPASTPointerToMember) pointer;
|
||||
|
@ -1663,12 +1719,12 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
|
|||
name.accept(this);
|
||||
}
|
||||
scribe.printNextToken(Token.tSTAR, false);
|
||||
if (skipConstVolatileRestrict()) {
|
||||
if (skipConstVolatileRestrict(false)) {
|
||||
scribe.space();
|
||||
}
|
||||
} else {
|
||||
scribe.printNextToken(Token.tSTAR, false);
|
||||
if (skipConstVolatileRestrict()) {
|
||||
boolean needSpace = alignPointer(pointers, pointer, Token.tSTAR);
|
||||
if (skipConstVolatileRestrict(needSpace)) {
|
||||
scribe.space();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 * const klz;
|
||||
const int *const klz;
|
||||
|
||||
const int l { 2 };
|
||||
|
||||
|
|
|
@ -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 * const klz;
|
||||
int const *const klz;
|
||||
|
||||
int const l { 2 };
|
||||
|
||||
|
|
|
@ -24,8 +24,8 @@ AClass::AClass(int x) throw (int) :
|
|||
int main(int argc, char **argv) {
|
||||
}
|
||||
// handling of string concat
|
||||
char* s1 = "this " "is " "one " "string.";
|
||||
char* s2 = "this " "is "
|
||||
char *s1 = "this " "is " "one " "string.";
|
||||
char *s2 = "this " "is "
|
||||
"one " "string.";
|
||||
// macro definition with line comment
|
||||
#define ID(x) x // identity
|
||||
|
|
|
@ -7,17 +7,17 @@ public:
|
|||
Point(double x, double y) :
|
||||
x(x), y(y) {
|
||||
}
|
||||
double distance(const Point& other) const;
|
||||
int compareX(const Point& other) const;
|
||||
double distance(const Point &other) const;
|
||||
int compareX(const Point &other) const;
|
||||
double x;
|
||||
double y;
|
||||
};
|
||||
double Point::distance(const Point& other) const {
|
||||
double Point::distance(const Point &other) const {
|
||||
double dx = x - other.x;
|
||||
double dy = y - other.y;
|
||||
return sqrt(dx * dx + dy * dy);
|
||||
}
|
||||
int Point::compareX(const Point& other) const {
|
||||
int Point::compareX(const Point &other) const {
|
||||
if (x < other.x) {
|
||||
return -1;
|
||||
} else if (x > other.x) {
|
||||
|
|
|
@ -8,9 +8,9 @@ struct SimpleStruct {
|
|||
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 */
|
||||
|
||||
|
@ -34,14 +34,14 @@ const SimpleStruct array[] = { { SIZEOF(simpleStruct, num),
|
|||
|
||||
// single line outside scope
|
||||
|
||||
void SimpleStruct_construct(struct SimpleStruct * const s) {
|
||||
void SimpleStruct_construct(struct SimpleStruct *const s) {
|
||||
// single line
|
||||
s->num = 1;
|
||||
s->name = "boo";
|
||||
s->floatNum = 1.5;
|
||||
}
|
||||
|
||||
int ConnectParams_doSomething(const struct SimpleStruct * const s) {
|
||||
int ConnectParams_doSomething(const struct SimpleStruct *const s) {
|
||||
/*
|
||||
* multiline
|
||||
*/
|
||||
|
|
|
@ -13,16 +13,16 @@ class Foo {
|
|||
// TEMPLATE_STRUCT
|
||||
template<class Key, class Value, class SortAlgorithm = DefaultSort>
|
||||
struct Map {
|
||||
Key* keys;
|
||||
Value* values;
|
||||
SortAlgorithm* sortAlgorithm;
|
||||
Key *keys;
|
||||
Value *values;
|
||||
SortAlgorithm *sortAlgorithm;
|
||||
Map();
|
||||
};
|
||||
|
||||
// TEMPLATE_CLASS
|
||||
template<class T> class nonVector {
|
||||
private:
|
||||
T* head;
|
||||
T *head;
|
||||
|
||||
public:
|
||||
nonVector() {
|
||||
|
@ -65,7 +65,7 @@ template<class Bar> void Foo::fum(int i) {
|
|||
}
|
||||
|
||||
// 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;
|
||||
|
||||
// an instantiation, not a template:
|
||||
|
|
|
@ -554,24 +554,24 @@ public class ExtractConstantRefactoringTest extends RefactoringTestBase {
|
|||
//A.h
|
||||
//class X {
|
||||
// void method() {
|
||||
// char* a = /*$*/"sometext"/*$$*/;
|
||||
// char *a = /*$*/"sometext"/*$$*/;
|
||||
// }
|
||||
//
|
||||
// void method2() {
|
||||
// const char* b = "sometext";
|
||||
// const char *b = "sometext";
|
||||
// }
|
||||
//};
|
||||
//====================
|
||||
//class X {
|
||||
// void method() {
|
||||
// char* a = EXTRACTED;
|
||||
// char *a = EXTRACTED;
|
||||
// }
|
||||
//
|
||||
// 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 {
|
||||
assertRefactoringSuccess();
|
||||
|
@ -580,26 +580,26 @@ public class ExtractConstantRefactoringTest extends RefactoringTestBase {
|
|||
//A.h
|
||||
//class X {
|
||||
// void method() {
|
||||
// wchar_t* a = /*$*/L"sometext"/*$$*/;
|
||||
// wchar_t *a = /*$*/L"sometext"/*$$*/;
|
||||
// }
|
||||
//
|
||||
// void method2() {
|
||||
// const wchar_t* b = L"sometext";
|
||||
// const char* c = "sometext";
|
||||
// const wchar_t *b = L"sometext";
|
||||
// const char *c = "sometext";
|
||||
// }
|
||||
//};
|
||||
//====================
|
||||
//class X {
|
||||
// void method() {
|
||||
// wchar_t* a = EXTRACTED;
|
||||
// wchar_t *a = EXTRACTED;
|
||||
// }
|
||||
//
|
||||
// void method2() {
|
||||
// const wchar_t* b = EXTRACTED;
|
||||
// const char* c = "sometext";
|
||||
// const wchar_t *b = EXTRACTED;
|
||||
// const char *c = "sometext";
|
||||
// }
|
||||
//
|
||||
// static const wchar_t* EXTRACTED = L"sometext";
|
||||
// static const wchar_t *EXTRACTED = L"sometext";
|
||||
//};
|
||||
public void testExtractConstantWideString() throws Exception {
|
||||
assertRefactoringSuccess();
|
||||
|
|
|
@ -782,7 +782,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
|
|||
//
|
||||
//private:
|
||||
// int help();
|
||||
// void extracted(int* j);
|
||||
// void extracted(int *j);
|
||||
//};
|
||||
//
|
||||
//#endif /*A_H_*/
|
||||
|
@ -815,7 +815,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
|
|||
//A::~A() {
|
||||
//}
|
||||
//
|
||||
//void A::extracted(int* j) {
|
||||
//void A::extracted(int *j) {
|
||||
// ++*j;
|
||||
// help();
|
||||
//}
|
||||
|
@ -850,7 +850,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
|
|||
// int j;
|
||||
//};
|
||||
//
|
||||
//int extracted(const struct A* a) {
|
||||
//int extracted(const struct A *a) {
|
||||
// return a->i + a->j;
|
||||
//}
|
||||
//
|
||||
|
@ -872,7 +872,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
|
|||
// return i - j;
|
||||
//}
|
||||
//====================
|
||||
//void swap(int* i, int* j) {
|
||||
//void swap(int *i, int *j) {
|
||||
// int k = *i;
|
||||
// *i = *j;
|
||||
// *j = k;
|
||||
|
@ -907,7 +907,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
|
|||
//====================
|
||||
//#include "A.h"
|
||||
//
|
||||
//int extracted(A b, A* a) {
|
||||
//int extracted(A b, A *a) {
|
||||
// return a->method() + b.const_method();
|
||||
//}
|
||||
//
|
||||
|
@ -923,14 +923,14 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
|
|||
//A.h
|
||||
//class A {
|
||||
//public:
|
||||
// A(int i, const char* s);
|
||||
// A(int i, const char *s);
|
||||
// int method();
|
||||
//};
|
||||
|
||||
//A.cpp
|
||||
//#include "A.h"
|
||||
//
|
||||
//void test(int i, const char* s) {
|
||||
//void test(int i, const char *s) {
|
||||
// /*$*/A a(i, s);/*$$*/
|
||||
// if (i != 0)
|
||||
// a.method();
|
||||
|
@ -938,12 +938,12 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
|
|||
//====================
|
||||
//#include "A.h"
|
||||
//
|
||||
//A extracted(int i, const char* s) {
|
||||
//A extracted(int i, const char *s) {
|
||||
// A a(i, s);
|
||||
// return a;
|
||||
//}
|
||||
//
|
||||
//void test(int i, const char* s) {
|
||||
//void test(int i, const char *s) {
|
||||
// A a = extracted(i, s);
|
||||
// if (i != 0)
|
||||
// a.method();
|
||||
|
@ -979,7 +979,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
|
|||
//
|
||||
//private:
|
||||
// int help();
|
||||
// void extracted(int& i);
|
||||
// void extracted(int &i);
|
||||
//};
|
||||
//
|
||||
//#endif /*A_H_*/
|
||||
|
@ -1012,7 +1012,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
|
|||
//A::~A() {
|
||||
//}
|
||||
//
|
||||
//void A::extracted(int& i) {
|
||||
//void A::extracted(int &i) {
|
||||
// ++i;
|
||||
// help();
|
||||
//}
|
||||
|
@ -1143,7 +1143,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
|
|||
//
|
||||
//private:
|
||||
// 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_*/
|
||||
|
@ -1160,7 +1160,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
|
|||
//int A::foo() {
|
||||
// int i = 2;
|
||||
// float x = i;
|
||||
// B* b = new B();
|
||||
// B *b = new B();
|
||||
// int y = x + i;
|
||||
// /*$*/++i;
|
||||
// b->hello(y);
|
||||
|
@ -1182,7 +1182,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
|
|||
//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;
|
||||
// b->hello(y);
|
||||
// i = i + x;
|
||||
|
@ -1193,7 +1193,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
|
|||
//int A::foo() {
|
||||
// int i = 2;
|
||||
// float x = i;
|
||||
// B* b = new B();
|
||||
// B *b = new B();
|
||||
// int y = x + i;
|
||||
// i = extracted(i, y, x, b);
|
||||
// ++x;
|
||||
|
@ -1238,7 +1238,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
|
|||
//
|
||||
//private:
|
||||
// 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_*/
|
||||
|
@ -1255,7 +1255,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
|
|||
//int A::foo() {
|
||||
// int i = 2;
|
||||
// float x = i;
|
||||
// B* b = new B();
|
||||
// B *b = new B();
|
||||
// bool y = false;
|
||||
// /*$*/++i;
|
||||
// b->hello(y);
|
||||
|
@ -1279,7 +1279,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
|
|||
//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;
|
||||
// b->hello(y);
|
||||
// y = !y;
|
||||
|
@ -1291,7 +1291,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
|
|||
//int A::foo() {
|
||||
// int i = 2;
|
||||
// float x = i;
|
||||
// B* b = new B();
|
||||
// B *b = new B();
|
||||
// bool y = false;
|
||||
// y = extracted(y, x, i, b);
|
||||
// b->hello(y);
|
||||
|
@ -1350,7 +1350,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
|
|||
//
|
||||
//private:
|
||||
// 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_*/
|
||||
|
@ -1367,7 +1367,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
|
|||
//int A::foo() {
|
||||
// int i = 2;
|
||||
// float x = i;
|
||||
// B* b = new B();
|
||||
// B *b = new B();
|
||||
// int y = x + i;
|
||||
// /*$*/++i;
|
||||
// b->hello(y);
|
||||
|
@ -1389,7 +1389,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
|
|||
//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;
|
||||
// b->hello(y);
|
||||
// i = i + x;
|
||||
|
@ -1400,7 +1400,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
|
|||
//int A::foo() {
|
||||
// int i = 2;
|
||||
// float x = i;
|
||||
// B* b = new B();
|
||||
// B *b = new B();
|
||||
// int y = x + i;
|
||||
// x = extracted(i, y, x, b);
|
||||
// ++x;
|
||||
|
@ -1459,7 +1459,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
|
|||
//
|
||||
//private:
|
||||
// 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_*/
|
||||
|
@ -1499,7 +1499,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
|
|||
//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;
|
||||
// b->hello(y);
|
||||
// i = i + x;
|
||||
|
@ -1885,7 +1885,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
|
|||
//====================
|
||||
//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;
|
||||
// *y *= i;
|
||||
// *s += x / *y;
|
||||
|
@ -1972,7 +1972,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
|
|||
// goto loop4;
|
||||
//}
|
||||
//====================
|
||||
//int extracted(int a, int b, int* c, int* d) {
|
||||
//int extracted(int a, int b, int *c, int *d) {
|
||||
// a++;
|
||||
// b++;
|
||||
// *c++;
|
||||
|
@ -2107,7 +2107,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
|
|||
//int main() {
|
||||
// int m_capacity;
|
||||
// /*$*/m_capacity += INITIAL_CAPACITY;
|
||||
// string* newElements = new string[m_capacity];/*$$*/
|
||||
// string *newElements = new string[m_capacity];/*$$*/
|
||||
// newElements[0] = "s";
|
||||
//}
|
||||
//====================
|
||||
|
@ -2119,13 +2119,13 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
|
|||
//
|
||||
//string* runTest(int m_capacity) {
|
||||
// m_capacity += INITIAL_CAPACITY;
|
||||
// string* newElements = new string[m_capacity];
|
||||
// string *newElements = new string[m_capacity];
|
||||
// return newElements;
|
||||
//}
|
||||
//
|
||||
//int main() {
|
||||
// int m_capacity;
|
||||
// string* newElements = runTest(m_capacity);
|
||||
// string *newElements = runTest(m_capacity);
|
||||
// newElements[0] = "s";
|
||||
//}
|
||||
public void testStringArray() throws Exception {
|
||||
|
@ -2141,7 +2141,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
|
|||
//public:
|
||||
// A();
|
||||
// virtual ~A();
|
||||
// int foo(int& a);
|
||||
// int foo(int &a);
|
||||
//};
|
||||
//
|
||||
//#endif /*A_H_*/
|
||||
|
@ -2153,10 +2153,10 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
|
|||
//public:
|
||||
// A();
|
||||
// virtual ~A();
|
||||
// int foo(int& a);
|
||||
// int foo(int &a);
|
||||
//
|
||||
//private:
|
||||
// void extracted(int b, int c, int& a);
|
||||
// void extracted(int b, int c, int &a);
|
||||
//};
|
||||
//
|
||||
//#endif /*A_H_*/
|
||||
|
@ -2170,7 +2170,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
|
|||
//A::~A() {
|
||||
//}
|
||||
//
|
||||
//int A::foo(int& a) {
|
||||
//int A::foo(int &a) {
|
||||
// int b = 7;
|
||||
// int c = 8;
|
||||
// /*$*/a = b + c;/*$$*/
|
||||
|
@ -2185,11 +2185,11 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
|
|||
//A::~A() {
|
||||
//}
|
||||
//
|
||||
//void A::extracted(int b, int c, int& a) {
|
||||
//void A::extracted(int b, int c, int &a) {
|
||||
// a = b + c;
|
||||
//}
|
||||
//
|
||||
//int A::foo(int& a) {
|
||||
//int A::foo(int &a) {
|
||||
// int b = 7;
|
||||
// int c = 8;
|
||||
// extracted(b, c, a);
|
||||
|
@ -2301,7 +2301,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
|
|||
//====================
|
||||
//#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);
|
||||
//}
|
||||
//
|
||||
|
@ -3051,7 +3051,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
|
|||
//
|
||||
//private:
|
||||
// int help();
|
||||
// int extracted(int j, int& a);
|
||||
// int extracted(int j, int &a);
|
||||
//};
|
||||
//
|
||||
//#endif /*A_H_*/
|
||||
|
@ -3093,7 +3093,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
|
|||
// i = extracted(i, j);
|
||||
//}
|
||||
//
|
||||
//int A::extracted(int j, int& a) {
|
||||
//int A::extracted(int j, int &a) {
|
||||
// j++;
|
||||
// a++;
|
||||
// help();
|
||||
|
@ -3241,7 +3241,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
|
|||
//
|
||||
//private:
|
||||
// int help();
|
||||
// int extracted(int i, float& j);
|
||||
// int extracted(int i, float &j);
|
||||
//};
|
||||
//
|
||||
//#endif /*A_H_*/
|
||||
|
@ -3287,7 +3287,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
|
|||
// blabla += 1;
|
||||
//}
|
||||
//
|
||||
//int A::extracted(int i, float& j) {
|
||||
//int A::extracted(int i, float &j) {
|
||||
// ++i;
|
||||
// j += 1;
|
||||
// help();
|
||||
|
@ -3425,7 +3425,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
|
|||
//
|
||||
//private:
|
||||
// int help();
|
||||
// void extracted(int& i, float j);
|
||||
// void extracted(int &i, float j);
|
||||
//};
|
||||
//
|
||||
//#endif /*A_H_*/
|
||||
|
@ -3468,7 +3468,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
|
|||
// extracted(oo, blabla);
|
||||
//}
|
||||
//
|
||||
//void A::extracted(int& i, float j) {
|
||||
//void A::extracted(int &i, float j) {
|
||||
// ++i;
|
||||
// j += 1;
|
||||
// help();
|
||||
|
@ -3604,7 +3604,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
|
|||
//
|
||||
//private:
|
||||
// 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_*/
|
||||
|
@ -3618,7 +3618,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
|
|||
//A::~A() {
|
||||
// int i = 2;
|
||||
// float x = i;
|
||||
// B* b = new B();
|
||||
// B *b = new B();
|
||||
// int y = x + i;
|
||||
// ++i;
|
||||
// b->hello(y);
|
||||
|
@ -3632,7 +3632,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
|
|||
//int A::foo() {
|
||||
// int i = 2;
|
||||
// float x = i;
|
||||
// B* b = new B();
|
||||
// B *b = new B();
|
||||
// int y = x + i;
|
||||
// /*$*/++i;
|
||||
// b->hello(y);
|
||||
|
@ -3655,7 +3655,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
|
|||
//A::~A() {
|
||||
// int i = 2;
|
||||
// float x = i;
|
||||
// B* b = new B();
|
||||
// B *b = new B();
|
||||
// int y = x + i;
|
||||
// i = extracted(i, y, x, b);
|
||||
// b->hello(y);
|
||||
|
@ -3663,7 +3663,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
|
|||
// i++;
|
||||
//}
|
||||
//
|
||||
//int A::extracted(int i, int y, float x, B* b) {
|
||||
//int A::extracted(int i, int y, float x, B *b) {
|
||||
// ++i;
|
||||
// b->hello(y);
|
||||
// i = i + x;
|
||||
|
@ -3674,7 +3674,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
|
|||
//int A::foo() {
|
||||
// int i = 2;
|
||||
// float x = i;
|
||||
// B* b = new B();
|
||||
// B *b = new B();
|
||||
// int y = x + i;
|
||||
// i = extracted(i, y, x, b);
|
||||
// b->hello(y);
|
||||
|
@ -3733,7 +3733,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
|
|||
//
|
||||
//private:
|
||||
// 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_*/
|
||||
|
@ -3747,7 +3747,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
|
|||
//A::~A() {
|
||||
// int i = 2;
|
||||
// float x = i;
|
||||
// B* b = new B();
|
||||
// B *b = new B();
|
||||
// int y = x + i;
|
||||
// ++i;
|
||||
// b->hello(y);
|
||||
|
@ -3761,7 +3761,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
|
|||
//int A::foo() {
|
||||
// int i = 2;
|
||||
// float x = i;
|
||||
// B* b = new B();
|
||||
// B *b = new B();
|
||||
// int y = x + i;
|
||||
// /*$*/++i;
|
||||
// b->hello(y);
|
||||
|
@ -3783,7 +3783,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
|
|||
//A::~A() {
|
||||
// int i = 2;
|
||||
// float x = i;
|
||||
// B* b = new B();
|
||||
// B *b = new B();
|
||||
// int y = x + i;
|
||||
// i = extracted(i, y, x, b);
|
||||
// b->hello(y);
|
||||
|
@ -3791,7 +3791,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
|
|||
// i++;
|
||||
//}
|
||||
//
|
||||
//int A::extracted(int i, int y, float x, B* b) {
|
||||
//int A::extracted(int i, int y, float x, B *b) {
|
||||
// ++i;
|
||||
// b->hello(y);
|
||||
// i = i + x;
|
||||
|
@ -3802,7 +3802,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
|
|||
//int A::foo() {
|
||||
// int i = 2;
|
||||
// float x = i;
|
||||
// B* b = new B();
|
||||
// B *b = new B();
|
||||
// int y = x + i;
|
||||
// i = extracted(i, y, x, b);
|
||||
// b->hello(y);
|
||||
|
@ -4143,7 +4143,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
|
|||
//
|
||||
//private:
|
||||
// int help();
|
||||
// int extracted(int& i, int b);
|
||||
// int extracted(int &i, int b);
|
||||
//};
|
||||
//
|
||||
//#endif /*A_H_*/
|
||||
|
@ -4183,7 +4183,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTestBase {
|
|||
//A::~A() {
|
||||
//}
|
||||
//
|
||||
//int A::extracted(int& i, int b) {
|
||||
//int A::extracted(int &i, int b) {
|
||||
// ++i;
|
||||
// help();
|
||||
// ADD(b);
|
||||
|
|
|
@ -86,7 +86,7 @@ public class ExtractLocalVariableRefactoringTest extends RefactoringTestBase {
|
|||
//}
|
||||
//====================
|
||||
//const char* foo() {
|
||||
// const char* helloWorld = "Hello World!";
|
||||
// const char *helloWorld = "Hello World!";
|
||||
// return helloWorld;
|
||||
//}
|
||||
public void testStringLiteral() throws Exception {
|
||||
|
@ -269,7 +269,7 @@ public class ExtractLocalVariableRefactoringTest extends RefactoringTestBase {
|
|||
//====================
|
||||
//void foo() {
|
||||
// int a[2];
|
||||
// int* i = a + 1;
|
||||
// int *i = a + 1;
|
||||
// int b = *i;
|
||||
//}
|
||||
public void testPointer() throws Exception {
|
||||
|
@ -277,16 +277,16 @@ public class ExtractLocalVariableRefactoringTest extends RefactoringTestBase {
|
|||
}
|
||||
|
||||
//A.cpp
|
||||
//const volatile int* k;
|
||||
//const volatile int *k;
|
||||
//
|
||||
//void foo() {
|
||||
// /*$*/k;/*$$*/
|
||||
//}
|
||||
//====================
|
||||
//const volatile int* k;
|
||||
//const volatile int *k;
|
||||
//
|
||||
//void foo() {
|
||||
// const volatile int* k0 = k;
|
||||
// const volatile int *k0 = k;
|
||||
// k0;
|
||||
//}
|
||||
public void testQualifiers() throws Exception {
|
||||
|
@ -328,7 +328,7 @@ public class ExtractLocalVariableRefactoringTest extends RefactoringTestBase {
|
|||
//
|
||||
//void func() {
|
||||
// int* (*a)[2];
|
||||
// int* (*a0)[2] = a;
|
||||
// int *(*a0)[2] = a;
|
||||
// a0;
|
||||
//}
|
||||
public void testArrayOfFunctionPointers_Bug318784() throws Exception {
|
||||
|
|
|
@ -303,7 +303,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
|
|||
// int systemId;
|
||||
//
|
||||
//protected:
|
||||
// char* name;
|
||||
// char *name;
|
||||
//
|
||||
//public:
|
||||
// const int socSecNo;
|
||||
|
@ -314,7 +314,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
|
|||
//
|
||||
// ~Person(); // destructor
|
||||
//
|
||||
// char* Name();
|
||||
// char *Name();
|
||||
//
|
||||
// void Print();
|
||||
//
|
||||
|
@ -343,7 +343,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
|
|||
// int systemId;
|
||||
//
|
||||
//protected:
|
||||
// char* name;
|
||||
// char *name;
|
||||
//
|
||||
//public:
|
||||
// const int socSecNo;
|
||||
|
@ -354,7 +354,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
|
|||
//
|
||||
// ~Person(); // destructor
|
||||
//
|
||||
// char* Name();
|
||||
// char *Name();
|
||||
//
|
||||
// void Print();
|
||||
//
|
||||
|
@ -370,7 +370,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
|
|||
// this->systemId = systemId;
|
||||
// }
|
||||
//
|
||||
// void setName(char* name) {
|
||||
// void setName(char *name) {
|
||||
// this->name = name;
|
||||
// }
|
||||
//};
|
||||
|
@ -386,7 +386,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
|
|||
// return socSecNo;
|
||||
//}
|
||||
//
|
||||
//int main(int argc, char** argv) {
|
||||
//int main(int argc, char **argv) {
|
||||
//}
|
||||
//====================
|
||||
public void testOneSetterSelection() throws Exception {
|
||||
|
@ -403,7 +403,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
|
|||
// int systemId;
|
||||
//
|
||||
//protected:
|
||||
// char* name;
|
||||
// char *name;
|
||||
//
|
||||
//public:
|
||||
// const int socSecNo;
|
||||
|
@ -414,7 +414,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
|
|||
//
|
||||
// ~Person(); // destructor
|
||||
//
|
||||
// char* Name();
|
||||
// char *Name();
|
||||
//
|
||||
// void Print();
|
||||
//
|
||||
|
@ -443,7 +443,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
|
|||
// int systemId;
|
||||
//
|
||||
//protected:
|
||||
// char* name;
|
||||
// char *name;
|
||||
//
|
||||
//public:
|
||||
// const int socSecNo;
|
||||
|
@ -454,7 +454,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
|
|||
//
|
||||
// ~Person(); // destructor
|
||||
//
|
||||
// char* Name();
|
||||
// char *Name();
|
||||
//
|
||||
// void Print();
|
||||
//
|
||||
|
@ -474,7 +474,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
|
|||
// return name;
|
||||
// }
|
||||
//
|
||||
// void setName(char* name) {
|
||||
// void setName(char *name) {
|
||||
// this->name = name;
|
||||
// }
|
||||
//};
|
||||
|
@ -490,7 +490,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
|
|||
// return socSecNo;
|
||||
//}
|
||||
//
|
||||
//int main(int argc, char** argv) {
|
||||
//int main(int argc, char **argv) {
|
||||
//}
|
||||
//====================
|
||||
public void testGetterAndSetterSelection() throws Exception {
|
||||
|
@ -508,7 +508,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
|
|||
// int systemId;
|
||||
//
|
||||
//protected:
|
||||
// char* name;
|
||||
// char *name;
|
||||
//
|
||||
//public:
|
||||
// const int socSecNo;
|
||||
|
@ -519,7 +519,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
|
|||
//
|
||||
// ~Person(); // destructor
|
||||
//
|
||||
// char* Name();
|
||||
// char *Name();
|
||||
//
|
||||
// void Print();
|
||||
//
|
||||
|
@ -540,7 +540,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
|
|||
// int systemId;
|
||||
//
|
||||
//protected:
|
||||
// char* name;
|
||||
// char *name;
|
||||
//
|
||||
//public:
|
||||
// const int socSecNo;
|
||||
|
@ -551,7 +551,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
|
|||
//
|
||||
// ~Person(); // destructor
|
||||
//
|
||||
// char* Name();
|
||||
// char *Name();
|
||||
//
|
||||
// void Print();
|
||||
//
|
||||
|
@ -563,7 +563,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
|
|||
// return name;
|
||||
// }
|
||||
//
|
||||
// void setName(char* name) {
|
||||
// void setName(char *name) {
|
||||
// this->name = name;
|
||||
// }
|
||||
//
|
||||
|
@ -587,7 +587,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
|
|||
// return socSecNo;
|
||||
//}
|
||||
//
|
||||
//int main(int argc, char** argv) {
|
||||
//int main(int argc, char **argv) {
|
||||
//}
|
||||
//====================
|
||||
public void testMultipleSelection() throws Exception {
|
||||
|
@ -781,9 +781,9 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
|
|||
//#define A_H_
|
||||
//
|
||||
//struct FullName {
|
||||
// const char* first;
|
||||
// const char* last;
|
||||
// FullName(const FullName& other);
|
||||
// const char *first;
|
||||
// const char *last;
|
||||
// FullName(const FullName &other);
|
||||
// ~FullName();
|
||||
//};
|
||||
//
|
||||
|
@ -803,7 +803,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
|
|||
//
|
||||
// ~Person(); // destructor
|
||||
//
|
||||
// char* Name();
|
||||
// char *Name();
|
||||
//
|
||||
// void Print();
|
||||
//
|
||||
|
@ -824,9 +824,9 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
|
|||
//#define A_H_
|
||||
//
|
||||
//struct FullName {
|
||||
// const char* first;
|
||||
// const char* last;
|
||||
// FullName(const FullName& other);
|
||||
// const char *first;
|
||||
// const char *last;
|
||||
// FullName(const FullName &other);
|
||||
// ~FullName();
|
||||
//};
|
||||
//
|
||||
|
@ -846,7 +846,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
|
|||
//
|
||||
// ~Person(); // destructor
|
||||
//
|
||||
// char* Name();
|
||||
// char *Name();
|
||||
//
|
||||
// void Print();
|
||||
//
|
||||
|
@ -858,7 +858,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
|
|||
//
|
||||
// void setSystemId(int systemId);
|
||||
// const FullName& getName() const;
|
||||
// void setName(const FullName& name);
|
||||
// void setName(const FullName &name);
|
||||
//};
|
||||
//
|
||||
//int gooo = 1;
|
||||
|
@ -872,7 +872,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
|
|||
// return socSecNo;
|
||||
//}
|
||||
//
|
||||
//int main(int argc, char** argv) {
|
||||
//int main(int argc, char **argv) {
|
||||
//}
|
||||
//====================
|
||||
//#include "A.h"
|
||||
|
@ -881,7 +881,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
|
|||
// return name;
|
||||
//}
|
||||
//
|
||||
//void Person::setName(const FullName& name) {
|
||||
//void Person::setName(const FullName &name) {
|
||||
// this->name = name;
|
||||
//}
|
||||
//
|
||||
|
@ -889,7 +889,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
|
|||
// return socSecNo;
|
||||
//}
|
||||
//
|
||||
//int main(int argc, char** argv) {
|
||||
//int main(int argc, char **argv) {
|
||||
//}
|
||||
public void testPassByReferenceSeparateDefinition() throws Exception {
|
||||
definitionSeparate = true;
|
||||
|
@ -1034,7 +1034,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
|
|||
// int systemId;
|
||||
//
|
||||
//protected:
|
||||
// char* name;
|
||||
// char *name;
|
||||
//
|
||||
//public:
|
||||
// const int socSecNo;
|
||||
|
@ -1045,7 +1045,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
|
|||
//
|
||||
// ~Person(); // destructor
|
||||
//
|
||||
// char* Name();
|
||||
// char *Name();
|
||||
//
|
||||
// void Print();
|
||||
//
|
||||
|
@ -1074,7 +1074,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
|
|||
// int systemId;
|
||||
//
|
||||
//protected:
|
||||
// char* name;
|
||||
// char *name;
|
||||
//
|
||||
//public:
|
||||
// const int socSecNo;
|
||||
|
@ -1085,7 +1085,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
|
|||
//
|
||||
// ~Person(); // destructor
|
||||
//
|
||||
// char* Name();
|
||||
// char *Name();
|
||||
//
|
||||
// void Print();
|
||||
//
|
||||
|
@ -1101,7 +1101,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
|
|||
// this->systemId = systemId;
|
||||
// }
|
||||
//
|
||||
// void setName(char* name);
|
||||
// void setName(char *name);
|
||||
//};
|
||||
//
|
||||
//int gooo = 1;
|
||||
|
@ -1115,12 +1115,12 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
|
|||
// return socSecNo;
|
||||
//}
|
||||
//
|
||||
//int main(int argc, char** argv) {
|
||||
//int main(int argc, char **argv) {
|
||||
//}
|
||||
//====================
|
||||
//#include "A.h"
|
||||
//
|
||||
//void Person::setName(char* name) {
|
||||
//void Person::setName(char *name) {
|
||||
// this->name = name;
|
||||
//}
|
||||
//
|
||||
|
@ -1128,7 +1128,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
|
|||
// return socSecNo;
|
||||
//}
|
||||
//
|
||||
//int main(int argc, char** argv) {
|
||||
//int main(int argc, char **argv) {
|
||||
//}
|
||||
public void testOneSetterSelectionSeparateDefinition() throws Exception {
|
||||
definitionSeparate = true;
|
||||
|
@ -1145,7 +1145,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
|
|||
// int systemId;
|
||||
//
|
||||
//protected:
|
||||
// char* name;
|
||||
// char *name;
|
||||
//
|
||||
//public:
|
||||
// const int socSecNo;
|
||||
|
@ -1156,7 +1156,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
|
|||
//
|
||||
// ~Person(); // destructor
|
||||
//
|
||||
// char* Name();
|
||||
// char *Name();
|
||||
//
|
||||
// void Print();
|
||||
//
|
||||
|
@ -1185,7 +1185,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
|
|||
// int systemId;
|
||||
//
|
||||
//protected:
|
||||
// char* name;
|
||||
// char *name;
|
||||
//
|
||||
//public:
|
||||
// const int socSecNo;
|
||||
|
@ -1196,7 +1196,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
|
|||
//
|
||||
// ~Person(); // destructor
|
||||
//
|
||||
// char* Name();
|
||||
// char *Name();
|
||||
//
|
||||
// void Print();
|
||||
//
|
||||
|
@ -1213,7 +1213,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
|
|||
// }
|
||||
//
|
||||
// char* getName() const;
|
||||
// void setName(char* name);
|
||||
// void setName(char *name);
|
||||
//};
|
||||
//
|
||||
//int gooo = 1;
|
||||
|
@ -1227,7 +1227,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
|
|||
// return socSecNo;
|
||||
//}
|
||||
//
|
||||
//int main(int argc, char** argv) {
|
||||
//int main(int argc, char **argv) {
|
||||
//}
|
||||
//====================
|
||||
//#include "A.h"
|
||||
|
@ -1236,7 +1236,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
|
|||
// return name;
|
||||
//}
|
||||
//
|
||||
//void Person::setName(char* name) {
|
||||
//void Person::setName(char *name) {
|
||||
// this->name = name;
|
||||
//}
|
||||
//
|
||||
|
@ -1244,7 +1244,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
|
|||
// return socSecNo;
|
||||
//}
|
||||
//
|
||||
//int main(int argc, char** argv) {
|
||||
//int main(int argc, char **argv) {
|
||||
//}
|
||||
public void testSelectionWithSeparateDefinition() throws Exception {
|
||||
definitionSeparate = true;
|
||||
|
@ -1618,7 +1618,7 @@ public class GenerateGettersAndSettersTest extends RefactoringTestBase {
|
|||
// return b;
|
||||
// }
|
||||
//
|
||||
// void setB(int* b) {
|
||||
// void setB(int *b) {
|
||||
// this->b = b;
|
||||
// }
|
||||
//
|
||||
|
|
|
@ -615,7 +615,7 @@ public class ImplementMethodRefactoringTest extends RefactoringTestBase {
|
|||
//
|
||||
//class TestClass {
|
||||
//public:
|
||||
// /*$*/int* get(char* val);/*$$*/
|
||||
// /*$*/int* get(char *val);/*$$*/
|
||||
//};
|
||||
//
|
||||
|
||||
|
@ -624,7 +624,7 @@ public class ImplementMethodRefactoringTest extends RefactoringTestBase {
|
|||
//====================
|
||||
//#include "A.h"
|
||||
//
|
||||
//int* TestClass::get(char* val) {
|
||||
//int* TestClass::get(char *val) {
|
||||
//}
|
||||
public void testPointerReturnValue_Bug238253() throws Exception {
|
||||
assertRefactoringSuccess();
|
||||
|
|
|
@ -700,7 +700,7 @@ public class IncludeOrganizerTest extends IncludesTestBase {
|
|||
//namespace ns3 {
|
||||
//namespace ns2 {
|
||||
//namespace ns1 {
|
||||
//C * f(const A &a, B *b);
|
||||
//C* f(const A &a, B *b);
|
||||
//} /* namespace ns1 */
|
||||
//} /* namespace ns2 */
|
||||
//} /* namespace ns3 */
|
||||
|
|
|
@ -137,7 +137,7 @@ public class OverrideMethodsRefactoringTest extends RefactoringTestBase {
|
|||
//class Base {
|
||||
//public:
|
||||
// virtual ~Base();
|
||||
// virtual void baseFunc(Base* ptr) const = 0;
|
||||
// virtual void baseFunc(Base *ptr) const = 0;
|
||||
//};
|
||||
//};
|
||||
//namespace SECOND {
|
||||
|
@ -152,14 +152,14 @@ public class OverrideMethodsRefactoringTest extends RefactoringTestBase {
|
|||
//class Base {
|
||||
//public:
|
||||
// virtual ~Base();
|
||||
// virtual void baseFunc(Base* ptr) const = 0;
|
||||
// virtual void baseFunc(Base *ptr) const = 0;
|
||||
//};
|
||||
//};
|
||||
//namespace SECOND {
|
||||
//class X: public FIRST::Base {
|
||||
//public:
|
||||
// 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"
|
||||
//
|
||||
//void SECOND::X::baseFunc(FIRST::Base* ptr) const {
|
||||
//void SECOND::X::baseFunc(FIRST::Base *ptr) const {
|
||||
//}
|
||||
public void testWithMixedNamespaceHeaderAndSource() throws Exception {
|
||||
selectedMethods = new String[] { "baseFunc(FIRST::Base *)const" };
|
||||
|
@ -538,7 +538,7 @@ public class OverrideMethodsRefactoringTest extends RefactoringTestBase {
|
|||
//class Base {
|
||||
//public:
|
||||
// virtual ~Base();
|
||||
// virtual void* baseFunc(void* ptr) const = 0;
|
||||
// virtual void* baseFunc(void *ptr) const = 0;
|
||||
//};
|
||||
//class X: public Base {
|
||||
//public:
|
||||
|
@ -549,12 +549,12 @@ public class OverrideMethodsRefactoringTest extends RefactoringTestBase {
|
|||
//class Base {
|
||||
//public:
|
||||
// virtual ~Base();
|
||||
// virtual void* baseFunc(void* ptr) const = 0;
|
||||
// virtual void* baseFunc(void *ptr) const = 0;
|
||||
//};
|
||||
//class X: public Base {
|
||||
//public:
|
||||
// X();
|
||||
// virtual void* baseFunc(void* ptr) const;
|
||||
// virtual void* baseFunc(void *ptr) const;
|
||||
//};
|
||||
|
||||
//A.cpp
|
||||
|
@ -562,7 +562,7 @@ public class OverrideMethodsRefactoringTest extends RefactoringTestBase {
|
|||
//====================
|
||||
//#include "A.h"
|
||||
//
|
||||
//void* X::baseFunc(void* ptr) const {
|
||||
//void* X::baseFunc(void *ptr) const {
|
||||
//}
|
||||
public void testWithPointers() throws Exception {
|
||||
selectedMethods = new String[] { "baseFunc(void *)const" };
|
||||
|
@ -573,7 +573,7 @@ public class OverrideMethodsRefactoringTest extends RefactoringTestBase {
|
|||
//class Base {
|
||||
//public:
|
||||
// virtual ~Base();
|
||||
// virtual void* baseFunc(void* ptr) const = 0, method2();
|
||||
// virtual void* baseFunc(void *ptr) const = 0, method2();
|
||||
//};
|
||||
//class X: public Base {
|
||||
//public:
|
||||
|
@ -584,12 +584,12 @@ public class OverrideMethodsRefactoringTest extends RefactoringTestBase {
|
|||
//class Base {
|
||||
//public:
|
||||
// virtual ~Base();
|
||||
// virtual void* baseFunc(void* ptr) const = 0, method2();
|
||||
// virtual void* baseFunc(void *ptr) const = 0, method2();
|
||||
//};
|
||||
//class X: public Base {
|
||||
//public:
|
||||
// X();
|
||||
// virtual void* baseFunc(void* ptr) const;
|
||||
// virtual void* baseFunc(void *ptr) const;
|
||||
//};
|
||||
|
||||
//A.cpp
|
||||
|
@ -597,7 +597,7 @@ public class OverrideMethodsRefactoringTest extends RefactoringTestBase {
|
|||
//====================
|
||||
//#include "A.h"
|
||||
//
|
||||
//void* X::baseFunc(void* ptr) const {
|
||||
//void* X::baseFunc(void *ptr) const {
|
||||
//}
|
||||
public void testWithMultipleMethodsOnSameLine() throws Exception {
|
||||
selectedMethods = new String[] { "baseFunc(void *)const" };
|
||||
|
|
|
@ -632,7 +632,7 @@ public class ToggleRefactoringTest extends RefactoringTestBase {
|
|||
//class A {
|
||||
//public:
|
||||
// template<typename U, typename V>
|
||||
// void /*$*/foo/*$$*/(const U& u, const V& v) {
|
||||
// void /*$*/foo/*$$*/(const U &u, const V &v) {
|
||||
// return;
|
||||
// }
|
||||
//};
|
||||
|
@ -641,12 +641,12 @@ public class ToggleRefactoringTest extends RefactoringTestBase {
|
|||
//class A {
|
||||
//public:
|
||||
// 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 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;
|
||||
//}
|
||||
public void testTestComplexTemplateFunctionFromInClassToInHeader() throws Exception {
|
||||
|
@ -663,7 +663,7 @@ public class ToggleRefactoringTest extends RefactoringTestBase {
|
|||
//
|
||||
//template<typename T, typename S>
|
||||
//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;
|
||||
//}
|
||||
//====================
|
||||
|
@ -671,7 +671,7 @@ public class ToggleRefactoringTest extends RefactoringTestBase {
|
|||
//class A {
|
||||
//public:
|
||||
// template<typename U, typename V>
|
||||
// void foo(const U& u, const V& v) {
|
||||
// void foo(const U &u, const V &v) {
|
||||
// return;
|
||||
// }
|
||||
//};
|
||||
|
@ -959,7 +959,7 @@ public class ToggleRefactoringTest extends RefactoringTestBase {
|
|||
// try {
|
||||
// return;
|
||||
// }
|
||||
// catch (std::exception& e1){
|
||||
// catch (std::exception &e1){
|
||||
// return;
|
||||
// }
|
||||
//};
|
||||
|
@ -975,7 +975,7 @@ public class ToggleRefactoringTest extends RefactoringTestBase {
|
|||
//try {
|
||||
// return;
|
||||
//}
|
||||
//catch (std::exception& e1) {
|
||||
//catch (std::exception &e1) {
|
||||
// return;
|
||||
//}
|
||||
public void testTestTryCatchFromInClassToInHeader() throws Exception {
|
||||
|
@ -1022,7 +1022,7 @@ public class ToggleRefactoringTest extends RefactoringTestBase {
|
|||
//try {
|
||||
// return;
|
||||
//}
|
||||
//catch (std::exception& e1) {
|
||||
//catch (std::exception &e1) {
|
||||
// return;
|
||||
//}
|
||||
public void testTestTryCatchFromInHeaderToImplementation() throws Exception {
|
||||
|
@ -1066,7 +1066,7 @@ public class ToggleRefactoringTest extends RefactoringTestBase {
|
|||
// try {
|
||||
// return;
|
||||
// }
|
||||
// catch (std::exception& e1) {
|
||||
// catch (std::exception &e1) {
|
||||
// return;
|
||||
// }
|
||||
//};
|
||||
|
@ -1083,10 +1083,10 @@ public class ToggleRefactoringTest extends RefactoringTestBase {
|
|||
// try {
|
||||
// return;
|
||||
// }
|
||||
// catch (std::exception& e1) {
|
||||
// catch (std::exception &e1) {
|
||||
// return;
|
||||
// }
|
||||
// catch (std::exception& e2) {
|
||||
// catch (std::exception &e2) {
|
||||
// return;
|
||||
// }
|
||||
//};
|
||||
|
@ -1102,10 +1102,10 @@ public class ToggleRefactoringTest extends RefactoringTestBase {
|
|||
//try {
|
||||
// return;
|
||||
//}
|
||||
//catch (std::exception& e1) {
|
||||
//catch (std::exception &e1) {
|
||||
// return;
|
||||
//}
|
||||
//catch (std::exception& e2) {
|
||||
//catch (std::exception &e2) {
|
||||
// return;
|
||||
//}
|
||||
public void testTestMultipleTryCatchFromInClassToInHeader() throws Exception {
|
||||
|
@ -1155,10 +1155,10 @@ public class ToggleRefactoringTest extends RefactoringTestBase {
|
|||
//try {
|
||||
// return;
|
||||
//}
|
||||
//catch (std::exception& e1) {
|
||||
//catch (std::exception &e1) {
|
||||
// return;
|
||||
//}
|
||||
//catch (std::exception& e2) {
|
||||
//catch (std::exception &e2) {
|
||||
// return;
|
||||
//}
|
||||
public void testTestMultipleTryCatchFromInHeaderToImplementation() throws Exception {
|
||||
|
@ -1205,10 +1205,10 @@ public class ToggleRefactoringTest extends RefactoringTestBase {
|
|||
// try {
|
||||
// return;
|
||||
// }
|
||||
// catch (std::exception& e1) {
|
||||
// catch (std::exception &e1) {
|
||||
// return;
|
||||
// }
|
||||
// catch (std::exception& e2) {
|
||||
// catch (std::exception &e2) {
|
||||
// return;
|
||||
// }
|
||||
//};
|
||||
|
@ -1787,7 +1787,7 @@ public class ToggleRefactoringTest extends RefactoringTestBase {
|
|||
// }
|
||||
//};
|
||||
//
|
||||
//int freeFunction(int* a, int& b);
|
||||
//int freeFunction(int *a, int &b);
|
||||
|
||||
//A.cpp
|
||||
//#include "A.h"
|
||||
|
@ -1802,7 +1802,7 @@ public class ToggleRefactoringTest extends RefactoringTestBase {
|
|||
// return 0;
|
||||
//}
|
||||
//
|
||||
//int freeFunction(int* a, int& b) {
|
||||
//int freeFunction(int *a, int &b) {
|
||||
// return 42;
|
||||
//}
|
||||
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>
|
||||
//
|
||||
|
@ -1859,7 +1859,7 @@ public class ToggleRefactoringTest extends RefactoringTestBase {
|
|||
// }
|
||||
//};
|
||||
//
|
||||
//int freeFunction(int* a, int& b) {
|
||||
//int freeFunction(int *a, int &b) {
|
||||
// return 42;
|
||||
//}
|
||||
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 {
|
||||
// return 42;
|
||||
//}
|
||||
//catch (std::exception& e) {
|
||||
//catch (std::exception &e) {
|
||||
//}
|
||||
public void testTestFreeFunctionToggleFromImplementationToHeaderWithOutDeclaration() throws Exception {
|
||||
assertRefactoringSuccess();
|
||||
|
|
|
@ -142,7 +142,7 @@ public class CodeFormatterTest extends BaseUITestCase {
|
|||
//pvar;
|
||||
|
||||
//int var;
|
||||
//int* pvar;
|
||||
//int *pvar;
|
||||
public void testSpaceBetweenTypeAndIdentifier_Bug194603() throws Exception {
|
||||
assertFormatterResult();
|
||||
}
|
||||
|
@ -229,7 +229,7 @@ public class CodeFormatterTest extends BaseUITestCase {
|
|||
//};
|
||||
//
|
||||
//void test() {
|
||||
// ClassWithALongName* variable_with_a_long_name;
|
||||
// ClassWithALongName *variable_with_a_long_name;
|
||||
// for (ClassWithALongName::Iterator iter_for_class_with_a_long_name =
|
||||
// variable_with_a_long_name->getIterator();
|
||||
// !iter_for_class_with_a_long_name.isDone();
|
||||
|
@ -416,7 +416,7 @@ public class CodeFormatterTest extends BaseUITestCase {
|
|||
// return 2;
|
||||
//}
|
||||
|
||||
//int main(int argc, char const int* argv[])
|
||||
//int main(int argc, char const int *argv[])
|
||||
//try {
|
||||
// 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[]) {
|
||||
//int main(int argc, char const int *argv[]) {
|
||||
// try {
|
||||
// for (int i = 1; i < argc; ++i) {
|
||||
// }
|
||||
|
@ -556,7 +556,7 @@ public class CodeFormatterTest extends BaseUITestCase {
|
|||
|
||||
//void f() {
|
||||
// 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);
|
||||
// delete[] py;
|
||||
// ::delete px;
|
||||
|
@ -600,11 +600,11 @@ public class CodeFormatterTest extends BaseUITestCase {
|
|||
//static void* h();
|
||||
//int* (*a) [2];
|
||||
|
||||
//static void *f() {
|
||||
//static void* f() {
|
||||
//}
|
||||
//static void * g();
|
||||
//static void* g();
|
||||
//static void* h();
|
||||
//int* (*a)[2];
|
||||
//int *(*a)[2];
|
||||
public void testSpaceBetweenDeclSpecAndDeclarator() throws Exception {
|
||||
assertFormatterResult();
|
||||
}
|
||||
|
@ -701,7 +701,7 @@ public class CodeFormatterTest extends BaseUITestCase {
|
|||
//};
|
||||
//
|
||||
//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 =
|
||||
// variable_with_a_long_name->methodWithAQuiteLongName();
|
||||
|
@ -731,8 +731,8 @@ public class CodeFormatterTest extends BaseUITestCase {
|
|||
//};
|
||||
//
|
||||
//void test() {
|
||||
// ClassWithALongName* variable_with_a_long_name;
|
||||
// ClassWithALongName* another_variable = variable_with_a_long_name
|
||||
// ClassWithALongName *variable_with_a_long_name;
|
||||
// ClassWithALongName *another_variable = variable_with_a_long_name
|
||||
// ->methodWithALongName()->anotherMethodWithALongName();
|
||||
//}
|
||||
public void testMemberAccess() throws Exception {
|
||||
|
@ -831,7 +831,7 @@ public class CodeFormatterTest extends BaseUITestCase {
|
|||
// EAbout
|
||||
// };
|
||||
//
|
||||
//CActiveScheduler* scheduler = new (ELeave) CActiveScheduler();
|
||||
//CActiveScheduler *scheduler = new (ELeave) CActiveScheduler();
|
||||
public void testFormatterRegressions_Bug225858() throws Exception {
|
||||
fOptions.putAll(DefaultCodeFormatterOptions.getWhitesmithsSettings().getMap());
|
||||
assertFormatterResult();
|
||||
|
@ -1044,14 +1044,14 @@ public class CodeFormatterTest extends BaseUITestCase {
|
|||
// if (D::iterator it = m.find(e))
|
||||
// m.erase(it);
|
||||
//}
|
||||
//T* A::b(T* t) {
|
||||
//T* A::b(T *t) {
|
||||
// S::iterator it = m.find(t);
|
||||
// if (!it)
|
||||
// return NULL;
|
||||
// else
|
||||
// return *it;
|
||||
//}
|
||||
//M* A::c(M* tm) {
|
||||
//M* A::c(M *tm) {
|
||||
// N::iterator it = myN.find(tm);
|
||||
// if (!it)
|
||||
// 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 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);
|
||||
//void f2(const char* long_parameter_name,
|
||||
//void f2(const char *long_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);
|
||||
//void f4(const char* long_parameter_name,
|
||||
//void f4(const char *long_parameter_name,
|
||||
// int very_loooooooooooong_parameter_name,
|
||||
// int very_looong_parameter_name);
|
||||
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,
|
||||
//int very_looooooooooooooooooooooooong_parameter_name);
|
||||
|
||||
//const char* function_name1(const char* parameter_name,
|
||||
// const char* another_parameter_name,
|
||||
//const char* function_name1(const char *parameter_name,
|
||||
// const char *another_parameter_name,
|
||||
// int very_loooooooooooooooooooooooong_parameter_name);
|
||||
//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);
|
||||
public void testFunctionDeclarationFallbackFormat() throws Exception {
|
||||
fOptions.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, CCorePlugin.SPACE);
|
||||
|
@ -1131,8 +1131,8 @@ public class CodeFormatterTest extends BaseUITestCase {
|
|||
//#define ABSTRACT = 0
|
||||
//
|
||||
//class A {
|
||||
// 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_loooooong_name(const char *parameter) ABSTRACT;
|
||||
// virtual bool function_with_a_looooooong_name(const char *parameter)
|
||||
// ABSTRACT;
|
||||
//};
|
||||
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 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) {
|
||||
//}
|
||||
public void testFunctionDefinition() throws Exception {
|
||||
|
@ -1322,14 +1322,14 @@ public class CodeFormatterTest extends BaseUITestCase {
|
|||
assertFormatterResult();
|
||||
}
|
||||
|
||||
//void function(const char* s);
|
||||
//void function(const char *s);
|
||||
//
|
||||
//void test() {
|
||||
//function("string literal"
|
||||
//"continuation of the string literal");
|
||||
//}
|
||||
|
||||
//void function(const char* s);
|
||||
//void function(const char *s);
|
||||
//
|
||||
//void test() {
|
||||
// function("string literal"
|
||||
|
@ -1548,9 +1548,9 @@ public class CodeFormatterTest extends BaseUITestCase {
|
|||
assertFormatterResult();
|
||||
}
|
||||
|
||||
//char *b, * const a;
|
||||
//char *b, *const a;
|
||||
|
||||
//char *b, * const a;
|
||||
//char *b, *const a;
|
||||
public void testPreserveSpaceBetweenPointerModifierAndIdentifier_Bug243056() throws Exception {
|
||||
assertFormatterResult();
|
||||
}
|
||||
|
@ -2204,7 +2204,7 @@ public class CodeFormatterTest extends BaseUITestCase {
|
|||
|
||||
//#define new new(__FILE__, __LINE__)
|
||||
//void func() {
|
||||
// char* a = new char[10];
|
||||
// char *a = new char[10];
|
||||
//}
|
||||
public void testPlacementNewAsMacro_Bug298593() throws Exception {
|
||||
assertFormatterResult();
|
||||
|
@ -2227,7 +2227,7 @@ public class CodeFormatterTest extends BaseUITestCase {
|
|||
//if (x == 0) x = 5;}
|
||||
|
||||
//void f() {
|
||||
// w_char* p = L"wide string literal";
|
||||
// w_char *p = L"wide string literal";
|
||||
// int x = 0;
|
||||
// if (x == 0)
|
||||
// x = 5;
|
||||
|
@ -2305,7 +2305,7 @@ public class CodeFormatterTest extends BaseUITestCase {
|
|||
|
||||
//void f() {
|
||||
// int array[5] = { 1, 2, 3, 4, 5 };
|
||||
// for (int& x : array)
|
||||
// for (int &x : array)
|
||||
// x *= 2;
|
||||
//}
|
||||
public void testRangeBasedFor_Bug328472() throws Exception {
|
||||
|
@ -2506,7 +2506,7 @@ public class CodeFormatterTest extends BaseUITestCase {
|
|||
//}
|
||||
|
||||
//class Stream {
|
||||
// Stream& operator<<(const char* s);
|
||||
// Stream& operator<<(const char *s);
|
||||
//};
|
||||
//
|
||||
//class Voidifier {
|
||||
|
@ -2544,7 +2544,7 @@ public class CodeFormatterTest extends BaseUITestCase {
|
|||
//}
|
||||
|
||||
//class Stream {
|
||||
// Stream& operator<<(const char* s);
|
||||
// Stream& operator<<(const char *s);
|
||||
//};
|
||||
//
|
||||
//class Voidifier {
|
||||
|
@ -2568,7 +2568,7 @@ public class CodeFormatterTest extends BaseUITestCase {
|
|||
}
|
||||
|
||||
//class Stream {
|
||||
//Stream& operator<<(const char* s);
|
||||
//Stream& operator<<(const char *s);
|
||||
//};
|
||||
//const char* function();
|
||||
//
|
||||
|
@ -2578,7 +2578,7 @@ public class CodeFormatterTest extends BaseUITestCase {
|
|||
//}
|
||||
|
||||
//class Stream {
|
||||
// Stream& operator<<(const char* s);
|
||||
// Stream& operator<<(const char *s);
|
||||
//};
|
||||
//const char* function();
|
||||
//
|
||||
|
@ -2595,7 +2595,7 @@ public class CodeFormatterTest extends BaseUITestCase {
|
|||
}
|
||||
|
||||
//class Stream {
|
||||
//Stream& operator<<(const char* s);
|
||||
//Stream& operator<<(const char *s);
|
||||
//Stream& operator<<(int i);
|
||||
//};
|
||||
//
|
||||
|
@ -2608,7 +2608,7 @@ public class CodeFormatterTest extends BaseUITestCase {
|
|||
//}
|
||||
|
||||
//class Stream {
|
||||
// Stream& operator<<(const char* s);
|
||||
// Stream& operator<<(const char *s);
|
||||
// Stream& operator<<(int i);
|
||||
//};
|
||||
//
|
||||
|
@ -2727,7 +2727,7 @@ public class CodeFormatterTest extends BaseUITestCase {
|
|||
//
|
||||
//#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,
|
||||
// very_loooooooooooooooooooooooong_name))
|
||||
// << variable_with_a_loooong_name;
|
||||
|
@ -2961,7 +2961,7 @@ public class CodeFormatterTest extends BaseUITestCase {
|
|||
|
||||
//struct {
|
||||
// int n;
|
||||
//}* l;
|
||||
//} *l;
|
||||
//void f(int p0, int p1) {
|
||||
// f((p0 + 2), l->n);
|
||||
//}
|
||||
|
@ -3830,7 +3830,7 @@ public class CodeFormatterTest extends BaseUITestCase {
|
|||
// }
|
||||
//};
|
||||
////explicit instantiation
|
||||
//template bool data::operator< <int>(int const &) const;
|
||||
//template bool data::operator< <int>(int const&) const;
|
||||
|
||||
//class data {
|
||||
//public:
|
||||
|
@ -3839,7 +3839,7 @@ public class CodeFormatterTest extends BaseUITestCase {
|
|||
// }
|
||||
//};
|
||||
////explicit instantiation
|
||||
//template bool data::operator< <int>(int const &) const;
|
||||
//template bool data::operator< <int>(int const&) const;
|
||||
public void testTemplateInstantiationOperatorLesser_Bug540252() throws Exception {
|
||||
assertFormatterResult();
|
||||
}
|
||||
|
@ -3865,7 +3865,7 @@ public class CodeFormatterTest extends BaseUITestCase {
|
|||
//void func() {
|
||||
// try {
|
||||
// WW("1") << "2";
|
||||
// } catch (const std::exception& e) {
|
||||
// } catch (const std::exception &e) {
|
||||
// std::cout << "blah...." << std::endl;
|
||||
// }
|
||||
//}
|
||||
|
|
|
@ -87,6 +87,8 @@ final class FormatterMessages extends NLS {
|
|||
public static String WhiteSpaceTabPage_after_opening_brace;
|
||||
public static String WhiteSpaceTabPage_after_closing_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_between_empty_braces;
|
||||
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_postfix_operator;
|
||||
public static String WhiteSpaceOptions_opening_paren;
|
||||
public static String WhiteSpaceOptions_pointer;
|
||||
public static String WhiteSpaceOptions_catch;
|
||||
public static String WhiteSpaceOptions_for;
|
||||
public static String WhiteSpaceOptions_if;
|
||||
|
@ -170,6 +173,8 @@ final class FormatterMessages extends NLS {
|
|||
public static String WhiteSpaceOptions_case;
|
||||
public static String WhiteSpaceOptions_default;
|
||||
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_after_opening_paren;
|
||||
public static String WhiteSpaceOptions_before_closing_paren;
|
||||
|
|
|
@ -92,6 +92,8 @@ WhiteSpaceTabPage_after_closing_brace=after closing brace
|
|||
WhiteSpaceTabPage_before_opening_brace=before opening brace
|
||||
WhiteSpaceTabPage_before_closing_brace=before closing brace
|
||||
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_closing_paren=after closing parenthesis
|
||||
|
@ -139,6 +141,10 @@ WhiteSpaceOptions_unary_operator=Unary operator
|
|||
WhiteSpaceOptions_prefix_operator=Prefix 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_catch='catch'
|
||||
WhiteSpaceOptions_for='for'
|
||||
|
|
|
@ -177,7 +177,8 @@ public final class WhiteSpaceOptions {
|
|||
|
||||
private final PreviewSnippet METHOD_DECL_PREVIEW = new PreviewSnippet(CodeFormatter.K_CLASS_BODY_DECLARATIONS,
|
||||
"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,
|
||||
"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$
|
||||
|
||||
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,
|
||||
"if (true) { return 1; } else { return 2; }"); //$NON-NLS-1$
|
||||
|
@ -242,6 +243,13 @@ public final class WhiteSpaceOptions {
|
|||
|
||||
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);
|
||||
createBeforeOpenParenTree(workingValues,
|
||||
createChild(element, workingValues, FormatterMessages.WhiteSpaceOptions_before));
|
||||
|
@ -344,6 +352,12 @@ public final class WhiteSpaceOptions {
|
|||
|
||||
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);
|
||||
createBeforeOpenParenTree(workingValues, parent);
|
||||
|
||||
|
@ -675,6 +689,25 @@ public final class WhiteSpaceOptions {
|
|||
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) {
|
||||
|
||||
createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_catch,
|
||||
|
@ -956,7 +989,12 @@ public final class WhiteSpaceOptions {
|
|||
createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_before_opening_brace,
|
||||
DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_METHOD_DECLARATION,
|
||||
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,
|
||||
DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_METHOD_DECLARATION_PARAMETERS,
|
||||
METHOD_DECL_PREVIEW);
|
||||
|
@ -1020,6 +1058,12 @@ public final class WhiteSpaceOptions {
|
|||
createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_declarator_list_after_comma,
|
||||
DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_DECLARATOR_LIST,
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue