From eaab6a9736ebcbc8351d394e147c5ba9c0a4415a Mon Sep 17 00:00:00 2001 From: Doug Schaefer Date: Mon, 25 Aug 2003 04:20:47 +0000 Subject: [PATCH] Patch for Hoda Amer: Core: -Solutions to bug#38985 & bug#38986 In IStructure: getField(String) Implemented getFields() Implemented getMethod(String) Implemented getMethods() Implemented isAbstract() Implemented getBaseTypes() Has been replaced by getSuperClassesNames() getAccessControl(int) Has been replaced by getSuperClassAccess(String name) - Added some methods to IMethodDeclaration, namely: isFriend(), isInline(), isVirtual(), and isPureVirtual(). Core Tests: Enabled some tests in the IStructureTests, namely: testGetFields(), testGetField(), testGetMethods(), testGetMethod(), testIsAbstract(), testGetBaseTypes(), and testGetAccessControl(). --- core/org.eclipse.cdt.core.tests/ChangeLog | 5 + .../cdt/core/model/tests/IStructureTests.java | 52 +++++------ core/org.eclipse.cdt.core/ChangeLog | 12 +++ .../eclipse/cdt/core/model/IDeclaration.java | 12 +-- .../org/eclipse/cdt/core/model/IInclude.java | 4 + .../eclipse/cdt/core/model/IInheritance.java | 11 ++- .../cdt/core/model/IMethodDeclaration.java | 2 +- .../eclipse/cdt/core/model/IStructure.java | 8 +- .../internal/core/model/BinaryFunction.java | 8 -- .../internal/core/model/BinaryVariable.java | 10 +- .../internal/core/model/CModelBuilder.java | 34 +++++-- .../cdt/internal/core/model/Enumeration.java | 7 -- .../cdt/internal/core/model/Field.java | 4 - .../cdt/internal/core/model/FieldInfo.java | 10 -- .../core/model/FunctionDeclaration.java | 5 - .../cdt/internal/core/model/FunctionInfo.java | 10 -- .../cdt/internal/core/model/Include.java | 25 ++++- .../core/model/MethodDeclaration.java | 36 +++---- .../cdt/internal/core/model/MethodInfo.java | 12 +-- .../cdt/internal/core/model/Structure.java | 93 ++++++++++--------- .../core/model/VariableDeclaration.java | 4 - .../cdt/internal/core/model/VariableInfo.java | 10 -- 22 files changed, 183 insertions(+), 191 deletions(-) diff --git a/core/org.eclipse.cdt.core.tests/ChangeLog b/core/org.eclipse.cdt.core.tests/ChangeLog index ed44915c34f..493c9783be4 100644 --- a/core/org.eclipse.cdt.core.tests/ChangeLog +++ b/core/org.eclipse.cdt.core.tests/ChangeLog @@ -1,3 +1,8 @@ +2003-08-21 Hoda Amer + Enabled some tests in the IStructureTests, namely: + testGetFields(), testGetField(), testGetMethods(), testGetMethod(), + testIsAbstract(), testGetBaseTypes(), and testGetAccessControl(). + 2003-08-19 Sean Evoy In order to properly support the indexing feature, the scanner has to function as well as the version that ships with the toolset if possible. diff --git a/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/model/tests/IStructureTests.java b/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/model/tests/IStructureTests.java index 7eb0034209d..de0967cd9e6 100644 --- a/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/model/tests/IStructureTests.java +++ b/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/model/tests/IStructureTests.java @@ -5,6 +5,7 @@ package org.eclipse.cdt.core.model.tests; import org.eclipse.cdt.core.model.*; +import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility; import junit.framework.*; @@ -48,18 +49,18 @@ public class IStructureTests extends IntegratedCModelTest { // Interface tests: suite.addTest( new IStructureTests("testGetChildrenOfTypeStruct")); suite.addTest( new IStructureTests("testGetChildrenOfTypeClass")); // C++ only - // TODO Bug# 38985: suite.addTest( new IStructureTests("testGetFields")); - suite.addTest( new IStructureTests("testGetFieldsHack")); - // TODO Bug# 38985: suite.addTest( new IStructureTests("testGetField")); - // TODO Bug# 38985: suite.addTest( new IStructureTests("testGetMethods")); // C++ only - suite.addTest( new IStructureTests("testGetMethodsHack")); // C++ only - // TODO Bug# 38985: suite.addTest( new IStructureTests("testGetMethod")); // C++ only + suite.addTest( new IStructureTests("testGetFields")); + //Bug# 38985: solved. suite.addTest( new IStructureTests("testGetFieldsHack")); + suite.addTest( new IStructureTests("testGetField")); + suite.addTest( new IStructureTests("testGetMethods")); // C++ only + //Bug# 38985: solved. suite.addTest( new IStructureTests("testGetMethodsHack")); // C++ only + suite.addTest( new IStructureTests("testGetMethod")); // C++ only suite.addTest( new IStructureTests("testIsStruct")); suite.addTest( new IStructureTests("testIsClass")); // C++ only suite.addTest( new IStructureTests("testIsUnion")); - // TODO Bug# 38985: suite.addTest( new IStructureTests("testIsAbstract")); // C++ only - // TODO Bug# 38985: suite.addTest( new IStructureTests("testGetBaseTypes")); // C++ only - // TODO Bug# 38985: suite.addTest( new IStructureTests("testGetAccessControl")); // C++ only + suite.addTest( new IStructureTests("testIsAbstract")); // C++ only + suite.addTest( new IStructureTests("testGetBaseTypes")); // C++ only + suite.addTest( new IStructureTests("testGetAccessControl")); // C++ only // Language Specification tests: suite.addTest( new IStructureTests("testAnonymousStructObject")); @@ -157,7 +158,7 @@ public class IStructureTests extends IntegratedCModelTest { ITranslationUnit tu = getTU(); ArrayList myArrayStructs = tu.getChildrenOfType(ICElement.C_STRUCT); IStructure myIStruct = (IStructure) myArrayStructs.get(0); - IMethod[] myArrayIMethod = myIStruct.getMethods(); + IMethodDeclaration[] myArrayIMethod = myIStruct.getMethods(); String[] myExpectedMethods = { "method1","method2","testStruct1","~testStruct1" }; @@ -194,7 +195,7 @@ public class IStructureTests extends IntegratedCModelTest { "method1","method2","testStruct1","~testStruct1" }; for(int i=0; i"#include "foobar.h" returns false. */ boolean isStandard(); + + public String getFullFileName(); + + public boolean isLocal(); } diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IInheritance.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IInheritance.java index ae8f968cda3..a6caa028d82 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IInheritance.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IInheritance.java @@ -1,5 +1,7 @@ package org.eclipse.cdt.core.model; +import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility; + /* * (c) Copyright QNX Software Systems Ltd. 2002. * All Rights Reserved. @@ -10,12 +12,11 @@ package org.eclipse.cdt.core.model; */ public interface IInheritance { /** - * Return the inherited structures. + * Return the inherited structures names. */ - public IStructure [] getBaseTypes() throws CModelException; - + public String[] getSuperClassesNames(); /** - * Return the access control for each inherited structure. + * Returns the super class access : ASTAccessVisibility */ - public int getAccessControl(int pos) throws CModelException; + public ASTAccessVisibility getSuperClassAccess(String name); } diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IMethodDeclaration.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IMethodDeclaration.java index 23a7a1e352a..35eb830805d 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IMethodDeclaration.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IMethodDeclaration.java @@ -42,7 +42,7 @@ public interface IMethodDeclaration extends IMember, IFunctionDeclaration { * @exception CModelException if this element does not exist or if an * exception occurs while accessing its corresponding resource. */ - boolean isAbstract(); + boolean isPureVirtual(); /** * Returns if this method is static or not diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IStructure.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IStructure.java index b0b5742d97f..e66fd371bbc 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IStructure.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IStructure.java @@ -1,5 +1,6 @@ package org.eclipse.cdt.core.model; + /* * (c) Copyright QNX Software Systems Ltd. 2002. * All Rights Reserved. @@ -9,13 +10,11 @@ package org.eclipse.cdt.core.model; * Represent struct(ure), class or union. */ public interface IStructure extends IInheritance, IParent, IVariableDeclaration { - //public String instantiatesTemplate(); - public IField getField(String name); public IField[] getFields(); - public IMethod getMethod(String name); - public IMethod [] getMethods(); + public IMethodDeclaration getMethod(String name); + public IMethodDeclaration [] getMethods(); public boolean isUnion(); @@ -24,4 +23,5 @@ public interface IStructure extends IInheritance, IParent, IVariableDeclaration public boolean isStruct(); public boolean isAbstract(); + } diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/BinaryFunction.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/BinaryFunction.java index 06eb5a5bdfa..39253ea5dc1 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/BinaryFunction.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/BinaryFunction.java @@ -86,12 +86,4 @@ public class BinaryFunction extends BinaryElement implements IFunction { return false; } - /* (non-Javadoc) - * @see org.eclipse.cdt.core.model.IDeclaration#getAccessControl() - */ - public int getAccessControl() { - // TODO Auto-generated method stub - return 0; - } - } diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/BinaryVariable.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/BinaryVariable.java index d7cfeb5a742..668be02a81b 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/BinaryVariable.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/BinaryVariable.java @@ -62,13 +62,5 @@ public class BinaryVariable extends BinaryElement implements IVariable { // TODO Auto-generated method stub return false; } - - /* (non-Javadoc) - * @see org.eclipse.cdt.core.model.IDeclaration#getAccessControl() - */ - public int getAccessControl() { - // TODO Auto-generated method stub - return 0; - } - + } diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelBuilder.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelBuilder.java index 5044abf178f..fa98ed3e443 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelBuilder.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelBuilder.java @@ -30,6 +30,7 @@ import org.eclipse.cdt.core.parser.ast.ASTNotImplementedException; import org.eclipse.cdt.core.parser.ast.ASTPointerOperator; import org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration; import org.eclipse.cdt.core.parser.ast.IASTAbstractTypeSpecifierDeclaration; +import org.eclipse.cdt.core.parser.ast.IASTBaseSpecifier; import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier; import org.eclipse.cdt.core.parser.ast.IASTCompilationUnit; import org.eclipse.cdt.core.parser.ast.IASTDeclaration; @@ -265,6 +266,7 @@ public class CModelBuilder { protected Include createInclusion(Parent parent, IASTInclusion inclusion){ // create element Include element = new Include((CElement)parent, inclusion.getName(), !inclusion.isLocal()); + element.setFullPathName(inclusion.getFullFileName()); // add to parent parent.addChild((CElement) element); // set position @@ -387,6 +389,12 @@ public class CModelBuilder { element = classTemplate; } + // store super classes names + Iterator baseClauses = classSpecifier.getBaseClauses(); + while (baseClauses.hasNext()){ + IASTBaseSpecifier baseSpec = (IASTBaseSpecifier)baseClauses.next(); + element.addSuperClass(baseSpec.getParentClassName(), baseSpec.getAccess()); + } // add to parent parent.addChild((ICElement) element); @@ -493,17 +501,16 @@ public class CModelBuilder { if( functionDeclaration instanceof IASTMethod ) { IASTMethod methodDeclaration = (IASTMethod) functionDeclaration; + MethodDeclaration methodElement = null; if (methodDeclaration.hasFunctionBody()) { // method if(!isTemplate){ Method newElement = new Method( parent, name ); - newElement.setVisibility(methodDeclaration.getVisiblity()); - element = newElement; + methodElement = newElement; }else { MethodTemplate newElement = new MethodTemplate(parent, name); - newElement.setVisibility(methodDeclaration.getVisiblity()); - element = newElement; + methodElement = newElement; } } else @@ -511,17 +518,24 @@ public class CModelBuilder { // method declaration if(!isTemplate){ MethodDeclaration newElement = new MethodDeclaration( parent, name ); - newElement.setVisibility(methodDeclaration.getVisiblity()); - element = newElement; + methodElement = newElement; }else { MethodTemplate newElement = new MethodTemplate(parent, name); - newElement.setVisibility(methodDeclaration.getVisiblity()); - element = newElement; + methodElement = newElement; } } - element.setVolatile(methodDeclaration.isVolatile()); - element.setConst(methodDeclaration.isConst()); + // Common settings for method declaration + methodElement.setVisibility(methodDeclaration.getVisiblity()); + methodElement.setVolatile(methodDeclaration.isVolatile()); + methodElement.setConst(methodDeclaration.isConst()); + methodElement.setVirtual(methodDeclaration.isVirtual()); + methodElement.setPureVirtual(methodDeclaration.isPureVirtual()); + methodElement.setInline(methodDeclaration.isInline()); + methodElement.setFriend(methodDeclaration.isFriend()); + methodElement.setConstructor(methodDeclaration.isConstructor()); + methodElement.setDestructor(methodDeclaration.isDestructor()); + element = methodElement; } else // instance of IASTFunction { diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Enumeration.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Enumeration.java index 09444485a0e..cca67d8fa7a 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Enumeration.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Enumeration.java @@ -48,13 +48,6 @@ public class Enumeration extends SourceManipulation implements IEnumeration{ getEnumerationInfo().setTypeName(type); } - /** - * @see org.eclipse.cdt.core.model.IDeclaration#getAccessControl() - */ - public int getAccessControl() { - return 0; - } - /** * @see org.eclipse.cdt.core.model.IDeclaration#isConst() */ diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Field.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Field.java index b4540ec28fc..59c62ca3b8f 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Field.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Field.java @@ -15,10 +15,6 @@ public class Field extends VariableDeclaration implements IField { super(parent, name, CElement.C_FIELD); } - public int getAccessControl(){ - return getFieldInfo().getAccessControl(); - } - public boolean isMutable(){ return getFieldInfo().isMutable(); } diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/FieldInfo.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/FieldInfo.java index 1f4b98ebd44..52e4b4c63d1 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/FieldInfo.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/FieldInfo.java @@ -15,7 +15,6 @@ import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility; public class FieldInfo extends SourceManipulationInfo { - int flags = 0; String typeStr = ""; boolean isConst = false; boolean isVolatile = false; @@ -25,22 +24,13 @@ public class FieldInfo extends SourceManipulationInfo { protected FieldInfo (CElement element) { super(element); - flags = 0; visibility = ASTAccessVisibility.PRIVATE; } - protected int getAccessControl() { - return flags; - } - protected String getTypeName(){ return typeStr; } - protected void setAccessControl(int flags) { - this.flags = flags; - } - protected void setTypeName(String type){ typeStr = type; } diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/FunctionDeclaration.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/FunctionDeclaration.java index 019cd639cb0..6e0db36083f 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/FunctionDeclaration.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/FunctionDeclaration.java @@ -83,11 +83,6 @@ public class FunctionDeclaration extends SourceManipulation implements IFunction return ""; } - public int getAccessControl(){ - return getFunctionInfo().getAccessControl(); - } - - public String[] getExceptions(){ return new String[] {}; } diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/FunctionInfo.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/FunctionInfo.java index 6e0f2cbd8fa..0d74c45793b 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/FunctionInfo.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/FunctionInfo.java @@ -7,7 +7,6 @@ package org.eclipse.cdt.internal.core.model; class FunctionInfo extends SourceManipulationInfo { - protected int flags; protected boolean isStatic; protected boolean isVolatile; protected boolean isConst; @@ -15,15 +14,6 @@ class FunctionInfo extends SourceManipulationInfo { protected FunctionInfo (CElement element) { super(element); - flags = 0; - } - - protected int getAccessControl() { - return flags; - } - - protected void setAccessControl(int flags) { - this.flags = flags; } /** diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Include.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Include.java index 332714fa20c..91ef79fe688 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Include.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Include.java @@ -10,7 +10,8 @@ import org.eclipse.cdt.core.model.IInclude; public class Include extends SourceManipulation implements IInclude { - private final boolean standard; + private final boolean standard; + private String fullPath; public Include(ICElement parent, String name, boolean isStandard) { super(parent, name, CElement.C_INCLUDE); @@ -28,4 +29,26 @@ public class Include extends SourceManipulation implements IInclude { protected CElementInfo createElementInfo () { return new SourceManipulationInfo(this); } + /* (non-Javadoc) + * @see org.eclipse.cdt.core.model.IInclude#getFullFileName() + */ + public String getFullFileName() { + return fullPath; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.model.IInclude#isLocal() + */ + public boolean isLocal() { + return !isStandard(); + } + + /* + * This is not yet populated properly by the parse; + * however, it might be in the near future. + */ + public void setFullPathName(String fullPath) { + this.fullPath = fullPath; + } + } diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/MethodDeclaration.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/MethodDeclaration.java index 053fce4a317..7d900e1a476 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/MethodDeclaration.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/MethodDeclaration.java @@ -17,45 +17,48 @@ import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility; public class MethodDeclaration extends FunctionDeclaration implements IMethodDeclaration{ - boolean isConst; -; + boolean isConst = false; + boolean isConstructor = false; + boolean isDestructor = false; public MethodDeclaration(ICElement parent, String name){ super(parent, name, CElement.C_METHOD_DECLARATION); } - public MethodDeclaration(ICElement parent, String name, int type){ super(parent, name, type); } - /** - * @see IMethod - */ public boolean isConstructor(){ + // Still a problem with the parser + //return isConstructor; return getElementName().equals(getParent().getElementName()); } - /** - * @see IMethod - */ public boolean isDestructor() { + // still a problem with the parser + //return isDestructor; return getElementName().startsWith("~"); } - /** - * @see IMethod - */ + public void setConstructor(boolean isConstructor) { + this.isConstructor = isConstructor; + } + + public void setDestructor(boolean isDestructor) { + this.isDestructor = isDestructor; + } + public boolean isOperator(){ return getElementName().startsWith("operator"); } - public boolean isAbstract(){ - return getMethodInfo().isAbstract(); + public boolean isPureVirtual(){ + return getMethodInfo().isPureVirtual(); } - public void setIsAbstract(boolean isAbstract){ - getMethodInfo().setAbstract(isAbstract); + public void setPureVirtual(boolean isPureVirtual){ + getMethodInfo().setPureVirtual(isPureVirtual); } public boolean isInline(){ @@ -119,4 +122,5 @@ public class MethodDeclaration extends FunctionDeclaration implements IMethodDec ); } + } diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/MethodInfo.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/MethodInfo.java index 9434e535463..bf3f5efadd4 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/MethodInfo.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/MethodInfo.java @@ -15,7 +15,7 @@ import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility; public class MethodInfo extends FunctionInfo { - boolean isAbstract = false; + boolean isPureVirtual = false; boolean isInline = false; boolean isVirtual = false; boolean isFriend = false; @@ -27,12 +27,12 @@ public class MethodInfo extends FunctionInfo { visibility = ASTAccessVisibility.PRIVATE; } - public boolean isAbstract(){ - return isAbstract; + public boolean isPureVirtual(){ + return isPureVirtual; } - public void setAbstract(boolean isAbstract){ - this.isAbstract = isAbstract; + public void setPureVirtual(boolean isPureVirtual){ + this.isPureVirtual = isPureVirtual; } public boolean isInline(){ @@ -89,7 +89,7 @@ public class MethodInfo extends FunctionInfo { public boolean hasSameContentsAs(SourceManipulationInfo otherInfo) { return (super.hasSameContentsAs(otherInfo) && (isConst == ((MethodInfo)otherInfo).isConst()) - && (isAbstract == ((MethodInfo)otherInfo).isAbstract()) + && (isPureVirtual == ((MethodInfo)otherInfo).isPureVirtual()) && (isInline == ((MethodInfo)otherInfo).isInline()) && (isVirtual == ((MethodInfo)otherInfo).isVirtual()) && (isFriend == ((MethodInfo)otherInfo).isFriend()) diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Structure.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Structure.java index c20fddf8fa4..c1c98042fb1 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Structure.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Structure.java @@ -5,34 +5,57 @@ package org.eclipse.cdt.internal.core.model; * All Rights Reserved. */ -import org.eclipse.cdt.core.model.CModelException; -import org.eclipse.cdt.core.model.ICElement; -import org.eclipse.cdt.core.model.IStructure; -import org.eclipse.cdt.core.model.IMethod; -import org.eclipse.cdt.core.model.IField; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; -public class Structure extends SourceManipulation implements IStructure { +import org.eclipse.cdt.core.model.ICElement; +import org.eclipse.cdt.core.model.IField; +import org.eclipse.cdt.core.model.IMethodDeclaration; +import org.eclipse.cdt.core.model.IStructure; +import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility; + +public class Structure extends SourceManipulation implements IStructure { - String [] baseTypes; + Map superClassesNames = new LinkedHashMap(); public Structure(ICElement parent, int kind, String name) { super(parent, name, kind); - baseTypes = new String[0]; } public IField[] getFields() { - return new IField[0]; + List fields = new ArrayList(); + fields.addAll(getChildrenOfType(ICElement.C_FIELD)); + return (IField[]) fields.toArray(new IField[fields.size()]); } public IField getField(String name) { + IField[] fields = getFields(); + for (int i = 0; i