[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[cdt-patch] patch to add IIndex#getReferences(IBinding) and IIndex#getDeclarations(IBinding)
|
This patch includes:
- new index/org.eclipse.cdt.internal.core.index.cindexstorage.dom
package
-> contains classes required
to mimic the DOM's IASTName and IBinding interfaces on the Index side of
things, this way IEntryResult's stored in the IIndex can be returned as
an IASTName instead
- added IIndex#getReferences(IBinding)
and IIndex#getDeclarations(IBinding)
- added a placeholder for IIndex#getDefinition(IBinding)
- added ASTTypeUtil#isConst(IType)
- added CharArrayUtils#concat(char[],
char) to concat IndexedOutput#TYPE_REF/IndexedOutput#TYPE_DECL with IndexedOutput#SOME_SUFFIX
Notes:
- might want to tweak Index#convertToIndexRefString(IBinding)
and Index#convertToIndexDeclString(IBinding) so that in the future they
also create IIndex search strings based on the structure of the IBinding...
i.e. limit the result to names in the Index found in a particular namespace/class/etc
Devin Steffler
IBM's Eclipse CDT
Ottawa (Palladium), Ontario, Canada
Index: index/org/eclipse/cdt/internal/core/index/IEntryResult.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt-core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/IEntryResult.java,v
retrieving revision 1.6
diff -u -r1.6 IEntryResult.java
--- index/org/eclipse/cdt/internal/core/index/IEntryResult.java 8 Apr 2005 06:07:51 -0000 1.6
+++ index/org/eclipse/cdt/internal/core/index/IEntryResult.java 21 Apr 2005 14:42:48 -0000
@@ -34,5 +34,13 @@
* offset array
*/
public int[][] getOffsetLengths();
+
+ /**
+ * Returns the simple name for this IEntryResult.
+ *
+ * ex:
+ * typeDecl/V/foo/namespace returns "foo"
+ */
+ public String extractSimpleName();
}
Index: index/org/eclipse/cdt/internal/core/index/IIndex.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt-core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/IIndex.java,v
retrieving revision 1.4
diff -u -r1.4 IIndex.java
--- index/org/eclipse/cdt/internal/core/index/IIndex.java 4 Apr 2005 17:46:28 -0000 1.4
+++ index/org/eclipse/cdt/internal/core/index/IIndex.java 21 Apr 2005 14:42:48 -0000
@@ -13,6 +13,8 @@
import java.io.File;
import java.io.IOException;
+import org.eclipse.cdt.core.dom.ast.IASTName;
+import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.IPath;
@@ -81,4 +83,31 @@
String[] getFileDependencies(IPath path) throws IOException;
String[] getFileDependencies(IFile file) throws IOException;
+ /**
+ * Returns the arrau of declarations in the Index for the given
+ * binding. The array contains the IASTName nodes that declare the binding.
+ *
+ * @param binding
+ * @return array of IASTName nodes for the binding's declaration
+ */
+ public IASTName[] getDeclarations(IBinding binding);
+
+ /**
+ * Returns the array of references in the Index to the given
+ * binding. This array contains the IASTName nodes that represent a use of
+ * the binding.
+ *
+ * @param binding
+ * @return array of IASTName nodes representing uses of the binding
+ */
+ public IASTName[] getReferences(IBinding binding);
+
+ /**
+ * Returns the IASTName in the Index corresponding to the definition
+ * of the binding.
+ *
+ * @param binding
+ * @return IASTName for the binding's definition
+ */
+ public IASTName getDefinition(IBinding binding);
}
Index: index/org/eclipse/cdt/internal/core/index/cindexstorage/EntryResult.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt-core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/cindexstorage/EntryResult.java,v
retrieving revision 1.2
diff -u -r1.2 EntryResult.java
--- index/org/eclipse/cdt/internal/core/index/cindexstorage/EntryResult.java 8 Apr 2005 06:07:50 -0000 1.2
+++ index/org/eclipse/cdt/internal/core/index/cindexstorage/EntryResult.java 21 Apr 2005 14:42:48 -0000
@@ -90,5 +90,27 @@
return offsetLengths;
}
+public String extractSimpleName() {
+ return EntryResult.extractSimpleName(getWord());
+}
+
+public static String extractSimpleName(char[] word) {
+ String aWord = new String(word);
+ String longName=null;
+ if (aWord.indexOf(new String(IndexerOutput.TYPE_DECL)) == 0) {
+ longName = aWord.substring(aWord.indexOf(IndexerOutput.SEPARATOR, IndexerOutput.TYPE_DECL.length)+1);
+ } else if (aWord.indexOf(new String(IndexerOutput.TYPE_REF)) == 0) {
+ longName = aWord.substring(aWord.indexOf(IndexerOutput.SEPARATOR, IndexerOutput.TYPE_REF.length)+1);
+ } else {
+ longName = aWord.substring(aWord.indexOf(IndexerOutput.SEPARATOR)+1);
+ }
+
+ int sepPos=longName.indexOf(IndexerOutput.SEPARATOR);
+ if (sepPos>=0)
+ return aWord.substring(0, longName.indexOf(IndexerOutput.SEPARATOR));
+ else
+ return longName;
+}
+
}
Index: index/org/eclipse/cdt/internal/core/index/cindexstorage/Index.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt-core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/cindexstorage/Index.java,v
retrieving revision 1.1
diff -u -r1.1 Index.java
--- index/org/eclipse/cdt/internal/core/index/cindexstorage/Index.java 7 Apr 2005 20:19:52 -0000 1.1
+++ index/org/eclipse/cdt/internal/core/index/cindexstorage/Index.java 21 Apr 2005 14:42:48 -0000
@@ -18,12 +18,42 @@
import java.util.Map;
import org.eclipse.cdt.core.CCorePlugin;
+import org.eclipse.cdt.core.dom.ast.DOMException;
+import org.eclipse.cdt.core.dom.ast.IASTName;
+import org.eclipse.cdt.core.dom.ast.IBinding;
+import org.eclipse.cdt.core.dom.ast.ICompositeType;
+import org.eclipse.cdt.core.dom.ast.IEnumeration;
+import org.eclipse.cdt.core.dom.ast.IEnumerator;
+import org.eclipse.cdt.core.dom.ast.IFunction;
+import org.eclipse.cdt.core.dom.ast.IMacroBinding;
+import org.eclipse.cdt.core.dom.ast.ITypedef;
+import org.eclipse.cdt.core.dom.ast.IVariable;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPField;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespace;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespaceAlias;
import org.eclipse.cdt.core.index.ICDTIndexer;
import org.eclipse.cdt.core.index.IIndexDelta;
+import org.eclipse.cdt.core.parser.util.ArrayUtil;
+import org.eclipse.cdt.core.parser.util.CharArrayUtils;
import org.eclipse.cdt.internal.core.index.IEntryResult;
import org.eclipse.cdt.internal.core.index.IIndex;
import org.eclipse.cdt.internal.core.index.IIndexer;
import org.eclipse.cdt.internal.core.index.IQueryResult;
+import org.eclipse.cdt.internal.core.index.cindexstorage.dom.ASTIndexedName;
+import org.eclipse.cdt.internal.core.index.cindexstorage.dom.IndexedClass;
+import org.eclipse.cdt.internal.core.index.cindexstorage.dom.IndexedEnumeration;
+import org.eclipse.cdt.internal.core.index.cindexstorage.dom.IndexedEnumerator;
+import org.eclipse.cdt.internal.core.index.cindexstorage.dom.IndexedField;
+import org.eclipse.cdt.internal.core.index.cindexstorage.dom.IndexedFunction;
+import org.eclipse.cdt.internal.core.index.cindexstorage.dom.IndexedMacro;
+import org.eclipse.cdt.internal.core.index.cindexstorage.dom.IndexedMethod;
+import org.eclipse.cdt.internal.core.index.cindexstorage.dom.IndexedNamespace;
+import org.eclipse.cdt.internal.core.index.cindexstorage.dom.IndexedProblemBinding;
+import org.eclipse.cdt.internal.core.index.cindexstorage.dom.IndexedStructure;
+import org.eclipse.cdt.internal.core.index.cindexstorage.dom.IndexedTypedef;
+import org.eclipse.cdt.internal.core.index.cindexstorage.dom.IndexedVariable;
import org.eclipse.cdt.internal.core.index.cindexstorage.io.BlocksIndexInput;
import org.eclipse.cdt.internal.core.index.cindexstorage.io.BlocksIndexOutput;
import org.eclipse.cdt.internal.core.index.cindexstorage.io.IndexInput;
@@ -45,6 +75,10 @@
*/
public class Index implements IIndex {
+ private static final String NO_IBINDING_MATCH_FOUND_FOR_IENTRY_RESULT = "No IBinding match found for IEntryResult "; //$NON-NLS-1$
+ private static final IASTName[] BLANK_NAME_ARRAY = new IASTName[0];
+ private static final String WILDCARD = "*"; //$NON-NLS-1$
+
/**
* Maximum size of the index in memory.
*/
@@ -97,7 +131,7 @@
* If the document already exists in the index, it overrides the previous one. The changes will be
* taken into account after a merge.
*/
- public void add(IFile file, IIndexer indexer) throws IOException {
+ public void add(IFile file, IIndexer anIndexer) throws IOException {
if (timeToMerge()) {
merge();
}
@@ -106,7 +140,7 @@
)
remove(indexedFile, MergeFactory.ADDS_INDEX);
IndexerOutput output= new IndexerOutput(addsIndex);
- indexer.index(file, output);
+ anIndexer.index(file, output);
state= CAN_MERGE;
}
/**
@@ -436,17 +470,299 @@
protected boolean timeToMerge() {
return (addsIndex.getFootprint() >= MAX_FOOTPRINT);
}
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
public String toString() {
- String str = this.toString;
- if (str == null) str = super.toString();
- str += "(length: "+ getIndexFile().length() +")"; //$NON-NLS-1$ //$NON-NLS-2$
- return str;
-}
+ String str = this.toString;
+ if (str == null) str = super.toString();
+ str += "(length: "+ getIndexFile().length() +")"; //$NON-NLS-1$ //$NON-NLS-2$
+ return str;
+ }
- public org.eclipse.cdt.core.index.ICDTIndexer getIndexer(){
- return (org.eclipse.cdt.core.index.ICDTIndexer) indexer;
+ public ICDTIndexer getIndexer(){
+ return indexer;
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.internal.core.index.IIndex#getDeclarations(org.eclipse.cdt.core.dom.ast.IBinding)
+ */
+ public IASTName[] getDeclarations(IBinding binding) {
+ StringBuffer buffer = new StringBuffer();
+
+ buffer.append(convertToIndexDeclString(binding));
+ buffer.append(binding.getNameCharArray());
+
+ return getIndexedNames(buffer.toString().toCharArray(), false);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.internal.core.index.IIndex#getReferences(org.eclipse.cdt.core.dom.ast.IBinding)
+ */
+ public IASTName[] getReferences(IBinding binding) {
+ StringBuffer buffer = new StringBuffer();
+
+ buffer.append(convertToIndexRefString(binding));
+ buffer.append(binding.getNameCharArray());
+
+ return getIndexedNames(buffer.toString().toCharArray(), false);
+ }
+
+ private String convertToIndexDeclString(IBinding binding) {
+ StringBuffer buffer = new StringBuffer();
+
+ // build the prefix used to search the Index for declarations
+ if (binding instanceof IFunction) {
+ buffer.append(IndexerOutput.FUNCTION_DECL);
+ } else if (binding instanceof ICPPNamespace || binding instanceof ICPPNamespaceAlias) {
+ buffer.append(IndexerOutput.NAMESPACE_DECL);
+ } else if (binding instanceof ICPPField) {
+ buffer.append(IndexerOutput.FIELD_DECL);
+ } else if (binding instanceof IEnumerator) {
+ buffer.append(IndexerOutput.ENUMTOR_DECL);
+ } else if (binding instanceof ICPPMethod) {
+ buffer.append(IndexerOutput.METHOD_DECL);
+ } else if (binding instanceof IMacroBinding) {
+ buffer.append(IndexerOutput.MACRO_DECL);
+ } else if (binding instanceof ITypedef) {
+ buffer.append(IndexerOutput.TYPE_DECL);
+ buffer.append(IndexerOutput.TYPEDEF_SUFFIX);
+ buffer.append(IndexerOutput.SEPARATOR);
+ } else if (binding instanceof IVariable) {
+ buffer.append(IndexerOutput.TYPE_DECL);
+ buffer.append(IndexerOutput.VAR_SUFFIX);
+ buffer.append(IndexerOutput.SEPARATOR);
+ } else if (binding instanceof ICPPClassType) {
+ buffer.append(IndexerOutput.TYPE_DECL);
+ buffer.append(IndexerOutput.CLASS_SUFFIX);
+ buffer.append(IndexerOutput.SEPARATOR);
+ } else if (binding instanceof ICompositeType) {
+ try {
+ switch(((ICompositeType)binding).getKey()) {
+ case ICompositeType.k_struct:
+ buffer.append(IndexerOutput.TYPE_DECL);
+ buffer.append(IndexerOutput.STRUCT_SUFFIX);
+ buffer.append(IndexerOutput.SEPARATOR);
+ break;
+ case ICompositeType.k_union:
+ buffer.append(IndexerOutput.TYPE_DECL);
+ buffer.append(IndexerOutput.UNION_SUFFIX);
+ buffer.append(IndexerOutput.SEPARATOR);
+ break;
+ }
+ } catch (DOMException e) {
+ // not sure why this would fail, search everything
+ buffer.append(IndexerOutput.TYPE_DECL);
+ buffer.append(IndexerOutput.SEPARATOR);
+ buffer.append(WILDCARD);
+ buffer.append(IndexerOutput.SEPARATOR);
+ }
+ } else if (binding instanceof IEnumeration) {
+ buffer.append(IndexerOutput.TYPE_DECL);
+ buffer.append(IndexerOutput.ENUM_SUFFIX);
+ buffer.append(IndexerOutput.SEPARATOR);
+ } else {
+ // if all else fails then search all declarations in the index
+ buffer.append(IndexerOutput.TYPE_DECL);
+ buffer.append(IndexerOutput.SEPARATOR);
+ buffer.append(WILDCARD);
+ buffer.append(IndexerOutput.SEPARATOR);
+ }
+
+ return buffer.toString();
+ }
+
+ private String convertToIndexRefString(IBinding binding) {
+ StringBuffer buffer = new StringBuffer();
-
+ // build the prefix used to search the Index for references
+ if (binding instanceof IFunction) {
+ buffer.append(IndexerOutput.FUNCTION_REF);
+ } else if (binding instanceof ICPPNamespace || binding instanceof ICPPNamespaceAlias) {
+ buffer.append(IndexerOutput.NAMESPACE_REF);
+ } else if (binding instanceof ICPPField) {
+ buffer.append(IndexerOutput.FIELD_REF);
+ } else if (binding instanceof IEnumerator) {
+ buffer.append(IndexerOutput.ENUMTOR_REF);
+ } else if (binding instanceof ICPPMethod) {
+ buffer.append(IndexerOutput.METHOD_REF);
+ } else if (binding instanceof IMacroBinding) {
+ buffer.append(IndexerOutput.MACRO_REF);
+ } else if (binding instanceof ITypedef) {
+ buffer.append(IndexerOutput.TYPE_REF);
+ buffer.append(IndexerOutput.TYPEDEF_SUFFIX);
+ buffer.append(IndexerOutput.SEPARATOR);
+ } else if (binding instanceof IVariable) {
+ buffer.append(IndexerOutput.TYPE_REF);
+ buffer.append(IndexerOutput.VAR_SUFFIX);
+ buffer.append(IndexerOutput.SEPARATOR);
+ } else if (binding instanceof ICPPClassType) {
+ buffer.append(IndexerOutput.TYPE_REF);
+ buffer.append(IndexerOutput.CLASS_SUFFIX);
+ buffer.append(IndexerOutput.SEPARATOR);
+ } else if (binding instanceof ICompositeType) {
+ try {
+ switch(((ICompositeType)binding).getKey()) {
+ case ICompositeType.k_struct:
+ buffer.append(IndexerOutput.TYPE_REF);
+ buffer.append(IndexerOutput.STRUCT_SUFFIX);
+ buffer.append(IndexerOutput.SEPARATOR);
+ break;
+ case ICompositeType.k_union:
+ buffer.append(IndexerOutput.TYPE_REF);
+ buffer.append(IndexerOutput.UNION_SUFFIX);
+ buffer.append(IndexerOutput.SEPARATOR);
+ break;
+ }
+ } catch (DOMException e) {
+ // not sure why this would fail, search everything
+ buffer.append(IndexerOutput.TYPE_REF);
+ buffer.append(IndexerOutput.SEPARATOR);
+ buffer.append(WILDCARD);
+ buffer.append(IndexerOutput.SEPARATOR);
+ }
+ } else if (binding instanceof IEnumeration) {
+ buffer.append(IndexerOutput.TYPE_REF);
+ buffer.append(IndexerOutput.ENUM_SUFFIX);
+ buffer.append(IndexerOutput.SEPARATOR);
+ } else {
+ // if all else fails then search all references in the index
+ buffer.append(IndexerOutput.TYPE_REF);
+ buffer.append(IndexerOutput.SEPARATOR);
+ buffer.append(WILDCARD);
+ buffer.append(IndexerOutput.SEPARATOR);
+ }
+ return buffer.toString();
+ }
+
+ private static final char[] TYPE_REF_TYPEDEF = CharArrayUtils.concat(IndexerOutput.TYPE_REF, IndexerOutput.TYPEDEF_SUFFIX);
+ private static final char[] TYPE_DECL_TYPEDEF = CharArrayUtils.concat(IndexerOutput.TYPE_DECL, IndexerOutput.TYPEDEF_SUFFIX);
+ private static final char[] TYPE_REF_VAR = CharArrayUtils.concat(IndexerOutput.TYPE_REF, IndexerOutput.VAR_SUFFIX);
+ private static final char[] TYPE_DECL_VAR = CharArrayUtils.concat(IndexerOutput.TYPE_DECL, IndexerOutput.VAR_SUFFIX);
+ private static final char[] TYPE_REF_CLASS = CharArrayUtils.concat(IndexerOutput.TYPE_REF, IndexerOutput.CLASS_SUFFIX);
+ private static final char[] TYPE_DECL_CLASS = CharArrayUtils.concat(IndexerOutput.TYPE_DECL, IndexerOutput.CLASS_SUFFIX);
+ private static final char[] TYPE_REF_STRUCT = CharArrayUtils.concat(IndexerOutput.TYPE_REF, IndexerOutput.STRUCT_SUFFIX);
+ private static final char[] TYPE_DECL_STRUCT = CharArrayUtils.concat(IndexerOutput.TYPE_DECL, IndexerOutput.STRUCT_SUFFIX);
+ private static final char[] TYPE_REF_UNION = CharArrayUtils.concat(IndexerOutput.TYPE_REF, IndexerOutput.UNION_SUFFIX);
+ private static final char[] TYPE_DECL_UNION = CharArrayUtils.concat(IndexerOutput.TYPE_DECL, IndexerOutput.UNION_SUFFIX);
+ private static final char[] TYPE_REF_ENUM = CharArrayUtils.concat(IndexerOutput.TYPE_REF, IndexerOutput.ENUM_SUFFIX);
+ private static final char[] TYPE_DECL_ENUM = CharArrayUtils.concat(IndexerOutput.TYPE_DECL, IndexerOutput.ENUM_SUFFIX);
+
+ private IBinding convertToIndexBinding(IEntryResult result) {
+ char[] word = result.getWord();
+ if (CharArrayUtils.indexOf(word, IndexerOutput.FUNCTION_REF) >= 0 || CharArrayUtils.indexOf(word, IndexerOutput.FUNCTION_DECL) >= 0) {
+ return new IndexedFunction(result);
+ } else if (CharArrayUtils.indexOf(word, IndexerOutput.NAMESPACE_REF) >= 0 || CharArrayUtils.indexOf(word, IndexerOutput.NAMESPACE_DECL) >= 0) {
+ return new IndexedNamespace(result);
+ } else if (CharArrayUtils.indexOf(word, IndexerOutput.FIELD_REF) >= 0 || CharArrayUtils.indexOf(word, IndexerOutput.FIELD_DECL) >= 0) {
+ return new IndexedField(result);
+ } else if (CharArrayUtils.indexOf(word, IndexerOutput.ENUMTOR_REF) >= 0 || CharArrayUtils.indexOf(word, IndexerOutput.ENUMTOR_DECL) >= 0) {
+ return new IndexedEnumerator(result);
+ } else if (CharArrayUtils.indexOf(word, IndexerOutput.METHOD_REF) >= 0 || CharArrayUtils.indexOf(word, IndexerOutput.METHOD_DECL) >= 0) {
+ return new IndexedMethod(result);
+ } else if (CharArrayUtils.indexOf(word, IndexerOutput.MACRO_REF) >= 0 || CharArrayUtils.indexOf(word, IndexerOutput.MACRO_DECL) >= 0) {
+ return new IndexedMacro(result);
+ } else if (CharArrayUtils.indexOf(word, TYPE_REF_TYPEDEF) >= 0 || CharArrayUtils.indexOf(word, TYPE_DECL_TYPEDEF) >= 0) {
+ return new IndexedTypedef(result);
+ } else if (CharArrayUtils.indexOf(word, TYPE_REF_VAR) >= 0 || CharArrayUtils.indexOf(word, TYPE_DECL_VAR) >= 0) {
+ return new IndexedVariable(result);
+ } else if (CharArrayUtils.indexOf(word, TYPE_REF_CLASS) >= 0 || CharArrayUtils.indexOf(word, TYPE_DECL_CLASS) >= 0) {
+ return new IndexedClass(result);
+ } else if (CharArrayUtils.indexOf(word, TYPE_REF_STRUCT) >= 0 || CharArrayUtils.indexOf(word, TYPE_DECL_STRUCT) >= 0) {
+ return new IndexedStructure(result);
+ } else if (CharArrayUtils.indexOf(word, TYPE_REF_UNION) >= 0 || CharArrayUtils.indexOf(word, TYPE_DECL_UNION) >= 0) {
+ return new IndexedStructure(result);
+ } else if (CharArrayUtils.indexOf(word, TYPE_REF_ENUM) >= 0 || CharArrayUtils.indexOf(word, TYPE_DECL_ENUM) >= 0) {
+ return new IndexedEnumeration(result);
+ } else {
+ return new IndexedProblemBinding(NO_IBINDING_MATCH_FOUND_FOR_IENTRY_RESULT + result.extractSimpleName(), result);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.internal.core.index.IIndex#getDefinition(org.eclipse.cdt.core.dom.ast.IBinding)
+ */
+ public IASTName getDefinition(IBinding binding) {
+ // TODO Devin no definitions on logical AST or indexer yet...
+ return null;
+ }
+
+ /**
+ * Retrieves IASTNames from the index corresponding to the char[] name and will search for prefixes if
+ * prefix is true or only exact matches if prefix is false.
+ *
+ * @param indexSearchPrefix the prefix used to search against the IIndex
+ * @param prefix used to specify whether the name to find is a prefix or not (i.e. c as a prefix for car)
+ * if true, then all names matching the prefix are returned, if false, then all names matching the exact
+ * name only are returned (without limits on where the name is contained)
+ * @return
+ */
+ private IASTName[] getIndexedNames(char[] indexSearchPrefix, boolean prefix) {
+ IEntryResult[] results = null;
+ IndexInput input= new BlocksIndexInput(indexFile);
+ IASTName[] names = null;
+ try {
+ results = input.queryEntriesPrefixedBy(indexSearchPrefix);
+
+ if (!prefix) {
+ // filter the names so that only IEntryResults with the exact name are returned
+ String filterName = EntryResult.extractSimpleName(indexSearchPrefix);
+ for(int i=0; i<results.length; i++) {
+ if (!filterName.equals(results[i].extractSimpleName())) {
+ results[i] = null;
+ }
+ }
+ results = (IEntryResult[])ArrayUtil.removeNulls(IEntryResult.class, results);
+ }
+
+ // build the IASTName[] to return based on the IEntryResult[]
+ names = new IASTName[results.length];
+ ASTIndexedName tempName = null;
+ if (results != null) {
+ for(int i=0; i<results.length; i++) {
+ // create an IBinding for the IEntryResult
+ IBinding resultBinding = convertToIndexBinding(results[i]);
+
+ int[] fileRefs = results[i].getFileReferences();
+ int[][] offsets = results[i].getOffsets();
+ int[][] lengths = results[i].getOffsetLengths();
+
+ // create an IASTName for each reference in the Index
+ for(int j=0; j<offsets.length; j++) {
+ for(int k=0; k<offsets[j].length; k++) {
+ String file=null;
+ try {
+ file = input.getIndexedFile(fileRefs[j]).getPath();
+ } catch (IOException e) {
+ return BLANK_NAME_ARRAY;
+ }
+
+ int offset=Integer.valueOf(String.valueOf(offsets[j][k]).substring(1)).intValue();
+ int length=0;
+ if (j < lengths.length && k < lengths[j].length) {
+ length = lengths[j][k];
+ }
+ tempName = new ASTIndexedName( results[i], offset, length, file );
+ tempName.setBinding(resultBinding);
+ tempName.setOffsetIsLineNumber((Integer.valueOf(String.valueOf(offsets[j][k]).substring(0,1)).intValue() == IndexerOutput.LINE));
+ names = (IASTName[])ArrayUtil.append(IASTName.class, names, tempName);
+ }
+ }
+ }
+ }
+ } catch (IOException e) {
+ return BLANK_NAME_ARRAY;
+ }
+ finally {
+ try {
+ input.close();
+ } catch (IOException e) {
+ return BLANK_NAME_ARRAY;
+ }
+ }
+
+ return (IASTName[])ArrayUtil.trim(IASTName.class, names);
+ }
}
Index: parser/org/eclipse/cdt/core/dom/ast/ASTTypeUtil.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt-core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ASTTypeUtil.java,v
retrieving revision 1.3
diff -u -r1.3 ASTTypeUtil.java
--- parser/org/eclipse/cdt/core/dom/ast/ASTTypeUtil.java 23 Mar 2005 16:25:51 -0000 1.3
+++ parser/org/eclipse/cdt/core/dom/ast/ASTTypeUtil.java 21 Apr 2005 14:42:48 -0000
@@ -374,4 +374,59 @@
return getType(type);
}
+ /**
+ * This can be used to invoke the IType's isConst() if it has one and returns false if it doesn't have
+ * an isConst() method. It is a convenience function so that the structure of IType does not need
+ * to be known to determine if the IType is const or not.
+ * @param type
+ * @return
+ */
+ public static boolean isConst(IType type) {
+ if (type instanceof IQualifierType) {
+ try {
+ return ((IQualifierType)type).isConst();
+ } catch (DOMException e) {
+ return false;
+ }
+ } else if (type instanceof ITypeContainer) {
+ try {
+ return isConst(((ITypeContainer)type).getType());
+ } catch (DOMException e) {
+ return false;
+ }
+ } else if (type instanceof IArrayType) {
+ try {
+ return isConst(((IArrayType)type).getType());
+ } catch (DOMException e) {
+ return false;
+ }
+ } else if (type instanceof ICPPReferenceType) {
+ try {
+ return isConst(((ICPPReferenceType)type).getType());
+ } catch (DOMException e) {
+ return false;
+ }
+ } else if (type instanceof IFunctionType) {
+ try {
+ return isConst(((IFunctionType)type).getReturnType());
+ } catch (DOMException e) {
+ return false;
+ }
+ } else if (type instanceof IPointerType) {
+ try {
+ return isConst(((IPointerType)type).getType());
+ } catch (DOMException e) {
+ return false;
+ }
+ } else if (type instanceof ITypedef) {
+ try {
+ return isConst(((ITypedef)type).getType());
+ } catch (DOMException e) {
+ return false;
+ }
+ } else {
+ return false;
+ }
+ }
+
}
Index: parser/org/eclipse/cdt/core/dom/ast/IProblemBinding.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt-core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IProblemBinding.java,v
retrieving revision 1.7
diff -u -r1.7 IProblemBinding.java
--- parser/org/eclipse/cdt/core/dom/ast/IProblemBinding.java 30 Mar 2005 20:20:41 -0000 1.7
+++ parser/org/eclipse/cdt/core/dom/ast/IProblemBinding.java 21 Apr 2005 14:42:48 -0000
@@ -112,6 +112,12 @@
* invalid redeclaration of the name
*/
public static final int SEMANTIC_INVALID_REDECLARATION = 0x00C;
+
+ /**
+ * A method was invoked on an IBinding that is not supported by
+ * an IIndexedBinding.
+ */
+ public static final int NOT_SUPPORTED_BY_IINDEXEDBINDING_EXCEPTION = 0x00D;
public static final int LAST_PROBLEM = SEMANTIC_INVALID_REDECLARATION;
}
Index: parser/org/eclipse/cdt/core/parser/util/CharArrayUtils.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt-core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/util/CharArrayUtils.java,v
retrieving revision 1.1
diff -u -r1.1 CharArrayUtils.java
--- parser/org/eclipse/cdt/core/parser/util/CharArrayUtils.java 30 Aug 2004 15:17:40 -0000 1.1
+++ parser/org/eclipse/cdt/core/parser/util/CharArrayUtils.java 21 Apr 2005 14:42:49 -0000
@@ -101,6 +101,21 @@
return result;
}
+ public static final char[] concat(char[] first, char second) {
+ char[] result = null;
+ if (first == null) {
+ result = new char[1];
+ result[0] = second;
+ return result;
+ }
+
+ int length1 = first.length;
+ result = new char[length1 + 1];
+ System.arraycopy(first, 0, result, 0, length1);
+ result[length1] = second;
+ return result;
+ }
+
public static final char[] replace(
char[] array,
char[] toBeReplaced,
Index: build.xml
===================================================================
RCS file: build.xml
diff -N build.xml
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ build.xml 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,225 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="org.eclipse.cdt.core" default="build.jars" basedir=".">
+
+ <property name="basews" value="${ws}"/>
+ <property name="baseos" value="${os}"/>
+ <property name="basearch" value="${arch}"/>
+ <property name="basenl" value="${nl}"/>
+
+ <!-- Compiler settings. -->
+ <property name="javacFailOnError" value="false"/>
+ <property name="javacDebugInfo" value="on"/>
+ <property name="javacVerbose" value="true"/>
+ <property name="javacSource" value="1.3"/>
+ <property name="javacTarget" value="1.2"/>
+ <property name="compilerArg" value=""/>
+ <path id="path_bootclasspath">
+ <fileset dir="${java.home}/lib">
+ <include name="*.jar"/>
+ </fileset>
+ </path>
+ <property name="bootclasspath" refid="path_bootclasspath"/>
+
+ <target name="init" depends="properties">
+ <condition property="pluginTemp" value="${buildTempFolder}/plugins">
+ <isset property="buildTempFolder"/>
+ </condition>
+ <property name="pluginTemp" value="${basedir}"/>
+ <condition property="build.result.folder" value="${pluginTemp}/org.eclipse.cdt.core">
+ <isset property="buildTempFolder"/>
+ </condition>
+ <property name="build.result.folder" value="${basedir}"/>
+ <property name="temp.folder" value="${basedir}/temp.folder"/>
+ <property name="plugin.destination" value="${basedir}"/>
+ </target>
+
+ <target name="properties" if="eclipse.running">
+ <property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/>
+
+ </target>
+
+ <target name="build.update.jar" depends="init" description="Build the plug-in: org.eclipse.cdt.core for an update site.">
+ <delete dir="${temp.folder}"/>
+ <mkdir dir="${temp.folder}"/>
+ <antcall target="build.jars"/>
+ <antcall target="gather.bin.parts">
+ <param name="destination.temp.folder" value="${temp.folder}/"/>
+ </antcall>
+ <zip destfile="${plugin.destination}/org.eclipse.cdt.core_3.0.0.jar" basedir="${temp.folder}/org.eclipse.cdt.core_3.0.0" filesonly="false" whenempty="skip" update="false"/>
+ <delete dir="${temp.folder}"/>
+ </target>
+
+ <target name="cdtparser.jar" depends="init" unless="cdtparser.jar" description="Create jar: org.eclipse.cdt.core cdtparser.jar.">
+ <delete dir="${temp.folder}/cdtparser.jar.bin"/>
+ <mkdir dir="${temp.folder}/cdtparser.jar.bin"/>
+ <!-- compile the source code -->
+ <javac destdir="${temp.folder}/cdtparser.jar.bin" failonerror="${javacFailOnError}" verbose="${javacVerbose}" debug="${javacDebugInfo}" includeAntRuntime="no" bootclasspath="${bootclasspath}" source="${javacSource}" target="${javacTarget}" >
+ <compilerarg line="${compilerArg}"/>
+ <classpath>
+ <pathelement path="../../eclipse_3_1M6/eclipse/plugins/org.eclipse.core.resources_3.1.0/resources.jar"/>
+ <pathelement path="../../eclipse_3_1M6/eclipse/plugins/org.eclipse.core.resources.compatibility_3.1.0/resources.jar"/>
+ <pathelement path="../../eclipse_3_1M6/eclipse/plugins/org.eclipse.core.resources.compatibility_3.1.0/compatibility.jar"/>
+ <pathelement path="../../eclipse_3_1M6/eclipse/plugins/org.eclipse.core.resources.win32_3.0.0/resources.jar"/>
+ <pathelement path="../../eclipse_3_1M6/eclipse/plugins/org.eclipse.core.resources.win32_3.0.0/resources-win32.jar"/>
+ <pathelement path="../../eclipse_3_1M6/eclipse/plugins/org.eclipse.core.runtime.compatibility_3.1.0/compatibility.jar"/>
+ <pathelement path="..\..\eclipse_3_1M6\eclipse\plugins\org.eclipse.core.runtime_3.1.0.jar"/>
+ <pathelement path="..\..\eclipse_3_1M6\eclipse\plugins\org.eclipse.osgi_3.1.0.jar"/>
+ <pathelement path="..\..\eclipse_3_1M6\eclipse\plugins\org.eclipse.update.configurator_3.1.0.jar"/>
+ <pathelement path="../../eclipse_3_1M6/eclipse/plugins/org.eclipse.team.core_3.1.0/team.jar"/>
+ <pathelement path="../../eclipse_3_1M6/eclipse/plugins/org.eclipse.text_3.1.0/text.jar"/>
+ <pathelement path="../../eclipse_3_1M6/eclipse/plugins/org.eclipse.core.variables_3.1.0/variables.jar"/>
+ </classpath>
+ <src path="parser/" />
+ </javac>
+ <!-- Copy necessary resources -->
+ <copy todir="${temp.folder}/cdtparser.jar.bin" failonerror="true">
+ <fileset dir="parser/" excludes="**/*.java, **/package.htm*" />
+ </copy>
+ <mkdir dir="${build.result.folder}"/>
+ <jar destfile="${build.result.folder}/cdtparser.jar" basedir="${temp.folder}/cdtparser.jar.bin"/>
+ <delete dir="${temp.folder}/cdtparser.jar.bin"/>
+ </target>
+
+ <target name="cdtparsersrc.zip" depends="init" unless="cdtparsersrc.zip">
+ <mkdir dir="${build.result.folder}"/>
+ <zip destfile="${build.result.folder}/cdtparsersrc.zip" filesonly="false" whenempty="skip" update="false">
+ <fileset dir="parser/" includes="**/*.java" />
+ </zip>
+ </target>
+
+ <target name="cdtcore.jar" depends="init" unless="cdtcore.jar" description="Create jar: org.eclipse.cdt.core cdtcore.jar.">
+ <delete dir="${temp.folder}/cdtcore.jar.bin"/>
+ <mkdir dir="${temp.folder}/cdtcore.jar.bin"/>
+ <!-- compile the source code -->
+ <javac destdir="${temp.folder}/cdtcore.jar.bin" failonerror="${javacFailOnError}" verbose="${javacVerbose}" debug="${javacDebugInfo}" includeAntRuntime="no" bootclasspath="${bootclasspath}" source="${javacSource}" target="${javacTarget}" >
+ <compilerarg line="${compilerArg}"/>
+ <classpath>
+ <pathelement path="../../eclipse_3_1M6/eclipse/plugins/org.eclipse.core.resources_3.1.0/resources.jar"/>
+ <pathelement path="../../eclipse_3_1M6/eclipse/plugins/org.eclipse.core.resources.compatibility_3.1.0/resources.jar"/>
+ <pathelement path="../../eclipse_3_1M6/eclipse/plugins/org.eclipse.core.resources.compatibility_3.1.0/compatibility.jar"/>
+ <pathelement path="../../eclipse_3_1M6/eclipse/plugins/org.eclipse.core.resources.win32_3.0.0/resources.jar"/>
+ <pathelement path="../../eclipse_3_1M6/eclipse/plugins/org.eclipse.core.resources.win32_3.0.0/resources-win32.jar"/>
+ <pathelement path="../../eclipse_3_1M6/eclipse/plugins/org.eclipse.core.runtime.compatibility_3.1.0/compatibility.jar"/>
+ <pathelement path="..\..\eclipse_3_1M6\eclipse\plugins\org.eclipse.core.runtime_3.1.0.jar"/>
+ <pathelement path="..\..\eclipse_3_1M6\eclipse\plugins\org.eclipse.osgi_3.1.0.jar"/>
+ <pathelement path="..\..\eclipse_3_1M6\eclipse\plugins\org.eclipse.update.configurator_3.1.0.jar"/>
+ <pathelement path="../../eclipse_3_1M6/eclipse/plugins/org.eclipse.team.core_3.1.0/team.jar"/>
+ <pathelement path="../../eclipse_3_1M6/eclipse/plugins/org.eclipse.text_3.1.0/text.jar"/>
+ <pathelement path="../../eclipse_3_1M6/eclipse/plugins/org.eclipse.core.variables_3.1.0/variables.jar"/>
+ <pathelement path="${build.result.folder}/bin"/>
+ <pathelement path="${build.result.folder}/../org.eclipse.cdt.core/bin"/>
+ <pathelement path="${build.result.folder}/cdtparser.jar"/>
+ <pathelement path="${build.result.folder}/../org.eclipse.cdt.core/cdtparser.jar"/>
+ </classpath>
+ <src path="index/" />
+ <src path="model/" />
+ <src path="src/" />
+ <src path="utils/" />
+ <src path="search/" />
+ <src path="dependency/" />
+ <src path="browser/" />
+ </javac>
+ <!-- Copy necessary resources -->
+ <copy todir="${temp.folder}/cdtcore.jar.bin" failonerror="true">
+ <fileset dir="index/" excludes="**/*.java, **/package.htm*" />
+ <fileset dir="model/" excludes="**/*.java, **/package.htm*" />
+ <fileset dir="src/" excludes="**/*.java, **/package.htm*" />
+ <fileset dir="utils/" excludes="**/*.java, **/package.htm*" />
+ <fileset dir="search/" excludes="**/*.java, **/package.htm*" />
+ <fileset dir="dependency/" excludes="**/*.java, **/package.htm*" />
+ <fileset dir="browser/" excludes="**/*.java, **/package.htm*" />
+ </copy>
+ <mkdir dir="${build.result.folder}"/>
+ <jar destfile="${build.result.folder}/cdtcore.jar" basedir="${temp.folder}/cdtcore.jar.bin"/>
+ <delete dir="${temp.folder}/cdtcore.jar.bin"/>
+ </target>
+
+ <target name="cdtcoresrc.zip" depends="init" unless="cdtcoresrc.zip">
+ <mkdir dir="${build.result.folder}"/>
+ <zip destfile="${build.result.folder}/cdtcoresrc.zip" filesonly="false" whenempty="skip" update="false">
+ <fileset dir="index/" includes="**/*.java" />
+ <fileset dir="model/" includes="**/*.java" />
+ <fileset dir="src/" includes="**/*.java" />
+ <fileset dir="utils/" includes="**/*.java" />
+ <fileset dir="search/" includes="**/*.java" />
+ <fileset dir="dependency/" includes="**/*.java" />
+ <fileset dir="browser/" includes="**/*.java" />
+ </zip>
+ </target>
+
+ <target name="build.jars" depends="init" description="Build all the jars for the plug-in: org.eclipse.cdt.core.">
+ <available property="cdtparser.jar" file="${build.result.folder}/cdtparser.jar"/>
+ <antcall target="cdtparser.jar"/>
+ <available property="cdtcore.jar" file="${build.result.folder}/cdtcore.jar"/>
+ <antcall target="cdtcore.jar"/>
+ </target>
+
+ <target name="build.sources" depends="init">
+ <available property="cdtparsersrc.zip" file="${build.result.folder}/cdtparsersrc.zip"/>
+ <antcall target="cdtparsersrc.zip"/>
+ <available property="cdtcoresrc.zip" file="${build.result.folder}/cdtcoresrc.zip"/>
+ <antcall target="cdtcoresrc.zip"/>
+ </target>
+
+ <target name="gather.bin.parts" depends="init" if="destination.temp.folder">
+ <mkdir dir="${destination.temp.folder}/org.eclipse.cdt.core_3.0.0"/>
+ <copy todir="${destination.temp.folder}/org.eclipse.cdt.core_3.0.0" failonerror="true">
+ <fileset dir="${build.result.folder}" includes="cdtparser.jar,cdtcore.jar" />
+ </copy>
+ <copy todir="${destination.temp.folder}/org.eclipse.cdt.core_3.0.0" failonerror="true">
+ <fileset dir="${basedir}" includes="plugin.xml,plugin.properties,about.html,cdtparser.jar,cdtcore.jar,template/" />
+ </copy>
+ </target>
+
+ <target name="build.zips" depends="init">
+ </target>
+
+ <target name="gather.sources" depends="init" if="destination.temp.folder">
+ <mkdir dir="${destination.temp.folder}/org.eclipse.cdt.core_3.0.0"/>
+ <copy file="${build.result.folder}/cdtparsersrc.zip" todir="${destination.temp.folder}/org.eclipse.cdt.core_3.0.0" failonerror="false"/>
+ <copy file="${build.result.folder}/cdtcoresrc.zip" todir="${destination.temp.folder}/org.eclipse.cdt.core_3.0.0" failonerror="false"/>
+ <copy todir="${destination.temp.folder}/org.eclipse.cdt.core_3.0.0" failonerror="false">
+ <fileset dir="${basedir}" includes="schema/,doc/,.options" />
+ </copy>
+ </target>
+
+ <target name="gather.logs" depends="init" if="destination.temp.folder">
+ <mkdir dir="${destination.temp.folder}/org.eclipse.cdt.core_3.0.0"/>
+ <copy file="${temp.folder}/cdtparser.jar.bin.log" todir="${destination.temp.folder}/org.eclipse.cdt.core_3.0.0" failonerror="false"/>
+ <copy file="${temp.folder}/cdtcore.jar.bin.log" todir="${destination.temp.folder}/org.eclipse.cdt.core_3.0.0" failonerror="false"/>
+ </target>
+
+ <target name="clean" depends="init" description="Clean the plug-in: org.eclipse.cdt.core of all the zips, jars and logs created.">
+ <delete file="${build.result.folder}/cdtparser.jar"/>
+ <delete file="${build.result.folder}/cdtparsersrc.zip"/>
+ <delete file="${build.result.folder}/cdtcore.jar"/>
+ <delete file="${build.result.folder}/cdtcoresrc.zip"/>
+ <delete file="${plugin.destination}/org.eclipse.cdt.core_3.0.0.jar"/>
+ <delete file="${plugin.destination}/org.eclipse.cdt.core_3.0.0.zip"/>
+ <delete dir="${temp.folder}"/>
+ </target>
+
+ <target name="refresh" depends="init" if="eclipse.running" description="Refresh this folder.">
+ <eclipse.convertPath fileSystemPath="C:/CDT_Head_Indexer_Work/org.eclipse.cdt.core" property="resourcePath"/>
+ <eclipse.refreshLocal resource="${resourcePath}" depth="infinite"/>
+ </target>
+
+ <target name="zip.plugin" depends="init" description="Create a zip containing all the elements for the plug-in: org.eclipse.cdt.core.">
+ <delete dir="${temp.folder}"/>
+ <mkdir dir="${temp.folder}"/>
+ <antcall target="build.jars"/>
+ <antcall target="build.sources"/>
+ <antcall target="gather.bin.parts">
+ <param name="destination.temp.folder" value="${temp.folder}/"/>
+ </antcall>
+ <antcall target="gather.sources">
+ <param name="destination.temp.folder" value="${temp.folder}/"/>
+ </antcall>
+ <delete>
+ <fileset dir="${temp.folder}" includes="**/*.bin.log" />
+ </delete>
+ <zip destfile="${plugin.destination}/org.eclipse.cdt.core_3.0.0.zip" basedir="${temp.folder}" filesonly="true" whenempty="skip" update="false"/>
+ <delete dir="${temp.folder}"/>
+ </target>
+
+</project>
Index: index/org/eclipse/cdt/internal/core/index/cindexstorage/dom/ASTIndexedName.java
===================================================================
RCS file: index/org/eclipse/cdt/internal/core/index/cindexstorage/dom/ASTIndexedName.java
diff -N index/org/eclipse/cdt/internal/core/index/cindexstorage/dom/ASTIndexedName.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ index/org/eclipse/cdt/internal/core/index/cindexstorage/dom/ASTIndexedName.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,226 @@
+/**********************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.cdt.internal.core.index.cindexstorage.dom;
+
+import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
+import org.eclipse.cdt.core.dom.ast.ASTVisitor;
+import org.eclipse.cdt.core.dom.ast.IASTFileLocation;
+import org.eclipse.cdt.core.dom.ast.IASTNode;
+import org.eclipse.cdt.core.dom.ast.IASTNodeLocation;
+import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
+import org.eclipse.cdt.core.dom.ast.IBinding;
+import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
+import org.eclipse.cdt.internal.core.index.IEntryResult;
+import org.eclipse.cdt.internal.core.index.cindexstorage.IndexerOutput;
+
+/**
+ * An IASTIndexedName that corresponds to an IASTName stored in an IIndex.
+ *
+ * @author dsteffle
+ */
+public class ASTIndexedName extends ASTNode implements IASTIndexedName {
+ private IEntryResult result=null;
+ private String file=null;
+ private boolean offsetLineNumber=false;
+ private IBinding binding = null;
+
+ public ASTIndexedName(IEntryResult result, int offset, int length, String file) {
+ setOffsetAndLength(offset, length);
+ this.result = result;
+ this.file = file;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.dom.ast.IASTName#resolveBinding()
+ */
+ public IBinding resolveBinding() {
+ return binding;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.dom.ast.IASTName#getBinding()
+ */
+ public IBinding getBinding() {
+ return binding;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.dom.ast.IASTName#setBinding()
+ */
+ public void setBinding(IBinding binding) {
+ this.binding = binding;
+ }
+
+ /**
+ * returns null
+ */
+ public IBinding[] resolvePrefix() {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.dom.ast.IASTName#toCharArray()
+ */
+ public char[] toCharArray() {
+ return result.extractSimpleName().toCharArray();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.dom.ast.IASTName#isDeclaration()
+ */
+ public boolean isDeclaration() {
+ String word = new String(result.getWord());
+ if (word.indexOf(new String(IndexerOutput.FUNCTION_DECL)) >= 0 ||
+ word.indexOf(new String(IndexerOutput.NAMESPACE_DECL)) >= 0 ||
+ word.indexOf(new String(IndexerOutput.FIELD_DECL)) >= 0 ||
+ word.indexOf(new String(IndexerOutput.ENUMTOR_DECL)) >= 0 ||
+ word.indexOf(new String(IndexerOutput.METHOD_DECL)) >= 0 ||
+ word.indexOf(new String(IndexerOutput.MACRO_DECL)) >= 0 ||
+ word.indexOf(new String(IndexerOutput.TYPE_DECL)) >= 0) {
+ return true;
+ }
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.dom.ast.IASTName#isReference()
+ */
+ public boolean isReference() {
+ String word = new String(result.getWord());
+ if (word.indexOf(new String(IndexerOutput.FUNCTION_REF)) >= 0 ||
+ word.indexOf(new String(IndexerOutput.NAMESPACE_REF)) >= 0 ||
+ word.indexOf(new String(IndexerOutput.FIELD_REF)) >= 0 ||
+ word.indexOf(new String(IndexerOutput.ENUMTOR_REF)) >= 0 ||
+ word.indexOf(new String(IndexerOutput.METHOD_REF)) >= 0 ||
+ word.indexOf(new String(IndexerOutput.MACRO_REF)) >= 0 ||
+ word.indexOf(new String(IndexerOutput.TYPE_REF)) >= 0) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Returns null
+ */
+ public IASTTranslationUnit getTranslationUnit() {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.dom.ast.IASTName#getNodeLocations()
+ */
+ public IASTNodeLocation[] getNodeLocations() {
+ IASTNodeLocation[] locs = new IASTNodeLocation[1];
+ locs[0] = new IndexedFileLocation(this.getOffset(), this.getLength());
+ return locs;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.dom.ast.IASTName#getContainingFilename()
+ */
+ public String getContainingFilename() {
+ return file;
+ }
+
+ /**
+ * Returns null
+ */
+ public IASTNode getParent() {
+ return null;
+ }
+
+ /**
+ * Does nothing
+ */
+ public void setParent(IASTNode node) {
+ }
+
+ /**
+ * Returns null
+ */
+ public ASTNodeProperty getPropertyInParent() {
+ // TODO might be able to build something based on the type of IEntryResult and its name if this is needed
+ return null;
+ }
+
+ /**
+ * Does nothing
+ */
+ public void setPropertyInParent(ASTNodeProperty property) {
+ }
+
+ /**
+ * Does nothing
+ */
+ public boolean accept(ASTVisitor visitor) {
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.dom.ast.IASTName#getRawSignature()
+ */
+ public String getRawSignature() {
+ return result.extractSimpleName();
+ }
+
+ private class IndexedFileLocation implements IASTNodeLocation {
+ private int offset=0, length=0;
+
+ public IndexedFileLocation(int offset, int length) {
+ this.offset = offset;
+ this.length = length;
+ }
+
+ /**
+ * Get the node's offset
+ */
+ public int getNodeOffset() {
+ return offset;
+ }
+
+ /**
+ * Get the node's length
+ */
+ public int getNodeLength() {
+ return length;
+ }
+
+ /**
+ * Returns null
+ */
+ public IASTFileLocation asFileLocation() {
+ return null;
+ }
+
+ }
+
+ /**
+ * Sets the return value of isOffsetLineNumber()
+ * @param value
+ */
+ public void setOffsetIsLineNumber(boolean value) {
+ offsetLineNumber=value;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.internal.core.dom.parser.IASTIndexedName#isOffsetLineNumber()
+ */
+ public boolean isOffsetLineNumber() {
+ return offsetLineNumber;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.internal.core.dom.parser.IASTIndexedName#getIEntryResult()
+ */
+ public IEntryResult getIEntryResult() {
+ return result;
+ }
+}
Index: index/org/eclipse/cdt/internal/core/index/cindexstorage/dom/IASTIndexedName.java
===================================================================
RCS file: index/org/eclipse/cdt/internal/core/index/cindexstorage/dom/IASTIndexedName.java
diff -N index/org/eclipse/cdt/internal/core/index/cindexstorage/dom/IASTIndexedName.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ index/org/eclipse/cdt/internal/core/index/cindexstorage/dom/IASTIndexedName.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,37 @@
+/**********************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.cdt.internal.core.index.cindexstorage.dom;
+
+import org.eclipse.cdt.core.dom.ast.IASTName;
+import org.eclipse.cdt.core.dom.ast.IASTNode;
+import org.eclipse.cdt.internal.core.index.IEntryResult;
+
+/**
+ * This name represents an IASTName that has been stored in an IIndex.
+ *
+ * @author dsteffle
+ */
+public interface IASTIndexedName extends IASTName, IASTNode {
+ /**
+ * This is used to determine if the IASTIndexedName's offset is actually a line number
+ * instead of an offset into the code. This will be true for indexes like the CTags
+ * Indexer that keeps track of IEntryResults as line numbers instead of offsets.
+ * @return
+ */
+ public boolean isOffsetLineNumber();
+
+ /**
+ * Return's the IEntryResult that is stored on the IASTIndexedName. This is the IEntryResult
+ * found in the index that represents the IASTIndexedName.
+ * @return
+ */
+ public IEntryResult getIEntryResult();
+}
Index: index/org/eclipse/cdt/internal/core/index/cindexstorage/dom/IIndexedBinding.java
===================================================================
RCS file: index/org/eclipse/cdt/internal/core/index/cindexstorage/dom/IIndexedBinding.java
diff -N index/org/eclipse/cdt/internal/core/index/cindexstorage/dom/IIndexedBinding.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ index/org/eclipse/cdt/internal/core/index/cindexstorage/dom/IIndexedBinding.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,27 @@
+/**********************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.cdt.internal.core.index.cindexstorage.dom;
+
+import org.eclipse.cdt.core.dom.ast.IBinding;
+import org.eclipse.cdt.internal.core.index.IEntryResult;
+
+/**
+ * This represents an IBinding corresponding to an IASTName that is stored in the IIndex.
+ *
+ * @author dsteffle
+ */
+public interface IIndexedBinding extends IBinding {
+ /**
+ * The IEntryResult that this IBinding corresponds to.
+ * @return
+ */
+ public IEntryResult getIEntryResult();
+}
Index: index/org/eclipse/cdt/internal/core/index/cindexstorage/dom/IndexedClass.java
===================================================================
RCS file: index/org/eclipse/cdt/internal/core/index/cindexstorage/dom/IndexedClass.java
diff -N index/org/eclipse/cdt/internal/core/index/cindexstorage/dom/IndexedClass.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ index/org/eclipse/cdt/internal/core/index/cindexstorage/dom/IndexedClass.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,178 @@
+/**********************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.cdt.internal.core.index.cindexstorage.dom;
+
+import org.eclipse.cdt.core.dom.ast.DOMException;
+import org.eclipse.cdt.core.dom.ast.IBinding;
+import org.eclipse.cdt.core.dom.ast.IField;
+import org.eclipse.cdt.core.dom.ast.IScope;
+import org.eclipse.cdt.core.dom.ast.IType;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPBase;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPField;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
+import org.eclipse.cdt.internal.core.index.IEntryResult;
+
+/**
+ * The IIndexedBinding corresponding to a class that is stored in the IIndex.
+ *
+ * @author dsteffle
+ */
+public class IndexedClass implements ICPPClassType, IIndexedBinding {
+ private static final String NOT_SUPPORTED_BY_INDEXED_CLASS = "Not supported by IndexedClass."; //$NON-NLS-1$
+ IEntryResult result = null;
+
+ public IndexedClass(IEntryResult result) {
+ this.result = result;
+ }
+
+ /**
+ * Throws a DOMException NOT_SUPPORTED_BY_INDEXED_CLASS.
+ */
+ public ICPPBase[] getBases() throws DOMException {
+ throw new DOMException(new IndexedProblemBinding(NOT_SUPPORTED_BY_INDEXED_CLASS, result));
+ }
+
+ /**
+ * Throws a DOMException NOT_SUPPORTED_BY_INDEXED_CLASS.
+ */
+ public IField[] getFields() throws DOMException {
+ throw new DOMException(new IndexedProblemBinding(NOT_SUPPORTED_BY_INDEXED_CLASS, result));
+ }
+
+ /**
+ * Throws a DOMException NOT_SUPPORTED_BY_INDEXED_CLASS.
+ */
+ public IField findField(String name) throws DOMException {
+ throw new DOMException(new IndexedProblemBinding(NOT_SUPPORTED_BY_INDEXED_CLASS, result));
+ }
+
+ /**
+ * Throws a DOMException NOT_SUPPORTED_BY_INDEXED_CLASS.
+ */
+ public ICPPField[] getDeclaredFields() throws DOMException {
+ throw new DOMException(new IndexedProblemBinding(NOT_SUPPORTED_BY_INDEXED_CLASS, result));
+ }
+
+ /**
+ * Throws a DOMException NOT_SUPPORTED_BY_INDEXED_CLASS.
+ */
+ public ICPPMethod[] getMethods() throws DOMException {
+ throw new DOMException(new IndexedProblemBinding(NOT_SUPPORTED_BY_INDEXED_CLASS, result));
+ }
+
+ /**
+ * Throws a DOMException NOT_SUPPORTED_BY_INDEXED_CLASS.
+ */
+ public ICPPMethod[] getAllDeclaredMethods() throws DOMException {
+ throw new DOMException(new IndexedProblemBinding(NOT_SUPPORTED_BY_INDEXED_CLASS, result));
+ }
+
+ /**
+ * Throws a DOMException NOT_SUPPORTED_BY_INDEXED_CLASS.
+ */
+ public ICPPMethod[] getDeclaredMethods() throws DOMException {
+ throw new DOMException(new IndexedProblemBinding(NOT_SUPPORTED_BY_INDEXED_CLASS, result));
+ }
+
+ /**
+ * Throws a DOMException NOT_SUPPORTED_BY_INDEXED_CLASS.
+ */
+ public ICPPConstructor[] getConstructors() throws DOMException {
+ throw new DOMException(new IndexedProblemBinding(NOT_SUPPORTED_BY_INDEXED_CLASS, result));
+ }
+
+ /**
+ * Throws a DOMException NOT_SUPPORTED_BY_INDEXED_CLASS.
+ */
+ public IBinding[] getFriends() throws DOMException {
+ throw new DOMException(new IndexedProblemBinding(NOT_SUPPORTED_BY_INDEXED_CLASS, result));
+ }
+
+ /**
+ * Returns ICPPClassType.k_class.
+ */
+ public int getKey() throws DOMException {
+ return ICPPClassType.k_class;
+ }
+
+ /**
+ * Throws a DOMException NOT_SUPPORTED_BY_INDEXED_CLASS.
+ */
+ public IScope getCompositeScope() throws DOMException {
+ throw new DOMException(new IndexedProblemBinding(NOT_SUPPORTED_BY_INDEXED_CLASS, result));
+ }
+
+ /**
+ * Returns the name of the IIndexedBinding.
+ */
+ public String getName() {
+ return result.extractSimpleName();
+ }
+
+ /**
+ * Returns the name of the IIndexedBinding.
+ */
+ public char[] getNameCharArray() {
+ return result.extractSimpleName().toCharArray();
+ }
+
+ /**
+ * Throws a DOMException NOT_SUPPORTED_BY_INDEXED_CLASS.
+ */
+ public IScope getScope() throws DOMException {
+ throw new DOMException(new IndexedProblemBinding(NOT_SUPPORTED_BY_INDEXED_CLASS, result));
+ }
+
+ /**
+ * Returns null.
+ */
+ public Object clone() {
+ return null;
+ }
+
+ /**
+ * Returns false.
+ */
+ public boolean isSameType(IType type) {
+ return false;
+ }
+
+ /**
+ * Throws a DOMException NOT_SUPPORTED_BY_INDEXED_CLASS.
+ */
+ public String[] getQualifiedName() throws DOMException {
+ throw new DOMException(new IndexedProblemBinding(NOT_SUPPORTED_BY_INDEXED_CLASS, result));
+ }
+
+ /**
+ * Throws a DOMException NOT_SUPPORTED_BY_INDEXED_CLASS.
+ */
+ public char[][] getQualifiedNameCharArray() throws DOMException {
+ throw new DOMException(new IndexedProblemBinding(NOT_SUPPORTED_BY_INDEXED_CLASS, result));
+ }
+
+ /**
+ * Throws a DOMException NOT_SUPPORTED_BY_INDEXED_CLASS.
+ */
+ public boolean isGloballyQualified() throws DOMException {
+ throw new DOMException(new IndexedProblemBinding(NOT_SUPPORTED_BY_INDEXED_CLASS, result));
+ }
+
+ /**
+ * Returns the IEntryResult that is stored in the IIndex corresponding to the IndexedClass.
+ */
+ public IEntryResult getIEntryResult() {
+ return result;
+ }
+
+}
Index: index/org/eclipse/cdt/internal/core/index/cindexstorage/dom/IndexedEnumeration.java
===================================================================
RCS file: index/org/eclipse/cdt/internal/core/index/cindexstorage/dom/IndexedEnumeration.java
diff -N index/org/eclipse/cdt/internal/core/index/cindexstorage/dom/IndexedEnumeration.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ index/org/eclipse/cdt/internal/core/index/cindexstorage/dom/IndexedEnumeration.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,82 @@
+/**********************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.cdt.internal.core.index.cindexstorage.dom;
+
+import org.eclipse.cdt.core.dom.ast.DOMException;
+import org.eclipse.cdt.core.dom.ast.IEnumeration;
+import org.eclipse.cdt.core.dom.ast.IEnumerator;
+import org.eclipse.cdt.core.dom.ast.IScope;
+import org.eclipse.cdt.core.dom.ast.IType;
+import org.eclipse.cdt.internal.core.index.IEntryResult;
+
+/**
+ * The IIndexedBinding corresponding to an enumeration that is stored in the IIndex.
+ *
+ * @author dsteffle
+ */
+public class IndexedEnumeration implements IEnumeration, IIndexedBinding {
+ private static final String NOT_SUPPORTED_BY_INDEXED_ENUMERATION = "Not supported by IndexedEnumeration."; //$NON-NLS-1$
+ IEntryResult result = null;
+
+ public IndexedEnumeration(IEntryResult result) {
+ this.result = result;
+ }
+
+ /**
+ * Throws a DOMException NOT_SUPPORTED_BY_INDEXED_ENUMERATION.
+ */
+ public IEnumerator[] getEnumerators() throws DOMException {
+ throw new DOMException(new IndexedProblemBinding(NOT_SUPPORTED_BY_INDEXED_ENUMERATION, result));
+ }
+
+ /**
+ * Returns the IEntryResult's simple name.
+ */
+ public String getName() {
+ return result.extractSimpleName();
+ }
+
+ /**
+ * Returns the IEntryResult's simple name.
+ */
+ public char[] getNameCharArray() {
+ return result.extractSimpleName().toCharArray();
+ }
+
+ /**
+ * Throws a DOMException NOT_SUPPORTED_BY_INDEXED_ENUMERATION.
+ */
+ public IScope getScope() throws DOMException {
+ throw new DOMException(new IndexedProblemBinding(NOT_SUPPORTED_BY_INDEXED_ENUMERATION, result));
+ }
+
+ /**
+ * Returns null.
+ */
+ public Object clone() {
+ return null;
+ }
+
+ /**
+ * Returns false.
+ */
+ public boolean isSameType(IType type) {
+ return false;
+ }
+
+ /**
+ * Returns the IEntryResult stored in the IIndex corresponding to the IndexedEnumeration.
+ */
+ public IEntryResult getIEntryResult() {
+ return result;
+ }
+
+}
Index: index/org/eclipse/cdt/internal/core/index/cindexstorage/dom/IndexedEnumerator.java
===================================================================
RCS file: index/org/eclipse/cdt/internal/core/index/cindexstorage/dom/IndexedEnumerator.java
diff -N index/org/eclipse/cdt/internal/core/index/cindexstorage/dom/IndexedEnumerator.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ index/org/eclipse/cdt/internal/core/index/cindexstorage/dom/IndexedEnumerator.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,67 @@
+/**********************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.cdt.internal.core.index.cindexstorage.dom;
+
+import org.eclipse.cdt.core.dom.ast.DOMException;
+import org.eclipse.cdt.core.dom.ast.IEnumerator;
+import org.eclipse.cdt.core.dom.ast.IScope;
+import org.eclipse.cdt.core.dom.ast.IType;
+import org.eclipse.cdt.internal.core.index.IEntryResult;
+
+/**
+ * The IIndexedBinding corresponding to a enumerator that is stored in the IIndex.
+ *
+ * @author dsteffle
+ */
+public class IndexedEnumerator implements IEnumerator, IIndexedBinding {
+ private static final String NOT_SUPPORTED_BY_INDEXED_ENUMERATOR = "Not supported by IndexedEnumerator."; //$NON-NLS-1$
+ private IEntryResult result = null;
+
+ public IndexedEnumerator(IEntryResult result) {
+ this.result = result;
+ }
+
+ /**
+ * Throws a DOMException NOT_SUPPORTED_BY_INDEXED_FIELD.
+ */
+ public IType getType() throws DOMException {
+ throw new DOMException(new IndexedProblemBinding(NOT_SUPPORTED_BY_INDEXED_ENUMERATOR, result));
+ }
+
+ /**
+ * Returns the IEntryResult's simple name.
+ */
+ public String getName() {
+ return result.extractSimpleName();
+ }
+
+ /**
+ * Return's the IEntryResult's simple name.
+ */
+ public char[] getNameCharArray() {
+ return result.extractSimpleName().toCharArray();
+ }
+
+ /**
+ * Throws a DOMException NOT_SUPPORTED_BY_INDEXED_FIELD.
+ */
+ public IScope getScope() throws DOMException {
+ throw new DOMException(new IndexedProblemBinding(NOT_SUPPORTED_BY_INDEXED_ENUMERATOR, result));
+ }
+
+ /**
+ * Returns the IEntryResult stored in the IIndex corresponding to the IndexedEnumerator.
+ */
+ public IEntryResult getIEntryResult() {
+ return result;
+ }
+
+}
Index: index/org/eclipse/cdt/internal/core/index/cindexstorage/dom/IndexedField.java
===================================================================
RCS file: index/org/eclipse/cdt/internal/core/index/cindexstorage/dom/IndexedField.java
diff -N index/org/eclipse/cdt/internal/core/index/cindexstorage/dom/IndexedField.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ index/org/eclipse/cdt/internal/core/index/cindexstorage/dom/IndexedField.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,130 @@
+/**********************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.cdt.internal.core.index.cindexstorage.dom;
+
+import org.eclipse.cdt.core.dom.ast.DOMException;
+import org.eclipse.cdt.core.dom.ast.IScope;
+import org.eclipse.cdt.core.dom.ast.IType;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPField;
+import org.eclipse.cdt.internal.core.index.IEntryResult;
+
+/**
+ * The IIndexedBinding corresponding to a field that is stored in the IIndex.
+ *
+ * @author dsteffle
+ */
+public class IndexedField implements ICPPField, IIndexedBinding {
+ private static final String NOT_SUPPORTED_BY_INDEXED_FIELD = "Not supported by IndexedField."; //$NON-NLS-1$
+ private IEntryResult result = null;
+
+ public IndexedField(IEntryResult result) {
+ this.result = result;
+ }
+
+ /**
+ * Throws a DOMException NOT_SUPPORTED_BY_INDEXED_FIELD.
+ */
+ public IType getType() throws DOMException {
+ throw new DOMException(new IndexedProblemBinding(NOT_SUPPORTED_BY_INDEXED_FIELD, result));
+ }
+
+ /**
+ * Throws a DOMException NOT_SUPPORTED_BY_INDEXED_FIELD.
+ */
+ public boolean isStatic() throws DOMException {
+ throw new DOMException(new IndexedProblemBinding(NOT_SUPPORTED_BY_INDEXED_FIELD, result));
+ }
+
+ /**
+ * Throws a DOMException NOT_SUPPORTED_BY_INDEXED_FIELD.
+ */
+ public boolean isExtern() throws DOMException {
+ throw new DOMException(new IndexedProblemBinding(NOT_SUPPORTED_BY_INDEXED_FIELD, result));
+ }
+
+ /**
+ * Throws a DOMException NOT_SUPPORTED_BY_INDEXED_FIELD.
+ */
+ public boolean isAuto() throws DOMException {
+ throw new DOMException(new IndexedProblemBinding(NOT_SUPPORTED_BY_INDEXED_FIELD, result));
+ }
+
+ /**
+ * Throws a DOMException NOT_SUPPORTED_BY_INDEXED_FIELD.
+ */
+ public boolean isRegister() throws DOMException {
+ throw new DOMException(new IndexedProblemBinding(NOT_SUPPORTED_BY_INDEXED_FIELD, result));
+ }
+
+ /**
+ * Returns the IEntryResult's simple name.
+ */
+ public String getName() {
+ return result.extractSimpleName();
+ }
+
+ /**
+ * Returns the IEntryResult's simple name.
+ */
+ public char[] getNameCharArray() {
+ return result.extractSimpleName().toCharArray();
+ }
+
+ /**
+ * Throws a DOMException NOT_SUPPORTED_BY_INDEXED_FIELD.
+ */
+ public IScope getScope() throws DOMException {
+ throw new DOMException(new IndexedProblemBinding(NOT_SUPPORTED_BY_INDEXED_FIELD, result));
+ }
+
+ /**
+ * Throws a DOMException NOT_SUPPORTED_BY_INDEXED_FIELD.
+ */
+ public int getVisibility() throws DOMException {
+ throw new DOMException(new IndexedProblemBinding(NOT_SUPPORTED_BY_INDEXED_FIELD, result));
+ }
+
+ /**
+ * Throws a DOMException NOT_SUPPORTED_BY_INDEXED_FIELD.
+ */
+ public String[] getQualifiedName() throws DOMException {
+ throw new DOMException(new IndexedProblemBinding(NOT_SUPPORTED_BY_INDEXED_FIELD, result));
+ }
+
+ /**
+ * Throws a DOMException NOT_SUPPORTED_BY_INDEXED_FIELD.
+ */
+ public char[][] getQualifiedNameCharArray() throws DOMException {
+ throw new DOMException(new IndexedProblemBinding(NOT_SUPPORTED_BY_INDEXED_FIELD, result));
+ }
+
+ /**
+ * Throws a DOMException NOT_SUPPORTED_BY_INDEXED_FIELD.
+ */
+ public boolean isGloballyQualified() throws DOMException {
+ throw new DOMException(new IndexedProblemBinding(NOT_SUPPORTED_BY_INDEXED_FIELD, result));
+ }
+
+ /**
+ * Throws a DOMException NOT_SUPPORTED_BY_INDEXED_FIELD.
+ */
+ public boolean isMutable() throws DOMException {
+ throw new DOMException(new IndexedProblemBinding(NOT_SUPPORTED_BY_INDEXED_FIELD, result));
+ }
+
+ /**
+ * Returns the IEntryResult stored in the IIndex corresponding to the IndexedField.
+ */
+ public IEntryResult getIEntryResult() {
+ return result;
+ }
+
+}
Index: index/org/eclipse/cdt/internal/core/index/cindexstorage/dom/IndexedFunction.java
===================================================================
RCS file: index/org/eclipse/cdt/internal/core/index/cindexstorage/dom/IndexedFunction.java
diff -N index/org/eclipse/cdt/internal/core/index/cindexstorage/dom/IndexedFunction.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ index/org/eclipse/cdt/internal/core/index/cindexstorage/dom/IndexedFunction.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,152 @@
+/**********************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.cdt.internal.core.index.cindexstorage.dom;
+
+import org.eclipse.cdt.core.dom.ast.DOMException;
+import org.eclipse.cdt.core.dom.ast.IFunctionType;
+import org.eclipse.cdt.core.dom.ast.IParameter;
+import org.eclipse.cdt.core.dom.ast.IScope;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
+import org.eclipse.cdt.internal.core.index.IEntryResult;
+
+/**
+* The IIndexedBinding corresponding to a function that is stored in the IIndex.
+*
+* @author dsteffle
+*/
+public class IndexedFunction implements ICPPFunction, IIndexedBinding {
+ private static final String NOT_SUPPORTED_BY_INDEXED_FUNCTION = "Not supported by IndexedFunction."; //$NON-NLS-1$
+ private IEntryResult result = null;
+
+ public IndexedFunction(IEntryResult result) {
+ this.result = result;
+ }
+
+ /**
+ * Throws a DOMException NOT_SUPPORTED_BY_INDEXED_FUNCTION.
+ */
+ public boolean isMutable() throws DOMException {
+ throw new DOMException(new IndexedProblemBinding(NOT_SUPPORTED_BY_INDEXED_FUNCTION, result));
+ }
+
+ /**
+ * Throws a DOMException NOT_SUPPORTED_BY_INDEXED_FUNCTION.
+ */
+ public boolean isInline() throws DOMException {
+ throw new DOMException(new IndexedProblemBinding(NOT_SUPPORTED_BY_INDEXED_FUNCTION, result));
+ }
+
+ /**
+ * Throws a DOMException NOT_SUPPORTED_BY_INDEXED_FUNCTION.
+ */
+ public IParameter[] getParameters() throws DOMException {
+ throw new DOMException(new IndexedProblemBinding(NOT_SUPPORTED_BY_INDEXED_FUNCTION, result));
+ }
+
+ /**
+ * Throws a DOMException NOT_SUPPORTED_BY_INDEXED_FUNCTION.
+ */
+ public IScope getFunctionScope() throws DOMException {
+ throw new DOMException(new IndexedProblemBinding(NOT_SUPPORTED_BY_INDEXED_FUNCTION, result));
+ }
+
+ /**
+ * Throws a DOMException NOT_SUPPORTED_BY_INDEXED_FUNCTION.
+ */
+ public IFunctionType getType() throws DOMException {
+ throw new DOMException(new IndexedProblemBinding(NOT_SUPPORTED_BY_INDEXED_FUNCTION, result));
+ }
+
+ /**
+ * Throws a DOMException NOT_SUPPORTED_BY_INDEXED_FUNCTION.
+ */
+ public boolean isStatic() throws DOMException {
+ throw new DOMException(new IndexedProblemBinding(NOT_SUPPORTED_BY_INDEXED_FUNCTION, result));
+ }
+
+ /**
+ * Throws a DOMException NOT_SUPPORTED_BY_INDEXED_FUNCTION.
+ */
+ public boolean isExtern() throws DOMException {
+ throw new DOMException(new IndexedProblemBinding(NOT_SUPPORTED_BY_INDEXED_FUNCTION, result));
+ }
+
+ /**
+ * Throws a DOMException NOT_SUPPORTED_BY_INDEXED_FUNCTION.
+ */
+ public boolean isAuto() throws DOMException {
+ throw new DOMException(new IndexedProblemBinding(NOT_SUPPORTED_BY_INDEXED_FUNCTION, result));
+ }
+
+ /**
+ * Throws a DOMException NOT_SUPPORTED_BY_INDEXED_FUNCTION.
+ */
+ public boolean isRegister() throws DOMException {
+ throw new DOMException(new IndexedProblemBinding(NOT_SUPPORTED_BY_INDEXED_FUNCTION, result));
+ }
+
+ /**
+ * Throws a DOMException NOT_SUPPORTED_BY_INDEXED_FUNCTION.
+ */
+ public boolean takesVarArgs() throws DOMException {
+ throw new DOMException(new IndexedProblemBinding(NOT_SUPPORTED_BY_INDEXED_FUNCTION, result));
+ }
+
+ /**
+ * Returns the IEntryResult's simple name.
+ */
+ public String getName() {
+ return result.extractSimpleName();
+ }
+
+ /**
+ * Returns the IEntryResult's simple name.
+ */
+ public char[] getNameCharArray() {
+ return result.extractSimpleName().toCharArray();
+ }
+
+ /**
+ * Throws a DOMException NOT_SUPPORTED_BY_INDEXED_FUNCTION.
+ */
+ public IScope getScope() throws DOMException {
+ throw new DOMException(new IndexedProblemBinding(NOT_SUPPORTED_BY_INDEXED_FUNCTION, result));
+ }
+
+ /**
+ * Throws a DOMException NOT_SUPPORTED_BY_INDEXED_FUNCTION.
+ */
+ public String[] getQualifiedName() throws DOMException {
+ throw new DOMException(new IndexedProblemBinding(NOT_SUPPORTED_BY_INDEXED_FUNCTION, result));
+ }
+
+ /**
+ * Throws a DOMException NOT_SUPPORTED_BY_INDEXED_FUNCTION.
+ */
+ public char[][] getQualifiedNameCharArray() throws DOMException {
+ throw new DOMException(new IndexedProblemBinding(NOT_SUPPORTED_BY_INDEXED_FUNCTION, result));
+ }
+
+ /**
+ * Throws a DOMException NOT_SUPPORTED_BY_INDEXED_FUNCTION.
+ */
+ public boolean isGloballyQualified() throws DOMException {
+ throw new DOMException(new IndexedProblemBinding(NOT_SUPPORTED_BY_INDEXED_FUNCTION, result));
+ }
+
+ /**
+ * Returns the IEntryResult that is stored in the IIndex corresponding to the IndexedFunction.
+ */
+ public IEntryResult getIEntryResult() {
+ return result;
+ }
+
+}
Index: index/org/eclipse/cdt/internal/core/index/cindexstorage/dom/IndexedMacro.java
===================================================================
RCS file: index/org/eclipse/cdt/internal/core/index/cindexstorage/dom/IndexedMacro.java
diff -N index/org/eclipse/cdt/internal/core/index/cindexstorage/dom/IndexedMacro.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ index/org/eclipse/cdt/internal/core/index/cindexstorage/dom/IndexedMacro.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,59 @@
+/**********************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.cdt.internal.core.index.cindexstorage.dom;
+
+import org.eclipse.cdt.core.dom.ast.DOMException;
+import org.eclipse.cdt.core.dom.ast.IMacroBinding;
+import org.eclipse.cdt.core.dom.ast.IScope;
+import org.eclipse.cdt.internal.core.index.IEntryResult;
+
+/**
+ * The IIndexedBinding corresponding to a macro that is stored in the IIndex.
+ *
+ * @author dsteffle
+ */
+public class IndexedMacro implements IMacroBinding, IIndexedBinding {
+ private static final String NOT_SUPPORTED_BY_INDEXED_MACRO = "Not supported by IndexedMacro."; //$NON-NLS-1$
+ IEntryResult result = null;
+
+ public IndexedMacro(IEntryResult result) {
+ this.result = result;
+ }
+
+ /**
+ * Returns the IEntryResult's simple name.
+ */
+ public String getName() {
+ return result.extractSimpleName();
+ }
+
+ /**
+ * Returns the IEntryResult's simple name.
+ */
+ public char[] getNameCharArray() {
+ return result.extractSimpleName().toCharArray();
+ }
+
+ /**
+ * Throws a DOMException NOT_SUPPORTED_BY_INDEXED_MACRO.
+ */
+ public IScope getScope() throws DOMException {
+ throw new DOMException(new IndexedProblemBinding(NOT_SUPPORTED_BY_INDEXED_MACRO, result));
+ }
+
+ /**
+ * Returns the IEntryResult stored in the IIndex corresponding to the IndexedMacro.
+ */
+ public IEntryResult getIEntryResult() {
+ return result;
+ }
+
+}
Index: index/org/eclipse/cdt/internal/core/index/cindexstorage/dom/IndexedMethod.java
===================================================================
RCS file: index/org/eclipse/cdt/internal/core/index/cindexstorage/dom/IndexedMethod.java
diff -N index/org/eclipse/cdt/internal/core/index/cindexstorage/dom/IndexedMethod.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ index/org/eclipse/cdt/internal/core/index/cindexstorage/dom/IndexedMethod.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,166 @@
+/**********************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.cdt.internal.core.index.cindexstorage.dom;
+
+import org.eclipse.cdt.core.dom.ast.DOMException;
+import org.eclipse.cdt.core.dom.ast.IFunctionType;
+import org.eclipse.cdt.core.dom.ast.IParameter;
+import org.eclipse.cdt.core.dom.ast.IScope;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
+import org.eclipse.cdt.internal.core.index.IEntryResult;
+
+/**
+ * The IIndexedBinding corresponding to a method that is stored in the IIndex.
+ *
+ * @author dsteffle
+ */
+public class IndexedMethod implements ICPPMethod, IIndexedBinding {
+ private static final String NOT_SUPPORTED_BY_INDEXED_METHOD = "Not supported by IndexedMethod."; //$NON-NLS-1$
+ private IEntryResult result = null;
+
+ public IndexedMethod(IEntryResult result) {
+ this.result = result;
+ }
+
+ /**
+ * Throws a DOMException NOT_SUPPORTED_BY_INDEXED_METHOD.
+ */
+ public boolean isVirtual() throws DOMException {
+ throw new DOMException(new IndexedProblemBinding(NOT_SUPPORTED_BY_INDEXED_METHOD, result));
+ }
+
+ /**
+ * Throws a DOMException NOT_SUPPORTED_BY_INDEXED_METHOD.
+ */
+ public boolean isMutable() throws DOMException {
+ throw new DOMException(new IndexedProblemBinding(NOT_SUPPORTED_BY_INDEXED_METHOD, result));
+ }
+
+ /**
+ * Throws a DOMException NOT_SUPPORTED_BY_INDEXED_METHOD.
+ */
+ public boolean isInline() throws DOMException {
+ throw new DOMException(new IndexedProblemBinding(NOT_SUPPORTED_BY_INDEXED_METHOD, result));
+ }
+
+ /**
+ * Throws a DOMException NOT_SUPPORTED_BY_INDEXED_METHOD.
+ */
+ public IParameter[] getParameters() throws DOMException {
+ throw new DOMException(new IndexedProblemBinding(NOT_SUPPORTED_BY_INDEXED_METHOD, result));
+ }
+
+ /**
+ * Throws a DOMException NOT_SUPPORTED_BY_INDEXED_METHOD.
+ */
+ public IScope getFunctionScope() throws DOMException {
+ throw new DOMException(new IndexedProblemBinding(NOT_SUPPORTED_BY_INDEXED_METHOD, result));
+ }
+
+ /**
+ * Throws a DOMException NOT_SUPPORTED_BY_INDEXED_METHOD.
+ */
+ public IFunctionType getType() throws DOMException {
+ throw new DOMException(new IndexedProblemBinding(NOT_SUPPORTED_BY_INDEXED_METHOD, result));
+ }
+
+ /**
+ * Throws a DOMException NOT_SUPPORTED_BY_INDEXED_METHOD.
+ */
+ public boolean isStatic() throws DOMException {
+ throw new DOMException(new IndexedProblemBinding(NOT_SUPPORTED_BY_INDEXED_METHOD, result));
+ }
+
+ /**
+ * Throws a DOMException NOT_SUPPORTED_BY_INDEXED_METHOD.
+ */
+ public boolean isExtern() throws DOMException {
+ throw new DOMException(new IndexedProblemBinding(NOT_SUPPORTED_BY_INDEXED_METHOD, result));
+ }
+
+ /**
+ * Throws a DOMException NOT_SUPPORTED_BY_INDEXED_METHOD.
+ */
+ public boolean isAuto() throws DOMException {
+ throw new DOMException(new IndexedProblemBinding(NOT_SUPPORTED_BY_INDEXED_METHOD, result));
+ }
+
+ /**
+ * Throws a DOMException NOT_SUPPORTED_BY_INDEXED_METHOD.
+ */
+ public boolean isRegister() throws DOMException {
+ throw new DOMException(new IndexedProblemBinding(NOT_SUPPORTED_BY_INDEXED_METHOD, result));
+ }
+
+ /**
+ * Throws a DOMException NOT_SUPPORTED_BY_INDEXED_METHOD.
+ */
+ public boolean takesVarArgs() throws DOMException {
+ throw new DOMException(new IndexedProblemBinding(NOT_SUPPORTED_BY_INDEXED_METHOD, result));
+ }
+
+ /**
+ * Returns the IEntryResult's simple name.
+ */
+ public String getName() {
+ return result.extractSimpleName();
+ }
+
+ /**
+ * Returns the IEntryResult's simple name.
+ */
+ public char[] getNameCharArray() {
+ return result.extractSimpleName().toCharArray();
+ }
+
+ /**
+ * Throws a DOMException NOT_SUPPORTED_BY_INDEXED_METHOD.
+ */
+ public IScope getScope() throws DOMException {
+ throw new DOMException(new IndexedProblemBinding(NOT_SUPPORTED_BY_INDEXED_METHOD, result));
+ }
+
+ /**
+ * Throws a DOMException NOT_SUPPORTED_BY_INDEXED_METHOD.
+ */
+ public String[] getQualifiedName() throws DOMException {
+ throw new DOMException(new IndexedProblemBinding(NOT_SUPPORTED_BY_INDEXED_METHOD, result));
+ }
+
+ /**
+ * Throws a DOMException NOT_SUPPORTED_BY_INDEXED_METHOD.
+ */
+ public char[][] getQualifiedNameCharArray() throws DOMException {
+ throw new DOMException(new IndexedProblemBinding(NOT_SUPPORTED_BY_INDEXED_METHOD, result));
+ }
+
+ /**
+ * Throws a DOMException NOT_SUPPORTED_BY_INDEXED_METHOD.
+ */
+ public boolean isGloballyQualified() throws DOMException {
+ throw new DOMException(new IndexedProblemBinding(NOT_SUPPORTED_BY_INDEXED_METHOD, result));
+ }
+
+ /**
+ * Throws a DOMException NOT_SUPPORTED_BY_INDEXED_METHOD.
+ */
+ public int getVisibility() throws DOMException {
+ throw new DOMException(new IndexedProblemBinding(NOT_SUPPORTED_BY_INDEXED_METHOD, result));
+ }
+
+ /**
+ * Returns the IEntryResult stored in the IIndex corresponding to the IndexedMethod.
+ */
+ public IEntryResult getIEntryResult() {
+ return result;
+ }
+
+}
Index: index/org/eclipse/cdt/internal/core/index/cindexstorage/dom/IndexedNamespace.java
===================================================================
RCS file: index/org/eclipse/cdt/internal/core/index/cindexstorage/dom/IndexedNamespace.java
diff -N index/org/eclipse/cdt/internal/core/index/cindexstorage/dom/IndexedNamespace.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ index/org/eclipse/cdt/internal/core/index/cindexstorage/dom/IndexedNamespace.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,88 @@
+/**********************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.cdt.internal.core.index.cindexstorage.dom;
+
+import org.eclipse.cdt.core.dom.ast.DOMException;
+import org.eclipse.cdt.core.dom.ast.IScope;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespace;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespaceScope;
+import org.eclipse.cdt.internal.core.index.IEntryResult;
+
+/**
+ * The IIndexedBinding corresponding to a namespace that is stored in the IIndex.
+ *
+ * @author dsteffle
+ */
+public class IndexedNamespace implements ICPPNamespace, IIndexedBinding {
+ private static final String NOT_SUPPORTED_BY_INDEXED_NAMESPACE = "Not supported by IndexedNamespace."; //$NON-NLS-1$
+ private IEntryResult result=null;
+
+ public IndexedNamespace(IEntryResult result) {
+ this.result = result;
+ }
+
+ /**
+ * Throws a DOMException NOT_SUPPORTED_BY_INDEXED_NAMESPACE.
+ */
+ public ICPPNamespaceScope getNamespaceScope() throws DOMException {
+ throw new DOMException(new IndexedProblemBinding(NOT_SUPPORTED_BY_INDEXED_NAMESPACE, result));
+ }
+
+ /**
+ * Throws a DOMException NOT_SUPPORTED_BY_INDEXED_NAMESPACE.
+ */
+ public String[] getQualifiedName() throws DOMException {
+ throw new DOMException(new IndexedProblemBinding(NOT_SUPPORTED_BY_INDEXED_NAMESPACE, result));
+ }
+
+ /**
+ * Throws a DOMException NOT_SUPPORTED_BY_INDEXED_NAMESPACE.
+ */
+ public char[][] getQualifiedNameCharArray() throws DOMException {
+ throw new DOMException(new IndexedProblemBinding(NOT_SUPPORTED_BY_INDEXED_NAMESPACE, result));
+ }
+
+ /**
+ * Throws a DOMException NOT_SUPPORTED_BY_INDEXED_NAMESPACE.
+ */
+ public boolean isGloballyQualified() throws DOMException {
+ throw new DOMException(new IndexedProblemBinding(NOT_SUPPORTED_BY_INDEXED_NAMESPACE, result));
+ }
+
+ /**
+ * Returns the IEntryResult's simple name.
+ */
+ public String getName() {
+ return result.extractSimpleName();
+ }
+
+ /**
+ * Returns the IEntryResult's simple name.
+ */
+ public char[] getNameCharArray() {
+ return result.extractSimpleName().toCharArray();
+ }
+
+ /**
+ * Throws a DOMException NOT_SUPPORTED_BY_INDEXED_NAMESPACE.
+ */
+ public IScope getScope() throws DOMException {
+ throw new DOMException(new IndexedProblemBinding(NOT_SUPPORTED_BY_INDEXED_NAMESPACE, result));
+ }
+
+ /**
+ * Returns the IEntryResult stored in the IIndex corresponding to the IndexedNamespace.
+ */
+ public IEntryResult getIEntryResult() {
+ return result;
+ }
+
+}
Index: index/org/eclipse/cdt/internal/core/index/cindexstorage/dom/IndexedProblemBinding.java
===================================================================
RCS file: index/org/eclipse/cdt/internal/core/index/cindexstorage/dom/IndexedProblemBinding.java
diff -N index/org/eclipse/cdt/internal/core/index/cindexstorage/dom/IndexedProblemBinding.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ index/org/eclipse/cdt/internal/core/index/cindexstorage/dom/IndexedProblemBinding.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,115 @@
+/**********************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.cdt.internal.core.index.cindexstorage.dom;
+
+import org.eclipse.cdt.core.dom.ast.DOMException;
+import org.eclipse.cdt.core.dom.ast.IASTName;
+import org.eclipse.cdt.core.dom.ast.IASTNode;
+import org.eclipse.cdt.core.dom.ast.IBinding;
+import org.eclipse.cdt.core.dom.ast.IProblemBinding;
+import org.eclipse.cdt.core.dom.ast.IScope;
+import org.eclipse.cdt.core.dom.ast.IType;
+import org.eclipse.cdt.internal.core.index.IEntryResult;
+
+/**
+ * Represents a problem with an IIndexedBinding.
+ *
+ * @author dsteffle
+ */
+public class IndexedProblemBinding implements IProblemBinding {
+
+ private String message=null;
+ private IEntryResult result=null;
+
+ public IndexedProblemBinding(String message, IEntryResult result) {
+ this.message = message;
+ this.result = result;
+ }
+
+ public int getID() {
+ return NOT_SUPPORTED_BY_IINDEXEDBINDING_EXCEPTION;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public IASTNode getASTNode() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public String getName() {
+ return new String(result.getWord());
+ }
+
+ public char[] getNameCharArray() {
+ return result.getWord();
+ }
+
+ public IScope getScope() throws DOMException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public IASTName getScopeName() throws DOMException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public IScope getParent() throws DOMException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public IBinding[] find(String name) throws DOMException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public IASTNode getPhysicalNode() throws DOMException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void addName(IASTName name) throws DOMException {
+ // TODO Auto-generated method stub
+ }
+
+ public void removeBinding(IBinding binding) throws DOMException {
+ // TODO Auto-generated method stub
+ }
+
+ public IBinding getBinding(IASTName name, boolean resolve) throws DOMException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void setFullyCached(boolean b) throws DOMException {
+ // TODO Auto-generated method stub
+ }
+
+ public boolean isFullyCached() throws DOMException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public Object clone() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public boolean isSameType(IType type) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+}
Index: index/org/eclipse/cdt/internal/core/index/cindexstorage/dom/IndexedStructure.java
===================================================================
RCS file: index/org/eclipse/cdt/internal/core/index/cindexstorage/dom/IndexedStructure.java
diff -N index/org/eclipse/cdt/internal/core/index/cindexstorage/dom/IndexedStructure.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ index/org/eclipse/cdt/internal/core/index/cindexstorage/dom/IndexedStructure.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,121 @@
+/**********************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.cdt.internal.core.index.cindexstorage.dom;
+
+import org.eclipse.cdt.core.dom.ast.DOMException;
+import org.eclipse.cdt.core.dom.ast.ICompositeType;
+import org.eclipse.cdt.core.dom.ast.IField;
+import org.eclipse.cdt.core.dom.ast.IScope;
+import org.eclipse.cdt.core.dom.ast.IType;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
+import org.eclipse.cdt.internal.core.index.IEntryResult;
+import org.eclipse.cdt.internal.core.index.cindexstorage.IndexerOutput;
+
+/**
+ * The IIndexedBinding corresponding to a structure (struct or union) that is stored in the IIndex.
+ *
+ * @author dsteffle
+ */
+public class IndexedStructure implements ICompositeType, IIndexedBinding {
+ private static final String NOT_SUPPORTED_BY_INDEXED_STRUCTURE = "Not supported by IndexedStructure."; //$NON-NLS-1$
+ private IEntryResult result = null;
+
+ public IndexedStructure(IEntryResult result) {
+ this.result = result;
+ }
+
+ /**
+ * Returns ICompositeType.k_struct if this is a struct or
+ * ICompositeType.k_union if this is a union or
+ * ICPPClassType.k_class otherwise.
+ */
+ public int getKey() throws DOMException {
+ String aWord = new String(result.getWord());
+ StringBuffer buffer = new StringBuffer();
+
+ buffer.append(IndexerOutput.TYPE_DECL);
+ buffer.append(IndexerOutput.STRUCT_SUFFIX);
+ if (aWord.indexOf(buffer.toString()) >= 0) {
+ return ICompositeType.k_struct;
+ }
+
+ buffer.append(IndexerOutput.TYPE_DECL);
+ buffer.append(IndexerOutput.UNION_SUFFIX);
+ if (aWord.indexOf(buffer.toString()) >= 0) {
+ return ICompositeType.k_union;
+ }
+
+ return ICPPClassType.k_class;
+ }
+
+ /**
+ * Throws a DOMException NOT_SUPPORTED_BY_INDEXED_STRUCTURE.
+ */
+ public IField[] getFields() throws DOMException {
+ throw new DOMException(new IndexedProblemBinding(NOT_SUPPORTED_BY_INDEXED_STRUCTURE, result));
+ }
+
+ /**
+ * Throws a DOMException NOT_SUPPORTED_BY_INDEXED_STRUCTURE.
+ */
+ public IField findField(String name) throws DOMException {
+ throw new DOMException(new IndexedProblemBinding(NOT_SUPPORTED_BY_INDEXED_STRUCTURE, result));
+ }
+
+ /**
+ * Throws a DOMException NOT_SUPPORTED_BY_INDEXED_STRUCTURE.
+ */
+ public IScope getCompositeScope() throws DOMException {
+ throw new DOMException(new IndexedProblemBinding(NOT_SUPPORTED_BY_INDEXED_STRUCTURE, result));
+ }
+
+ /**
+ * Returns the IEntryResult's simple name.
+ */
+ public String getName() {
+ return result.extractSimpleName();
+ }
+
+ /**
+ * Returns the IEntryResult's simple name.
+ */
+ public char[] getNameCharArray() {
+ return result.extractSimpleName().toCharArray();
+ }
+
+ /**
+ * Throws a DOMException NOT_SUPPORTED_BY_INDEXED_STRUCTURE.
+ */
+ public IScope getScope() throws DOMException {
+ throw new DOMException(new IndexedProblemBinding(NOT_SUPPORTED_BY_INDEXED_STRUCTURE, result));
+ }
+
+ /**
+ * Returns null.
+ */
+ public Object clone() {
+ return null;
+ }
+
+ /**
+ * Returns false.
+ */
+ public boolean isSameType(IType type) {
+ return false;
+ }
+
+ /**
+ * Returns the IEntryResult stored in the IIndex corresponding to the IndexedStructure.
+ */
+ public IEntryResult getIEntryResult() {
+ return result;
+ }
+}
Index: index/org/eclipse/cdt/internal/core/index/cindexstorage/dom/IndexedTypedef.java
===================================================================
RCS file: index/org/eclipse/cdt/internal/core/index/cindexstorage/dom/IndexedTypedef.java
diff -N index/org/eclipse/cdt/internal/core/index/cindexstorage/dom/IndexedTypedef.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ index/org/eclipse/cdt/internal/core/index/cindexstorage/dom/IndexedTypedef.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,81 @@
+/**********************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.cdt.internal.core.index.cindexstorage.dom;
+
+import org.eclipse.cdt.core.dom.ast.DOMException;
+import org.eclipse.cdt.core.dom.ast.IScope;
+import org.eclipse.cdt.core.dom.ast.IType;
+import org.eclipse.cdt.core.dom.ast.ITypedef;
+import org.eclipse.cdt.internal.core.index.IEntryResult;
+
+/**
+ * The IIndexedBinding corresponding to a typedef that is stored in the IIndex.
+ *
+ * @author dsteffle
+ */
+public class IndexedTypedef implements ITypedef, IIndexedBinding {
+ private static final String NOT_SUPPORTED_BY_INDEXED_TYPEDEF = "Not supported by IndexedTypedef."; //$NON-NLS-1$
+ private IEntryResult result = null;
+
+ public IndexedTypedef(IEntryResult result) {
+ this.result = result;
+ }
+
+ /**
+ * Throws a DOMException NOT_SUPPORTED_BY_INDEXED_TYPEDEF.
+ */
+ public IType getType() throws DOMException {
+ throw new DOMException(new IndexedProblemBinding(NOT_SUPPORTED_BY_INDEXED_TYPEDEF, result));
+ }
+
+ /**
+ * Returns the IEntryResult's simple name.
+ */
+ public String getName() {
+ return result.extractSimpleName();
+ }
+
+ /**
+ * Returns the IEntryResult's simple name.
+ */
+ public char[] getNameCharArray() {
+ return result.extractSimpleName().toCharArray();
+ }
+
+ /**
+ * Throws a DOMException NOT_SUPPORTED_BY_INDEXED_TYPEDEF.
+ */
+ public IScope getScope() throws DOMException {
+ throw new DOMException(new IndexedProblemBinding(NOT_SUPPORTED_BY_INDEXED_TYPEDEF, result));
+ }
+
+ /**
+ * Returns null.
+ */
+ public Object clone() {
+ return null;
+ }
+
+ /**
+ * Returns false.
+ */
+ public boolean isSameType(IType type) {
+ return false;
+ }
+
+ /**
+ * Returns the IEntryResult stored in the IIndex corresponding to the IndexedTypedef.
+ */
+ public IEntryResult getIEntryResult() {
+ return result;
+ }
+
+}
Index: index/org/eclipse/cdt/internal/core/index/cindexstorage/dom/IndexedVariable.java
===================================================================
RCS file: index/org/eclipse/cdt/internal/core/index/cindexstorage/dom/IndexedVariable.java
diff -N index/org/eclipse/cdt/internal/core/index/cindexstorage/dom/IndexedVariable.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ index/org/eclipse/cdt/internal/core/index/cindexstorage/dom/IndexedVariable.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,95 @@
+/**********************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.cdt.internal.core.index.cindexstorage.dom;
+
+import org.eclipse.cdt.core.dom.ast.DOMException;
+import org.eclipse.cdt.core.dom.ast.IScope;
+import org.eclipse.cdt.core.dom.ast.IType;
+import org.eclipse.cdt.core.dom.ast.IVariable;
+import org.eclipse.cdt.internal.core.index.IEntryResult;
+
+/**
+ * The IIndexedBinding corresponding to a variable that is stored in the IIndex.
+ *
+ * @author dsteffle
+ */
+public class IndexedVariable implements IVariable, IIndexedBinding {
+ private static final String NOT_SUPPORTED_BY_INDEXED_VARIABLE = "Not supported by IndexedVariable."; //$NON-NLS-1$
+ private IEntryResult result = null;
+
+ public IndexedVariable(IEntryResult result) {
+ this.result = result;
+ }
+
+ /**
+ * Throws a DOMException NOT_SUPPORTED_BY_INDEXED_VARIABLE.
+ */
+ public IType getType() throws DOMException {
+ throw new DOMException(new IndexedProblemBinding(NOT_SUPPORTED_BY_INDEXED_VARIABLE, result));
+ }
+
+ /**
+ * Throws a DOMException NOT_SUPPORTED_BY_INDEXED_VARIABLE.
+ */
+ public boolean isStatic() throws DOMException {
+ throw new DOMException(new IndexedProblemBinding(NOT_SUPPORTED_BY_INDEXED_VARIABLE, result));
+ }
+
+ /**
+ * Throws a DOMException NOT_SUPPORTED_BY_INDEXED_VARIABLE.
+ */
+ public boolean isExtern() throws DOMException {
+ throw new DOMException(new IndexedProblemBinding(NOT_SUPPORTED_BY_INDEXED_VARIABLE, result));
+ }
+
+ /**
+ * Throws a DOMException NOT_SUPPORTED_BY_INDEXED_VARIABLE.
+ */
+ public boolean isAuto() throws DOMException {
+ throw new DOMException(new IndexedProblemBinding(NOT_SUPPORTED_BY_INDEXED_VARIABLE, result));
+ }
+
+ /**
+ * Throws a DOMException NOT_SUPPORTED_BY_INDEXED_VARIABLE.
+ */
+ public boolean isRegister() throws DOMException {
+ throw new DOMException(new IndexedProblemBinding(NOT_SUPPORTED_BY_INDEXED_VARIABLE, result));
+ }
+
+ /**
+ * Return's the IEntryResult's simple name.
+ */
+ public String getName() {
+ return result.extractSimpleName();
+ }
+
+ /**
+ * Returns the IEntryResult's simple name.
+ */
+ public char[] getNameCharArray() {
+ return result.extractSimpleName().toCharArray();
+ }
+
+ /**
+ * Throws a DOMException NOT_SUPPORTED_BY_INDEXED_VARIABLE.
+ */
+ public IScope getScope() throws DOMException {
+ throw new DOMException(new IndexedProblemBinding(NOT_SUPPORTED_BY_INDEXED_VARIABLE, result));
+ }
+
+ /**
+ * Returns the IEntryResult stored in the IIndex corresponding to the IndexedVariable.
+ */
+ public IEntryResult getIEntryResult() {
+ return result;
+ }
+
+}