mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-26 02:15:31 +02:00
Cosmetics.
This commit is contained in:
parent
d5f6bfc0bd
commit
cf9f88cb44
1 changed files with 37 additions and 26 deletions
|
@ -8,7 +8,7 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM - Initial API and implementation
|
* IBM - Initial API and implementation
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
* /
|
*
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
/*
|
/*
|
||||||
* Created on Apr 29, 2005
|
* Created on Apr 29, 2005
|
||||||
|
@ -30,38 +30,40 @@ import org.eclipse.core.runtime.PlatformObject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author aniefer
|
* @author aniefer
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public abstract class CPPSpecialization extends PlatformObject implements ICPPSpecialization, ICPPInternalBinding {
|
public abstract class CPPSpecialization extends PlatformObject
|
||||||
|
implements ICPPSpecialization, ICPPInternalBinding {
|
||||||
private IBinding specialized;
|
private IBinding specialized;
|
||||||
private ICPPScope scope;
|
private ICPPScope scope;
|
||||||
protected ObjectMap argumentMap;
|
protected ObjectMap argumentMap;
|
||||||
|
|
||||||
private IASTNode definition = null;
|
private IASTNode definition;
|
||||||
private IASTNode [] declarations = null;
|
private IASTNode[] declarations;
|
||||||
|
|
||||||
public CPPSpecialization( IBinding specialized, ICPPScope scope, ObjectMap argumentMap ){
|
public CPPSpecialization(IBinding specialized, ICPPScope scope, ObjectMap argumentMap) {
|
||||||
this.specialized = specialized;
|
this.specialized = specialized;
|
||||||
this.scope = scope;
|
this.scope = scope;
|
||||||
this.argumentMap = argumentMap;
|
this.argumentMap = argumentMap;
|
||||||
|
|
||||||
if( specialized instanceof ICPPInternalBinding ){
|
if (specialized instanceof ICPPInternalBinding) {
|
||||||
definition = ((ICPPInternalBinding)specialized).getDefinition();
|
definition = ((ICPPInternalBinding)specialized).getDefinition();
|
||||||
IASTNode [] decls = ((ICPPInternalBinding)specialized).getDeclarations();
|
IASTNode[] decls = ((ICPPInternalBinding)specialized).getDeclarations();
|
||||||
if( decls != null && decls.length > 0 )
|
if (decls != null && decls.length > 0)
|
||||||
declarations = new IASTNode[]{ decls[0] };
|
declarations = new IASTNode[] { decls[0] };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPSpecialization#getSpecializedBinding()
|
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPSpecialization#getSpecializedBinding()
|
||||||
*/
|
*/
|
||||||
public IBinding getSpecializedBinding() {
|
public IBinding getSpecializedBinding() {
|
||||||
return specialized;
|
return specialized;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IASTNode[] getDeclarations() {
|
public IASTNode[] getDeclarations() {
|
||||||
return declarations;
|
return declarations;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IASTNode getDefinition() {
|
public IASTNode getDefinition() {
|
||||||
return definition;
|
return definition;
|
||||||
}
|
}
|
||||||
|
@ -69,48 +71,57 @@ public abstract class CPPSpecialization extends PlatformObject implements ICPPSp
|
||||||
public void addDefinition(IASTNode node) {
|
public void addDefinition(IASTNode node) {
|
||||||
definition = node;
|
definition = node;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addDeclaration(IASTNode node) {
|
public void addDeclaration(IASTNode node) {
|
||||||
if( declarations == null )
|
if (declarations == null) {
|
||||||
declarations = new IASTNode[] { node };
|
declarations = new IASTNode[] { node };
|
||||||
else {
|
} else {
|
||||||
//keep the lowest offset declaration in [0]
|
// keep the lowest offset declaration in [0]
|
||||||
if( declarations.length > 0 && ((ASTNode)node).getOffset() < ((ASTNode)declarations[0]).getOffset() ){
|
if (declarations.length > 0 &&
|
||||||
declarations = (IASTNode[]) ArrayUtil.prepend( IASTNode.class, declarations, node );
|
((ASTNode) node).getOffset() < ((ASTNode) declarations[0]).getOffset()) {
|
||||||
|
declarations = (IASTNode[]) ArrayUtil.prepend(IASTNode.class, declarations, node);
|
||||||
} else {
|
} else {
|
||||||
declarations = (IASTNode[]) ArrayUtil.append( IASTNode.class, declarations, node );
|
declarations = (IASTNode[]) ArrayUtil.append(IASTNode.class, declarations, node);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeDeclaration(IASTNode node) {
|
public void removeDeclaration(IASTNode node) {
|
||||||
if( node == definition ){
|
if (node == definition) {
|
||||||
definition = null;
|
definition = null;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ArrayUtil.remove(declarations, node);
|
ArrayUtil.remove(declarations, node);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return specialized.getName();
|
return specialized.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
public char[] getNameCharArray() {
|
public char[] getNameCharArray() {
|
||||||
return specialized.getNameCharArray();
|
return specialized.getNameCharArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
public IScope getScope() {
|
public IScope getScope() {
|
||||||
return scope;
|
return scope;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] getQualifiedName() {
|
public String[] getQualifiedName() {
|
||||||
return CPPVisitor.getQualifiedName( this );
|
return CPPVisitor.getQualifiedName(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public char[][] getQualifiedNameCharArray() {
|
public char[][] getQualifiedNameCharArray() {
|
||||||
return CPPVisitor.getQualifiedNameCharArray( this );
|
return CPPVisitor.getQualifiedNameCharArray(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isGloballyQualified() throws DOMException {
|
public boolean isGloballyQualified() throws DOMException {
|
||||||
return ((ICPPInternalBinding)specialized).isGloballyQualified();
|
return ((ICPPInternalBinding) specialized).isGloballyQualified();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ILinkage getLinkage() {
|
public ILinkage getLinkage() {
|
||||||
return Linkage.CPP_LINKAGE;
|
return Linkage.CPP_LINKAGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ObjectMap getArgumentMap() {
|
public ObjectMap getArgumentMap() {
|
||||||
return argumentMap;
|
return argumentMap;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue