Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] C Model cleanups + solutions to bug#38985 & bug#38986


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().


Regards,
Hoda Amer
Staff Software Engineer
Rational Software - IBM Software Group


Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core.tests/ChangeLog,v
retrieving revision 1.64
diff -u -r1.64 ChangeLog
--- ChangeLog	20 Aug 2003 18:05:19 -0000	1.64
+++ ChangeLog	21 Aug 2003 18:35:20 -0000
@@ -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. 
Index: model/org/eclipse/cdt/core/model/tests/IStructureTests.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/model/tests/IStructureTests.java,v
retrieving revision 1.1
diff -u -r1.1 IStructureTests.java
--- model/org/eclipse/cdt/core/model/tests/IStructureTests.java	18 Jun 2003 21:29:47 -0000	1.1
+++ model/org/eclipse/cdt/core/model/tests/IStructureTests.java	21 Aug 2003 18:35:20 -0000
@@ -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 @@
 		// 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 @@
 		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 @@
 			"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 @@
 			"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 @@
 		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 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 @@
 		}
 		
 		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 );
 			}		
 		}
Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/ChangeLog,v
retrieving revision 1.128
diff -u -r1.128 ChangeLog
--- ChangeLog	20 Aug 2003 20:05:40 -0000	1.128
+++ ChangeLog	21 Aug 2003 18:35:03 -0000
@@ -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
Index: model/org/eclipse/cdt/core/model/IDeclaration.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IDeclaration.java,v
retrieving revision 1.1
diff -u -r1.1 IDeclaration.java
--- model/org/eclipse/cdt/core/model/IDeclaration.java	28 Mar 2003 21:05:20 -0000	1.1
+++ model/org/eclipse/cdt/core/model/IDeclaration.java	21 Aug 2003 18:35:03 -0000
@@ -14,15 +14,5 @@
 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();	
 }
Index: model/org/eclipse/cdt/core/model/IInclude.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IInclude.java,v
retrieving revision 1.1
diff -u -r1.1 IInclude.java
--- model/org/eclipse/cdt/core/model/IInclude.java	26 Jun 2002 20:37:15 -0000	1.1
+++ model/org/eclipse/cdt/core/model/IInclude.java	21 Aug 2003 18:35:03 -0000
@@ -22,4 +22,8 @@
 	 * <code>"#include "foobar.h"</code> returns false.
 	 */
 	boolean isStandard();
+	
+	public String getFullFileName(); 
+	
+	public boolean isLocal(); 
 }
Index: model/org/eclipse/cdt/core/model/IInheritance.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IInheritance.java,v
retrieving revision 1.1
diff -u -r1.1 IInheritance.java
--- model/org/eclipse/cdt/core/model/IInheritance.java	26 Jun 2002 20:37:14 -0000	1.1
+++ model/org/eclipse/cdt/core/model/IInheritance.java	21 Aug 2003 18:35:03 -0000
@@ -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 @@
  */
 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);
 }
Index: model/org/eclipse/cdt/core/model/IMethodDeclaration.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IMethodDeclaration.java,v
retrieving revision 1.3
diff -u -r1.3 IMethodDeclaration.java
--- model/org/eclipse/cdt/core/model/IMethodDeclaration.java	26 Mar 2003 16:03:03 -0000	1.3
+++ model/org/eclipse/cdt/core/model/IMethodDeclaration.java	21 Aug 2003 18:35:03 -0000
@@ -42,7 +42,7 @@
 	 * @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
Index: model/org/eclipse/cdt/core/model/IStructure.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IStructure.java,v
retrieving revision 1.4
diff -u -r1.4 IStructure.java
--- model/org/eclipse/cdt/core/model/IStructure.java	1 Apr 2003 19:51:26 -0000	1.4
+++ model/org/eclipse/cdt/core/model/IStructure.java	21 Aug 2003 18:35:03 -0000
@@ -1,5 +1,6 @@
 package org.eclipse.cdt.core.model;
 
+
 /*
  * (c) Copyright QNX Software Systems Ltd. 2002.
  * All Rights Reserved.
@@ -9,13 +10,11 @@
  * 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 boolean isStruct();
 
 	public boolean isAbstract();
+	
 }
Index: model/org/eclipse/cdt/internal/core/model/BinaryFunction.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/BinaryFunction.java,v
retrieving revision 1.3
diff -u -r1.3 BinaryFunction.java
--- model/org/eclipse/cdt/internal/core/model/BinaryFunction.java	2 Apr 2003 04:52:40 -0000	1.3
+++ model/org/eclipse/cdt/internal/core/model/BinaryFunction.java	21 Aug 2003 18:35:04 -0000
@@ -86,12 +86,4 @@
 		return false;
 	}
 
-	/* (non-Javadoc)
-	 * @see org.eclipse.cdt.core.model.IDeclaration#getAccessControl()
-	 */
-	public int getAccessControl() {
-		// TODO Auto-generated method stub
-		return 0;
-	}
-
 }
Index: model/org/eclipse/cdt/internal/core/model/BinaryVariable.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/BinaryVariable.java,v
retrieving revision 1.2
diff -u -r1.2 BinaryVariable.java
--- model/org/eclipse/cdt/internal/core/model/BinaryVariable.java	2 Apr 2003 04:52:40 -0000	1.2
+++ model/org/eclipse/cdt/internal/core/model/BinaryVariable.java	21 Aug 2003 18:35:04 -0000
@@ -62,13 +62,5 @@
 		// 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;
-	}
-
+	
 }
Index: model/org/eclipse/cdt/internal/core/model/CModelBuilder.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelBuilder.java,v
retrieving revision 1.12
diff -u -r1.12 CModelBuilder.java
--- model/org/eclipse/cdt/internal/core/model/CModelBuilder.java	14 Aug 2003 15:33:27 -0000	1.12
+++ model/org/eclipse/cdt/internal/core/model/CModelBuilder.java	21 Aug 2003 18:35:04 -0000
@@ -30,6 +30,7 @@
 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 @@
 	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 @@
 			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 @@
 		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 @@
 				// 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 
 		{
Index: model/org/eclipse/cdt/internal/core/model/Enumeration.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Enumeration.java,v
retrieving revision 1.3
diff -u -r1.3 Enumeration.java
--- model/org/eclipse/cdt/internal/core/model/Enumeration.java	4 Apr 2003 14:01:29 -0000	1.3
+++ model/org/eclipse/cdt/internal/core/model/Enumeration.java	21 Aug 2003 18:35:04 -0000
@@ -49,13 +49,6 @@
 	}
 
 	/**
-	 * @see org.eclipse.cdt.core.model.IDeclaration#getAccessControl()
-	 */
-	public int getAccessControl() {
-		return 0;
-	}
-
-	/**
 	 * @see org.eclipse.cdt.core.model.IDeclaration#isConst()
 	 */
 	public boolean isConst() {
Index: model/org/eclipse/cdt/internal/core/model/Field.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Field.java,v
retrieving revision 1.7
diff -u -r1.7 Field.java
--- model/org/eclipse/cdt/internal/core/model/Field.java	24 Jul 2003 13:30:30 -0000	1.7
+++ model/org/eclipse/cdt/internal/core/model/Field.java	21 Aug 2003 18:35:04 -0000
@@ -15,10 +15,6 @@
 		super(parent, name, CElement.C_FIELD);
 	}
 
-	public int getAccessControl(){
-		return getFieldInfo().getAccessControl();
-	}
-
 	public boolean isMutable(){
 		return getFieldInfo().isMutable();
 	}
Index: model/org/eclipse/cdt/internal/core/model/FieldInfo.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/FieldInfo.java,v
retrieving revision 1.5
diff -u -r1.5 FieldInfo.java
--- model/org/eclipse/cdt/internal/core/model/FieldInfo.java	24 Jul 2003 13:30:30 -0000	1.5
+++ model/org/eclipse/cdt/internal/core/model/FieldInfo.java	21 Aug 2003 18:35:04 -0000
@@ -15,7 +15,6 @@
 
 public class FieldInfo extends SourceManipulationInfo {
 
-	int flags = 0;
 	String typeStr = "";
 	boolean isConst = false;
 	boolean isVolatile = false;
@@ -25,20 +24,11 @@
 	
 	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){
Index: model/org/eclipse/cdt/internal/core/model/FunctionDeclaration.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/FunctionDeclaration.java,v
retrieving revision 1.8
diff -u -r1.8 FunctionDeclaration.java
--- model/org/eclipse/cdt/internal/core/model/FunctionDeclaration.java	16 Apr 2003 20:32:20 -0000	1.8
+++ model/org/eclipse/cdt/internal/core/model/FunctionDeclaration.java	21 Aug 2003 18:35:04 -0000
@@ -83,11 +83,6 @@
 		return "";
 	}
 	
-	public int getAccessControl(){
-		return getFunctionInfo().getAccessControl();
-	}
-
-
 	public String[] getExceptions(){
 		return new String[] {};
 	}
Index: model/org/eclipse/cdt/internal/core/model/FunctionInfo.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/FunctionInfo.java,v
retrieving revision 1.6
diff -u -r1.6 FunctionInfo.java
--- model/org/eclipse/cdt/internal/core/model/FunctionInfo.java	8 Apr 2003 21:30:53 -0000	1.6
+++ model/org/eclipse/cdt/internal/core/model/FunctionInfo.java	21 Aug 2003 18:35:04 -0000
@@ -7,7 +7,6 @@
 
 class FunctionInfo extends SourceManipulationInfo {
 
-	protected int flags;
 	protected boolean isStatic;
 	protected boolean isVolatile;
 	protected boolean isConst;
@@ -15,15 +14,6 @@
 
 	protected FunctionInfo (CElement element) {
 		super(element);
-		flags = 0;
-	}
-
-	protected int getAccessControl() {
-		return flags;
-	}
-
-	protected void setAccessControl(int flags) {
-		this.flags = flags;
 	}
 
 	/**
Index: model/org/eclipse/cdt/internal/core/model/Include.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Include.java,v
retrieving revision 1.3
diff -u -r1.3 Include.java
--- model/org/eclipse/cdt/internal/core/model/Include.java	5 Jun 2003 20:01:54 -0000	1.3
+++ model/org/eclipse/cdt/internal/core/model/Include.java	21 Aug 2003 18:35:04 -0000
@@ -10,7 +10,8 @@
 
 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 @@
 	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;
+	}
+
 }
Index: model/org/eclipse/cdt/internal/core/model/MethodDeclaration.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/MethodDeclaration.java,v
retrieving revision 1.4
diff -u -r1.4 MethodDeclaration.java
--- model/org/eclipse/cdt/internal/core/model/MethodDeclaration.java	24 Jul 2003 13:30:30 -0000	1.4
+++ model/org/eclipse/cdt/internal/core/model/MethodDeclaration.java	21 Aug 2003 18:35:04 -0000
@@ -17,45 +17,48 @@
 
 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 @@
 		);
 	}
 		
+
 }
Index: model/org/eclipse/cdt/internal/core/model/MethodInfo.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/MethodInfo.java,v
retrieving revision 1.4
diff -u -r1.4 MethodInfo.java
--- model/org/eclipse/cdt/internal/core/model/MethodInfo.java	24 Jul 2003 13:30:30 -0000	1.4
+++ model/org/eclipse/cdt/internal/core/model/MethodInfo.java	21 Aug 2003 18:35:04 -0000
@@ -15,7 +15,7 @@
 
 public class MethodInfo extends FunctionInfo {
 
-	boolean isAbstract = false;
+	boolean isPureVirtual = false;
 	boolean isInline = false;
 	boolean isVirtual = false;
 	boolean isFriend = false;
@@ -27,12 +27,12 @@
 		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 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())
Index: model/org/eclipse/cdt/internal/core/model/Structure.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Structure.java,v
retrieving revision 1.4
diff -u -r1.4 Structure.java
--- model/org/eclipse/cdt/internal/core/model/Structure.java	28 Mar 2003 21:05:20 -0000	1.4
+++ model/org/eclipse/cdt/internal/core/model/Structure.java	21 Aug 2003 18:35:04 -0000
@@ -5,34 +5,57 @@
  * 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 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;
-	}
-
-	/**
-	 * Return the inherited structures.
-	 * @IInheritance
-	 */
-	public IStructure [] getBaseTypes() throws CModelException {
-		return new IStructure[0];
-	}
-
-	/**
-	 * @see IVariable
-	 */
+	public String[] getSuperClassesNames(){
+		return (String[])superClassesNames.keySet().toArray(new String[superClassesNames.keySet().size()]);
+	}
+
+	public ASTAccessVisibility getSuperClassAccess(String name){
+		return (ASTAccessVisibility)superClassesNames.get(name);
+	}
+
 	public String getTypeName() {
 		return getStructureInfo().getTypeName();
 	}
@@ -105,31 +124,17 @@
 	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;
 	}
 
 }
Index: model/org/eclipse/cdt/internal/core/model/VariableDeclaration.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/VariableDeclaration.java,v
retrieving revision 1.5
diff -u -r1.5 VariableDeclaration.java
--- model/org/eclipse/cdt/internal/core/model/VariableDeclaration.java	8 Apr 2003 21:30:53 -0000	1.5
+++ model/org/eclipse/cdt/internal/core/model/VariableDeclaration.java	21 Aug 2003 18:35:04 -0000
@@ -18,10 +18,6 @@
 		super(parent, name, type);
 	}
 
-	public int getAccessControl() {
-		return getVariableInfo().getAccessControl();
-	}
-
 	public String getTypeName() {
 		return getVariableInfo().getTypeName();
 	}
Index: model/org/eclipse/cdt/internal/core/model/VariableInfo.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/VariableInfo.java,v
retrieving revision 1.5
diff -u -r1.5 VariableInfo.java
--- model/org/eclipse/cdt/internal/core/model/VariableInfo.java	4 Apr 2003 14:01:29 -0000	1.5
+++ model/org/eclipse/cdt/internal/core/model/VariableInfo.java	21 Aug 2003 18:35:04 -0000
@@ -7,7 +7,6 @@
 
 class VariableInfo extends SourceManipulationInfo {
 
-	protected int flags;
 	String typeStr = "";
 	boolean isConst = false;
 	boolean isVolatile = false;
@@ -15,11 +14,6 @@
 	
 	protected VariableInfo (CElement element) {
 		super(element);
-		flags = 0;
-	}
-
-	protected int getAccessControl() {
-		return flags;
 	}
 
 	protected String getTypeName(){
@@ -28,10 +22,6 @@
 	
 	protected void setTypeName(String type){
 		typeStr = type;
-	}
-	
-	protected void setAccessControl(int flags) {
-		this.flags = flags;
 	}
 	
 	protected void setTypeString(String type){

Back to the top