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; }