mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Modified indexer friend encoding to encode IASTElaboratedTypeSpecifier
This commit is contained in:
parent
21b56220d7
commit
2f19221ac0
3 changed files with 49 additions and 5 deletions
|
@ -1,3 +1,6 @@
|
|||
2004-05-07 Bogdan Gheorghe
|
||||
Modified indexer friend encoding to encode IASTElaboratedTypeSpecifier
|
||||
|
||||
2004-05-06 Bogdan Gheorghe
|
||||
Modified AbstractIndexer to encode friends, add friends constant to IIndexConstants,
|
||||
modified SourceIndexerRequestor to add class specifier on exit instead of enter in order
|
||||
|
|
|
@ -88,6 +88,11 @@ public abstract class AbstractIndexer implements IIndexer, IIndexConstants, ICSe
|
|||
String[] baseFullyQualifiedName = friendClassSpec.getFullyQualifiedName();
|
||||
this.output.addRef(encodeTypeEntry(baseFullyQualifiedName,FRIEND,ICSearchConstants.DECLARATIONS));
|
||||
}
|
||||
else if (decl instanceof IASTElaboratedTypeSpecifier){
|
||||
IASTElaboratedTypeSpecifier friendClassSpec = (IASTElaboratedTypeSpecifier) decl;
|
||||
String[] baseFullyQualifiedName = friendClassSpec.getFullyQualifiedName();
|
||||
this.output.addRef(encodeTypeEntry(baseFullyQualifiedName,FRIEND,ICSearchConstants.DECLARATIONS));
|
||||
}
|
||||
else if (decl instanceof IASTFunction){
|
||||
|
||||
}
|
||||
|
@ -115,6 +120,28 @@ public abstract class AbstractIndexer implements IIndexer, IIndexConstants, ICSe
|
|||
} catch (ASTNotImplementedException e) {}
|
||||
}
|
||||
|
||||
// Get friends
|
||||
Iterator friends = classSpecification.getFriends();
|
||||
while (friends.hasNext()){
|
||||
Object decl = friends.next();
|
||||
if (decl instanceof IASTClassSpecifier){
|
||||
IASTClassSpecifier friendClassSpec = (IASTClassSpecifier) decl;
|
||||
String[] baseFullyQualifiedName = friendClassSpec.getFullyQualifiedName();
|
||||
this.output.addRef(encodeTypeEntry(baseFullyQualifiedName,FRIEND,ICSearchConstants.DECLARATIONS));
|
||||
}
|
||||
else if (decl instanceof IASTElaboratedTypeSpecifier){
|
||||
IASTElaboratedTypeSpecifier friendClassSpec = (IASTElaboratedTypeSpecifier) decl;
|
||||
String[] baseFullyQualifiedName = friendClassSpec.getFullyQualifiedName();
|
||||
this.output.addRef(encodeTypeEntry(baseFullyQualifiedName,FRIEND,ICSearchConstants.DECLARATIONS));
|
||||
}
|
||||
else if (decl instanceof IASTFunction){
|
||||
|
||||
}
|
||||
else if (decl instanceof IASTMethod){
|
||||
//
|
||||
}
|
||||
}
|
||||
|
||||
this.output.addRef(encodeTypeEntry(classSpecification.getFullyQualifiedName(),STRUCT, ICSearchConstants.DECLARATIONS));
|
||||
}
|
||||
else if (classSpecification.getClassKind().equals(ASTClassKind.UNION))
|
||||
|
|
|
@ -12,6 +12,7 @@ import org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate;
|
|||
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.IASTElaboratedTypeSpecifier;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTTypeSpecifier;
|
||||
import org.eclipse.cdt.internal.core.search.indexing.AbstractIndexer;
|
||||
|
||||
|
@ -67,20 +68,31 @@ public class FriendPattern extends ClassDeclarationPattern {
|
|||
Iterator i = tempNode.getFriends();
|
||||
|
||||
boolean matchFlag=false;
|
||||
|
||||
String[] fullName=null;
|
||||
while (i.hasNext()){
|
||||
Object friend = i.next();
|
||||
String[] baseFullyQualifiedName = null;
|
||||
if (friend instanceof IASTClassSpecifier)
|
||||
{
|
||||
IASTClassSpecifier classSpec = (IASTClassSpecifier) friend;
|
||||
String[] baseFullyQualifiedName = classSpec.getFullyQualifiedName();
|
||||
|
||||
baseFullyQualifiedName = classSpec.getFullyQualifiedName();
|
||||
|
||||
//check name, if simpleName == null, its treated the same as "*"
|
||||
if( simpleName != null && !matchesName( simpleName, classSpec.getName().toCharArray() ) ){
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else if (friend instanceof IASTElaboratedTypeSpecifier ){
|
||||
IASTElaboratedTypeSpecifier elabType = (IASTElaboratedTypeSpecifier) friend;
|
||||
baseFullyQualifiedName = elabType.getFullyQualifiedName();
|
||||
|
||||
//check name, if simpleName == null, its treated the same as "*"
|
||||
if( simpleName != null && !matchesName( simpleName, elabType.getName().toCharArray() ) ){
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (baseFullyQualifiedName != null){
|
||||
char [][] qualName = new char [ baseFullyQualifiedName.length - 1 ][];
|
||||
for( int j = 0; j < baseFullyQualifiedName.length - 1; j++ ){
|
||||
qualName[j] = baseFullyQualifiedName[j].toCharArray();
|
||||
|
@ -102,4 +114,6 @@ public class FriendPattern extends ClassDeclarationPattern {
|
|||
|
||||
return IMPOSSIBLE_MATCH;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue