mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-12 10:45:37 +02:00
178789: match initial template support in the PDOM
This commit is contained in:
parent
27d7f76135
commit
8c9eaf991e
21 changed files with 829 additions and 6 deletions
|
@ -0,0 +1,21 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007 Symbian Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Andrew Ferguson (Symbian) - Initial implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.index;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBinding;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
||||
/**
|
||||
* This interface is possibly interim. It allows determining the owner of a parameter.
|
||||
*/
|
||||
public interface IIndexInternalTemplateParameter {
|
||||
ICPPBinding getParameterOwner() throws CoreException;
|
||||
}
|
|
@ -24,10 +24,14 @@ import org.eclipse.cdt.core.dom.ast.IType;
|
|||
import org.eclipse.cdt.core.dom.ast.ITypedef;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassScope;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplate;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplatePartialSpecialization;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDeferredTemplateInstance;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPField;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionTemplate;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespace;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespaceAlias;
|
||||
|
@ -35,6 +39,10 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespaceScope;
|
|||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPParameter;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPPointerToMemberType;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPReferenceType;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPSpecialization;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateDefinition;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateInstance;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateTypeParameter;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPVariable;
|
||||
import org.eclipse.cdt.core.index.IIndex;
|
||||
import org.eclipse.cdt.core.index.IIndexBinding;
|
||||
|
@ -95,7 +103,9 @@ public class CPPCompositesFactory extends AbstractCompositeFactory implements IC
|
|||
public IType getCompositeType(IIndexType rtype) throws DOMException {
|
||||
IType result;
|
||||
|
||||
if(rtype instanceof ICPPClassType) {
|
||||
if(rtype instanceof ICPPSpecialization) {
|
||||
result = (IIndexType) getCompositeBinding((IIndexFragmentBinding) rtype);
|
||||
} else if(rtype instanceof ICPPClassType) {
|
||||
result = (ICPPClassType) getCompositeBinding((IIndexFragmentBinding) rtype);
|
||||
} else if(rtype instanceof ITypedef) {
|
||||
result = new CompositeCPPTypedef(this, (ICPPBinding) rtype);
|
||||
|
@ -113,6 +123,8 @@ public class CPPCompositesFactory extends AbstractCompositeFactory implements IC
|
|||
result = new CompositeArrayType((IArrayType) rtype, this);
|
||||
} else if(rtype == null) {
|
||||
result = null;
|
||||
} else if(rtype instanceof ICPPTemplateTypeParameter) {
|
||||
result = (IIndexType) getCompositeBinding((IIndexFragmentBinding) rtype);
|
||||
} else if(rtype instanceof IBasicType) {
|
||||
result = rtype; // no context required its a leaf with no way to traverse upward
|
||||
} else {
|
||||
|
@ -141,6 +153,54 @@ public class CPPCompositesFactory extends AbstractCompositeFactory implements IC
|
|||
try {
|
||||
if(binding==null) {
|
||||
result = null;
|
||||
} else if (binding instanceof ICPPTemplateDefinition) {
|
||||
if(binding instanceof ICPPClassTemplate) {
|
||||
return new CompositeCPPClassTemplate(this, (ICPPClassType) binding);
|
||||
} else if (binding instanceof ICPPFunctionTemplate) {
|
||||
return new CompositeCPPFunctionTemplate(this, (ICPPFunction) binding);
|
||||
} else {
|
||||
throw new CompositingNotImplementedError("composite binding unavailable for "+binding+" "+binding.getClass()); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
} else if(binding instanceof ICPPSpecialization) {
|
||||
if(binding instanceof ICPPTemplateInstance) {
|
||||
if(binding instanceof ICPPDeferredTemplateInstance) {
|
||||
if(binding instanceof ICPPClassType) {
|
||||
return new CompositeCPPDeferredClassInstance(this, (ICPPClassType) binding);
|
||||
} else if(binding instanceof ICPPFunction) {
|
||||
return new CompositeCPPDeferredFunctionInstance(this, (ICPPFunction) binding);
|
||||
} else {
|
||||
throw new CompositingNotImplementedError("composite binding unavailable for "+binding+" "+binding.getClass()); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
} else {
|
||||
if(binding instanceof ICPPClassType) {
|
||||
return new CompositeCPPClassInstance(this, (ICPPClassType) binding);
|
||||
} if(binding instanceof ICPPFunction) {
|
||||
return new CompositeCPPFunctionInstance(this, (ICPPFunction) binding);
|
||||
} else {
|
||||
throw new CompositingNotImplementedError("composite binding unavailable for "+binding+" "+binding.getClass()); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if(binding instanceof ICPPClassType) {
|
||||
if(binding instanceof ICPPClassTemplatePartialSpecialization) {
|
||||
return new CompositeCPPClassTemplatePartialSpecialization(this, (ICPPClassTemplatePartialSpecialization) binding);
|
||||
} else {
|
||||
return new CompositeCPPClassSpecialization(this, (ICPPClassType) binding);
|
||||
}
|
||||
} if(binding instanceof ICPPConstructor) {
|
||||
return new CompositeCPPConstructorSpecialization(this, (ICPPConstructor) binding);
|
||||
} if(binding instanceof ICPPMethod) {
|
||||
return new CompositeCPPMethodSpecialization(this, (ICPPMethod) binding);
|
||||
} if(binding instanceof ICPPFunction) {
|
||||
return new CompositeCPPFunctionSpecialization(this, (ICPPFunction) binding);
|
||||
} if(binding instanceof ICPPField) {
|
||||
return new CompositeCPPField(this, (ICPPField) binding);
|
||||
} if(binding instanceof ICPPParameter) {
|
||||
return new CompositeCPPParameter(this, (ICPPParameter) binding);
|
||||
} else {
|
||||
throw new CompositingNotImplementedError("composite binding unavailable for "+binding+" "+binding.getClass()); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
}
|
||||
} else if(binding instanceof ICPPParameter) {
|
||||
result = new CompositeCPPParameter(this, (ICPPParameter) binding);
|
||||
} else if(binding instanceof ICPPField) {
|
||||
|
@ -168,6 +228,8 @@ public class CPPCompositesFactory extends AbstractCompositeFactory implements IC
|
|||
result = new CompositeCPPEnumerator(this, (IEnumerator) binding);
|
||||
} else if(binding instanceof ITypedef) {
|
||||
result = new CompositeCPPTypedef(this, (ICPPBinding) binding);
|
||||
} else if(binding instanceof ICPPTemplateTypeParameter) {
|
||||
result = new CompositeCPPTemplateTypeParameter(this, (ICPPTemplateTypeParameter) binding);
|
||||
} else {
|
||||
throw new CompositingNotImplementedError("composite binding unavailable for "+binding+" "+binding.getClass()); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007 Symbian Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Andrew Ferguson (Symbian) - Initial implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.index.composite.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPSpecialization;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateDefinition;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateInstance;
|
||||
import org.eclipse.cdt.core.parser.util.ObjectMap;
|
||||
import org.eclipse.cdt.internal.core.index.IIndexType;
|
||||
import org.eclipse.cdt.internal.core.index.composite.ICompositesFactory;
|
||||
|
||||
public class CompositeCPPClassInstance extends CompositeCPPClassType implements
|
||||
ICPPClassType, IIndexType, ICPPTemplateInstance, ICPPSpecialization {
|
||||
|
||||
public CompositeCPPClassInstance(ICompositesFactory cf, ICPPClassType rbinding) {
|
||||
super(cf, rbinding);
|
||||
}
|
||||
|
||||
public ObjectMap getArgumentMap() { return TemplateInstanceUtil.getArgumentMap(cf, rbinding); }
|
||||
public IBinding getSpecializedBinding() { return TemplateInstanceUtil.getSpecializedBinding(cf, rbinding); }
|
||||
public IType[] getArguments() { return TemplateInstanceUtil.getArguments(cf, rbinding); }
|
||||
public ICPPTemplateDefinition getTemplateDefinition() { return TemplateInstanceUtil.getTemplateDefinition(cf, rbinding); }
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007 Symbian Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Andrew Ferguson (Symbian) - Initial implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.index.composite.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPSpecialization;
|
||||
import org.eclipse.cdt.core.parser.util.ObjectMap;
|
||||
import org.eclipse.cdt.internal.core.index.IIndexType;
|
||||
import org.eclipse.cdt.internal.core.index.composite.ICompositesFactory;
|
||||
|
||||
public class CompositeCPPClassSpecialization extends CompositeCPPClassType implements
|
||||
IIndexType, ICPPSpecialization {
|
||||
|
||||
public CompositeCPPClassSpecialization(ICompositesFactory cf, ICPPClassType rbinding) {
|
||||
super(cf, rbinding);
|
||||
}
|
||||
|
||||
public ObjectMap getArgumentMap() {
|
||||
return TemplateInstanceUtil.getArgumentMap(cf, rbinding);
|
||||
}
|
||||
|
||||
public IBinding getSpecializedBinding() {
|
||||
return TemplateInstanceUtil.getSpecializedBinding(cf, rbinding);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007 Symbian Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Andrew Ferguson (Symbian) - Initial implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.index.composite.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplate;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplatePartialSpecialization;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPSpecialization;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalTemplateInstantiator;
|
||||
import org.eclipse.cdt.internal.core.index.IIndexFragmentBinding;
|
||||
import org.eclipse.cdt.internal.core.index.composite.ICompositesFactory;
|
||||
|
||||
public class CompositeCPPClassTemplate extends CompositeCPPClassType implements
|
||||
ICPPClassTemplate, ICPPInternalTemplateInstantiator{
|
||||
|
||||
public CompositeCPPClassTemplate(ICompositesFactory cf, ICPPClassType ct) {
|
||||
super(cf, ct);
|
||||
}
|
||||
|
||||
public ICPPClassTemplatePartialSpecialization[] getPartialSpecializations()
|
||||
throws DOMException {
|
||||
ICPPClassTemplatePartialSpecialization[] result= ((ICPPClassTemplate)rbinding).getPartialSpecializations();
|
||||
for(int i=0; i<result.length; i++) {
|
||||
result[i]= (ICPPClassTemplatePartialSpecialization) cf.getCompositeBinding((IIndexFragmentBinding)result[i]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public ICPPTemplateParameter[] getTemplateParameters() throws DOMException {
|
||||
ICPPTemplateParameter[] result= ((ICPPClassTemplate)rbinding).getTemplateParameters();
|
||||
for(int i=0; i<result.length; i++) {
|
||||
result[i]= (ICPPTemplateParameter) cf.getCompositeBinding((IIndexFragmentBinding) result[i]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public ICPPSpecialization deferredInstance(IType[] arguments) {
|
||||
return InternalTemplateInstantiatorUtil.deferredInstance(arguments, cf, rbinding);
|
||||
}
|
||||
|
||||
public ICPPSpecialization getInstance(IType[] arguments) {
|
||||
return InternalTemplateInstantiatorUtil.getInstance(arguments, cf, rbinding);
|
||||
}
|
||||
|
||||
public IBinding instantiate(IType[] arguments) {
|
||||
return InternalTemplateInstantiatorUtil.instantiate(arguments, cf, rbinding);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007 Symbian Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Andrew Ferguson (Symbian) - Initial implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.index.composite.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplate;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplatePartialSpecialization;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPSpecialization;
|
||||
import org.eclipse.cdt.core.parser.util.ObjectMap;
|
||||
import org.eclipse.cdt.internal.core.index.IIndexFragmentBinding;
|
||||
import org.eclipse.cdt.internal.core.index.composite.ICompositesFactory;
|
||||
import org.eclipse.cdt.internal.core.pdom.dom.IPDOMOverloader;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
||||
public class CompositeCPPClassTemplatePartialSpecialization extends CompositeCPPClassTemplate implements ICPPClassTemplatePartialSpecialization, ICPPSpecialization, IPDOMOverloader {
|
||||
public CompositeCPPClassTemplatePartialSpecialization(ICompositesFactory cf, ICPPClassTemplatePartialSpecialization delegate) {
|
||||
super(cf, (ICPPClassType) delegate);
|
||||
}
|
||||
|
||||
public ICPPClassTemplate getPrimaryClassTemplate() throws DOMException {
|
||||
ICPPClassTemplate preresult= ((ICPPClassTemplatePartialSpecialization)rbinding).getPrimaryClassTemplate();
|
||||
return (ICPPClassTemplate) cf.getCompositeBinding((IIndexFragmentBinding)preresult);
|
||||
}
|
||||
|
||||
public IType[] getArguments() { return TemplateInstanceUtil.getArguments(cf, rbinding); }
|
||||
public ObjectMap getArgumentMap() { return TemplateInstanceUtil.getArgumentMap(cf, rbinding); }
|
||||
public IBinding getSpecializedBinding() { return TemplateInstanceUtil.getSpecializedBinding(cf, rbinding); }
|
||||
public int getSignatureMemento() throws CoreException { return ((IPDOMOverloader) rbinding).getSignatureMemento(); }
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007 Symbian Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Andrew Ferguson (Symbian) - Initial implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.index.composite.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplate;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplatePartialSpecialization;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPSpecialization;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalTemplateInstantiator;
|
||||
import org.eclipse.cdt.internal.core.index.IIndexFragmentBinding;
|
||||
import org.eclipse.cdt.internal.core.index.composite.ICompositesFactory;
|
||||
|
||||
public class CompositeCPPClassTemplateSpecialization extends
|
||||
CompositeCPPClassSpecialization implements ICPPClassTemplate, ICPPInternalTemplateInstantiator{
|
||||
|
||||
public CompositeCPPClassTemplateSpecialization(ICompositesFactory cf, ICPPClassType rbinding) {
|
||||
super(cf, rbinding);
|
||||
}
|
||||
|
||||
public ICPPClassTemplatePartialSpecialization[] getPartialSpecializations()
|
||||
throws DOMException {
|
||||
ICPPClassTemplatePartialSpecialization[] result= ((ICPPClassTemplate)rbinding).getPartialSpecializations();
|
||||
for(int i=0; i<result.length; i++) {
|
||||
result[i]= (ICPPClassTemplatePartialSpecialization) cf.getCompositeBinding((IIndexFragmentBinding)result[i]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public ICPPTemplateParameter[] getTemplateParameters() throws DOMException {
|
||||
ICPPTemplateParameter[] result= ((ICPPClassTemplate)rbinding).getTemplateParameters();
|
||||
for(int i=0; i<result.length; i++) {
|
||||
result[i]= (ICPPTemplateParameter) cf.getCompositeBinding((IIndexFragmentBinding) result[i]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public ICPPSpecialization deferredInstance(IType[] arguments) {
|
||||
return InternalTemplateInstantiatorUtil.deferredInstance(arguments, cf, rbinding);
|
||||
}
|
||||
|
||||
public ICPPSpecialization getInstance(IType[] arguments) {
|
||||
return InternalTemplateInstantiatorUtil.getInstance(arguments, cf, rbinding);
|
||||
}
|
||||
|
||||
public IBinding instantiate(IType[] arguments) {
|
||||
return InternalTemplateInstantiatorUtil.instantiate(arguments, cf, rbinding);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007 Symbian Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Andrew Ferguson (Symbian) - Initial implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.index.composite.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
|
||||
import org.eclipse.cdt.internal.core.index.composite.ICompositesFactory;
|
||||
|
||||
public class CompositeCPPConstructorSpecialization extends
|
||||
CompositeCPPMethodSpecialization implements ICPPConstructor {
|
||||
|
||||
public CompositeCPPConstructorSpecialization(ICompositesFactory cf, ICPPConstructor cons) {
|
||||
super(cf, cons);
|
||||
}
|
||||
|
||||
public boolean isExplicit() throws DOMException {
|
||||
return ((ICPPConstructor)rbinding).isExplicit();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007 Symbian Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Andrew Ferguson (Symbian) - Initial implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.index.composite.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDeferredTemplateInstance;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPSpecialization;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateDefinition;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateInstance;
|
||||
import org.eclipse.cdt.core.parser.util.ObjectMap;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalTemplateInstantiator;
|
||||
import org.eclipse.cdt.internal.core.index.IIndexFragmentBinding;
|
||||
import org.eclipse.cdt.internal.core.index.composite.ICompositesFactory;
|
||||
|
||||
public class CompositeCPPDeferredClassInstance extends CompositeCPPClassType implements ICPPDeferredTemplateInstance, ICPPSpecialization {
|
||||
|
||||
public CompositeCPPDeferredClassInstance(ICompositesFactory cf, ICPPClassType rbinding) {
|
||||
super(cf, rbinding);
|
||||
}
|
||||
|
||||
public ICPPTemplateDefinition getTemplateDefinition() {
|
||||
ICPPTemplateDefinition preresult= ((ICPPTemplateInstance)rbinding).getTemplateDefinition();
|
||||
return (ICPPTemplateDefinition) cf.getCompositeBinding((IIndexFragmentBinding)preresult);
|
||||
}
|
||||
|
||||
// TODO - what happens to the arguments?
|
||||
public ICPPSpecialization deferredInstance(IType[] arguments) {
|
||||
ICPPSpecialization spec= ((ICPPInternalTemplateInstantiator)rbinding).deferredInstance(arguments);
|
||||
return (ICPPSpecialization) cf.getCompositeBinding((IIndexFragmentBinding)spec);
|
||||
}
|
||||
|
||||
// TODO - what happens to the arguments?
|
||||
public ICPPSpecialization getInstance(IType[] arguments) {
|
||||
ICPPSpecialization ins= ((ICPPInternalTemplateInstantiator)rbinding).getInstance(arguments);
|
||||
return (ICPPSpecialization) cf.getCompositeBinding((IIndexFragmentBinding)ins);
|
||||
}
|
||||
|
||||
// TODO - what happens to the arguments?
|
||||
public IBinding instantiate(IType[] arguments) {
|
||||
IBinding ins= ((ICPPInternalTemplateInstantiator)rbinding).instantiate(arguments);
|
||||
return (IBinding) cf.getCompositeBinding((IIndexFragmentBinding)ins);
|
||||
}
|
||||
|
||||
public IType[] getArguments() { return TemplateInstanceUtil.getArguments(cf, rbinding); }
|
||||
public ObjectMap getArgumentMap() { return TemplateInstanceUtil.getArgumentMap(cf, rbinding); }
|
||||
public IBinding getSpecializedBinding() { return TemplateInstanceUtil.getSpecializedBinding(cf, rbinding); }
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007 Symbian Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Andrew Ferguson (Symbian) - Initial implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.index.composite.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDeferredTemplateInstance;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateDefinition;
|
||||
import org.eclipse.cdt.core.parser.util.ObjectMap;
|
||||
import org.eclipse.cdt.internal.core.index.composite.ICompositesFactory;
|
||||
|
||||
public class CompositeCPPDeferredFunctionInstance extends CompositeCPPFunction
|
||||
implements ICPPDeferredTemplateInstance {
|
||||
|
||||
public CompositeCPPDeferredFunctionInstance(ICompositesFactory cf, ICPPFunction rbinding) {
|
||||
super(cf, rbinding);
|
||||
}
|
||||
|
||||
public IType[] getArguments() { return TemplateInstanceUtil.getArguments(cf, rbinding); }
|
||||
public ICPPTemplateDefinition getTemplateDefinition() { return TemplateInstanceUtil.getTemplateDefinition(cf, rbinding); }
|
||||
public ObjectMap getArgumentMap() { return TemplateInstanceUtil.getArgumentMap(cf, rbinding); }
|
||||
public IBinding getSpecializedBinding() { return TemplateInstanceUtil.getSpecializedBinding(cf, rbinding); }
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007 Symbian Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Andrew Ferguson (Symbian) - Initial implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.index.composite.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPField;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPSpecialization;
|
||||
import org.eclipse.cdt.core.parser.util.ObjectMap;
|
||||
import org.eclipse.cdt.internal.core.index.composite.ICompositesFactory;
|
||||
|
||||
public class CompositeCPPFieldSpecialization extends CompositeCPPField implements ICPPSpecialization {
|
||||
|
||||
public CompositeCPPFieldSpecialization(ICompositesFactory cf, ICPPField rbinding) {
|
||||
super(cf, rbinding);
|
||||
}
|
||||
|
||||
public ObjectMap getArgumentMap() {
|
||||
return TemplateInstanceUtil.getArgumentMap(cf, rbinding);
|
||||
}
|
||||
|
||||
public IBinding getSpecializedBinding() {
|
||||
return TemplateInstanceUtil.getSpecializedBinding(cf, rbinding);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007 Symbian Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Andrew Ferguson (Symbian) - Initial implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.index.composite.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPSpecialization;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateDefinition;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateInstance;
|
||||
import org.eclipse.cdt.core.parser.util.ObjectMap;
|
||||
import org.eclipse.cdt.internal.core.index.composite.ICompositesFactory;
|
||||
|
||||
public class CompositeCPPFunctionInstance extends CompositeCPPFunction implements ICPPTemplateInstance, ICPPSpecialization {
|
||||
|
||||
public CompositeCPPFunctionInstance(ICompositesFactory cf, ICPPFunction rbinding) {
|
||||
super(cf, rbinding);
|
||||
}
|
||||
|
||||
public IType[] getArguments() { return TemplateInstanceUtil.getArguments(cf, rbinding); }
|
||||
public ICPPTemplateDefinition getTemplateDefinition() { return TemplateInstanceUtil.getTemplateDefinition(cf, rbinding); }
|
||||
public ObjectMap getArgumentMap() { return TemplateInstanceUtil.getArgumentMap(cf, rbinding); }
|
||||
public IBinding getSpecializedBinding() { return TemplateInstanceUtil.getSpecializedBinding(cf, rbinding); }
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007 Symbian Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Andrew Ferguson (Symbian) - Initial implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.index.composite.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPSpecialization;
|
||||
import org.eclipse.cdt.core.parser.util.ObjectMap;
|
||||
import org.eclipse.cdt.internal.core.index.IIndexType;
|
||||
import org.eclipse.cdt.internal.core.index.composite.ICompositesFactory;
|
||||
|
||||
public class CompositeCPPFunctionSpecialization extends CompositeCPPFunction
|
||||
implements IIndexType, ICPPFunction, ICPPSpecialization {
|
||||
|
||||
public CompositeCPPFunctionSpecialization(ICompositesFactory cf, ICPPFunction ft) {
|
||||
super(cf, (ICPPFunction) ft);
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuffer result = new StringBuffer();
|
||||
try {
|
||||
result.append(getName()+" "+ASTTypeUtil.getParameterTypeString(getType())); //$NON-NLS-1$
|
||||
} catch(DOMException de) {
|
||||
result.append(de);
|
||||
}
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
public ObjectMap getArgumentMap() {
|
||||
return TemplateInstanceUtil.getArgumentMap(cf, rbinding);
|
||||
}
|
||||
|
||||
public IBinding getSpecializedBinding() {
|
||||
return TemplateInstanceUtil.getSpecializedBinding(cf, rbinding);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007 Symbian Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Andrew Ferguson (Symbian) - Initial implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.index.composite.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionTemplate;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPSpecialization;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalTemplateInstantiator;
|
||||
import org.eclipse.cdt.internal.core.index.IIndexFragmentBinding;
|
||||
import org.eclipse.cdt.internal.core.index.composite.ICompositesFactory;
|
||||
|
||||
public class CompositeCPPFunctionTemplate extends CompositeCPPFunction implements ICPPFunctionTemplate, ICPPInternalTemplateInstantiator {
|
||||
|
||||
public CompositeCPPFunctionTemplate(ICompositesFactory cf, ICPPFunction rbinding) {
|
||||
super(cf, rbinding);
|
||||
}
|
||||
|
||||
public ICPPTemplateParameter[] getTemplateParameters() throws DOMException {
|
||||
ICPPTemplateParameter[] result= ((ICPPFunctionTemplate)rbinding).getTemplateParameters();
|
||||
for(int i=0; i<result.length; i++) {
|
||||
result[i]= (ICPPTemplateParameter) cf.getCompositeBinding((IIndexFragmentBinding) result[i]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public ICPPSpecialization deferredInstance(IType[] arguments) {
|
||||
return InternalTemplateInstantiatorUtil.deferredInstance(arguments, cf, rbinding);
|
||||
}
|
||||
|
||||
public ICPPSpecialization getInstance(IType[] arguments) {
|
||||
return InternalTemplateInstantiatorUtil.getInstance(arguments, cf, rbinding);
|
||||
}
|
||||
|
||||
public IBinding instantiate(IType[] arguments) {
|
||||
return InternalTemplateInstantiatorUtil.instantiate(arguments, cf, rbinding);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007 Symbian Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Andrew Ferguson (Symbian) - Initial implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.index.composite.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
|
||||
import org.eclipse.cdt.internal.core.index.IIndexFragmentBinding;
|
||||
import org.eclipse.cdt.internal.core.index.composite.ICompositesFactory;
|
||||
|
||||
public class CompositeCPPMethodSpecialization extends CompositeCPPFunctionSpecialization
|
||||
implements ICPPMethod {
|
||||
|
||||
public CompositeCPPMethodSpecialization(ICompositesFactory cf, ICPPMethod method) {
|
||||
super(cf, method);
|
||||
}
|
||||
|
||||
public boolean isDestructor() throws DOMException {
|
||||
return ((ICPPMethod)rbinding).isDestructor();
|
||||
}
|
||||
|
||||
public boolean isImplicit() {
|
||||
return ((ICPPMethod)rbinding).isImplicit();
|
||||
}
|
||||
|
||||
public boolean isVirtual() throws DOMException {
|
||||
return ((ICPPMethod)rbinding).isVirtual();
|
||||
}
|
||||
|
||||
public ICPPClassType getClassOwner() throws DOMException {
|
||||
IIndexFragmentBinding rowner = (IIndexFragmentBinding) ((ICPPMethod)rbinding).getClassOwner();
|
||||
return (ICPPClassType) cf.getCompositeBinding(rowner);
|
||||
}
|
||||
|
||||
public int getVisibility() throws DOMException {
|
||||
return ((ICPPMethod)rbinding).getVisibility();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007 Symbian Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Andrew Ferguson (Symbian) - Initial implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.index.composite.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPSpecialization;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPVariable;
|
||||
import org.eclipse.cdt.core.parser.util.ObjectMap;
|
||||
import org.eclipse.cdt.internal.core.index.composite.ICompositesFactory;
|
||||
|
||||
public class CompositeCPPParameterSpecialization extends CompositeCPPParameter implements ICPPSpecialization {
|
||||
|
||||
public CompositeCPPParameterSpecialization(ICompositesFactory cf, ICPPVariable rbinding) {
|
||||
super(cf, rbinding);
|
||||
}
|
||||
|
||||
public ObjectMap getArgumentMap() {
|
||||
return TemplateInstanceUtil.getArgumentMap(cf, rbinding);
|
||||
}
|
||||
|
||||
public IBinding getSpecializedBinding() {
|
||||
return TemplateInstanceUtil.getSpecializedBinding(cf, rbinding);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007 Symbian Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Andrew Ferguson (Symbian) - Initial implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.index.composite.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateTypeParameter;
|
||||
import org.eclipse.cdt.internal.core.index.IIndexFragmentBinding;
|
||||
import org.eclipse.cdt.internal.core.index.IIndexInternalTemplateParameter;
|
||||
import org.eclipse.cdt.internal.core.index.IIndexType;
|
||||
import org.eclipse.cdt.internal.core.index.composite.ICompositesFactory;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
||||
public class CompositeCPPTemplateTypeParameter extends CompositeCPPBinding implements ICPPTemplateTypeParameter, IIndexType, IIndexInternalTemplateParameter {
|
||||
|
||||
public CompositeCPPTemplateTypeParameter(ICompositesFactory cf, ICPPTemplateTypeParameter binding) {
|
||||
super(cf, binding);
|
||||
}
|
||||
|
||||
public IType getDefault() throws DOMException {
|
||||
IIndexType preresult= (IIndexType) ((ICPPTemplateTypeParameter)rbinding).getDefault();
|
||||
return cf.getCompositeType(preresult);
|
||||
}
|
||||
|
||||
public boolean isSameType(IType type) {
|
||||
return ((IType)rbinding).isSameType(type);
|
||||
}
|
||||
|
||||
public ICPPBinding getParameterOwner() throws CoreException {
|
||||
IIndexFragmentBinding preresult= (IIndexFragmentBinding) ((IIndexInternalTemplateParameter)rbinding).getParameterOwner();
|
||||
return (ICPPBinding) cf.getCompositeBinding(preresult);
|
||||
}
|
||||
|
||||
public Object clone() {
|
||||
fail(); return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007 Symbian Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Andrew Ferguson (Symbian) - Initial implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.index.composite.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPSpecialization;
|
||||
import org.eclipse.cdt.core.index.IIndexBinding;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalTemplateInstantiator;
|
||||
import org.eclipse.cdt.internal.core.index.IIndexFragmentBinding;
|
||||
import org.eclipse.cdt.internal.core.index.composite.ICompositesFactory;
|
||||
|
||||
public class InternalTemplateInstantiatorUtil {
|
||||
public static ICPPSpecialization deferredInstance(IType[] arguments, ICompositesFactory cf, IIndexBinding rbinding) {
|
||||
ICPPSpecialization spec= ((ICPPInternalTemplateInstantiator)rbinding).deferredInstance(arguments);
|
||||
return (ICPPSpecialization) cf.getCompositeBinding((IIndexFragmentBinding)spec);
|
||||
}
|
||||
|
||||
public static ICPPSpecialization getInstance(IType[] arguments, ICompositesFactory cf, IIndexBinding rbinding) {
|
||||
ICPPSpecialization ins= ((ICPPInternalTemplateInstantiator)rbinding).getInstance(arguments);
|
||||
return (ICPPSpecialization) cf.getCompositeBinding((IIndexFragmentBinding)ins);
|
||||
}
|
||||
|
||||
public static IBinding instantiate(IType[] arguments, ICompositesFactory cf, IIndexBinding rbinding) {
|
||||
IBinding ins= ((ICPPInternalTemplateInstantiator)rbinding).instantiate(arguments);
|
||||
return (IBinding) cf.getCompositeBinding((IIndexFragmentBinding)ins);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007 Symbian Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Andrew Ferguson (Symbian) - Initial implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.index.composite.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPSpecialization;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateDefinition;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateInstance;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter;
|
||||
import org.eclipse.cdt.core.index.IIndexBinding;
|
||||
import org.eclipse.cdt.core.parser.util.ObjectMap;
|
||||
import org.eclipse.cdt.internal.core.index.IIndexFragmentBinding;
|
||||
import org.eclipse.cdt.internal.core.index.IIndexType;
|
||||
import org.eclipse.cdt.internal.core.index.composite.ICompositesFactory;
|
||||
|
||||
/**
|
||||
* For implementation re-use in the absence of multiple inheritance
|
||||
*/
|
||||
public class TemplateInstanceUtil {
|
||||
public static ObjectMap getArgumentMap(ICompositesFactory cf, IIndexBinding rbinding) {
|
||||
ObjectMap preresult= ((ICPPSpecialization)rbinding).getArgumentMap();
|
||||
ObjectMap result= new ObjectMap(preresult.size());
|
||||
Object[] keys= preresult.keyArray();
|
||||
for(int i=0; i<keys.length; i++) {
|
||||
ICPPTemplateParameter param= (ICPPTemplateParameter) preresult.get(keys[i]);
|
||||
result.put(keys[i], cf.getCompositeBinding((IIndexFragmentBinding)param));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static IBinding getSpecializedBinding(ICompositesFactory cf, IIndexBinding rbinding) {
|
||||
IBinding preresult= ((ICPPSpecialization)rbinding).getSpecializedBinding();
|
||||
return cf.getCompositeBinding((IIndexFragmentBinding)preresult);
|
||||
}
|
||||
|
||||
|
||||
public static IType[] getArguments(ICompositesFactory cf, IIndexBinding rbinding) {
|
||||
IType[] result = ((ICPPTemplateInstance)rbinding).getArguments();
|
||||
try {
|
||||
for(int i=0; i<result.length; i++) {
|
||||
result[i] = cf.getCompositeType((IIndexType)result[i]);
|
||||
}
|
||||
} catch(DOMException de) {
|
||||
CCorePlugin.log(de);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static ICPPTemplateDefinition getTemplateDefinition(ICompositesFactory cf, IIndexBinding rbinding) {
|
||||
ICPPTemplateDefinition preresult= ((ICPPTemplateInstance)rbinding).getTemplateDefinition();
|
||||
return (ICPPTemplateDefinition) cf.getCompositeBinding((IIndexFragmentBinding)preresult);
|
||||
}
|
||||
}
|
|
@ -26,7 +26,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateInstance;
|
|||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter;
|
||||
import org.eclipse.cdt.core.parser.util.ObjectMap;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPVisitor;
|
||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
|
||||
import org.eclipse.cdt.internal.core.index.IIndexInternalTemplateParameter;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
||||
/**
|
||||
|
@ -91,8 +91,8 @@ public class PDOMCPPOverloaderUtil {
|
|||
}
|
||||
if (qualifyTemplateParameters && types[i] instanceof ICPPTemplateParameter) {
|
||||
ICPPBinding parent = null;
|
||||
if (types[i] instanceof PDOMNode) {
|
||||
parent = (ICPPBinding)((PDOMNode)types[i]).getParentNode();
|
||||
if (types[i] instanceof IIndexInternalTemplateParameter) {
|
||||
parent = ((IIndexInternalTemplateParameter)types[i]).getParameterOwner();
|
||||
} else {
|
||||
IName parentName = ((ICPPTemplateParameter)types[i]).getScope().getScopeName();
|
||||
if (parentName instanceof IASTName) {
|
||||
|
@ -105,7 +105,7 @@ public class PDOMCPPOverloaderUtil {
|
|||
String sig = getSignature(parent);
|
||||
if (sig != null)
|
||||
buffer.append(sig);
|
||||
buffer.append("::");
|
||||
buffer.append("::"); //$NON-NLS-1$
|
||||
}
|
||||
buffer.append(((ICPPTemplateParameter)types[i]).getName());
|
||||
} else {
|
||||
|
|
|
@ -14,9 +14,12 @@ import org.eclipse.cdt.core.CCorePlugin;
|
|||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
import org.eclipse.cdt.core.dom.ast.ITypedef;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateTypeParameter;
|
||||
import org.eclipse.cdt.internal.core.Util;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.ProblemBinding;
|
||||
import org.eclipse.cdt.internal.core.index.IIndexInternalTemplateParameter;
|
||||
import org.eclipse.cdt.internal.core.index.IIndexType;
|
||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
@ -26,7 +29,7 @@ import org.eclipse.core.runtime.CoreException;
|
|||
*
|
||||
*/
|
||||
class PDOMCPPTemplateTypeParameter extends PDOMCPPBinding implements
|
||||
ICPPTemplateTypeParameter, IType {
|
||||
ICPPTemplateTypeParameter, IIndexType, IIndexInternalTemplateParameter {
|
||||
|
||||
private static final int DEFAULT_TYPE = PDOMCPPBinding.RECORD_SIZE + 0;
|
||||
|
||||
|
@ -100,5 +103,9 @@ class PDOMCPPTemplateTypeParameter extends PDOMCPPBinding implements
|
|||
return null;
|
||||
}
|
||||
|
||||
public ICPPBinding getParameterOwner() throws CoreException {
|
||||
return (ICPPBinding) getParentBinding();
|
||||
}
|
||||
|
||||
public Object clone() { fail();return null; }
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue