Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] IStructure and extensions in core

Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/ChangeLog,v
retrieving revision 1.55
diff -u -r1.55 ChangeLog
--- ChangeLog	17 Jan 2003 19:20:20 -0000	1.55
+++ ChangeLog	23 Jan 2003 16:42:12 -0000
@@ -1,6 +1,25 @@
+2003-01-23 Alain Magloire
+
+	* model/org/eclipse/cdt/internal/core/model/CModelManager.java (getHeaderExtensions):  Returns possible C/C++ header extensions name.
+	(getSourceExtensions): Returns possible C/C++ extension.
+	(getTranslationUnitExtensions): Returns possible C/C++ extension.
+	* model/org/eclipse/cdt/core/model/CoreModel.java:
+	(getHeaderExtensions): New method.
+	(getSourceExtensions): New method.
+	(getTranslationUnitExtensions): New method.
+
+2003-01-23 Alain Magloire
+
+	Changes proposed by Amer Hoda.
+
+	* model/org/eclipse/cdt/internal/core/model/Structure.java:
+	Extends IVariableDeclaration instead of IVariable.
+	* model/org/eclipse/cdt/core/model/IStructure.java:
+	Extends IVariableDeclaration instead of IVariable.
+
 2003-01-17 Alain Magloire
 
-	* mode/org/eclipse/cdt/internal/core/model/parser/ElfBinaryFile.java (addSymbols):
+	* model/org/eclipse/cdt/internal/core/model/parser/ElfBinaryFile.java (addSymbols):
 	The catch IOException was at the wrong place.
 
 2002-12-23 Alain Magloire
Index: model/org/eclipse/cdt/core/model/CoreModel.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/CoreModel.java,v
retrieving revision 1.6
diff -u -r1.6 CoreModel.java
--- model/org/eclipse/cdt/core/model/CoreModel.java	27 Nov 2002 04:43:49 -0000	1.6
+++ model/org/eclipse/cdt/core/model/CoreModel.java	23 Jan 2003 16:32:51 -0000
@@ -118,6 +118,27 @@
 	}
 
 	/**
+	 * Return the list of headers extensions.
+	 */
+	public String[] getHeaderExtensions() {
+		return manager.getHeaderExtensions();
+	}
+
+	/**
+	 * Returns the list of source extensions.
+	 */
+	public String[] getSourceExtensions() {
+		return manager.getSourceExtensions();
+	}
+
+	/**
+	 * Returns the list of headers and sources extensions
+	 */
+	public String[] getTranslationUnitExtensions() {
+		return manager.getTranslationUnitExtensions();
+	}
+
+	/**
 	 * Return true if project has C nature.
 	 */
 	public boolean hasCNature(IProject project){
Index: model/org/eclipse/cdt/core/model/IStructure.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IStructure.java,v
retrieving revision 1.1
diff -u -r1.1 IStructure.java
--- model/org/eclipse/cdt/core/model/IStructure.java	26 Jun 2002 20:37:14 -0000	1.1
+++ model/org/eclipse/cdt/core/model/IStructure.java	23 Jan 2003 16:32:51 -0000
@@ -8,7 +8,7 @@
 /**
  * Represent struct(ure), class or union.
  */
-public interface IStructure extends IInheritance, IParent, ICElement, IVariable {
+public interface IStructure extends IInheritance, IParent, ICElement, IVariableDeclaration {
 	//public String instantiatesTemplate();
 
 	public IField getField(String name);
Index: model/org/eclipse/cdt/internal/core/model/CModelManager.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelManager.java,v
retrieving revision 1.12
diff -u -r1.12 CModelManager.java
--- model/org/eclipse/cdt/internal/core/model/CModelManager.java	27 Nov 2002 04:46:27 -0000	1.12
+++ model/org/eclipse/cdt/internal/core/model/CModelManager.java	23 Jan 2003 16:32:51 -0000
@@ -82,7 +82,9 @@
 	 */
 	protected ArrayList fElementChangedListeners= new ArrayList();
 
-	public static final String [] cExtensions = {"c", "cxx", "cc", "C", "cpp", "h", "hh"};
+	public static final String [] sourceExtensions = {"c", "cxx", "cc", "C", "cpp"};
+
+	public static final String [] headerExtensions = {"h", "hh", "hpp"};
 
 	static CModelManager factory = null;
 	
@@ -527,11 +529,29 @@
 			return false;
 		}
 		String ext = name.substring(index + 1);
-		for (int i = 0; i < cExtensions.length; i++) {
-			if (ext.equals(cExtensions[i]))
+		String[] cexts = getTranslationUnitExtensions();
+		for (int i = 0; i < cexts.length; i++) {
+			if (ext.equals(cexts[i]))
 				return true;
 		}
 		return false;
+	}
+	
+	public String[] getHeaderExtensions() {
+		return headerExtensions;
+	}
+	
+	public String[] getSourceExtensions() {
+		return sourceExtensions;
+	}
+
+	public String[] getTranslationUnitExtensions() {
+		String[] headers = getHeaderExtensions();
+		String[] sources = getSourceExtensions();
+		String[] cexts = new String[headers.length + sources.length];
+		System.arraycopy(sources, 0, cexts, 0, sources.length);
+		System.arraycopy(headers, 0, cexts, sources.length, headers.length);
+		return cexts;
 	}
 
 	/* Only project with C nature and Open.  */
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.1
diff -u -r1.1 Structure.java
--- model/org/eclipse/cdt/internal/core/model/Structure.java	26 Jun 2002 20:37:14 -0000	1.1
+++ model/org/eclipse/cdt/internal/core/model/Structure.java	23 Jan 2003 16:32:51 -0000
@@ -65,14 +65,6 @@
 	}
 
 	/**
-	 * Return the access control for each inherited structure.
-	 * @IInheritance
-	 */
-	public int getAccessControl(int pos) throws CModelException {
-		return 0;
-	}
-
-	/**
 	 * @see IVariable
 	 */
 	public String getType() {
@@ -99,6 +91,22 @@
 
 	protected CElementInfo createElementInfo () {
 		return new SourceManipulationInfo(this);
+	}
+
+	/**
+	 * Return the access control for each inherited structure.
+	 * @IInheritance
+	 */
+	public int getAccessControl(int pos) throws CModelException {
+		return 0;
+	}
+
+
+	/**
+	 * @see org.eclipse.cdt.core.model.IVariableDeclaration#getAccesControl()
+	 */
+	public int getAccesControl() {
+		return 0;
 	}
 
 }



Back to the top