Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Schaefer2003-08-25 00:20:47 -0400
committerDoug Schaefer2003-08-25 00:20:47 -0400
commiteaab6a9736ebcbc8351d394e147c5ba9c0a4415a (patch)
tree850c78aef33260e4f3d285e892a9ceb4be046818
parentcc174bfe8c322c059aa2e9a4c97ad0d3898d5623 (diff)
downloadorg.eclipse.cdt-eaab6a9736ebcbc8351d394e147c5ba9c0a4415a.tar.gz
org.eclipse.cdt-eaab6a9736ebcbc8351d394e147c5ba9c0a4415a.tar.xz
org.eclipse.cdt-eaab6a9736ebcbc8351d394e147c5ba9c0a4415a.zip
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().
-rw-r--r--core/org.eclipse.cdt.core.tests/ChangeLog5
-rw-r--r--core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/model/tests/IStructureTests.java52
-rw-r--r--core/org.eclipse.cdt.core/ChangeLog12
-rw-r--r--core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IDeclaration.java12
-rw-r--r--core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IInclude.java4
-rw-r--r--core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IInheritance.java11
-rw-r--r--core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IMethodDeclaration.java2
-rw-r--r--core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IStructure.java8
-rw-r--r--core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/BinaryFunction.java8
-rw-r--r--core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/BinaryVariable.java10
-rw-r--r--core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelBuilder.java34
-rw-r--r--core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Enumeration.java7
-rw-r--r--core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Field.java4
-rw-r--r--core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/FieldInfo.java10
-rw-r--r--core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/FunctionDeclaration.java5
-rw-r--r--core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/FunctionInfo.java10
-rw-r--r--core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Include.java25
-rw-r--r--core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/MethodDeclaration.java36
-rw-r--r--core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/MethodInfo.java12
-rw-r--r--core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Structure.java89
-rw-r--r--core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/VariableDeclaration.java4
-rw-r--r--core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/VariableInfo.java10
22 files changed, 181 insertions, 189 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<myExpectedMethods.length; i++) {
- IMethod myIMethod = myIStruct.getMethod( myExpectedMethods[i] );
+ IMethodDeclaration myIMethod = myIStruct.getMethod( myExpectedMethods[i] );
assertNotNull( "Failed on "+i, myIMethod);
}
@@ -202,7 +203,7 @@ public class IStructureTests extends IntegratedCModelTest {
"method7","method8","method9",
};
for(int i=0; i<myUnexpectedMethods.length; i++) {
- IMethod myIMethod = myIStruct.getMethod( myUnexpectedMethods[i] );
+ IMethodDeclaration myIMethod = myIStruct.getMethod( myUnexpectedMethods[i] );
assertNull( "Failed on "+i, myIMethod);
}
}
@@ -300,7 +301,7 @@ public class IStructureTests extends IntegratedCModelTest {
assertTrue( myStructAbstract.isAbstract() );
assertNotNull( myElementNonAbstract );
- assertTrue( myElementNonAbstract.getElementType()!=ICElement.C_CLASS );
+ assertTrue( myElementNonAbstract.getElementType() == ICElement.C_CLASS );
IStructure myStructNonAbstract = (IStructure) myElementNonAbstract;
assertNotNull( myStructNonAbstract );
assertFalse( myStructNonAbstract.isAbstract() );
@@ -310,14 +311,14 @@ public class IStructureTests extends IntegratedCModelTest {
public void testGetBaseTypes() {
ITranslationUnit tu = getTU();
ICElement myElementDerived = null;
- IStructure[] myBaseTypes = null;
+ String[] myBaseTypes = null;
try {
myElementDerived = tu.getElement("testClass5"); // throws
assertNotNull( myElementDerived );
assertTrue( myElementDerived.getElementType()==ICElement.C_CLASS );
IStructure myStructDerived = (IStructure) myElementDerived;
assertNotNull( myStructDerived );
- myBaseTypes = myStructDerived.getBaseTypes(); // throws
+ myBaseTypes = myStructDerived.getSuperClassesNames();
}
catch( CModelException c )
{
@@ -325,37 +326,36 @@ public class IStructureTests extends IntegratedCModelTest {
}
String[] myExpectedBaseTypes = {
- "testClass1","testClass3","testClass4"
+ "testClass1","testClass3","testClass4Abstract"
};
assertEquals( myExpectedBaseTypes.length, myBaseTypes.length );
for(int i=0; i<myBaseTypes.length; i++) {
- assertEquals( "Failed on "+i, myExpectedBaseTypes[i], myBaseTypes[i].getElementName() );
+ assertEquals( "Failed on "+i, myExpectedBaseTypes[i], myBaseTypes[i] );
}
}
- // tests IInheritance.getAccessControl(int),
- // not IDeclaration.getAccessControl()
+ // IInheritance
public void testGetAccessControl() {
ITranslationUnit tu = getTU();
ICElement myElementDerived = null;
- IStructure[] myBaseTypes = null;
+ String[] myBaseTypes = null;
try {
myElementDerived = tu.getElement("testClass5"); // throws
assertNotNull( myElementDerived );
assertTrue( myElementDerived.getElementType()==ICElement.C_CLASS );
IStructure myStructDerived = (IStructure) myElementDerived;
assertNotNull( myStructDerived );
- myBaseTypes = myStructDerived.getBaseTypes(); // throws
+ myBaseTypes = myStructDerived.getSuperClassesNames();
- int[] myExpectedAccessControl = {
+ ASTAccessVisibility[] myExpectedAccessControl = {
// TODO #38986: expect appropriate access control tags
- ICElement.CPP_PUBLIC,
- org.eclipse.cdt.core.index.TagFlags.T_PROTECTED,
- ICElement.CPP_PRIVATE
+ ASTAccessVisibility.PUBLIC,
+ ASTAccessVisibility.PROTECTED,
+ ASTAccessVisibility.PRIVATE
};
assertEquals( myExpectedAccessControl.length, myBaseTypes.length );
for(int i=0; i<myBaseTypes.length; i++) {
- int myAccessControl = myStructDerived.getAccessControl(i); // throws
+ ASTAccessVisibility myAccessControl = myStructDerived.getSuperClassAccess(myBaseTypes[i]);
assertEquals( "Failed on "+i, myExpectedAccessControl[i], myAccessControl );
}
}
diff --git a/core/org.eclipse.cdt.core/ChangeLog b/core/org.eclipse.cdt.core/ChangeLog
index d3e92175b6b..1330848c710 100644
--- a/core/org.eclipse.cdt.core/ChangeLog
+++ b/core/org.eclipse.cdt.core/ChangeLog
@@ -1,3 +1,15 @@
+2003-08-21 Hoda Amer
+ - C Model cleanups + solutions to bug#38985 & bug#38986
+ 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().
+
2003-08-20 Alain Magloire
When doing the IPlugin.shutdown(). We have to make
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IDeclaration.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IDeclaration.java
index 7686d5cda29..2acb4ace4f2 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IDeclaration.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IDeclaration.java
@@ -14,15 +14,5 @@ package org.eclipse.cdt.core.model;
public interface IDeclaration extends ICElement, ISourceManipulation, ISourceReference {
boolean isStatic();
boolean isConst();
- boolean isVolatile();
-
- /**
- * Returns the access Control of the member. The access qualifier
- * can be examine using the AccessControl class.
- *
- * @exception CModelException if this element does not exist or if an
- * exception occurs while accessing its corresponding resource.
- * @see IAccessControl
- */
- int getAccessControl();
+ boolean isVolatile();
}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IInclude.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IInclude.java
index e6e22ecc7c9..5a89f70217f 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IInclude.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IInclude.java
@@ -22,4 +22,8 @@ public interface IInclude extends ICElement, ISourceReference, ISourceManipulati
* <code>"#include "foobar.h"</code> 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
@@ -49,13 +49,6 @@ public class Enumeration extends SourceManipulation implements IEnumeration{
}
/**
- * @see org.eclipse.cdt.core.model.IDeclaration#getAccessControl()
- */
- public int getAccessControl() {
- return 0;
- }
-
- /**
* @see org.eclipse.cdt.core.model.IDeclaration#isConst()
*/
public boolean 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 java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
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 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 {
+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<fields.length; i++){
+ IField field = fields[i];
+ if(field.getElementName().equals(name)){
+ return field;
+ }
+ }
return null;
}
- public IMethod[] getMethods() {
- return new IMethod[0];
+ public IMethodDeclaration[] getMethods() {
+ List methods = new ArrayList();
+ methods.addAll(getChildrenOfType(ICElement.C_METHOD_DECLARATION));
+ methods.addAll(getChildrenOfType(ICElement.C_METHOD));
+ return (IMethodDeclaration[])methods.toArray(new IMethodDeclaration[methods.size()]);
}
- public IMethod getMethod(String name) {
+ public IMethodDeclaration getMethod(String name) {
+ IMethodDeclaration[] methods = getMethods();
+ for (int i = 0; i<methods.length; i++){
+ IMethodDeclaration method = methods[i];
+ if(method.getElementName().equals(name)){
+ return method;
+ }
+ }
return null;
}
@@ -49,27 +72,23 @@ public class Structure extends SourceManipulation implements IStructure {
}
public boolean isAbstract() {
+ IMethodDeclaration[] methods = getMethods();
+ for(int i=0; i<methods.length; i++){
+ IMethodDeclaration method = methods[i];
+ if(method.isPureVirtual())
+ return true;
+ }
return false;
}
- /**
- * @see org.eclipse.cdt.core.model.IDeclaration#getAccessControl()
- */
- public int getAccessControl(){
- return 0;
+ public String[] getSuperClassesNames(){
+ return (String[])superClassesNames.keySet().toArray(new String[superClassesNames.keySet().size()]);
}
- /**
- * Return the inherited structures.
- * @IInheritance
- */
- public IStructure [] getBaseTypes() throws CModelException {
- return new IStructure[0];
+ public ASTAccessVisibility getSuperClassAccess(String name){
+ return (ASTAccessVisibility)superClassesNames.get(name);
}
- /**
- * @see IVariable
- */
public String getTypeName() {
return getStructureInfo().getTypeName();
}
@@ -105,31 +124,17 @@ public class Structure extends SourceManipulation implements IStructure {
public StructureInfo getStructureInfo(){
return (StructureInfo) getElementInfo();
}
- /**
- * @see IVariable
- */
- public String getInitializer() {
- return "";
- }
public void addSuperClass(String name) {
- String[] newBase = new String[baseTypes.length + 1];
- System.arraycopy(baseTypes, 0, newBase, 0, baseTypes.length);
- newBase[baseTypes.length] = name;
- baseTypes = newBase;
+ superClassesNames.put(name, ASTAccessVisibility.PUBLIC);
}
+ public void addSuperClass(String name, ASTAccessVisibility access) {
+ superClassesNames.put(name, access);
+ }
protected CElementInfo createElementInfo () {
return new StructureInfo(this);
}
- /**
- * Return the access control for each inherited structure.
- * @IInheritance
- */
- public int getAccessControl(int pos) throws CModelException {
- return 0;
- }
-
}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/VariableDeclaration.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/VariableDeclaration.java
index 76c455ddaa6..10caa7f4836 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/VariableDeclaration.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/VariableDeclaration.java
@@ -18,10 +18,6 @@ public class VariableDeclaration extends SourceManipulation implements IVariable
super(parent, name, type);
}
- public int getAccessControl() {
- return getVariableInfo().getAccessControl();
- }
-
public String getTypeName() {
return getVariableInfo().getTypeName();
}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/VariableInfo.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/VariableInfo.java
index 4e7f3d1f659..a528f414c2a 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/VariableInfo.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/VariableInfo.java
@@ -7,7 +7,6 @@ package org.eclipse.cdt.internal.core.model;
class VariableInfo extends SourceManipulationInfo {
- protected int flags;
String typeStr = "";
boolean isConst = false;
boolean isVolatile = false;
@@ -15,11 +14,6 @@ class VariableInfo extends SourceManipulationInfo {
protected VariableInfo (CElement element) {
super(element);
- flags = 0;
- }
-
- protected int getAccessControl() {
- return flags;
}
protected String getTypeName(){
@@ -30,10 +24,6 @@ class VariableInfo extends SourceManipulationInfo {
typeStr = type;
}
- protected void setAccessControl(int flags) {
- this.flags = flags;
- }
-
protected void setTypeString(String type){
typeStr = type;
}

Back to the top