Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergey Prigogin2008-03-10 00:31:39 +0000
committerSergey Prigogin2008-03-10 00:31:39 +0000
commitcf9f88cb446c019cadcfb7d0a3b3d67ea611ffcf (patch)
treef5e5dc99b55b528ecfecc133945be26bdf9b5e96 /core/org.eclipse.cdt.core/parser
parentd5f6bfc0bd425709c5054e0c81a1c8e3a9a9daf0 (diff)
downloadorg.eclipse.cdt-cf9f88cb446c019cadcfb7d0a3b3d67ea611ffcf.tar.gz
org.eclipse.cdt-cf9f88cb446c019cadcfb7d0a3b3d67ea611ffcf.tar.xz
org.eclipse.cdt-cf9f88cb446c019cadcfb7d0a3b3d67ea611ffcf.zip
Cosmetics.
Diffstat (limited to 'core/org.eclipse.cdt.core/parser')
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPSpecialization.java63
1 files changed, 37 insertions, 26 deletions
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPSpecialization.java
index b82c85d572d..d557d19c994 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPSpecialization.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPSpecialization.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM - Initial API and implementation
* Markus Schorn (Wind River Systems)
- * /
+ *
*******************************************************************************/
/*
* Created on Apr 29, 2005
@@ -30,38 +30,40 @@ import org.eclipse.core.runtime.PlatformObject;
/**
* @author aniefer
- *
*/
-public abstract class CPPSpecialization extends PlatformObject implements ICPPSpecialization, ICPPInternalBinding {
+public abstract class CPPSpecialization extends PlatformObject
+ implements ICPPSpecialization, ICPPInternalBinding {
private IBinding specialized;
private ICPPScope scope;
protected ObjectMap argumentMap;
-
- private IASTNode definition = null;
- private IASTNode [] declarations = null;
-
- public CPPSpecialization( IBinding specialized, ICPPScope scope, ObjectMap argumentMap ){
+
+ private IASTNode definition;
+ private IASTNode[] declarations;
+
+ public CPPSpecialization(IBinding specialized, ICPPScope scope, ObjectMap argumentMap) {
this.specialized = specialized;
this.scope = scope;
this.argumentMap = argumentMap;
-
- if( specialized instanceof ICPPInternalBinding ){
+
+ if (specialized instanceof ICPPInternalBinding) {
definition = ((ICPPInternalBinding)specialized).getDefinition();
- IASTNode [] decls = ((ICPPInternalBinding)specialized).getDeclarations();
- if( decls != null && decls.length > 0 )
- declarations = new IASTNode[]{ decls[0] };
+ IASTNode[] decls = ((ICPPInternalBinding)specialized).getDeclarations();
+ if (decls != null && decls.length > 0)
+ declarations = new IASTNode[] { decls[0] };
}
}
-
+
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPSpecialization#getSpecializedBinding()
*/
public IBinding getSpecializedBinding() {
return specialized;
}
+
public IASTNode[] getDeclarations() {
return declarations;
}
+
public IASTNode getDefinition() {
return definition;
}
@@ -69,48 +71,57 @@ public abstract class CPPSpecialization extends PlatformObject implements ICPPSp
public void addDefinition(IASTNode node) {
definition = node;
}
+
public void addDeclaration(IASTNode node) {
- if( declarations == null )
+ if (declarations == null) {
declarations = new IASTNode[] { node };
- else {
- //keep the lowest offset declaration in [0]
- if( declarations.length > 0 && ((ASTNode)node).getOffset() < ((ASTNode)declarations[0]).getOffset() ){
- declarations = (IASTNode[]) ArrayUtil.prepend( IASTNode.class, declarations, node );
+ } else {
+ // keep the lowest offset declaration in [0]
+ if (declarations.length > 0 &&
+ ((ASTNode) node).getOffset() < ((ASTNode) declarations[0]).getOffset()) {
+ declarations = (IASTNode[]) ArrayUtil.prepend(IASTNode.class, declarations, node);
} else {
- declarations = (IASTNode[]) ArrayUtil.append( IASTNode.class, declarations, node );
+ declarations = (IASTNode[]) ArrayUtil.append(IASTNode.class, declarations, node);
}
}
}
-
+
public void removeDeclaration(IASTNode node) {
- if( node == definition ){
+ if (node == definition) {
definition = null;
return;
}
ArrayUtil.remove(declarations, node);
}
-
+
public String getName() {
return specialized.getName();
}
+
public char[] getNameCharArray() {
return specialized.getNameCharArray();
}
+
public IScope getScope() {
return scope;
}
+
public String[] getQualifiedName() {
- return CPPVisitor.getQualifiedName( this );
+ return CPPVisitor.getQualifiedName(this);
}
+
public char[][] getQualifiedNameCharArray() {
- return CPPVisitor.getQualifiedNameCharArray( this );
+ return CPPVisitor.getQualifiedNameCharArray(this);
}
+
public boolean isGloballyQualified() throws DOMException {
- return ((ICPPInternalBinding)specialized).isGloballyQualified();
+ return ((ICPPInternalBinding) specialized).isGloballyQualified();
}
+
public ILinkage getLinkage() {
return Linkage.CPP_LINKAGE;
}
+
public ObjectMap getArgumentMap() {
return argumentMap;
}

Back to the top