mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52:11 +02:00
Update to constant references in search patterns
This commit is contained in:
parent
277bec9a0d
commit
85f5ea3b48
9 changed files with 46 additions and 46 deletions
|
@ -17,9 +17,9 @@ import org.eclipse.cdt.core.browser.PathUtil;
|
|||
import org.eclipse.cdt.internal.core.CharOperation;
|
||||
import org.eclipse.cdt.internal.core.index.IEntryResult;
|
||||
import org.eclipse.cdt.internal.core.index.IIndex;
|
||||
import org.eclipse.cdt.internal.core.index.cindexstorage.ICIndexStorageConstants;
|
||||
import org.eclipse.cdt.internal.core.index.cindexstorage.Index;
|
||||
import org.eclipse.cdt.internal.core.index.cindexstorage.IndexedFileEntry;
|
||||
import org.eclipse.cdt.internal.core.index.cindexstorage.IndexerOutput;
|
||||
import org.eclipse.cdt.internal.core.index.cindexstorage.io.BlocksIndexInput;
|
||||
import org.eclipse.cdt.internal.core.index.cindexstorage.io.IndexInput;
|
||||
import org.eclipse.cdt.internal.core.search.indexing.IndexManager;
|
||||
|
@ -91,7 +91,7 @@ public class IndexerDependenciesJob extends IndexerJob {
|
|||
|
||||
private IPath getIncludePath(IEntryResult entry) {
|
||||
char[] word = entry.getWord();
|
||||
int firstSlash = CharOperation.indexOf(IndexerOutput.SEPARATOR, word, 0);
|
||||
int firstSlash = CharOperation.indexOf(ICIndexStorageConstants.SEPARATOR, word, 0);
|
||||
String include = String.valueOf(CharOperation.subarray(word, firstSlash + 1, -1));
|
||||
return PathUtil.getWorkspaceRelativePath(include);
|
||||
}
|
||||
|
|
|
@ -22,9 +22,9 @@ import org.eclipse.cdt.core.model.ICElement;
|
|||
import org.eclipse.cdt.internal.core.CharOperation;
|
||||
import org.eclipse.cdt.internal.core.index.IEntryResult;
|
||||
import org.eclipse.cdt.internal.core.index.IIndex;
|
||||
import org.eclipse.cdt.internal.core.index.cindexstorage.ICIndexStorageConstants;
|
||||
import org.eclipse.cdt.internal.core.index.cindexstorage.Index;
|
||||
import org.eclipse.cdt.internal.core.index.cindexstorage.IndexedFileEntry;
|
||||
import org.eclipse.cdt.internal.core.index.cindexstorage.IndexerOutput;
|
||||
import org.eclipse.cdt.internal.core.index.cindexstorage.io.BlocksIndexInput;
|
||||
import org.eclipse.cdt.internal.core.index.cindexstorage.io.IndexInput;
|
||||
import org.eclipse.cdt.internal.core.search.indexing.IndexManager;
|
||||
|
@ -73,8 +73,8 @@ public class IndexerTypesJob extends IndexerJob {
|
|||
|
||||
IEntryResult entry = namespaceEntries[i];
|
||||
char[] word = entry.getWord();
|
||||
int firstSlash = CharOperation.indexOf(IndexerOutput.SEPARATOR, word, 0);
|
||||
int slash = CharOperation.indexOf(IndexerOutput.SEPARATOR, word, firstSlash + 1);
|
||||
int firstSlash = CharOperation.indexOf(ICIndexStorageConstants.SEPARATOR, word, 0);
|
||||
int slash = CharOperation.indexOf(ICIndexStorageConstants.SEPARATOR, word, firstSlash + 1);
|
||||
String name = String.valueOf(CharOperation.subarray(word, firstSlash + 1, slash));
|
||||
if (name.length() != 0) {
|
||||
String[] enclosingNames = getEnclosingNames(word, slash);
|
||||
|
@ -98,20 +98,20 @@ public class IndexerTypesJob extends IndexerJob {
|
|||
|
||||
IEntryResult entry = typeEntries[i];
|
||||
char[] word = entry.getWord();
|
||||
int firstSlash = CharOperation.indexOf(IndexerOutput.SEPARATOR, word, 0);
|
||||
int firstSlash = CharOperation.indexOf(ICIndexStorageConstants.SEPARATOR, word, 0);
|
||||
char decodedType = word[firstSlash + 1];
|
||||
int type = getElementType(decodedType);
|
||||
if (type != 0) {
|
||||
firstSlash += 2;
|
||||
int slash = CharOperation.indexOf(IndexerOutput.SEPARATOR, word, firstSlash + 1);
|
||||
int slash = CharOperation.indexOf(ICIndexStorageConstants.SEPARATOR, word, firstSlash + 1);
|
||||
String name = String.valueOf(CharOperation.subarray(word, firstSlash + 1, slash));
|
||||
if (name.length() != 0) { // skip anonymous structs
|
||||
String[] enclosingNames = getEnclosingNames(word, slash);
|
||||
addType(input, project, entry, type, name, enclosingNames, monitor);
|
||||
}
|
||||
} else if (decodedType == IndexerOutput.DERIVED_SUFFIX) {
|
||||
} else if (decodedType == ICIndexStorageConstants.DERIVED_SUFFIX) {
|
||||
firstSlash += 2;
|
||||
int slash = CharOperation.indexOf(IndexerOutput.SEPARATOR, word, firstSlash + 1);
|
||||
int slash = CharOperation.indexOf(ICIndexStorageConstants.SEPARATOR, word, firstSlash + 1);
|
||||
String name = String.valueOf(CharOperation.subarray(word, firstSlash + 1, slash));
|
||||
if (name.length() != 0) { // skip anonymous structs
|
||||
String[] enclosingNames = getEnclosingNames(word, slash);
|
||||
|
@ -124,15 +124,15 @@ public class IndexerTypesJob extends IndexerJob {
|
|||
|
||||
private int getElementType(char decodedType) {
|
||||
switch (decodedType) {
|
||||
case IndexerOutput.CLASS_SUFFIX :
|
||||
case ICIndexStorageConstants.CLASS_SUFFIX :
|
||||
return ICElement.C_CLASS;
|
||||
case IndexerOutput.STRUCT_SUFFIX :
|
||||
case ICIndexStorageConstants.STRUCT_SUFFIX :
|
||||
return ICElement.C_STRUCT;
|
||||
case IndexerOutput.TYPEDEF_SUFFIX :
|
||||
case ICIndexStorageConstants.TYPEDEF_SUFFIX :
|
||||
return ICElement.C_TYPEDEF;
|
||||
case IndexerOutput.ENUM_SUFFIX :
|
||||
case ICIndexStorageConstants.ENUM_SUFFIX :
|
||||
return ICElement.C_ENUMERATION;
|
||||
case IndexerOutput.UNION_SUFFIX :
|
||||
case ICIndexStorageConstants.UNION_SUFFIX :
|
||||
return ICElement.C_UNION;
|
||||
}
|
||||
return 0;
|
||||
|
|
|
@ -30,9 +30,9 @@ import org.eclipse.cdt.core.search.ICSearchScope;
|
|||
import org.eclipse.cdt.internal.core.CharOperation;
|
||||
import org.eclipse.cdt.internal.core.index.IEntryResult;
|
||||
import org.eclipse.cdt.internal.core.index.IIndex;
|
||||
import org.eclipse.cdt.internal.core.index.cindexstorage.ICIndexStorageConstants;
|
||||
import org.eclipse.cdt.internal.core.index.cindexstorage.Index;
|
||||
import org.eclipse.cdt.internal.core.index.cindexstorage.IndexedFileEntry;
|
||||
import org.eclipse.cdt.internal.core.index.cindexstorage.IndexerOutput;
|
||||
import org.eclipse.cdt.internal.core.index.cindexstorage.io.IndexInput;
|
||||
import org.eclipse.cdt.internal.core.search.IIndexSearchRequestor;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
|
@ -164,7 +164,7 @@ public class ClassDeclarationPattern extends CSearchPattern {
|
|||
|
||||
|
||||
public void feedIndexRequestor(IIndexSearchRequestor requestor, int detailLevel, int[] fileRefs, int[][] offsets, int[][] offsetLengths,IndexInput input, ICSearchScope scope) throws IOException {
|
||||
boolean isClass = decodedType == IndexerOutput.CLASS_SUFFIX;
|
||||
boolean isClass = decodedType == ICIndexStorageConstants.CLASS_SUFFIX;
|
||||
|
||||
for (int i = 0, max = fileRefs.length; i < max; i++) {
|
||||
IndexedFileEntry file = input.getIndexedFile(fileRefs[i]);
|
||||
|
@ -194,15 +194,15 @@ public class ClassDeclarationPattern extends CSearchPattern {
|
|||
|
||||
match.parentName = ""; //$NON-NLS-1$
|
||||
|
||||
if (decodedType == IndexerOutput.CLASS_SUFFIX){
|
||||
if (decodedType == ICIndexStorageConstants.CLASS_SUFFIX){
|
||||
match.type=ICElement.C_CLASS;
|
||||
} else if (decodedType == IndexerOutput.STRUCT_SUFFIX){
|
||||
} else if (decodedType == ICIndexStorageConstants.STRUCT_SUFFIX){
|
||||
match.type=ICElement.C_STRUCT;
|
||||
} else if (decodedType == IndexerOutput.UNION_SUFFIX){
|
||||
} else if (decodedType == ICIndexStorageConstants.UNION_SUFFIX){
|
||||
match.type=ICElement.C_UNION;
|
||||
} else if (decodedType == IndexerOutput.ENUM_SUFFIX) {
|
||||
} else if (decodedType == ICIndexStorageConstants.ENUM_SUFFIX) {
|
||||
match.type=ICElement.C_ENUMERATION;
|
||||
} else if (decodedType == IndexerOutput.TYPEDEF_SUFFIX){
|
||||
} else if (decodedType == ICIndexStorageConstants.TYPEDEF_SUFFIX){
|
||||
match.type=ICElement.C_TYPEDEF;
|
||||
}
|
||||
|
||||
|
@ -230,12 +230,12 @@ public class ClassDeclarationPattern extends CSearchPattern {
|
|||
char[] word = entryResult.getWord();
|
||||
int size = word.length;
|
||||
|
||||
int firstSlash = CharOperation.indexOf( IndexerOutput.SEPARATOR, word, 0 );
|
||||
int firstSlash = CharOperation.indexOf( ICIndexStorageConstants.SEPARATOR, word, 0 );
|
||||
|
||||
this.decodedType = word[ firstSlash + 1 ];
|
||||
firstSlash += 2;
|
||||
|
||||
int slash = CharOperation.indexOf( IndexerOutput.SEPARATOR, word, firstSlash + 1 );
|
||||
int slash = CharOperation.indexOf( ICIndexStorageConstants.SEPARATOR, word, firstSlash + 1 );
|
||||
|
||||
this.decodedSimpleName = CharOperation.subarray( word, firstSlash + 1, slash );
|
||||
|
||||
|
@ -262,30 +262,30 @@ public class ClassDeclarationPattern extends CSearchPattern {
|
|||
protected boolean matchIndexEntry() {
|
||||
//check type matches
|
||||
if( classKind == null ){
|
||||
if( searchFor == TYPEDEF && decodedType != IndexerOutput.TYPEDEF_SUFFIX ){
|
||||
if( searchFor == TYPEDEF && decodedType != ICIndexStorageConstants.TYPEDEF_SUFFIX ){
|
||||
return false;
|
||||
}
|
||||
//don't match variable entries
|
||||
if( decodedType == IndexerOutput.VAR_SUFFIX ){
|
||||
if( decodedType == ICIndexStorageConstants.VAR_SUFFIX ){
|
||||
return false;
|
||||
}
|
||||
} else if( classKind == ASTClassKind.CLASS ) {
|
||||
if( decodedType != IndexerOutput.CLASS_SUFFIX &&
|
||||
decodedType != IndexerOutput.FWD_CLASS_SUFFIX){
|
||||
if( decodedType != ICIndexStorageConstants.CLASS_SUFFIX &&
|
||||
decodedType != ICIndexStorageConstants.FWD_CLASS_SUFFIX){
|
||||
return false;
|
||||
}
|
||||
} else if ( classKind == ASTClassKind.STRUCT ) {
|
||||
if( decodedType != IndexerOutput.STRUCT_SUFFIX &&
|
||||
decodedType != IndexerOutput.FWD_STRUCT_SUFFIX){
|
||||
if( decodedType != ICIndexStorageConstants.STRUCT_SUFFIX &&
|
||||
decodedType != ICIndexStorageConstants.FWD_STRUCT_SUFFIX){
|
||||
return false;
|
||||
}
|
||||
} else if ( classKind == ASTClassKind.UNION ) {
|
||||
if( decodedType != IndexerOutput.UNION_SUFFIX &&
|
||||
decodedType != IndexerOutput.FWD_UNION_SUFFIX){
|
||||
if( decodedType != ICIndexStorageConstants.UNION_SUFFIX &&
|
||||
decodedType != ICIndexStorageConstants.FWD_UNION_SUFFIX){
|
||||
return false;
|
||||
}
|
||||
} else if ( classKind == ASTClassKind.ENUM ) {
|
||||
if( decodedType != IndexerOutput.ENUM_SUFFIX ) {
|
||||
if( decodedType != ICIndexStorageConstants.ENUM_SUFFIX ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,8 +23,8 @@ import org.eclipse.cdt.core.parser.ast.ASTNotImplementedException;
|
|||
import org.eclipse.cdt.core.parser.ast.IASTBaseSpecifier;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTTypeSpecifier;
|
||||
import org.eclipse.cdt.internal.core.index.cindexstorage.ICIndexStorageConstants;
|
||||
import org.eclipse.cdt.internal.core.index.cindexstorage.Index;
|
||||
import org.eclipse.cdt.internal.core.index.cindexstorage.IndexerOutput;
|
||||
|
||||
/**
|
||||
* @author bgheorgh
|
||||
|
@ -58,7 +58,7 @@ public class DerivedTypesPattern extends ClassDeclarationPattern {
|
|||
}
|
||||
|
||||
protected boolean matchIndexEntry() {
|
||||
if( decodedType != IndexerOutput.DERIVED_SUFFIX ){
|
||||
if( decodedType != ICIndexStorageConstants.DERIVED_SUFFIX ){
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,8 +22,8 @@ import java.util.Iterator;
|
|||
import org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTElaboratedTypeSpecifier;
|
||||
import org.eclipse.cdt.internal.core.index.cindexstorage.ICIndexStorageConstants;
|
||||
import org.eclipse.cdt.internal.core.index.cindexstorage.Index;
|
||||
import org.eclipse.cdt.internal.core.index.cindexstorage.IndexerOutput;
|
||||
|
||||
/**
|
||||
* @author bgheorgh
|
||||
|
@ -57,7 +57,7 @@ public class FriendPattern extends ClassDeclarationPattern {
|
|||
}
|
||||
|
||||
protected boolean matchIndexEntry() {
|
||||
if( decodedType != IndexerOutput.FRIEND_SUFFIX ){
|
||||
if( decodedType != ICIndexStorageConstants.FRIEND_SUFFIX ){
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -18,9 +18,9 @@ import org.eclipse.cdt.core.parser.ast.IASTInclusion;
|
|||
import org.eclipse.cdt.core.search.ICSearchScope;
|
||||
import org.eclipse.cdt.internal.core.CharOperation;
|
||||
import org.eclipse.cdt.internal.core.index.IEntryResult;
|
||||
import org.eclipse.cdt.internal.core.index.cindexstorage.ICIndexStorageConstants;
|
||||
import org.eclipse.cdt.internal.core.index.cindexstorage.Index;
|
||||
import org.eclipse.cdt.internal.core.index.cindexstorage.IndexedFileEntry;
|
||||
import org.eclipse.cdt.internal.core.index.cindexstorage.IndexerOutput;
|
||||
import org.eclipse.cdt.internal.core.index.cindexstorage.io.IndexInput;
|
||||
import org.eclipse.cdt.internal.core.search.IIndexSearchRequestor;
|
||||
|
||||
|
@ -44,7 +44,7 @@ public class IncludePattern extends CSearchPattern {
|
|||
protected void decodeIndexEntry(IEntryResult entryResult) {
|
||||
char[] word = entryResult.getWord();
|
||||
|
||||
int firstSlash = CharOperation.indexOf( IndexerOutput.SEPARATOR, word, 0 );
|
||||
int firstSlash = CharOperation.indexOf( ICIndexStorageConstants.SEPARATOR, word, 0 );
|
||||
|
||||
this.decodedSimpleName = CharOperation.subarray(word, firstSlash + 1, -1);
|
||||
}
|
||||
|
|
|
@ -25,9 +25,9 @@ import org.eclipse.cdt.core.search.ICSearchScope;
|
|||
import org.eclipse.cdt.internal.core.CharOperation;
|
||||
import org.eclipse.cdt.internal.core.index.IEntryResult;
|
||||
import org.eclipse.cdt.internal.core.index.IIndex;
|
||||
import org.eclipse.cdt.internal.core.index.cindexstorage.ICIndexStorageConstants;
|
||||
import org.eclipse.cdt.internal.core.index.cindexstorage.Index;
|
||||
import org.eclipse.cdt.internal.core.index.cindexstorage.IndexedFileEntry;
|
||||
import org.eclipse.cdt.internal.core.index.cindexstorage.IndexerOutput;
|
||||
import org.eclipse.cdt.internal.core.index.cindexstorage.io.IndexInput;
|
||||
import org.eclipse.cdt.internal.core.search.IIndexSearchRequestor;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
|
@ -124,7 +124,7 @@ public class MacroDeclarationPattern extends CSearchPattern {
|
|||
protected void decodeIndexEntry(IEntryResult entryResult) {
|
||||
char[] word = entryResult.getWord();
|
||||
|
||||
int firstSlash = CharOperation.indexOf( IndexerOutput.SEPARATOR, word, 0 );
|
||||
int firstSlash = CharOperation.indexOf( ICIndexStorageConstants.SEPARATOR, word, 0 );
|
||||
|
||||
this.decodedSimpleName = CharOperation.subarray(word, firstSlash + 1, -1);
|
||||
}
|
||||
|
|
|
@ -27,9 +27,9 @@ import org.eclipse.cdt.core.search.ICSearchScope;
|
|||
import org.eclipse.cdt.internal.core.CharOperation;
|
||||
import org.eclipse.cdt.internal.core.index.IEntryResult;
|
||||
import org.eclipse.cdt.internal.core.index.IIndex;
|
||||
import org.eclipse.cdt.internal.core.index.cindexstorage.ICIndexStorageConstants;
|
||||
import org.eclipse.cdt.internal.core.index.cindexstorage.Index;
|
||||
import org.eclipse.cdt.internal.core.index.cindexstorage.IndexedFileEntry;
|
||||
import org.eclipse.cdt.internal.core.index.cindexstorage.IndexerOutput;
|
||||
import org.eclipse.cdt.internal.core.index.cindexstorage.io.IndexInput;
|
||||
import org.eclipse.cdt.internal.core.search.IIndexSearchRequestor;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
|
@ -147,9 +147,9 @@ public class MethodDeclarationPattern extends CSearchPattern {
|
|||
char[] word = entryResult.getWord();
|
||||
int size = word.length;
|
||||
|
||||
int firstSlash = CharOperation.indexOf( IndexerOutput.SEPARATOR, word, 0 );
|
||||
int firstSlash = CharOperation.indexOf( ICIndexStorageConstants.SEPARATOR, word, 0 );
|
||||
|
||||
int slash = CharOperation.indexOf( IndexerOutput.SEPARATOR, word, firstSlash + 1 );
|
||||
int slash = CharOperation.indexOf( ICIndexStorageConstants.SEPARATOR, word, firstSlash + 1 );
|
||||
|
||||
this.decodedSimpleName = CharOperation.subarray(word, firstSlash + 1, slash);
|
||||
|
||||
|
|
|
@ -24,9 +24,9 @@ import org.eclipse.cdt.core.search.ICSearchScope;
|
|||
import org.eclipse.cdt.internal.core.CharOperation;
|
||||
import org.eclipse.cdt.internal.core.index.IEntryResult;
|
||||
import org.eclipse.cdt.internal.core.index.IIndex;
|
||||
import org.eclipse.cdt.internal.core.index.cindexstorage.ICIndexStorageConstants;
|
||||
import org.eclipse.cdt.internal.core.index.cindexstorage.Index;
|
||||
import org.eclipse.cdt.internal.core.index.cindexstorage.IndexedFileEntry;
|
||||
import org.eclipse.cdt.internal.core.index.cindexstorage.IndexerOutput;
|
||||
import org.eclipse.cdt.internal.core.index.cindexstorage.io.IndexInput;
|
||||
import org.eclipse.cdt.internal.core.search.IIndexSearchRequestor;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
|
@ -139,9 +139,9 @@ public class NamespaceDeclarationPattern extends CSearchPattern {
|
|||
char[] word = entryResult.getWord();
|
||||
int size = word.length;
|
||||
|
||||
int firstSlash = CharOperation.indexOf( IndexerOutput.SEPARATOR, word, 0 );
|
||||
int firstSlash = CharOperation.indexOf( ICIndexStorageConstants.SEPARATOR, word, 0 );
|
||||
|
||||
int slash = CharOperation.indexOf(IndexerOutput.SEPARATOR, word, firstSlash + 1);
|
||||
int slash = CharOperation.indexOf(ICIndexStorageConstants.SEPARATOR, word, firstSlash + 1);
|
||||
|
||||
this.decodedSimpleName = CharOperation.subarray(word, firstSlash+1, slash);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue