Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] Updates to the C Model for the Outline to reflect type and visibi lity changes

The Following patch updates the C model to enable the Outline view to
display type and visibility info for both fields and methods.

The attached gif files are the new icons that indicate method visibility.
They should be added to:
\org.eclipse.cdt.ui\icons\full\obj16

Thanks,
Hoda


Index: model/org/eclipse/cdt/core/model/IField.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IField.java,v
retrieving revision 1.2
diff -u -r1.2 IField.java
--- model/org/eclipse/cdt/core/model/IField.java	2 Feb 2003 01:01:36 -0000	1.2
+++ model/org/eclipse/cdt/core/model/IField.java	25 Mar 2003 17:15:38 -0000
@@ -16,5 +16,5 @@
 	 * @exception CModelException if this element does not exist or if an
 	 *      exception occurs while accessing its corresponding resource.
 	 */
-	public boolean isMutable() throws CModelException;
+	public boolean isMutable();
 }
Index: model/org/eclipse/cdt/core/model/IFunction.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IFunction.java,v
retrieving revision 1.1
diff -u -r1.1 IFunction.java
--- model/org/eclipse/cdt/core/model/IFunction.java	26 Jun 2002 20:37:14 -0000	1.1
+++ model/org/eclipse/cdt/core/model/IFunction.java	25 Mar 2003 17:15:39 -0000
@@ -8,71 +8,6 @@
 /**
  * Represents a function.
  */
-public interface IFunction extends ICElement, ISourceReference, ISourceManipulation {
+public interface IFunction extends IFunctionDeclaration {
 
-	/**
-	 * Returns the exceptions this method throws, in the order declared in the source.
-	 * or an empty array if this method throws no exceptions.
-	 *
-	 * <p>For example, a source method declaring <code>"void f(int a) throw (x2, x3);"</code>,
-	 * would return the array <code>{"x2", "x3"}</code>.
-	 *
-	 * @exception CModelException if this element does not exist or if an
-	 *      exception occurs while accessing its corresponding resource.
-	 *
-	 */
-	public String[] getExceptions() throws CModelException;
-
-	/**
-	 * Returns the number of parameters of this method.
-	 */
-	public int getNumberOfParameters();
-
-	/**
-	 * Returns the initializer of parameters pos for this method.
-	 * Returns an empty string if this argument has no initializer.
-	 *
-	 * <p>For example, a method declared as <code>void foo(String text, int length=9)</code>
-	 * would return the array <code>{"9"}</code>.
-	 *
-	 * @exception CModelException if this argument does not exist or if an
-	 *      exception occurs while accessing its corresponding resource.
-	 */
-	public String getParameterInitializer(int pos);
-
-	/**
-	 * Returns the type signatures for the parameters of this method.
-	 * Returns an empty array if this method has no parameters.
-	 * This is a handle-only method.
-	 *
-	 * <p>For example, a source method declared as <code>void foo(string text, int length)</code>
-	 * would return the array <code>{"string","int"}</code>.
-	 *
-	 * @see Signature
-	 */
-	public String[] getParameterTypes();
-
-	/**
-	 * Returns the type signature of the return value of this method.
-	 * For constructors, this returns the signature for void.
-	 *
-	 * <p>For example, a source method declared as <code>int getName()</code>
-	 * would return <code>"int"</code>.
-	 *
-	 * @exception CModelException if this element does not exist or if an
-	 *      exception occurs while accessing its corresponding resource.
-	 *
-	 * @see Signature
-	 */
-	public String getReturnType() throws CModelException;
-
-	/**
-	 * Returns the access Control of the member.  The value can be
-	 * can be examined using class <code>Flags</code>.
-	 *
-	 * @exception CModelException if this element does not exist or if an
-	 *      exception occurs while accessing its corresponding resource.
-	 * @see Flags
-	 */
-	public int getAccessControl() throws CModelException;
 }
Index: model/org/eclipse/cdt/core/model/IFunctionDeclaration.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IFunctionDeclaration.java,v
retrieving revision 1.1
diff -u -r1.1 IFunctionDeclaration.java
--- model/org/eclipse/cdt/core/model/IFunctionDeclaration.java	26 Jun 2002 20:37:14 -0000	1.1
+++ model/org/eclipse/cdt/core/model/IFunctionDeclaration.java	25 Mar 2003 17:15:38 -0000
@@ -23,7 +23,7 @@
 	 *
 	 * @see Signature
 	 */
-	String[] getExceptions() throws CModelException;
+	String[] getExceptions();
 
 	/**
 	 * Returns the number of parameters of this method.
@@ -55,18 +55,14 @@
 	String[] getParameterTypes();
 
 	/**
-	 * Returns the type signature of the return value of this method.
-	 * For constructors, this returns the signature for void.
-	 *
-	 * <p>For example, a source method declared as <code>public String getName()</code>
-	 * would return <code>"String"</code>.
-	 *
-	 * @exception CModelException if this element does not exist or if an
-	 *      exception occurs while accessing its corresponding resource.
-	 *
-	 * @see Signature
+	 * Returns the return value of this method. 
 	 */
-	String getReturnType() throws CModelException;
+	String getReturnType();
+	
+	/**
+	 * Returns the signature of the method. 
+	 */	
+	String getSignature();
 
 	/**
 	 * Returns the access Control of the member. The access qualifier
@@ -76,5 +72,5 @@
 	 *      exception occurs while accessing its corresponding resource.
 	 * @see IAccessControl
 	 */
-	int getAccessControl() throws CModelException;
+	int getAccessControl();
 }
Index: model/org/eclipse/cdt/core/model/IMember.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IMember.java,v
retrieving revision 1.1
diff -u -r1.1 IMember.java
--- model/org/eclipse/cdt/core/model/IMember.java	26 Jun 2002 20:37:14 -0000	1.1
+++ model/org/eclipse/cdt/core/model/IMember.java	25 Mar 2003 17:15:39 -0000
@@ -12,21 +12,20 @@
  */
 public interface IMember extends ICElement, ISourceReference, ISourceManipulation {
 
-	///**
-	//* Returns the structure in which this member is declared, or <code>null</code>
-	//* if this member is not declared in a type (for example, a top-level type).
-	//*/
-	//IStructure belongsTo() throws CModelException;
+	static final int V_PUBLIC = 0;
+	static final int V_PROTECTED = 1;
+	static final int V_PRIVATE = 2;
+
 
 	/**
-	 * Returns true if the member as class scope.
-	 * For example static methods in C++ have class scope 
+	 * Returns true if the member has class scope. For example static methods in
+	 * C++ have class scope
 	 * 
 	 *
 	 * @exception CModelException if this element does not exist or if an
 	 *      exception occurs while accessing its corresponding resource.
 	 */
-	public boolean hasClassScope() throws CModelException;
+	public boolean hasClassScope();
 
 	/**
 	 * Returns whether this method/field is declared constant.
@@ -34,7 +33,13 @@
 	 * @exception CModelException if this element does not exist or if an
 	 *      exception occurs while accessing its corresponding resource.
 	 */
-	public boolean isConst() throws CModelException;
+	public boolean isConst();
+	
+	/**
+	 * Returns if this member is volatile or not
+	 * @return boolean
+	 */
+	public boolean isVolatile();
 
 	/**
 	 * Returns the access Control of the member. The access qualifier
@@ -44,5 +49,12 @@
 	 *      exception occurs while accessing its corresponding resource.
 	 * @see IAccessControl
 	 */
-	public int getAccessControl() throws CModelException;
+	public int getAccessControl();
+	/**
+	 * Returns the member's visibility
+	 * V_PRIVATE = 0 V_PROTECTED = 1 V_PUBLIC = 2
+	 * @return int
+	 */
+	public int getVisibility();	
+	
 }
Index: model/org/eclipse/cdt/core/model/IMethod.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IMethod.java,v
retrieving revision 1.2
diff -u -r1.2 IMethod.java
--- model/org/eclipse/cdt/core/model/IMethod.java	23 Jan 2003 19:27:35 -0000	1.2
+++ model/org/eclipse/cdt/core/model/IMethod.java	25 Mar 2003 17:15:39 -0000
@@ -8,110 +8,6 @@
 /**
  * Represents the definition method of a class.
  */
-public interface IMethod extends IMember, IFunction {
+public interface IMethod extends IMethodDeclaration {
 
-	/**
-	 * Returns the type signatures of the exceptions this method throws,
-	 * in the order declared in the source. Returns an empty array
-	 * if this method throws no exceptions.
-	 *
-	 * <p>For example, a source method declaring <code>"throws IOException"</code>,
-	 * would return the array <code>{"QIOException;"}</code>.
-	 *
-	 * @exception CModelException if this element does not exist or if an
-	 *      exception occurs while accessing its corresponding resource.
-	 *
-	 * @see Signature
-	 */
-	String[] getExceptions() throws CModelException;
-
-	/**
-	 * Returns the number of parameters of this method.
-	 */
-	int getNumberOfParameters();
-
-	/**
-	 * Returns the initializer of parameters pos for this method.
-	 * Returns an empty string if this argument has no initializer.
-	 *
-	 * <p>For example, a method declared as <code>public void foo(String text, int length=9)</code>
-	 * would return the array <code>{"9"}</code>.
-	 *
-	 * @exception CModelException if this argument does not exist or if an
-	 *      exception occurs while accessing its corresponding resource.
-	 */
-	String getParameterInitializer(int pos);
-
-	/**
-	 * Returns the type signatures for the parameters of this method.
-	 * Returns an empty array if this method has no parameters.
-	 * This is a handle-only method.
-	 *
-	 * <p>For example, a source method declared as <code>void foo(String text, int length)</code>
-	 * would return the array <code>{"String","int"}</code>.
-	 *
-	 * @see Signature
-	 */
-	String[] getParameterTypes();
-
-	/**
-	 * Returns the type signature of the return value of this method.
-	 * For constructors, this returns the signature for void.
-	 *
-	 * <p>For example, a source method declared as <code>public String getName()</code>
-	 * would return <code>"String"</code>.
-	 *
-	 * @exception CModelException if this element does not exist or if an
-	 *      exception occurs while accessing its corresponding resource.
-	 *
-	 * @see Signature
-	 */
-	String getReturnType() throws CModelException;
-
-	/**
-	 * Returns whether this method is a constructor.
-	 *
-	 * @exception CModelException if this element does not exist or if an
-	 *      exception occurs while accessing its corresponding resource.
-	 */
-	boolean isConstructor() throws CModelException;
-
-	/**
-	 * Returns whether this method is a destructor.
-	 *
-	 * @exception CModelException if this element does not exist or if an
-	 *      exception occurs while accessing its corresponding resource.
-	 */
-	boolean isDestructor() throws CModelException;
-
-	/**
-	 * Returns whether this method is an operator method.
-	 *
-	 * @exception CModelException if this element does not exist or if an
-	 *      exception occurs while accessing its corresponding resource.
-	 */
-	boolean isOperator() throws CModelException;
-
-	/**
-	 * Returns whether this method is declared pure virtual.
-	 *
-	 * <p>For example, a source method declared as <code>virtual void m() = 0;</code>. 
-	 *
-	 * @exception CModelException if this element does not exist or if an
-	 *      exception occurs while accessing its corresponding resource.
-	 */
-	boolean isAbstract() throws CModelException;
-
-	/**
-	 * Returns whether this method is declared virtual.
-	 *
-	 * @exception CModelException if this element does not exist or if an
-	 *      exception occurs while accessing its corresponding resource.
-	 */
-	boolean isVirtual() throws CModelException;
-
-	/**
-	 * return true if the member is a friend.
-	 */
-	public boolean isFriend() throws CModelException;
-}
+}
\ No newline at end of file
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.2
diff -u -r1.2 IMethodDeclaration.java
--- model/org/eclipse/cdt/core/model/IMethodDeclaration.java	2 Feb 2003 01:01:49 -0000	1.2
+++ model/org/eclipse/cdt/core/model/IMethodDeclaration.java	25 Mar 2003 17:15:39 -0000
@@ -11,70 +11,12 @@
 public interface IMethodDeclaration extends IMember, IFunctionDeclaration {
 
 	/**
-	 * Returns the type signatures of the exceptions this method throws,
-	 * in the order declared in the source. Returns an empty array
-	 * if this method throws no exceptions.
-	 *
-	 * <p>For example, a source method declaring <code>"throws IOException"</code>,
-	 * would return the array <code>{"QIOException;"}</code>.
-	 *
-	 * @exception CModelException if this element does not exist or if an
-	 *      exception occurs while accessing its corresponding resource.
-	 *
-	 * @see Signature
-	 */
-	String[] getExceptions() throws CModelException;
-
-	/**
-	 * Returns the number of parameters of this method.
-	 */
-	int getNumberOfParameters();
-
-	/**
-	 * Returns the initializer of parameters pos for this method.
-	 * Returns an empty string if this argument has no initializer.
-	 *
-	 * <p>For example, a method declared as <code>public void foo(String text, int length=9)</code>
-	 * would return the array <code>{"9"}</code>.
-	 *
-	 * @exception CModelException if this argument does not exist or if an
-	 *      exception occurs while accessing its corresponding resource.
-	 */
-	String getParameterInitializer(int pos);
-
-	/**
-	 * Returns the type signatures for the parameters of this method.
-	 * Returns an empty array if this method has no parameters.
-	 * This is a handle-only method.
-	 *
-	 * <p>For example, a source method declared as <code>void foo(String text, int length)</code>
-	 * would return the array <code>{"String","int"}</code>.
-	 *
-	 * @see Signature
-	 */
-	String[] getParameterTypes();
-
-	/**
-	 * Returns the type signature of the return value of this method.
-	 * For constructors, this returns the signature for void.
-	 *
-	 * <p>For example, a source method declared as <code>public String getName()</code>
-	 * would return <code>"String"</code>.
-	 *
-	 * @exception CModelException if this element does not exist or if an
-	 *      exception occurs while accessing its corresponding resource.
-	 *
-	 * @see Signature
-	 */
-	String getReturnType() throws CModelException;
-
-	/**
 	 * Returns whether this method is a constructor.
 	 *
 	 * @exception CModelException if this element does not exist or if an
 	 *      exception occurs while accessing its corresponding resource.
 	 */
-	boolean isConstructor() throws CModelException;
+	boolean isConstructor();
 
 	/**
 	 * Returns whether this method is a destructor.
@@ -82,7 +24,7 @@
 	 * @exception CModelException if this element does not exist or if an
 	 *      exception occurs while accessing its corresponding resource.
 	 */
-	boolean isDestructor() throws CModelException;
+	boolean isDestructor();
 
 	/**
 	 * Returns whether this method is an operator method.
@@ -90,7 +32,7 @@
 	 * @exception CModelException if this element does not exist or if an
 	 *      exception occurs while accessing its corresponding resource.
 	 */
-	boolean isOperator() throws CModelException;
+	boolean isOperator();
 
 	/**
 	 * Returns whether this method is declared pure virtual.
@@ -100,18 +42,31 @@
 	 * @exception CModelException if this element does not exist or if an
 	 *      exception occurs while accessing its corresponding resource.
 	 */
-	boolean isAbstract() throws CModelException;
+	boolean isAbstract();
 
 	/**
+	 * Returns if this method is static or not
+	 * @return boolean
+	 */
+	public boolean isStatic();
+	
+	/**
+	 * Returns if this method is inline or not
+	 * @return boolean
+	 */
+	public boolean isInline();
+	
+	/**
 	 * Returns whether this method is declared virtual.
 	 *
 	 * @exception CModelException if this element does not exist or if an
 	 *      exception occurs while accessing its corresponding resource.
 	 */
-	boolean isVirtual() throws CModelException;
+	boolean isVirtual();
 
 	/**
 	 * return true if the member is a friend.
 	 */
-	public boolean isFriend() throws CModelException;
+	public boolean isFriend();
+
 }
Index: model/org/eclipse/cdt/core/model/IVariable.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IVariable.java,v
retrieving revision 1.1
diff -u -r1.1 IVariable.java
--- model/org/eclipse/cdt/core/model/IVariable.java	26 Jun 2002 20:37:15 -0000	1.1
+++ model/org/eclipse/cdt/core/model/IVariable.java	25 Mar 2003 17:15:38 -0000
@@ -9,7 +9,8 @@
  * Represents a global variable.
  */
 public interface IVariable extends ICElement , ISourceManipulation, ISourceReference {
-	public String getType();
+	public String getTypeName();
+	public void setTypeName(String type);
 	public String getInitializer();
 	public int getAccessControl() throws CModelException;
 }
Index: model/org/eclipse/cdt/core/model/IVariableDeclaration.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IVariableDeclaration.java,v
retrieving revision 1.2
diff -u -r1.2 IVariableDeclaration.java
--- model/org/eclipse/cdt/core/model/IVariableDeclaration.java	2 Feb 2003 01:02:09 -0000	1.2
+++ model/org/eclipse/cdt/core/model/IVariableDeclaration.java	25 Mar 2003 17:15:38 -0000
@@ -10,6 +10,7 @@
  */
 public interface IVariableDeclaration extends ICElement, ISourceManipulation, ISourceReference {
 
-	public String getType ();
-	public int getAccessControl() throws CModelException;
+	public String getTypeName();
+	public void setTypeName(String type);
+	public int getAccessControl();
 }
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.2
diff -u -r1.2 Field.java
--- model/org/eclipse/cdt/internal/core/model/Field.java	2 Feb 2003 01:02:42 -0000	1.2
+++ model/org/eclipse/cdt/internal/core/model/Field.java	25 Mar 2003 17:15:39 -0000
@@ -5,7 +5,6 @@
  * All Rights Reserved.
  */
 
-import org.eclipse.cdt.core.model.CModelException;
 import org.eclipse.cdt.core.model.ICElement;
 import org.eclipse.cdt.core.model.IField;
 
@@ -15,61 +14,78 @@
 		super(parent, name, CElement.C_FIELD);
 	}
 
-	public boolean isMutable() throws CModelException {
-		return false;
+	public int getAccessControl(){
+		return getFieldInfo().getAccessControl();
 	}
 
-	/*
-	 * @IVariable
-	 */
-	public String getType() {
-		return "";
+	public boolean isMutable(){
+		return getFieldInfo().isMutable();
 	}
 
-	/*
-	 * @IVariable
-	 */
-	public String getInitializer() {
-		return "";
+	public void setIsMutable(boolean mutable){
+		getFieldInfo().setIsMutable(mutable);
 	}
 
-	/**
-	 * Returns true if the member as class scope.
-	 * For example static methods in C++ have class scope 
-	 *
-	 * @see IMember
-	 * @exception CModelException if this element does not exist or if an
-	 *      exception occurs while accessing its corresponding resource.
-	 */
-	public boolean hasClassScope() throws CModelException {
-		return false;
+	public String getTypeName() {
+		return getFieldInfo().getTypeName();
 	}
 
-	/**
-	 * Returns whether this method/field is declared constant.
-	 *
-	 * @see IMember
-	 * @exception CModelException if this element does not exist or if an
-	 *      exception occurs while accessing its corresponding resource.
-	 */
-	public boolean isConst() throws CModelException {
-		return false;
+	public void setTypeName(String type) {
+		getFieldInfo().setTypeName(type);
+	}
+
+	public boolean isConst() {
+		return getFieldInfo().isConst();
+	}
+
+	public void setIsConst(boolean isConst) {
+		getFieldInfo().setIsConst(isConst);
+	}
+
+	public boolean isVolatile() {
+		return getFieldInfo().isVolatile();
+	}
+
+	public void setIsVolatile(boolean isVolatile) {
+		getFieldInfo().setIsVolatile(isVolatile);
+	}
+
+	public int getVisibility() {
+		return getFieldInfo().getVisibility();
+	}
+
+	public void setVisibility(int visibility) {
+		getFieldInfo().setVisibility(visibility);
+	}
+
+	public FieldInfo getFieldInfo(){
+		return (FieldInfo) getElementInfo();
 	}
 
 	/**
-	 * Returns the access Control of the member. The access qualifier
-	 * can be examine using the AccessControl class.
+	 * Returns true if the member as class scope.
+	 * For example static methods in C++ have class scope 
 	 *
 	 * @see IMember
 	 * @exception CModelException if this element does not exist or if an
 	 *      exception occurs while accessing its corresponding resource.
 	 */
-	public int getAccessControl() throws CModelException {
-		return 0;
+	public boolean hasClassScope(){
+		return false;
 	}
 
 	protected CElementInfo createElementInfo () {
-		return new SourceManipulationInfo(this);
+		return new FieldInfo(this);
 	}
 
+	// tests both info stored in element and element info
+	public boolean isIdentical(Field other){
+		FieldInfo otherInfo= other.getFieldInfo();
+		if ( (this.equals(other))
+		 && (getFieldInfo().hasSameContentsAs(otherInfo))
+		 )
+			return true;
+		else
+			return false;
+	}
 }
Index: model/org/eclipse/cdt/internal/core/model/FieldInfo.java
===================================================================
RCS file: model/org/eclipse/cdt/internal/core/model/FieldInfo.java
diff -N model/org/eclipse/cdt/internal/core/model/FieldInfo.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ model/org/eclipse/cdt/internal/core/model/FieldInfo.java	25 Mar 2003 17:15:39 -0000
@@ -0,0 +1,104 @@
+package org.eclipse.cdt.internal.core.model;
+
+/**********************************************************************
+ * Copyright (c) 2002,2003 Rational Software Corporation and others.
+ * All rights reserved.   This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ * 
+ * Contributors: 
+ * Rational Software - Initial API and implementation
+***********************************************************************/
+
+import org.eclipse.cdt.core.model.IMember;
+
+public class FieldInfo extends SourceManipulationInfo {
+
+	int flags = 0;
+	String typeStr;
+	boolean isConst = false;
+	boolean isVolatile = false;
+	boolean isMutable = false;
+	int visibility;
+	
+	protected FieldInfo (CElement element) {
+		super(element);
+		flags = 0;
+		visibility = IMember.V_PRIVATE;
+	}
+
+	protected int getAccessControl() {
+		return flags;
+	}
+
+	protected String getTypeName(){
+		return typeStr;
+	}
+
+	/**
+	 * Tests info stored in element info only
+	 * @param otherInfo
+	 * @return boolean
+	 */
+	public boolean hasSameContentsAs( SourceManipulationInfo info){
+		FieldInfo otherInfo = (FieldInfo) info;
+		if( (typeStr.equals(otherInfo.getTypeName())) 
+		&&  (isConst == otherInfo.isConst())
+		&&  (isVolatile == otherInfo.isVolatile())
+		&& 	(isMutable == otherInfo.isMutable())
+		&& 	(visibility == otherInfo.getVisibility())
+		)
+			return true;
+		else
+			return false;
+	}
+	
+	protected void setAccessControl(int flags) {
+		this.flags = flags;
+	}
+	
+	protected void setTypeName(String type){
+		typeStr = type;
+	}
+	
+	protected boolean isConst(){
+		return isConst;
+	}
+
+	protected void setIsConst(boolean isConst){
+		this.isConst = isConst;
+	}
+
+	protected boolean isVolatile(){
+		return isVolatile;
+	}
+
+	protected void setIsVolatile(boolean isVolatile){
+		this.isVolatile = isVolatile;
+	}
+
+	protected boolean isMutable(){
+		return isMutable;
+	}
+
+	protected void setIsMutable(boolean mutable){
+		this.isMutable = mutable;
+	}
+	/**
+	 * Returns the visibility.
+	 * @return int
+	 */
+	public int getVisibility() {
+		return visibility;
+	}
+
+	/**
+	 * Sets the visibility.
+	 * @param visibility The visibility to set
+	 */
+	public void setVisibility(int visibility) {
+		this.visibility = visibility;
+	}
+
+}
Index: model/org/eclipse/cdt/internal/core/model/Function.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Function.java,v
retrieving revision 1.1
diff -u -r1.1 Function.java
--- model/org/eclipse/cdt/internal/core/model/Function.java	26 Jun 2002 20:37:14 -0000	1.1
+++ model/org/eclipse/cdt/internal/core/model/Function.java	25 Mar 2003 17:15:39 -0000
@@ -5,45 +5,12 @@
  * All Rights Reserved.
  */
 
-import org.eclipse.cdt.core.model.CModelException;
 import org.eclipse.cdt.core.model.ICElement;
 import org.eclipse.cdt.core.model.IFunction;
 
-public class Function extends SourceManipulation implements IFunction {
+public class Function extends FunctionDeclaration implements IFunction {
 	
 	public Function(ICElement parent, String name) {
 		super(parent, name, CElement.C_FUNCTION);
-	}
-
-	public String[] getExceptions() throws CModelException {
-		return new String[] {};
-	}
-
-	public int getNumberOfParameters() {
-		return 0;
-	}
-
-	public String getParameterInitializer(int pos) {
-		return "";
-	}
-
-	public String[] getParameterTypes() {
-		return new String[0];
-	}
-
-	public String getReturnType() throws CModelException {
-		return  "";
-	}
-
-	public int getAccessControl() throws CModelException {
-		return getFunctionInfo().getAccessControl();
-	}
-
-	public FunctionInfo getFunctionInfo() {
-		return (FunctionInfo)getElementInfo();
-	} 
-
-	protected CElementInfo createElementInfo () {
-		return new FunctionInfo(this);
 	}
 }
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.1
diff -u -r1.1 FunctionDeclaration.java
--- model/org/eclipse/cdt/internal/core/model/FunctionDeclaration.java	26 Jun 2002 20:37:14 -0000	1.1
+++ model/org/eclipse/cdt/internal/core/model/FunctionDeclaration.java	25 Mar 2003 17:15:39 -0000
@@ -5,41 +5,94 @@
  * All Rights Reserved.
  */
 
-import org.eclipse.cdt.core.model.CModelException;
 import org.eclipse.cdt.core.model.ICElement;
 import org.eclipse.cdt.core.model.IFunctionDeclaration;
 
 public class FunctionDeclaration extends SourceManipulation implements IFunctionDeclaration {
+	/**
+	 * An empty list of Strings
+	 */
+	protected static final String[] fgEmptyList= new String[] {};
+	protected String[] fParameterTypes;
+	protected String returnType;
 	
 	public FunctionDeclaration(ICElement parent, String name) {
 		super(parent, name, CElement.C_FUNCTION_DECLARATION);
+		fParameterTypes= fgEmptyList;
 	}
 
-	public String[] getExceptions() throws CModelException {
-		return new String[] {};
+	public FunctionDeclaration(ICElement parent, String name, int type) {
+		super(parent, name, type);
+		fParameterTypes= fgEmptyList;
 	}
 
-	public int getNumberOfParameters() {
-		return 0;
+	public String getReturnType(){
+		return returnType;
 	}
 
-	public String getParameterInitializer(int pos) {
-		return "";
+	public void setReturnType(String type){
+		returnType = type;
+		getFunctionInfo().setReturnType(type);
 	}
 
-	public String[] getParameterTypes() {
-		return new String[0];
+	public int getNumberOfParameters() {
+		return fParameterTypes == null ? 0 : fParameterTypes.length;
 	}
 
-	public String getReturnType() throws CModelException {
-		return  "";
+	public String[] getParameterTypes() {
+		return fParameterTypes;
+	}
+	
+	public void setParameterTypes(String[] parameterTypes) {
+		fParameterTypes = parameterTypes;
+	}		
+		
+	public String getSignature(){
+		String sig = getReturnType();
+		sig += " ";
+		sig += getElementName();
+		if(getNumberOfParameters() > 0){
+			sig += "(";
+			String[] paramTypes = getParameterTypes();
+			int i = 0;
+			sig += paramTypes[i++];
+			while (i < paramTypes.length){
+				sig += (", ");
+				sig += paramTypes[i++];
+			}
+			sig += ")";
+		}
+		else{
+			sig +=  "()";
+		}
+		return sig;
+	}
+		
+	public String getParameterInitializer(int pos) {
+		return "";
+	}
+	
+	public int getAccessControl(){
+		return getFunctionInfo().getAccessControl();
 	}
 
-	public int getAccessControl() throws CModelException {
-		return 0;
+	public String[] getExceptions(){
+		return new String[] {};
 	}
 
 	protected CElementInfo createElementInfo () {
-		return new SourceManipulationInfo(this);
+		return new FunctionInfo(this);
 	}
+	
+	protected FunctionInfo getFunctionInfo(){
+		return (FunctionInfo) getElementInfo();
+	}
+	
+	public boolean equals(Object other) {
+		return ( super.equals(other) 
+		&& Util.equalArraysOrNull(fParameterTypes, ((FunctionDeclaration)other).fParameterTypes)
+		&& getReturnType().equals(((FunctionDeclaration)other).getReturnType())
+		);
+	}
+	
 }
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.1
diff -u -r1.1 FunctionInfo.java
--- model/org/eclipse/cdt/internal/core/model/FunctionInfo.java	26 Jun 2002 20:37:14 -0000	1.1
+++ model/org/eclipse/cdt/internal/core/model/FunctionInfo.java	25 Mar 2003 17:15:39 -0000
@@ -8,6 +8,8 @@
 class FunctionInfo extends SourceManipulationInfo {
 
 	protected int flags;
+	protected String returnType;
+	protected int numOfParams;
 
 	protected FunctionInfo (CElement element) {
 		super(element);
@@ -21,4 +23,12 @@
 	protected void setAccessControl(int flags) {
 		this.flags = flags;
 	}
+
+	protected String getReturnType(){
+		return returnType;
+	}
+	
+	protected void setReturnType(String type){
+		returnType = type;
+	}	
 }
Index: model/org/eclipse/cdt/internal/core/model/Method.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Method.java,v
retrieving revision 1.1
diff -u -r1.1 Method.java
--- model/org/eclipse/cdt/internal/core/model/Method.java	26 Jun 2002 20:37:14 -0000	1.1
+++ model/org/eclipse/cdt/internal/core/model/Method.java	25 Mar 2003 17:15:39 -0000
@@ -5,120 +5,12 @@
  * All Rights Reserved.
  */
  
-import org.eclipse.cdt.core.model.CModelException;
 import org.eclipse.cdt.core.model.ICElement;
 import org.eclipse.cdt.core.model.IMethod;
 
-public class Method extends SourceManipulation implements IMethod {
+public class Method extends MethodDeclaration implements IMethod{
 	
-	public Method(ICElement parent, String name) {
+	public Method(ICElement parent, String name){
 		super(parent, name, CElement.C_METHOD);
-	}
-
-	/**
-	 * @see IMethod
-	 */
-	public boolean isConstructor() throws CModelException {
-		return getElementName().equals(getParent().getElementName());
-	}
-
-	/**
-	 * @see IMethod
-	 */
-	public boolean isDestructor() throws CModelException {
-		return getElementName().startsWith("~");
-	}
-
-	/**
-	 * @see IMethod
-	 */
-	public boolean isOperator() throws CModelException {
-		return getElementName().startsWith("operator");
-	}
-
-	/**
-	 * @see IMethod
-	 */
-	public boolean isAbstract() throws CModelException {
-		return false;
-	}
-
-	/**
-	 * @see IMethod
-	 */
-	public boolean isVirtual() throws CModelException {
-		return false;
-	}
-
-	/**
-	 * @see IMethod
-	 */
-	public boolean isFriend() throws CModelException {
-		return false;
-	}
-
-	/**
-	 * @see IMethod
-	 */
-	public String[] getExceptions() {
-		return new String[0];
-	}
-
-	/**
-	 * @see IMethod
-	 */
-	public int getNumberOfParameters() {
-		return 0;
-	}
-
-	public String getParameterInitializer(int pos) {
-		return "";
-	}
-
-	public String[] getParameterTypes() {
-		return new String[0];
-	}
-
-	public String getReturnType() throws CModelException {
-		return "";
-	}
-
-	/**
-	 * Returns true if the member as class scope.
-	 * For example static methods in C++ have class scope 
-	 *
-	 * @see IMember
-	 * @exception CModelException if this element does not exist or if an
-	 *      exception occurs while accessing its corresponding resource.
-	 */
-	public boolean hasClassScope() throws CModelException {
-		return false;
-	}
-
-	/**
-	 * Returns whether this method/field is declared constant.
-	 *
-	 * @see IMember
-	 * @exception CModelException if this element does not exist or if an
-	 *      exception occurs while accessing its corresponding resource.
-	 */
-	public boolean isConst() throws CModelException {
-		return false;
-	}
-
-	/**
-	 * Returns the access Control of the member. The access qualifier
-	 * can be examine using the AccessControl class.
-	 *
-	 * @see IMember
-	 * @exception CModelException if this element does not exist or if an
-	 *      exception occurs while accessing its corresponding resource.
-	 */
-	public int getAccessControl() throws CModelException {
-		return 0;
-	}
-
-	protected CElementInfo createElementInfo () {
-		return new SourceManipulationInfo(this);
 	}
 }
Index: model/org/eclipse/cdt/internal/core/model/MethodDeclaration.java
===================================================================
RCS file: model/org/eclipse/cdt/internal/core/model/MethodDeclaration.java
diff -N model/org/eclipse/cdt/internal/core/model/MethodDeclaration.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ model/org/eclipse/cdt/internal/core/model/MethodDeclaration.java	25 Mar 2003 17:15:39 -0000
@@ -0,0 +1,134 @@
+package org.eclipse.cdt.internal.core.model;
+
+/**********************************************************************
+ * Copyright (c) 2002,2003 Rational Software Corporation and others.
+ * All rights reserved.   This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ * 
+ * Contributors: 
+ * Rational Software - Initial API and implementation
+***********************************************************************/
+
+import org.eclipse.cdt.core.model.ICElement;
+import org.eclipse.cdt.core.model.IMethodDeclaration;
+
+public class MethodDeclaration extends FunctionDeclaration implements IMethodDeclaration{
+	
+
+	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(){
+		return getElementName().equals(getParent().getElementName());
+	}
+
+	/**
+	 * @see IMethod
+	 */
+	public boolean isDestructor() {
+		return getElementName().startsWith("~");
+	}
+
+	/**
+	 * @see IMethod
+	 */
+	public boolean isOperator(){
+		return getElementName().startsWith("operator");
+	}
+
+	public boolean isAbstract(){
+		return getMethodInfo().isAbstract();
+	}
+
+	public void setIsAbstract(boolean isAbstract){
+		getMethodInfo().setIsAbstract(isAbstract);
+	}
+
+	public boolean isStatic(){
+		return getMethodInfo().isStatic();
+	}
+
+	public void setIsStatic(boolean isStatic){
+		getMethodInfo().setIsStatic(isStatic);
+	}
+
+	public boolean isInline(){
+		return getMethodInfo().isInline();
+	}
+
+	public void setIsInline(boolean isInline){
+		getMethodInfo().setIsInline(isInline);
+	}
+
+	public boolean isVirtual(){
+		return getMethodInfo().isVirtual();
+	}
+
+	public void setIsVirtual(boolean isVirtual){
+		getMethodInfo().setIsVirtual(isVirtual);
+	}
+
+	public boolean isFriend(){
+		return getMethodInfo().isFriend();
+	}
+
+	public void setIsFriend(boolean isFriend){
+		getMethodInfo().setIsFriend(isFriend);
+	}
+
+	public boolean isConst(){
+		return getMethodInfo().isConst();
+	}
+
+	public void setIsConst(boolean isConst){
+		getMethodInfo().setIsConst(isConst);
+	}
+
+	public boolean isVolatile(){
+		return getMethodInfo().isVolatile();
+	}
+
+	public void setIsVolatile(boolean isVolatile){
+		getMethodInfo().setIsVolatile(isVolatile);
+	}
+
+	public int getVisibility(){
+		return getMethodInfo().getVisibility();
+	}
+	
+	public void setVisibility(int visibility){
+		getMethodInfo().setVisibility(visibility);
+	}
+	// do we need this one or not?
+	// can we get this info from the parser or not?
+	public boolean hasClassScope(){
+		return false;
+	}
+	
+	protected CElementInfo createElementInfo () {
+		return new MethodInfo(this);
+	}
+	
+	private MethodInfo getMethodInfo(){
+		return (MethodInfo) getElementInfo();
+	}
+	
+	/*
+	 * See if we need anything else to put in equals here
+	 */
+	public boolean equals(Object other) {
+		return ( super.equals(other) );
+	}
+		
+}
Index: model/org/eclipse/cdt/internal/core/model/MethodInfo.java
===================================================================
RCS file: model/org/eclipse/cdt/internal/core/model/MethodInfo.java
diff -N model/org/eclipse/cdt/internal/core/model/MethodInfo.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ model/org/eclipse/cdt/internal/core/model/MethodInfo.java	25 Mar 2003 17:15:39 -0000
@@ -0,0 +1,105 @@
+package org.eclipse.cdt.internal.core.model;
+
+/**********************************************************************
+ * Copyright (c) 2002,2003 Rational Software Corporation and others.
+ * All rights reserved.   This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ * 
+ * Contributors: 
+ * Rational Software - Initial API and implementation
+***********************************************************************/
+
+import org.eclipse.cdt.core.model.IMember;
+
+public class MethodInfo extends FunctionInfo {
+
+	boolean isAbstract = false;
+	boolean isStatic = false;
+	boolean isInline = false;
+	boolean isVirtual = false;
+	boolean isFriend = false;
+	boolean isConst = false;
+	boolean isVolatile = false;
+	int visibility;
+		
+	MethodInfo(CElement element) {
+		super(element);
+		visibility = IMember.V_PRIVATE;
+	}
+	
+	public boolean isAbstract(){
+		return isAbstract;
+	}
+
+	public void setIsAbstract(boolean isAbstract){
+		this.isAbstract = isAbstract;
+	}
+
+	public boolean isStatic(){
+		return isStatic;
+	}
+
+	public void setIsStatic(boolean isStatic){
+		this.isStatic = isStatic;
+	}
+
+	public boolean isInline(){
+		return isInline;
+	}
+
+	public void setIsInline(boolean isInline){
+		this.isInline = isInline;
+	}
+
+	public boolean isVirtual(){
+		return isVirtual;
+	}
+
+	public void setIsVirtual(boolean isVirtual){
+		this.isVirtual = isVirtual;
+	}
+
+	public boolean isFriend(){
+		return isFriend;
+	}
+
+	public void setIsFriend(boolean isFriend){
+		this.isFriend = isFriend;
+	}
+
+	public boolean isConst(){
+		return isConst;
+	}
+
+	public void setIsConst(boolean isConst){
+		this.isConst = isConst;
+	}
+
+	public boolean isVolatile(){
+		return isVolatile;
+	}
+
+	public void setIsVolatile(boolean isVolatile){
+		this.isVolatile = isVolatile;
+	}
+	
+	
+	/**
+	 * Returns the visibility.
+	 * @return int
+	 */
+	public int getVisibility() {
+		return visibility;
+	}
+
+	/**
+	 * Sets the visibility.
+	 * @param visibility The visibility to set
+	 */
+	public void setVisibility(int visibility) {
+		this.visibility = visibility;
+	}
+
+}
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.2
diff -u -r1.2 Structure.java
--- model/org/eclipse/cdt/internal/core/model/Structure.java	23 Jan 2003 16:39:35 -0000	1.2
+++ model/org/eclipse/cdt/internal/core/model/Structure.java	25 Mar 2003 17:15:40 -0000
@@ -37,22 +37,22 @@
 	}
 
 	public boolean isUnion() {
-		return getElementType() == ICElement.C_UNION;
+		return getStructureInfo().isUnion();
 	}
 
 	public boolean isClass() {
-		return getElementType() == ICElement.C_CLASS;
+		return getStructureInfo().isClass();
 	}
 
 	public boolean isStruct() {
-		return getElementType() == ICElement.C_STRUCT;
+		return getStructureInfo().isStruct();
 	}
 
 	public boolean isAbstract() {
 		return false;
 	}
 
-	public int getAccessControl() throws CModelException {
+	public int getAccessControl(){
 		return 0;
 	}
 
@@ -67,14 +67,17 @@
 	/**
 	 * @see IVariable
 	 */
-	public String getType() {
-		if (isClass())
-			return "class";
-		if (isUnion())
-			return "union";
-		return "struct";
+	public String getTypeName() {
+		return getStructureInfo().getTypeName();
+	}
+	
+	public void setTypeName(String type){
+		getStructureInfo().setTypeString(type);
+	}
+	
+	public StructureInfo getStructureInfo(){
+		return (StructureInfo) getElementInfo();
 	}
-
 	/**
 	 * @see IVariable
 	 */
@@ -90,7 +93,7 @@
 	}
 
 	protected CElementInfo createElementInfo () {
-		return new SourceManipulationInfo(this);
+		return new StructureInfo(this);
 	}
 
 	/**
Index: model/org/eclipse/cdt/internal/core/model/StructureInfo.java
===================================================================
RCS file: model/org/eclipse/cdt/internal/core/model/StructureInfo.java
diff -N model/org/eclipse/cdt/internal/core/model/StructureInfo.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ model/org/eclipse/cdt/internal/core/model/StructureInfo.java	25 Mar 2003 17:15:39 -0000
@@ -0,0 +1,54 @@
+package org.eclipse.cdt.internal.core.model;
+
+/**********************************************************************
+ * Copyright (c) 2002,2003 Rational Software Corporation and others.
+ * All rights reserved.   This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ * 
+ * Contributors: 
+ * Rational Software - Initial API and implementation
+***********************************************************************/
+import org.eclipse.cdt.core.model.ICElement;
+
+public class StructureInfo extends SourceManipulationInfo {
+	
+	String type;
+	
+	protected StructureInfo (CElement element) {
+		super(element);
+		
+		if (element.getElementType() == ICElement.C_CLASS)
+			type = "class";
+		else if (element.getElementType() == ICElement.C_UNION)
+			type = "union";
+		else
+			type = "struct";
+	}
+
+	public boolean isUnion() {
+		return element.getElementType() == ICElement.C_UNION;
+	}
+
+	public boolean isClass() {
+		return element.getElementType() == ICElement.C_CLASS;
+	}
+
+	public boolean isStruct() {
+		return element.getElementType() == ICElement.C_STRUCT;
+	}
+
+	public String getTypeName(){
+		return type;
+	}
+	
+	public void setTypeString(String elmType){
+		type = elmType;
+	}
+	public boolean hasSameContentsAs( StructureInfo otherInfo){
+		return true;
+	}
+
+}
+
Index: model/org/eclipse/cdt/internal/core/model/Util.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Util.java,v
retrieving revision 1.2
diff -u -r1.2 Util.java
--- model/org/eclipse/cdt/internal/core/model/Util.java	19 Mar 2003 20:19:36 -0000	1.2
+++ model/org/eclipse/cdt/internal/core/model/Util.java	25 Mar 2003 17:15:39 -0000
@@ -166,4 +166,66 @@
 	public static int combineHashCodes(int hashCode1, int hashCode2) {
 		return hashCode1 * 17 + hashCode2;
 	}
+	/**
+		 * Compares two arrays using equals() on the elements.
+		 * Either or both arrays may be null.
+		 * Returns true if both are null.
+		 * Returns false if only one is null.
+		 * If both are arrays, returns true iff they have the same length and
+		 * all elements compare true with equals.
+		 */
+		public static boolean equalArraysOrNull(Object[] a, Object[] b) {
+			if (a == b)	return true;
+			if (a == null || b == null) return false;
+
+			int len = a.length;
+			if (len != b.length) return false;
+			for (int i = 0; i < len; ++i) {
+				if (a[i] == null) {
+					if (b[i] != null) return false;
+				} else {
+					if (!a[i].equals(b[i])) return false;
+				}
+			}
+			return true;
+		}
+		/**
+		 * Compares two arrays using equals() on the elements.
+		 * Either or both arrays may be null.
+		 * Returns true if both are null.
+		 * Returns false if only one is null.
+		 * If both are arrays, returns true iff they have the same length and
+		 * all elements are equal.
+		 */
+		public static boolean equalArraysOrNull(int[] a, int[] b) {
+			if (a == b)
+				return true;
+			if (a == null || b == null)
+				return false;
+			int len = a.length;
+			if (len != b.length)
+				return false;
+			for (int i = 0; i < len; ++i) {
+				if (a[i] != b[i])
+					return false;
+			}
+			return true;
+		}
+
+		/**
+		 * Compares two objects using equals().
+		 * Either or both array may be null.
+		 * Returns true if both are null.
+		 * Returns false if only one is null.
+		 * Otherwise, return the result of comparing with equals().
+		 */
+		public static boolean equalOrNull(Object a, Object b) {
+			if (a == b) {
+				return true;
+			}
+			if (a == null || b == null) {
+				return false;
+			}
+			return a.equals(b);
+		}	
 }
Index: model/org/eclipse/cdt/internal/core/model/Variable.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Variable.java,v
retrieving revision 1.1
diff -u -r1.1 Variable.java
--- model/org/eclipse/cdt/internal/core/model/Variable.java	26 Jun 2002 20:37:14 -0000	1.1
+++ model/org/eclipse/cdt/internal/core/model/Variable.java	25 Mar 2003 17:15:40 -0000
@@ -14,10 +14,13 @@
 		super(parent, name, CElement.C_VARIABLE);
 	}
 
-	public String getType() {
-		return "";
+	public String getTypeName() {
+		return getVariableInfo().getTypeName();
 	}
 
+	public void setTypeName(String type){
+		getVariableInfo().setTypeName(type);
+	}
 	public String getInitializer() {
 		return "";
 	}
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.2
diff -u -r1.2 VariableDeclaration.java
--- model/org/eclipse/cdt/internal/core/model/VariableDeclaration.java	2 Feb 2003 01:02:53 -0000	1.2
+++ model/org/eclipse/cdt/internal/core/model/VariableDeclaration.java	25 Mar 2003 17:15:40 -0000
@@ -14,14 +14,22 @@
 		super(parent, name, CElement.C_VARIABLE_DECLARATION);
 	}
 
-	public String getType() {
-		return "";
+	public int getAccessControl() {
+		return getVariableInfo().getAccessControl();
 	}
 
-	public int getAccessControl() {
-		return 0;
+	public String getTypeName() {
+		return getVariableInfo().getTypeName();
 	}
 
+	public void setTypeName(String type) {
+		getVariableInfo().setTypeString(type);
+	}
+
+	public VariableInfo getVariableInfo(){
+		return (VariableInfo) getElementInfo();
+	}
+	
 	protected CElementInfo createElementInfo () {
 		return new SourceManipulationInfo(this);
 	}
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.1
diff -u -r1.1 VariableInfo.java
--- model/org/eclipse/cdt/internal/core/model/VariableInfo.java	26 Jun 2002 20:37:14 -0000	1.1
+++ model/org/eclipse/cdt/internal/core/model/VariableInfo.java	25 Mar 2003 17:15:39 -0000
@@ -8,7 +8,8 @@
 class VariableInfo extends SourceManipulationInfo {
 
 	protected int flags;
-
+	String typeStr;
+	
 	protected VariableInfo (CElement element) {
 		super(element);
 		flags = 0;
@@ -18,7 +19,26 @@
 		return flags;
 	}
 
+	protected String getTypeName(){
+		return typeStr;
+	}
+	
+	protected void setTypeName(String type){
+		typeStr = type;
+	}
+
+	protected boolean hasSameContentsAs( VariableInfo otherInfo){
+		if(typeStr.equals(otherInfo.getTypeName())) 
+			return true;
+		else
+			return false;
+	}
+	
 	protected void setAccessControl(int flags) {
 		this.flags = flags;
+	}
+	
+	protected void setTypeString(String type){
+		typeStr = type;
 	}
 }
Index: parser/org/eclipse/cdt/internal/core/model/NewModelBuilder.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/model/NewModelBuilder.java,v
retrieving revision 1.9
diff -u -r1.9 NewModelBuilder.java
--- parser/org/eclipse/cdt/internal/core/model/NewModelBuilder.java	24 Mar 2003 03:04:35 -0000	1.9
+++ parser/org/eclipse/cdt/internal/core/model/NewModelBuilder.java	25 Mar 2003 17:15:41 -0000
@@ -129,9 +129,10 @@
 		ICElementWrapper wrapper = (ICElementWrapper)container; 
 		Object parent = wrapper.getElement();
 		SimpleDeclarationWrapper result = new SimpleDeclarationWrapper();
-		if( wrapper instanceof SimpleDeclarationWrapper )
+		if( wrapper instanceof SimpleDeclarationWrapper ){
 			result.setParent( (CElement)wrapper.getElement() );
-		else if ( wrapper instanceof TranslationUnitWrapper )
+			result.setCurrentVisibility(((SimpleDeclarationWrapper)wrapper).getCurrentVisibility());
+		} else if ( wrapper instanceof TranslationUnitWrapper )
 			result.setParent( (TranslationUnit)wrapper.getElement());
 		return result;  	
 	}
Index: parser/org/eclipse/cdt/internal/core/model/SimpleDeclarationWrapper.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/model/SimpleDeclarationWrapper.java,v
retrieving revision 1.9
diff -u -r1.9 SimpleDeclarationWrapper.java
--- parser/org/eclipse/cdt/internal/core/model/SimpleDeclarationWrapper.java	24 Mar 2003 03:04:35 -0000	1.9
+++ parser/org/eclipse/cdt/internal/core/model/SimpleDeclarationWrapper.java	25 Mar 2003 17:15:40 -0000
@@ -88,34 +88,43 @@
 				//	this is an attribute or a varaible
 				if( parentElement instanceof IStructure )
 				{
-					declaration = new Field( parentElement, currentDeclarator.getName().toString() ); 
+					declaration = createField( parentElement, currentDeclarator.getName().toString() ); 
 				}
 				else if( parentElement instanceof ITranslationUnit )
 				{
-					declaration = new Variable( parentElement, currentDeclarator.getName().toString() );
+					if(isExtern())
+					{
+						declaration = createVariableDeclaration( parentElement, currentDeclarator.getName().toString() );
+					}
+					else
+					{
+						declaration = createVariable( parentElement, currentDeclarator.getName().toString() );						
+					}
 				}
 			}
 			else
 			{
+				Parameter [] parameters = (Parameter []) clause.toArray( new Parameter[ clause.size() ]);
 				// this is a function or a method
 				if( parentElement instanceof IStructure )
 				{
-					declaration = new Method( parentElement, currentDeclarator.getName().toString() ); 
+					declaration = createMethodDeclaration( parentElement, currentDeclarator.getName().toString(), parameters ); 
 		
 				}
 				else if( parentElement instanceof ITranslationUnit )
 				{
-					declaration = new FunctionDeclaration( parentElement, currentDeclarator.getName().toString() ); 
-				}
-				
-				Parameter [] parameters = (Parameter []) clause.toArray( new Parameter[ clause.size() ]);
-				
-				for( int j = 0; j< parameters.length; ++j )
-				{
-					Parameter parm = parameters[j];
-					 
-				}
-				
+					if (isFunctionDefinition())
+					{
+						// if it belongs to a class, then create a method
+						// else create a function
+						// this will not be known until we have cross reference information
+						declaration = createFunction( parentElement, currentDeclarator.getName().toString(), parameters ); 
+					}
+					else
+					{
+						declaration = createFunctionDeclaration( parentElement, currentDeclarator.getName().toString(), parameters ); 
+					}
+				}				
 			}
 			
 			// hook up the offsets
@@ -216,7 +225,7 @@
 
 	public static final int v_public = 0; 
 	public static final int v_protected = 1; 
-	public static final int v_private = 3; 
+	public static final int v_private = 2; 
 
 	private int currentVisibility; 
 	/**
@@ -232,6 +241,116 @@
 	 */
 	public void setCurrentVisibility(int currentVisibility) {
 		this.currentVisibility = currentVisibility;
+	}
+	
+	/**
+	 * Creates a Field and fills its info
+	 * @param parent
+	 * @param name
+	 * @return CElement
+	 */
+	private CElement createField(CElement parent, String name){
+		Field newElement = new Field( parent, name );
+		newElement.setTypeName ( getTypeName() );
+		newElement.setIsConst(isConst());
+		newElement.setIsMutable(isMutable());
+		newElement.setVisibility(this.getCurrentVisibility());
+		return newElement;
+	}
+
+	/**
+	 * Creates a Variable and fills its info
+	 * @param parent
+	 * @param name
+	 * @return CElement
+	 */
+	private CElement createVariable(CElement parent, String name){
+		Variable newElement = new Variable( parent, name );
+		newElement.setTypeName ( getTypeName() );
+		return newElement;
+	}
+
+	/**
+	 * Creates a VariableDeclaration and fills its info
+	 * @param parent
+	 * @param name
+	 * @return CElement
+	 */
+	private CElement createVariableDeclaration(CElement parent, String name){
+		VariableDeclaration newElement = new VariableDeclaration( parent, name );
+		newElement.setTypeName ( getTypeName() );
+		return newElement;
+	}
+
+
+	/**
+	 * Creates a MethodDeclaration and fills its info
+	 * @param parent
+	 * @param name
+	 * @param parameters
+	 * @return CElement
+	 */
+	private CElement createMethodDeclaration(CElement parent, String name, Parameter[] parameters){
+		String[] parameterTypes = new String[parameters.length];
+		for( int j = 0; j< parameters.length; ++j )
+		{
+			Parameter param = parameters[j];
+			parameterTypes[j] = new String(param.getTypeName());
+		}
+
+		MethodDeclaration newElement = new MethodDeclaration( parent, name );
+		newElement.setParameterTypes(parameterTypes);
+		newElement.setReturnType( getTypeName() );
+		newElement.setVisibility(this.getCurrentVisibility());
+		return newElement;		
+	}
+
+	/**
+	 * Creates a Method and fills its info
+	 * @param parent
+	 * @param name
+	 * @param parameters
+	 * @return CElement
+	 */
+	private CElement createMethod(CElement parent, String name, Parameter[] parameters){
+		String[] parameterTypes = new String[parameters.length];
+		for( int j = 0; j< parameters.length; ++j )
+		{
+			Parameter param = parameters[j];
+			parameterTypes[j] = new String(param.getTypeName());
+		}
+
+		Method newElement = new Method( parent, name );
+		newElement.setParameterTypes(parameterTypes);
+		newElement.setReturnType( getTypeName() );
+		newElement.setVisibility(this.getCurrentVisibility());
+		return newElement;		
+	}
+
+	/**
+	 * Creates a FunctionDeclaration and fills its info
+	 * @param parent
+	 * @param name
+	 * @param parameters
+	 * @return CElement
+	 */
+	private CElement createFunctionDeclaration(CElement parent, String name, Parameter[] parameters){
+		FunctionDeclaration newElement = new FunctionDeclaration( parent, name );
+		newElement.setReturnType( getTypeName() );
+		return newElement;
+	}
+
+	/**
+	 * Creates a Function and fills its info
+	 * @param parent
+	 * @param name
+	 * @param parameters
+	 * @return CElement
+	 */
+	private CElement createFunction(CElement parent, String name, Parameter[] parameters){
+		Function newElement = new Function( parent, name );
+		newElement.setReturnType( getTypeName() );
+		return newElement;
 	}
 
 }
Index: parser/org/eclipse/cdt/internal/core/parser/util/DeclSpecifier.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/util/DeclSpecifier.java,v
retrieving revision 1.4
diff -u -r1.4 DeclSpecifier.java
--- parser/org/eclipse/cdt/internal/core/parser/util/DeclSpecifier.java	19 Mar 2003 16:12:00 -0000	1.4
+++ parser/org/eclipse/cdt/internal/core/parser/util/DeclSpecifier.java	25 Mar 2003 17:15:40 -0000
@@ -220,5 +220,32 @@
 	public void setName(Name name) {
 		this.name = name;
 	}
+	
+	/**
+	 * Returns the type as a String
+	 * @return String
+	 */
+	public String getTypeName(){
+		switch(getType()){
+			case t_char:
+				return "char";
+			case t_wchar_t:
+				return "wchar_t";
+			case t_bool:
+				return "bool";
+			case t_int:
+				return "int";
+			case t_float:
+				return "float";
+			case t_double:
+				return "double";
+			case t_void:
+				return "void";
+			case t_type:
+				return getName().toString();
+			default:
+				return "";
+		}
+	}
 
 }
Index: icons/full/obj16/private_m.gif
===================================================================
RCS file: icons/full/obj16/private_m.gif
diff -N icons/full/obj16/private_m.gif
Binary files /dev/null and private_m.gif differ
Index: icons/full/obj16/protected_m.gif
===================================================================
RCS file: icons/full/obj16/protected_m.gif
diff -N icons/full/obj16/protected_m.gif
Binary files /dev/null and protected_m.gif differ
Index: icons/full/obj16/public_m.gif
===================================================================
RCS file: icons/full/obj16/public_m.gif
diff -N icons/full/obj16/public_m.gif
Binary files /dev/null and public_m.gif differ
Index: src/org/eclipse/cdt/internal/ui/CElementImageProvider.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CElementImageProvider.java,v
retrieving revision 1.4
diff -u -r1.4 CElementImageProvider.java
--- src/org/eclipse/cdt/internal/ui/CElementImageProvider.java	9 Jan 2003 21:03:12 -0000	1.4
+++ src/org/eclipse/cdt/internal/ui/CElementImageProvider.java	25 Mar 2003 17:16:11 -0000
@@ -14,6 +14,8 @@
 import org.eclipse.cdt.core.model.ICElement;
 import org.eclipse.cdt.core.model.ICFile;
 import org.eclipse.cdt.core.model.ICProject;
+import org.eclipse.cdt.core.model.IMember;
+import org.eclipse.cdt.core.model.IMethodDeclaration;
 import org.eclipse.cdt.internal.ui.util.ImageDescriptorRegistry;
 import org.eclipse.cdt.ui.*;
 import org.eclipse.core.resources.IProject;
@@ -211,7 +213,17 @@
 			case ICElement.C_VARIABLE:
 				return CPluginImages.DESC_OBJS_FIELD;
 
-			case ICElement.C_METHOD:  // FIXME: provide an icon for methods.
+			case ICElement.C_METHOD:  
+			case ICElement.C_METHOD_DECLARATION:
+				IMethodDeclaration  md= (IMethodDeclaration)celement;
+				switch(md.getVisibility()){
+					case IMember.V_PUBLIC:
+						return CPluginImages.DESC_OBJS_PUBLIC_METHOD;
+					case IMember.V_PROTECTED:
+						return CPluginImages.DESC_OBJS_PROTECTED_METHOD;
+					case IMember.V_PRIVATE:
+						return CPluginImages.DESC_OBJS_PRIVATE_METHOD;
+				}
 			case ICElement.C_FUNCTION:
 				return CPluginImages.DESC_OBJS_FUNCTION;
 		
@@ -248,7 +260,9 @@
 			case ICElement.C_VARIABLE:
 				return CPluginImages.DESC_OBJS_FIELD;
 
-			case ICElement.C_METHOD: // FIXME: Provide a different icon.
+			case ICElement.C_METHOD: // assumed public
+				return CPluginImages.DESC_OBJS_PUBLIC_METHOD;
+				
 			case ICElement.C_FUNCTION:
 			case ICElement.C_FUNCTION_DECLARATION:
 				return CPluginImages.DESC_OBJS_FUNCTION;
Index: src/org/eclipse/cdt/internal/ui/CPluginImages.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CPluginImages.java,v
retrieving revision 1.4
diff -u -r1.4 CPluginImages.java
--- src/org/eclipse/cdt/internal/ui/CPluginImages.java	4 Feb 2003 20:00:45 -0000	1.4
+++ src/org/eclipse/cdt/internal/ui/CPluginImages.java	25 Mar 2003 17:16:10 -0000
@@ -48,6 +48,9 @@
 	public static final String IMG_OBJS_STRUCT= NAME_PREFIX + "struct_obj.gif";
 	public static final String IMG_OBJS_UNION= NAME_PREFIX + "union_obj.gif";
 	public static final String IMG_OBJS_FUNCTION= NAME_PREFIX + "function_obj.gif";
+	public static final String IMG_OBJS_PUBLIC_METHOD= NAME_PREFIX + "public_m.gif";
+	public static final String IMG_OBJS_PROTECTED_METHOD= NAME_PREFIX + "protected_m.gif";
+	public static final String IMG_OBJS_PRIVATE_METHOD= NAME_PREFIX + "private_m.gif";	
 	public static final String IMG_OBJS_DECLARATION= NAME_PREFIX + "cdeclaration_obj.gif";
 	public static final String IMG_OBJS_INCLUDE= NAME_PREFIX + "include_obj.gif";
 	public static final String IMG_OBJS_MACRO= NAME_PREFIX + "define_obj.gif";
@@ -70,6 +73,9 @@
 	public static final ImageDescriptor DESC_OBJS_STRUCT= createManaged(T_OBJ, IMG_OBJS_STRUCT);
 	public static final ImageDescriptor DESC_OBJS_UNION= createManaged(T_OBJ, IMG_OBJS_UNION);
 	public static final ImageDescriptor DESC_OBJS_FUNCTION= createManaged(T_OBJ, IMG_OBJS_FUNCTION);
+	public static final ImageDescriptor DESC_OBJS_PUBLIC_METHOD= createManaged(T_OBJ, IMG_OBJS_PUBLIC_METHOD);
+	public static final ImageDescriptor DESC_OBJS_PROTECTED_METHOD= createManaged(T_OBJ, IMG_OBJS_PROTECTED_METHOD);
+	public static final ImageDescriptor DESC_OBJS_PRIVATE_METHOD= createManaged(T_OBJ, IMG_OBJS_PRIVATE_METHOD);	
 	public static final ImageDescriptor DESC_OBJS_DECLARARION= createManaged(T_OBJ, IMG_OBJS_DECLARATION);
 	public static final ImageDescriptor DESC_OBJS_INCLUDE= createManaged(T_OBJ, IMG_OBJS_INCLUDE);
 	public static final ImageDescriptor DESC_OBJS_MACRO= createManaged(T_OBJ, IMG_OBJS_MACRO);
Index: src/org/eclipse/cdt/ui/CElementLabelProvider.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CElementLabelProvider.java,v
retrieving revision 1.2
diff -u -r1.2 CElementLabelProvider.java
--- src/org/eclipse/cdt/ui/CElementLabelProvider.java	25 Feb 2003 01:42:13 -0000	1.2
+++ src/org/eclipse/cdt/ui/CElementLabelProvider.java	25 Mar 2003 17:16:10 -0000
@@ -8,6 +8,9 @@
 import org.eclipse.cdt.core.model.IBinary;
 import org.eclipse.cdt.core.model.ICElement;
 import org.eclipse.cdt.core.model.ICFile;
+import org.eclipse.cdt.core.model.IFunctionDeclaration;
+import org.eclipse.cdt.core.model.IVariable;
+import org.eclipse.cdt.core.model.IVariableDeclaration;
 import org.eclipse.cdt.internal.ui.CElementImageProvider;
 import org.eclipse.cdt.internal.ui.ErrorTickAdornmentProvider;
 import org.eclipse.cdt.internal.ui.IAdornmentProvider;
@@ -57,12 +60,29 @@
 		if (element instanceof ICElement) {
 			ICElement celem= (ICElement)element;
 			
-			String name= celem.getElementName();
-			if (celem.getElementType() == ICElement.C_FUNCTION) {
-				name += "()";
-			} else if(celem.getElementType() == ICElement.C_FUNCTION_DECLARATION) {
-				name += "();";
+			String name;
+			switch(celem.getElementType()){
+				case ICElement.C_FUNCTION:
+				case ICElement.C_FUNCTION_DECLARATION:
+				case ICElement.C_METHOD:
+				case ICElement.C_METHOD_DECLARATION:
+					IFunctionDeclaration fdecl = (IFunctionDeclaration) celem;
+					name = fdecl.getSignature();		
+				break;
+				case ICElement.C_VARIABLE:
+					IVariable var = (IVariable) celem;
+					name = var.getTypeName() + " " + var.getElementName(); 					
+				break;
+				case ICElement.C_VARIABLE_DECLARATION:
+				case ICElement.C_FIELD:
+					IVariableDeclaration vdecl = (IVariableDeclaration) celem;
+					name = vdecl.getTypeName() + " " + vdecl.getElementName(); 					
+				break;					
+				default:
+					name= celem.getElementName();
+				break;				
 			}
+
 			if (celem instanceof IBinary) {
 				IBinary bin = (IBinary)celem;
 				name += " - [" + bin.getCPU() + (bin.isLittleEndian() ? "le" : "be") + "]";

Attachment: public_m.gif
Description: GIF image

Attachment: protected_m.gif
Description: GIF image

Attachment: private_m.gif
Description: GIF image


Back to the top