Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] Model Builder Patch

This patch includes 
- Changes in the Model Builder
- Minor changes to code model
- Fixes for bugs 35781, 26467

Thanks,
Hoda

Index: dom/org/eclipse/cdt/internal/core/dom/ClassSpecifier.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/ClassSpecifier.java,v
retrieving revision 1.6
diff -u -r1.6 ClassSpecifier.java
--- dom/org/eclipse/cdt/internal/core/dom/ClassSpecifier.java	8 Apr 2003 03:41:05 -0000	1.6
+++ dom/org/eclipse/cdt/internal/core/dom/ClassSpecifier.java	8 Apr 2003 20:06:58 -0000
@@ -4,15 +4,17 @@
 import java.util.LinkedList;
 import java.util.List;
 
+import org.eclipse.cdt.internal.core.parser.Token;
 import org.eclipse.cdt.internal.core.parser.util.AccessSpecifier;
 import org.eclipse.cdt.internal.core.parser.util.ClassKey;
 import org.eclipse.cdt.internal.core.parser.util.Name;
 
-public class ClassSpecifier extends TypeSpecifier implements IScope, IOffsettable {
+public class ClassSpecifier extends TypeSpecifier implements IScope, IOffsetable {
 
 	private AccessSpecifier access = new AccessSpecifier( AccessSpecifier.v_private );
 	private ClassKey key = new ClassKey();
-	private int startingOffset = 0, totalLength = 0;   
+	private int startingOffset = 0, totalLength = 0;
+	private Token classKeyToken = null;
 
 	public int getClassKey() { return key.getClassKey(); }
 
@@ -81,6 +83,22 @@
 	 */
 	public void setTotalLength(int i) {
 		totalLength = i;
+	}
+
+	/**
+	 * Returns the classKeyToken.
+	 * @return Token
+	 */
+	public Token getClassKeyToken() {
+		return classKeyToken;
+	}
+
+	/**
+	 * Sets the classKeyToken.
+	 * @param classKeyToken The classKeyToken to set
+	 */
+	public void setClassKeyToken(Token classKeyToken) {
+		this.classKeyToken = classKeyToken;
 	}
 
 }
Index: dom/org/eclipse/cdt/internal/core/dom/DOMBuilder.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/DOMBuilder.java,v
retrieving revision 1.16
diff -u -r1.16 DOMBuilder.java
--- dom/org/eclipse/cdt/internal/core/dom/DOMBuilder.java	8 Apr 2003 03:41:05 -0000	1.16
+++ dom/org/eclipse/cdt/internal/core/dom/DOMBuilder.java	8 Apr 2003 20:06:58 -0000
@@ -59,6 +59,7 @@
 		ClassSpecifier classSpecifier = new ClassSpecifier(kind, decl);
 		classSpecifier.setCurrentVisibility( visibility );
 		classSpecifier.setStartingOffset( classKey.getOffset() );
+		classSpecifier.setClassKeyToken( classKey );
 		decl.setTypeSpecifier(classSpecifier);
 		return classSpecifier;
 	}
@@ -156,7 +157,7 @@
 	 * @see org.eclipse.cdt.internal.core.newparser.IParserCallback#inclusionBegin(java.lang.String)
 	 */
 	public void inclusionBegin(String includeFile, int offset, int inclusionBeginOffset) {
-		translationUnit.addInclusion( new Inclusion( includeFile, offset, inclusionBeginOffset, offset + includeFile.length() + 1 ) );
+		translationUnit.addInclusion( new Inclusion( includeFile, offset, inclusionBeginOffset, offset - inclusionBeginOffset + includeFile.length() + 1 ) );
 	}
 
 	/**
@@ -180,7 +181,7 @@
 		((IScope)container).addDeclaration(decl);
 		if( container instanceof ClassSpecifier )
 			decl.setAccessSpecifier(new AccessSpecifier( ((ClassSpecifier)container).getCurrentVisibility() ));
-		((IOffsettable)decl).setStartingOffset( firstToken.getOffset() );
+		((IOffsetable)decl).setStartingOffset( firstToken.getOffset() );
 		return decl;
 	}
 
@@ -188,7 +189,7 @@
 	 * @see org.eclipse.cdt.internal.core.newparser.IParserCallback#simpleDeclarationEnd(org.eclipse.cdt.internal.core.newparser.Token)
 	 */
 	public void simpleDeclarationEnd(Object declaration, Token lastToken) {
-		IOffsettable offsetable = (IOffsettable)declaration;
+		IOffsetable offsetable = (IOffsetable)declaration;
 		offsetable.setTotalLength( lastToken.getOffset() + lastToken.getLength() - offsetable.getStartingOffset());
 	}
 
@@ -364,7 +365,10 @@
 	 * @see org.eclipse.cdt.internal.core.parser.IParserCallback#simpleDeclSpecifierName(java.lang.Object)
 	 */
 	public Object simpleDeclSpecifierName(Object declaration) {
-		return declaration;
+		DeclSpecifier.Container decl = (DeclSpecifier.Container)declaration;
+		DeclSpecifier declSpec = decl.getDeclSpecifier(); 
+		declSpec.setName( currName ); 
+		return declSpec;
 	}
 
 	/* (non-Javadoc)
@@ -520,7 +524,8 @@
 	public Object namespaceDefinitionBegin(Object container, Token namespace) {
 		IScope ownerScope = (IScope)container;
 		NamespaceDefinition namespaceDef = new NamespaceDefinition(ownerScope);
-		((IOffsettable)namespaceDef).setStartingOffset( namespace.getOffset() );
+		namespaceDef.setStartToken(namespace);
+		((IOffsetable)namespaceDef).setStartingOffset( namespace.getOffset() );
 		return namespaceDef;
 		
 	}
@@ -637,8 +642,9 @@
 	public Object enumSpecifierBegin(Object container, Token enumKey) {
 		SimpleDeclaration decl = (SimpleDeclaration)container;
 		EnumerationSpecifier es = new EnumerationSpecifier( decl );
+		es.setStartToken(enumKey);
 		decl.setTypeSpecifier(es);
-		((IOffsettable)decl).setStartingOffset( enumKey.getOffset() ); 
+		((IOffsetable)es).setStartingOffset( enumKey.getOffset() ); 
 		return es;
 	}
 
@@ -663,7 +669,7 @@
 	 * @see org.eclipse.cdt.internal.core.parser.IParserCallback#enumSpecifierEnd(java.lang.Object)
 	 */
 	public void enumSpecifierEnd(Object enumSpec, Token closingBrace) {
-		IOffsettable offsetable = (IOffsettable)enumSpec;
+		IOffsetable offsetable = (IOffsetable)enumSpec;
 		offsetable.setTotalLength( closingBrace.getOffset() + closingBrace.getLength() - offsetable.getStartingOffset());
 	}
 
@@ -683,7 +689,7 @@
 	public Object enumeratorId(Object enumDefn) {
 		EnumeratorDefinition definition = (EnumeratorDefinition)enumDefn;
 		definition.setName( currName );
-		((IOffsettable)enumDefn).setStartingOffset( currName.getStartOffset() );
+		((IOffsetable)enumDefn).setStartingOffset( currName.getStartOffset() );
 		return definition;
 	}
 
@@ -691,7 +697,7 @@
 	 * @see org.eclipse.cdt.internal.core.parser.IParserCallback#enumDefinitionEnd(java.lang.Object)
 	 */
 	public void enumeratorEnd(Object enumDefn, Token lastToken) {
-		IOffsettable offsetable = (IOffsettable)enumDefn;
+		IOffsetable offsetable = (IOffsetable)enumDefn;
 		offsetable.setTotalLength( lastToken.getOffset() + lastToken.getLength() - offsetable.getStartingOffset());
 	}
 
Index: dom/org/eclipse/cdt/internal/core/dom/EnumerationSpecifier.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/EnumerationSpecifier.java,v
retrieving revision 1.4
diff -u -r1.4 EnumerationSpecifier.java
--- dom/org/eclipse/cdt/internal/core/dom/EnumerationSpecifier.java	8 Apr 2003 03:41:05 -0000	1.4
+++ dom/org/eclipse/cdt/internal/core/dom/EnumerationSpecifier.java	8 Apr 2003 20:06:58 -0000
@@ -16,13 +16,14 @@
 import java.util.Collections;
 import java.util.List;
 
+import org.eclipse.cdt.internal.core.parser.Token;
 import org.eclipse.cdt.internal.core.parser.util.Name;
 
 /**
  * @author jcamelon
  *
  */
-public class EnumerationSpecifier extends TypeSpecifier implements IOffsettable {
+public class EnumerationSpecifier extends TypeSpecifier implements IOffsetable {
 	
 	public EnumerationSpecifier(SimpleDeclaration declaration) {
 		super(declaration);
@@ -31,6 +32,7 @@
 	private Name name = null;
 	private List enumeratorDefinitions = new ArrayList();
 	private int startingOffset = 0, totalLength = 0;
+	private Token startToken = null;
 	
 	public void addEnumeratorDefinition( EnumeratorDefinition def )
 	{
@@ -86,6 +88,22 @@
 	 */
 	public void setTotalLength(int i) {
 		totalLength = i;
+	}
+
+	/**
+	 * Returns the startToken.
+	 * @return Token
+	 */
+	public Token getStartToken() {
+		return startToken;
+	}
+
+	/**
+	 * Sets the startToken.
+	 * @param startToken The startToken to set
+	 */
+	public void setStartToken(Token startToken) {
+		this.startToken = startToken;
 	}
 
 }
Index: dom/org/eclipse/cdt/internal/core/dom/EnumeratorDefinition.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/EnumeratorDefinition.java,v
retrieving revision 1.2
diff -u -r1.2 EnumeratorDefinition.java
--- dom/org/eclipse/cdt/internal/core/dom/EnumeratorDefinition.java	8 Apr 2003 03:41:05 -0000	1.2
+++ dom/org/eclipse/cdt/internal/core/dom/EnumeratorDefinition.java	8 Apr 2003 20:06:58 -0000
@@ -18,7 +18,7 @@
  * @author jcamelon
  *
  */
-public class EnumeratorDefinition implements IExpressionOwner, IOffsettable {
+public class EnumeratorDefinition implements IExpressionOwner, IOffsetable {
 
 	private Expression initialValue = null;
 	private Name name = null; 
Index: dom/org/eclipse/cdt/internal/core/dom/IOffsetable.java
===================================================================
RCS file: dom/org/eclipse/cdt/internal/core/dom/IOffsetable.java
diff -N dom/org/eclipse/cdt/internal/core/dom/IOffsetable.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ dom/org/eclipse/cdt/internal/core/dom/IOffsetable.java	8 Apr 2003 20:06:58 -0000
@@ -0,0 +1,38 @@
+/**********************************************************************
+ * Created on Apr 7, 2003
+ *
+ * Copyright (c) 2002,2003 IBM/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: 
+ * IBM Ltd. - Rational Software - Initial API and implementation
+************************************************************************/
+package org.eclipse.cdt.internal.core.dom;
+
+
+/**
+ * @author jcamelon
+ *
+ */
+public interface IOffsetable {
+
+	/**
+	 * @return
+	 */
+	public abstract int getStartingOffset();
+	/**
+	 * @return
+	 */
+	public abstract int getTotalLength();
+	/**
+	 * @param i
+	 */
+	public abstract void setStartingOffset(int i);
+	/**
+	 * @param i
+	 */
+	public abstract void setTotalLength(int i);
+}
\ No newline at end of file
Index: dom/org/eclipse/cdt/internal/core/dom/IOffsettable.java
===================================================================
RCS file: dom/org/eclipse/cdt/internal/core/dom/IOffsettable.java
diff -N dom/org/eclipse/cdt/internal/core/dom/IOffsettable.java
--- dom/org/eclipse/cdt/internal/core/dom/IOffsettable.java	8 Apr 2003 03:41:05 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,38 +0,0 @@
-/**********************************************************************
- * Created on Apr 7, 2003
- *
- * Copyright (c) 2002,2003 IBM/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: 
- * IBM Ltd. - Rational Software - Initial API and implementation
-************************************************************************/
-package org.eclipse.cdt.internal.core.dom;
-
-
-/**
- * @author jcamelon
- *
- */
-public interface IOffsettable {
-
-	/**
-	 * @return
-	 */
-	public abstract int getStartingOffset();
-	/**
-	 * @return
-	 */
-	public abstract int getTotalLength();
-	/**
-	 * @param i
-	 */
-	public abstract void setStartingOffset(int i);
-	/**
-	 * @param i
-	 */
-	public abstract void setTotalLength(int i);
-}
\ No newline at end of file
Index: dom/org/eclipse/cdt/internal/core/dom/NamespaceDefinition.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/NamespaceDefinition.java,v
retrieving revision 1.3
diff -u -r1.3 NamespaceDefinition.java
--- dom/org/eclipse/cdt/internal/core/dom/NamespaceDefinition.java	8 Apr 2003 03:41:05 -0000	1.3
+++ dom/org/eclipse/cdt/internal/core/dom/NamespaceDefinition.java	8 Apr 2003 20:06:58 -0000
@@ -16,18 +16,20 @@
 import java.util.LinkedList;
 import java.util.List;
 
+import org.eclipse.cdt.internal.core.parser.Token;
 import org.eclipse.cdt.internal.core.parser.util.Name;
 
 /**
  * @author jcamelon
  *
  */
-public class NamespaceDefinition extends Declaration implements IScope, IOffsettable {
+public class NamespaceDefinition extends Declaration implements IScope, IOffsetable {
 
 	private List declarations = new LinkedList();
 	private IScope ownerScope;
 	private Name name = null;
 	private int startingOffset = 0, totalLength = 0;
+	private Token startToken = null;
 
 	public NamespaceDefinition( IScope owner )
 	{
@@ -98,6 +100,22 @@
 	 */
 	public void setTotalLength(int i) {
 		totalLength = i;
+	}
+
+	/**
+	 * Returns the startToken.
+	 * @return Token
+	 */
+	public Token getStartToken() {
+		return startToken;
+	}
+
+	/**
+	 * Sets the startToken.
+	 * @param startToken The startToken to set
+	 */
+	public void setStartToken(Token startToken) {
+		this.startToken = startToken;
 	}
 
 }
Index: dom/org/eclipse/cdt/internal/core/dom/PreprocessorStatement.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/PreprocessorStatement.java,v
retrieving revision 1.1
diff -u -r1.1 PreprocessorStatement.java
--- dom/org/eclipse/cdt/internal/core/dom/PreprocessorStatement.java	8 Apr 2003 03:41:05 -0000	1.1
+++ dom/org/eclipse/cdt/internal/core/dom/PreprocessorStatement.java	8 Apr 2003 20:06:58 -0000
@@ -16,11 +16,11 @@
  * @author jcamelon
  *
  */
-public class PreprocessorStatement {
+public class PreprocessorStatement implements IOffsetable {
 	
-	private final int startingOffset, totalLength;
-	final private int nameOffset;
-	final private String name; 
+	private int startingOffset, totalLength;
+	private final int nameOffset;
+	private final String name; 
 	
 	public PreprocessorStatement( String name, int nameOffset, int startingOffset, int totalLength )
 	{
@@ -61,6 +61,18 @@
 	
 	public int getNameLength() {
 		return name.length();
+	}
+	/**
+	 * @see org.eclipse.cdt.internal.core.dom.IOffsettable#setStartingOffset(int)
+	 */
+	public void setStartingOffset(int i) {
+		startingOffset = i;
+	}
+	/**
+	 * @see org.eclipse.cdt.internal.core.dom.IOffsettable#setTotalLength(int)
+	 */
+	public void setTotalLength(int i) {
+		totalLength = i;
 	}
 
 }
Index: dom/org/eclipse/cdt/internal/core/dom/SimpleDeclaration.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/SimpleDeclaration.java,v
retrieving revision 1.5
diff -u -r1.5 SimpleDeclaration.java
--- dom/org/eclipse/cdt/internal/core/dom/SimpleDeclaration.java	8 Apr 2003 03:41:05 -0000	1.5
+++ dom/org/eclipse/cdt/internal/core/dom/SimpleDeclaration.java	8 Apr 2003 20:06:59 -0000
@@ -7,7 +7,7 @@
 import org.eclipse.cdt.internal.core.parser.util.AccessSpecifier;
 import org.eclipse.cdt.internal.core.parser.util.DeclSpecifier;
 
-public class SimpleDeclaration extends Declaration implements DeclSpecifier.Container, IOffsettable, TypeSpecifier.IOwner {
+public class SimpleDeclaration extends Declaration implements DeclSpecifier.Container, IOffsetable, TypeSpecifier.IOwner {
 
 	private int startingOffset = 0, totalLength = 0;
 	private AccessSpecifier accessSpecifier = null;
Index: dom/org/eclipse/cdt/internal/core/dom/TranslationUnit.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/TranslationUnit.java,v
retrieving revision 1.5
diff -u -r1.5 TranslationUnit.java
--- dom/org/eclipse/cdt/internal/core/dom/TranslationUnit.java	8 Apr 2003 03:41:05 -0000	1.5
+++ dom/org/eclipse/cdt/internal/core/dom/TranslationUnit.java	8 Apr 2003 20:06:58 -0000
@@ -13,9 +13,11 @@
 	private List declarations = new LinkedList();
 	private List macros = new ArrayList(); 
 	private List inclusions = new ArrayList(); 
+	private List offsetables = new ArrayList(); 
 	
 	public void addDeclaration(Declaration declaration) {
 		declarations.add(declaration);
+		offsetables.add(declaration);
 	}
 
 	public List getDeclarations() {
@@ -38,11 +40,21 @@
 
 	public void addMacro(Macro macro) {
 		macros.add(macro);
+		offsetables.add(macro);
 	}
 
 	public void addInclusion(Inclusion inclusion) {
 		inclusions.add(inclusion);
+		offsetables.add(inclusion);
 	}
 
+
+	/**
+	 * Returns the offsetables.
+	 * @return List
+	 */
+	public List getOffsetables() {
+		return Collections.unmodifiableList( offsetables );
+	}
 
 }
Index: model/org/eclipse/cdt/core/model/INamespace.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/INamespace.java,v
retrieving revision 1.3
diff -u -r1.3 INamespace.java
--- model/org/eclipse/cdt/core/model/INamespace.java	4 Apr 2003 14:01:29 -0000	1.3
+++ model/org/eclipse/cdt/core/model/INamespace.java	8 Apr 2003 20:06:57 -0000
@@ -8,4 +8,6 @@
  * Represents a package declaration in a C translation unit.
  */
 public interface INamespace extends ICElement, IParent, ISourceManipulation, ISourceReference {
+	
+	String getTypeName();
 }
Index: model/org/eclipse/cdt/core/model/ITypeDef.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ITypeDef.java,v
retrieving revision 1.2
diff -u -r1.2 ITypeDef.java
--- model/org/eclipse/cdt/core/model/ITypeDef.java	4 Apr 2003 14:01:29 -0000	1.2
+++ model/org/eclipse/cdt/core/model/ITypeDef.java	8 Apr 2003 20:06:57 -0000
@@ -9,4 +9,9 @@
  * Represents a field declared in a type.
  */
 public interface ITypeDef extends ICElement, ISourceManipulation, ISourceReference {
+	/**
+	 * Returns the type of the typedef item
+	 * @return String
+	 */
+	String getTypeName();
 }
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.5
diff -u -r1.5 Field.java
--- model/org/eclipse/cdt/internal/core/model/Field.java	4 Apr 2003 14:01:29 -0000	1.5
+++ model/org/eclipse/cdt/internal/core/model/Field.java	8 Apr 2003 20:06:58 -0000
@@ -8,7 +8,7 @@
 import org.eclipse.cdt.core.model.ICElement;
 import org.eclipse.cdt.core.model.IField;
 
-public class Field extends SourceManipulation implements IField {
+public class Field extends VariableDeclaration implements IField {
 	
 	public Field(ICElement parent, String name) {
 		super(parent, name, CElement.C_FIELD);
@@ -66,21 +66,8 @@
 		getFieldInfo().setVisibility(visibility);
 	}
 
-
 	public FieldInfo getFieldInfo(){
 		return (FieldInfo) getElementInfo();
-	}
-
-	/**
-	 * 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(){
-		return false;
 	}
 
 	protected CElementInfo createElementInfo () {
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.5
diff -u -r1.5 FunctionDeclaration.java
--- model/org/eclipse/cdt/internal/core/model/FunctionDeclaration.java	4 Apr 2003 14:01:29 -0000	1.5
+++ model/org/eclipse/cdt/internal/core/model/FunctionDeclaration.java	8 Apr 2003 20:06:57 -0000
@@ -65,6 +65,10 @@
 		else{
 			sig +=  "()";
 		}
+		if(isConst())
+			sig += " const";
+		if(isVolatile())
+			sig += " volatile";
 		return sig;
 	}
 		
@@ -105,7 +109,11 @@
 	 * @see org.eclipse.cdt.core.model.IDeclaration#isConst()
 	 */
 	public boolean isConst(){
-		return false;
+		return getFunctionInfo().isConst();
+	}
+
+	public void setConst(boolean isConst){
+		getFunctionInfo().setConst(isConst);
 	}
 
 	/**
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.5
diff -u -r1.5 FunctionInfo.java
--- model/org/eclipse/cdt/internal/core/model/FunctionInfo.java	4 Apr 2003 14:01:29 -0000	1.5
+++ model/org/eclipse/cdt/internal/core/model/FunctionInfo.java	8 Apr 2003 20:06:57 -0000
@@ -10,6 +10,7 @@
 	protected int flags;
 	protected boolean isStatic;
 	protected boolean isVolatile;
+	protected boolean isConst;
 	
 
 	protected FunctionInfo (CElement element) {
@@ -65,6 +66,22 @@
 		&& (this.isStatic() == ((FunctionInfo)otherInfo).isStatic())
 		&& (this.isVolatile() == ((FunctionInfo)otherInfo).isVolatile())
 		);
+	}
+
+	/**
+	 * Returns the isConst.
+	 * @return boolean
+	 */
+	public boolean isConst() {
+		return isConst;
+	}
+
+	/**
+	 * Sets the isConst.
+	 * @param isConst The isConst to set
+	 */
+	public void setConst(boolean isConst) {
+		this.isConst = isConst;
 	}
 
 }
Index: model/org/eclipse/cdt/internal/core/model/Namespace.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Namespace.java,v
retrieving revision 1.2
diff -u -r1.2 Namespace.java
--- model/org/eclipse/cdt/internal/core/model/Namespace.java	4 Apr 2003 14:01:29 -0000	1.2
+++ model/org/eclipse/cdt/internal/core/model/Namespace.java	8 Apr 2003 20:06:58 -0000
@@ -16,8 +16,25 @@
 
 public class Namespace extends SourceManipulation implements INamespace{
 
+	String typeName = "";
 	public Namespace(ICElement parent, String name) {
 		super(parent, name, CElement.C_NAMESPACE);
+	}
+
+	/**
+	 * Returns the typeName.
+	 * @return String
+	 */
+	public String getTypeName() {
+		return typeName;
+	}
+
+	/**
+	 * Sets the typeName.
+	 * @param typeName The typeName to set
+	 */
+	public void setTypeName(String typeName) {
+		this.typeName = typeName;
 	}
 
 }
Index: model/org/eclipse/cdt/internal/core/model/TranslationUnitInfo.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/TranslationUnitInfo.java,v
retrieving revision 1.5
diff -u -r1.5 TranslationUnitInfo.java
--- model/org/eclipse/cdt/internal/core/model/TranslationUnitInfo.java	27 Mar 2003 16:05:18 -0000	1.5
+++ model/org/eclipse/cdt/internal/core/model/TranslationUnitInfo.java	8 Apr 2003 20:06:58 -0000
@@ -11,7 +11,6 @@
 import org.eclipse.cdt.core.CCorePlugin;
 import org.eclipse.cdt.core.model.ICElement;
 import org.eclipse.cdt.core.model.ISourceRange;
-import org.eclipse.cdt.internal.core.parser.Parser;
 import org.eclipse.cdt.internal.parser.CStructurizer;
 import org.eclipse.core.runtime.IPath;
 
@@ -44,9 +43,9 @@
 			removeChildren();
 			if (CCorePlugin.getDefault().useNewParser()) {
 				// new parser
-				NewModelBuilder modelBuilder = new NewModelBuilder((TranslationUnit)getElement());
-				Parser parser = new Parser(in, modelBuilder, true);
-				parser.parse();
+				CModelBuilder modelBuilder = new CModelBuilder((TranslationUnit)getElement());
+				modelBuilder.parse();
+
 			} else {
 				// cdt 1.0 parser
 				ModelBuilder modelBuilder= new ModelBuilder((TranslationUnit)getElement());
Index: model/org/eclipse/cdt/internal/core/model/TypeDef.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/TypeDef.java,v
retrieving revision 1.2
diff -u -r1.2 TypeDef.java
--- model/org/eclipse/cdt/internal/core/model/TypeDef.java	4 Apr 2003 14:01:29 -0000	1.2
+++ model/org/eclipse/cdt/internal/core/model/TypeDef.java	8 Apr 2003 20:06:58 -0000
@@ -16,8 +16,24 @@
 
 public class TypeDef extends SourceManipulation implements ITypeDef{
 	
+	String typeName= "";
 	public TypeDef(ICElement parent, String name) {
 		super(parent, name, CElement.C_TYPEDEF);
+	}
+	/**
+	 * Returns the typeName.
+	 * @return String
+	 */
+	public String getTypeName() {
+		return typeName;
+	}
+
+	/**
+	 * Sets the typeName.
+	 * @param typeName The typeName to set
+	 */
+	public void setTypeName(String typeName) {
+		this.typeName = typeName;
 	}
 
 }
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.3
diff -u -r1.3 Variable.java
--- model/org/eclipse/cdt/internal/core/model/Variable.java	28 Mar 2003 21:05:20 -0000	1.3
+++ model/org/eclipse/cdt/internal/core/model/Variable.java	8 Apr 2003 20:06:58 -0000
@@ -8,57 +8,14 @@
 import org.eclipse.cdt.core.model.ICElement;
 import org.eclipse.cdt.core.model.IVariable;
 
-public class Variable extends SourceManipulation implements IVariable {
+public class Variable extends VariableDeclaration implements IVariable {
 	
 	public Variable(ICElement parent, String name) {
 		super(parent, name, CElement.C_VARIABLE);
 	}
 
-	public String getTypeName() {
-		return getVariableInfo().getTypeName();
-	}
-
-	public void setTypeName(String type){
-		getVariableInfo().setTypeName(type);
-	}
-
-	public boolean isConst() {
-		return getVariableInfo().isConst();
-	}
-
-	public void setConst(boolean isConst) {
-		getVariableInfo().setConst(isConst);
-	}
-
-	public boolean isVolatile() {
-		return getVariableInfo().isVolatile();
-	}
-
-	public void setVolatile(boolean isVolatile) {
-		getVariableInfo().setVolatile(isVolatile);
-	}
-
-	public boolean isStatic() {
-		return getVariableInfo().isStatic();
-	}
-
-	public void setStatic(boolean isStatic) {
-		getVariableInfo().setStatic(isStatic);
-	}
-
 	public String getInitializer() {
 		return "";
 	}
 
-	public int getAccessControl() {
-		return getVariableInfo().getAccessControl();
-	}
-
-	protected VariableInfo getVariableInfo() {
-		return (VariableInfo)getElementInfo();
-	}
-
-	protected CElementInfo createElementInfo () {
-		return new VariableInfo(this);
-	}
 }
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.4
diff -u -r1.4 VariableDeclaration.java
--- model/org/eclipse/cdt/internal/core/model/VariableDeclaration.java	28 Mar 2003 21:05:20 -0000	1.4
+++ model/org/eclipse/cdt/internal/core/model/VariableDeclaration.java	8 Apr 2003 20:06:58 -0000
@@ -14,6 +14,10 @@
 		super(parent, name, CElement.C_VARIABLE_DECLARATION);
 	}
 
+	public VariableDeclaration(ICElement parent, String name, int type) {
+		super(parent, name, type);
+	}
+
 	public int getAccessControl() {
 		return getVariableInfo().getAccessControl();
 	}
Index: parser/org/eclipse/cdt/internal/core/model/CModelBuilder.java
===================================================================
RCS file: parser/org/eclipse/cdt/internal/core/model/CModelBuilder.java
diff -N parser/org/eclipse/cdt/internal/core/model/CModelBuilder.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ parser/org/eclipse/cdt/internal/core/model/CModelBuilder.java	8 Apr 2003 20:06:59 -0000
@@ -0,0 +1,464 @@
+package org.eclipse.cdt.internal.core.model;
+
+
+/*******************************************************************************
+ * Copyright (c) 2001 Rational Software Corp. 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 implementation
+ ******************************************************************************/
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.cdt.core.model.ICElement;
+import org.eclipse.cdt.core.model.INamespace;
+import org.eclipse.cdt.core.model.IParent;
+import org.eclipse.cdt.core.model.IStructure;
+import org.eclipse.cdt.core.model.ITranslationUnit;
+import org.eclipse.cdt.internal.core.dom.ClassSpecifier;
+import org.eclipse.cdt.internal.core.dom.DOMBuilder;
+import org.eclipse.cdt.internal.core.dom.Declaration;
+import org.eclipse.cdt.internal.core.dom.Declarator;
+import org.eclipse.cdt.internal.core.dom.ElaboratedTypeSpecifier;
+import org.eclipse.cdt.internal.core.dom.EnumerationSpecifier;
+import org.eclipse.cdt.internal.core.dom.EnumeratorDefinition;
+import org.eclipse.cdt.internal.core.dom.IOffsetable;
+import org.eclipse.cdt.internal.core.dom.Inclusion;
+import org.eclipse.cdt.internal.core.dom.Macro;
+import org.eclipse.cdt.internal.core.dom.NamespaceDefinition;
+import org.eclipse.cdt.internal.core.dom.ParameterDeclaration;
+import org.eclipse.cdt.internal.core.dom.ParameterDeclarationClause;
+import org.eclipse.cdt.internal.core.dom.PointerOperator;
+import org.eclipse.cdt.internal.core.dom.SimpleDeclaration;
+import org.eclipse.cdt.internal.core.dom.TranslationUnit;
+import org.eclipse.cdt.internal.core.dom.TypeSpecifier;
+import org.eclipse.cdt.internal.core.parser.Parser;
+import org.eclipse.cdt.internal.core.parser.ParserException;
+import org.eclipse.cdt.internal.core.parser.util.ClassKey;
+import org.eclipse.cdt.internal.core.parser.util.DeclSpecifier;
+
+public class CModelBuilder {
+	
+	org.eclipse.cdt.internal.core.model.TranslationUnit translationUnit;
+	public CModelBuilder(org.eclipse.cdt.internal.core.model.TranslationUnit tu) {
+		this.translationUnit = tu ;
+	}
+
+	public TranslationUnit parse() throws Exception {
+		DOMBuilder domBuilder = new DOMBuilder();
+		String code = translationUnit.getBuffer().getContents();
+		Parser parser = new Parser(code, domBuilder, true);
+		if( ! parser.parse() ) throw new ParserException( "Parse failure" ); 
+		generateModelElements(domBuilder.getTranslationUnit());
+		return domBuilder.getTranslationUnit();
+	}
+	
+	protected void generateModelElements(TranslationUnit tu){
+		List offsetables = tu.getOffsetables();
+		Iterator i = offsetables.iterator();
+		while (i.hasNext()){
+			IOffsetable offsetable = (IOffsetable)i.next();
+			if(offsetable instanceof Inclusion){
+				createInclusion(translationUnit, (Inclusion) offsetable); 		
+			}
+			else if(offsetable instanceof Macro){
+				createMacro(translationUnit, (Macro) offsetable);				
+			}else if(offsetable instanceof Declaration){
+				generateModelElements (translationUnit, (Declaration) offsetable);
+			}
+		} 
+	}	
+	
+	protected void generateModelElements (Parent parent, Declaration declaration){
+		// Namespace
+		if(declaration instanceof NamespaceDefinition){
+			NamespaceDefinition nsDef = (NamespaceDefinition) declaration;
+			IParent namespace = createNamespace(parent, nsDef);
+			List nsDeclarations = nsDef.getDeclarations();
+			Iterator nsDecls = 	nsDeclarations.iterator();
+			while (nsDecls.hasNext()){
+				Declaration subNsDeclaration = (Declaration) nsDecls.next();
+				generateModelElements((Parent)namespace, subNsDeclaration);			
+			}
+		}
+
+		if(declaration instanceof SimpleDeclaration){
+			SimpleDeclaration simpleDeclaration = (SimpleDeclaration) declaration;
+
+			/*-------------------------------------------
+			 * Checking the type if it is a composite one
+			 *-------------------------------------------*/
+			TypeSpecifier typeSpec = simpleDeclaration.getTypeSpecifier();
+			// Enumeration
+			if (typeSpec instanceof EnumerationSpecifier){
+				EnumerationSpecifier enumSpecifier = (EnumerationSpecifier) typeSpec;
+				IParent enumElement = createEnumeration (parent, enumSpecifier);
+			}
+			// Structure
+			else if (typeSpec instanceof ClassSpecifier){
+				ClassSpecifier classSpecifier = (ClassSpecifier) typeSpec;
+				IParent classElement = createClass (parent, simpleDeclaration, classSpecifier);
+				// create the sub declarations 
+				List declarations = classSpecifier.getDeclarations();
+				Iterator j = declarations.iterator();
+				while (j.hasNext()){
+					Declaration subDeclaration = (Declaration)j.next();
+					generateModelElements((Parent)classElement, subDeclaration);					
+				}
+				// TODO: create the declarators too here				
+			}
+
+			/*-----------------------------------------
+			 * Create declarators of simple declaration
+			 * ----------------------------------------*/
+
+			List declarators  = simpleDeclaration.getDeclarators();
+			Iterator d = declarators.iterator();
+			while (d.hasNext()){ 		
+				Declarator declarator = (Declarator)d.next();
+				// typedef
+				if(simpleDeclaration.getDeclSpecifier().isTypedef()){
+					createTypeDef(parent, declarator, simpleDeclaration);
+				} else {
+					ParameterDeclarationClause pdc = declarator.getParms();
+					if (pdc == null){
+						createVariableSpecification(parent, simpleDeclaration, declarator); 
+					}
+					else{
+						createFunctionSpecification(parent, simpleDeclaration, declarator, pdc);
+					}
+				}				
+			} // end while
+		} // end if SimpleDeclaration		 
+	}
+	
+	
+	
+	private void createInclusion(Parent parent, Inclusion inclusion){
+		// create element
+		Include element = new Include((CElement)parent, inclusion.getName());
+		// add to parent
+		parent.addChild((CElement) element);
+		// set position
+		element.setIdPos(inclusion.getNameOffset(), inclusion.getNameLength());
+		element.setPos(inclusion.getStartingOffset(), inclusion.getTotalLength());
+	}
+	
+	private void createMacro(Parent parent, Macro macro){
+		// create element
+		org.eclipse.cdt.internal.core.model.Macro element = new  org.eclipse.cdt.internal.core.model.Macro(parent, macro.getName());
+		// add to parent
+		parent.addChild((CElement) element);		
+		// set position
+		element.setIdPos(macro.getNameOffset(), macro.getNameLength());
+		element.setPos(macro.getStartingOffset(), macro.getTotalLength());
+		
+	}
+	
+	private IParent createNamespace(Parent parent, NamespaceDefinition nsDef){
+		// create element
+		String nsName = (nsDef.getName() == null ) ? "" : nsDef.getName().toString();
+		Namespace element = new Namespace ((ICElement)parent, nsName );
+		// add to parent
+		parent.addChild((ICElement)element);
+		// set element position
+		if(nsDef.getName() != null){
+			element.setIdPos(nsDef.getName().getStartOffset(), nsDef.getName().length());
+		}else{
+			element.setIdPos(nsDef.getStartToken().getOffset(), nsDef.getStartToken().getLength());
+		}
+		element.setPos(nsDef.getStartingOffset(), nsDef.getTotalLength());
+		element.setTypeName(nsDef.getStartToken().getImage());
+		
+		return (IParent)element;
+	}
+
+	private IParent createEnumeration(Parent parent, EnumerationSpecifier enumSpecifier){
+		// create element
+		String enumName = (enumSpecifier.getName() == null ) ? "" : enumSpecifier.getName().toString();
+		Enumeration enum = new Enumeration ((ICElement)parent, enumName );
+		// add to parent
+		parent.addChild((ICElement)enum);
+		List enumItems = enumSpecifier.getEnumeratorDefinitions();
+		Iterator i = enumItems.iterator();
+		while (i.hasNext()){
+			// create sub element
+			EnumeratorDefinition enumDef = (EnumeratorDefinition) i.next();
+			Enumerator element = new Enumerator (enum, enumDef.getName().toString());
+			// add to parent
+			enum.addChild(element);
+			// set enumerator position
+			element.setIdPos(enumDef.getName().getStartOffset(), enumDef.getName().length());
+			element.setPos(enumDef.getStartingOffset(), enumDef.getTotalLength());
+		}
+		
+		// set enumeration position
+		if(enumSpecifier.getName() != null ){
+			enum.setIdPos(enumSpecifier.getName().getStartOffset(), enumSpecifier.getName().length());
+		}else {
+			enum.setIdPos(enumSpecifier.getStartToken().getOffset(), enumSpecifier.getStartToken().getLength());				
+		}
+		enum.setPos(enumSpecifier.getStartingOffset(), enumSpecifier.getTotalLength());
+		enum.setTypeName(enumSpecifier.getStartToken().getImage());
+		 
+		return (IParent)enum;
+	}
+	
+	private IParent createClass(Parent parent, SimpleDeclaration simpleDeclaration, ClassSpecifier classSpecifier){
+		// create element
+		String className = (classSpecifier.getName() == null ) ? "" : classSpecifier.getName().toString();
+		int kind;
+		switch( classSpecifier.getClassKey() )
+		{
+			case ClassKey.t_class:
+				kind = ICElement.C_CLASS;
+				break;
+			case ClassKey.t_struct:
+				kind = ICElement.C_STRUCT;
+				break;	
+			default:
+				kind = ICElement.C_UNION;
+				break;
+		}
+		
+		Structure classElement = new Structure( (CElement)parent, kind, className );
+
+		// add to parent
+		parent.addChild((ICElement) classElement);
+		String type;
+		// set element position 
+		if( classSpecifier.getName()  != null )
+		{
+			type = simpleDeclaration.getDeclSpecifier().getTypeName();
+			classElement.setIdPos( classSpecifier.getName().getStartOffset(), classSpecifier.getName().length() );
+		}
+		else
+		{
+			type = classSpecifier.getClassKeyToken().getImage();
+			classElement.setIdPos(classSpecifier.getClassKeyToken().getOffset(), classSpecifier.getClassKeyToken().getLength());
+			
+		}
+		classElement.setTypeName( type );
+		classElement.setPos(classSpecifier.getStartingOffset(), classSpecifier.getTotalLength());
+		
+		return classElement;
+	}
+	
+	private void createTypeDef(Parent parent, Declarator declarator, SimpleDeclaration simpleDeclaration){
+		// create the element
+		String declaratorName = declarator.getName().toString();		
+		TypeDef typedef = new TypeDef( parent, declaratorName );
+		String type = getType(simpleDeclaration, declarator);
+		typedef.setTypeName(type);
+		
+		// add to parent
+		parent.addChild((CElement)typedef);
+
+		// set positions
+		typedef.setIdPos(declarator.getName().getStartOffset(), declarator.getName().length());	
+		typedef.setPos(simpleDeclaration.getStartingOffset(), simpleDeclaration.getTotalLength());	
+	}
+
+	private void createVariableSpecification(Parent parent, SimpleDeclaration simpleDeclaration, Declarator declarator){
+		
+		String declaratorName = declarator.getName().toString();
+		DeclSpecifier declSpecifier = simpleDeclaration.getDeclSpecifier();
+		
+		VariableDeclaration element = null;
+		if(parent instanceof IStructure){
+			// field
+			Field newElement = new Field( parent, declaratorName );
+			newElement.setMutable(declSpecifier.isMutable());			
+			newElement.setVisibility(simpleDeclaration.getAccessSpecifier().getAccess());
+			element = newElement;			
+		}
+		else {
+			if(declSpecifier.isExtern()){
+				// variableDeclaration
+				VariableDeclaration newElement = new VariableDeclaration( parent, declaratorName );
+				element = newElement;
+			}
+			else {
+				// variable
+				Variable newElement = new Variable( parent, declaratorName );
+				element = newElement;				
+			}
+		}
+		element.setTypeName ( getType(simpleDeclaration, declarator) );
+		element.setConst(declSpecifier.isConst());
+		element.setVolatile(declSpecifier.isVolatile());
+		element.setStatic(declSpecifier.isStatic());
+		// add to parent
+		parent.addChild( element ); 	
+
+		// set position
+			// hook up the offsets
+		element.setIdPos( declarator.getName().getStartOffset(), declarator.getName().length() );
+		element.setPos(simpleDeclaration.getStartingOffset(), simpleDeclaration.getTotalLength());	
+
+	}
+
+	private void createFunctionSpecification(Parent parent, SimpleDeclaration simpleDeclaration, Declarator declarator, ParameterDeclarationClause pdc){
+		String declaratorName = declarator.getName().toString();
+		DeclSpecifier declSpecifier = simpleDeclaration.getDeclSpecifier();
+		// getParameterTypes
+		List parameterList = pdc.getDeclarations();
+		String[] parameterTypes = new String[parameterList.size()];
+		FunctionDeclaration element = null;
+		for( int j = 0; j< parameterList.size(); ++j )
+		{
+			ParameterDeclaration param = (ParameterDeclaration )parameterList.get(j);
+			Declarator paramDeclarator = (Declarator)param.getDeclarators().get(0);
+			parameterTypes[j] = new String(getType(param, paramDeclarator));
+		}
+		
+		if( parent instanceof IStructure )
+		{
+			if (simpleDeclaration.isFunctionDefinition())
+			{
+				// method
+				Method newElement = new Method( parent, declaratorName );
+				newElement.setVisibility(simpleDeclaration.getAccessSpecifier().getAccess());
+				element = newElement;				
+			}
+			else
+			{
+				// method declaration
+				MethodDeclaration newElement = new MethodDeclaration( parent, declaratorName );
+				newElement.setVisibility(simpleDeclaration.getAccessSpecifier().getAccess());
+				element = newElement;				
+			}
+		}
+		else if(( parent instanceof ITranslationUnit ) 
+				|| ( parent instanceof INamespace ))
+		{
+			if (simpleDeclaration.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
+				
+				// function
+				Function newElement = new Function( parent, declaratorName );
+				element = newElement;				
+			}
+			else
+			{
+				// functionDeclaration
+				FunctionDeclaration newElement = new FunctionDeclaration( parent, declaratorName );
+				element = newElement;				
+			}
+		}						
+		element.setParameterTypes(parameterTypes);
+		element.setReturnType( getType(simpleDeclaration, declarator) );
+		element.setVolatile(declSpecifier.isVolatile());
+		element.setStatic(declSpecifier.isStatic());
+		element.setConst(declarator.isConst());				
+
+		// add to parent
+		parent.addChild( element ); 	
+
+		// hook up the offsets
+		element.setIdPos( declarator.getName().getStartOffset(), declarator.getName().length() );		
+		element.setPos(simpleDeclaration.getStartingOffset(), simpleDeclaration.getTotalLength());	
+		
+	}
+	
+	private String getType(Declaration declaration, Declarator declarator){
+		String type = "";
+		// get type from declaration
+		type = getDeclarationType(declaration);
+		// add pointerr or reference from declarator if any
+		type += getDeclaratorPointerOperation(declarator);
+		return type;		
+	}
+	
+	private String getDeclarationType(Declaration declaration){
+		String type = "";
+		if(declaration instanceof ParameterDeclaration){
+			ParameterDeclaration paramDeclaration = (ParameterDeclaration) declaration;
+			if(paramDeclaration.getDeclSpecifier().isConst())
+				type += "const ";
+			if(paramDeclaration.getDeclSpecifier().isVolatile())
+				type += "volatile ";
+			TypeSpecifier typeSpecifier = paramDeclaration.getTypeSpecifier();
+			if(typeSpecifier == null){
+				type += paramDeclaration.getDeclSpecifier().getTypeName();
+			}
+			else if(typeSpecifier instanceof ElaboratedTypeSpecifier){
+				ElaboratedTypeSpecifier elab = (ElaboratedTypeSpecifier) typeSpecifier;
+				type += getElaboratedTypeSignature(elab);
+			}
+		}
+		
+		if(declaration instanceof SimpleDeclaration){
+			SimpleDeclaration simpleDeclaration = (SimpleDeclaration) declaration;
+			if(simpleDeclaration.getDeclSpecifier().isConst())
+				type += "const ";
+			if(simpleDeclaration.getDeclSpecifier().isVolatile())
+				type += "volatile ";
+			TypeSpecifier typeSpecifier = simpleDeclaration.getTypeSpecifier();
+			if(typeSpecifier == null){
+				type += simpleDeclaration.getDeclSpecifier().getTypeName(); 
+			} 
+			else if(typeSpecifier instanceof ElaboratedTypeSpecifier){
+				ElaboratedTypeSpecifier elab = (ElaboratedTypeSpecifier) typeSpecifier;
+				type += getElaboratedTypeSignature(elab);
+			}
+		}
+		
+		return type;	
+	}
+	
+	private String getElaboratedTypeSignature(ElaboratedTypeSpecifier elab){
+		String type = "";
+		int t = elab.getClassKey();
+		switch (t){
+			case ClassKey.t_class:
+				type = "class";
+			break;
+			case ClassKey.t_struct:
+				type = "struct";
+			break;
+			case ClassKey.t_union:
+				type = "union";
+			break;
+			case ClassKey.t_enum:
+				type = "enum";
+			break;
+		};
+		type += " ";
+		type += elab.getName().toString();
+		return type;
+	}
+	
+	private String getDeclaratorPointerOperation(Declarator declarator){		
+		String pointerString = "";
+		List pointerOperators = declarator.getPointerOperators();
+		if(pointerOperators != null) {
+			Iterator i = pointerOperators.iterator();
+			while(i.hasNext()){
+				PointerOperator po = (PointerOperator) i.next();
+				switch (po.getType()){
+					case PointerOperator.t_pointer:
+						pointerString += "*";
+					break;
+					case PointerOperator.t_reference:
+						pointerString += "&";
+					break;									
+				}
+				
+				if(po.isConst())
+					pointerString += " const";
+				if(po.isVolatile())
+					pointerString += " volatile";
+			}
+		}
+		return pointerString;
+	}
+}
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.10
diff -u -r1.10 CElementLabelProvider.java
--- src/org/eclipse/cdt/ui/CElementLabelProvider.java	4 Apr 2003 14:01:31 -0000	1.10
+++ src/org/eclipse/cdt/ui/CElementLabelProvider.java	8 Apr 2003 20:06:35 -0000
@@ -8,6 +8,8 @@
 import org.eclipse.cdt.core.model.IBinary;
 import org.eclipse.cdt.core.model.ICElement;
 import org.eclipse.cdt.core.model.IFunctionDeclaration;
+import org.eclipse.cdt.core.model.INamespace;
+import org.eclipse.cdt.core.model.ITypeDef;
 import org.eclipse.cdt.core.model.IVariableDeclaration;
 import org.eclipse.cdt.internal.ui.CElementImageProvider;
 import org.eclipse.cdt.internal.ui.ErrorTickAdornmentProvider;
@@ -65,17 +67,21 @@
 				case ICElement.C_VARIABLE_DECLARATION:
 					IVariableDeclaration vDecl = (IVariableDeclaration) celem;
 					name =  vDecl.getElementName();
-					name += " : ";
-					name += vDecl.getTypeName();
+					if((vDecl.getTypeName() != null) &&(vDecl.getTypeName().length() > 0)){
+						name += " : ";
+						name += vDecl.getTypeName();
+					}
 				break;
 				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();		
-					name += " : ";
-					name += fDecl.getReturnType();
+					name = fDecl.getSignature();
+					if((fDecl.getReturnType() != null) &&(fDecl.getReturnType().length() > 0)){
+						name += " : ";
+						name += fDecl.getReturnType();
+					}
 				break;
 				case ICElement.C_STRUCT:
 				case ICElement.C_UNION:
@@ -85,6 +91,22 @@
 					} else if (celem instanceof IVariableDeclaration) {
 						IVariableDeclaration varDecl = (IVariableDeclaration) celem;
 						name = varDecl.getTypeName();				
+					}
+				break;
+				case ICElement.C_TYPEDEF:
+					ITypeDef tDecl = (ITypeDef) celem;
+					name = tDecl.getElementName();
+					if((tDecl.getTypeName() != null) &&(tDecl.getTypeName().length() > 0)){
+						name += " : ";
+						name += tDecl.getTypeName();				
+					}
+				break;
+				case ICElement.C_NAMESPACE:
+					if((celem.getElementName() != null) && (celem.getElementName().length() > 0)){
+						name = celem.getElementName();
+					} else if (celem instanceof INamespace) {
+						INamespace nDecl = (INamespace) celem;
+						name = nDecl.getTypeName();				
 					}
 				break;
 				default:

Back to the top