mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-09 17:25:38 +02:00
PDOM - Added Handling for C++ namespaces.
This commit is contained in:
parent
8811ecbb05
commit
59830a2ba7
8 changed files with 346 additions and 8 deletions
|
@ -55,6 +55,8 @@ Export-Package: org.eclipse.cdt.core,
|
||||||
org.eclipse.cdt.internal.core.pdom,
|
org.eclipse.cdt.internal.core.pdom,
|
||||||
org.eclipse.cdt.internal.core.pdom.db,
|
org.eclipse.cdt.internal.core.pdom.db,
|
||||||
org.eclipse.cdt.internal.core.pdom.dom,
|
org.eclipse.cdt.internal.core.pdom.dom,
|
||||||
|
org.eclipse.cdt.internal.core.pdom.dom.c,
|
||||||
|
org.eclipse.cdt.internal.core.pdom.dom.cpp,
|
||||||
org.eclipse.cdt.internal.core.search,
|
org.eclipse.cdt.internal.core.search,
|
||||||
org.eclipse.cdt.internal.core.search.indexing,
|
org.eclipse.cdt.internal.core.search.indexing,
|
||||||
org.eclipse.cdt.internal.core.search.matching,
|
org.eclipse.cdt.internal.core.search.matching,
|
||||||
|
|
|
@ -42,6 +42,13 @@ public interface ICPPASTQualifiedName extends IASTName, IASTNameOwner {
|
||||||
*/
|
*/
|
||||||
public IASTName[] getNames();
|
public IASTName[] getNames();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The last name is often semantically significant.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public IASTName getLastName();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is this name fully qualified?
|
* Is this name fully qualified?
|
||||||
*
|
*
|
||||||
|
|
|
@ -41,12 +41,14 @@ public class CPPASTQualifiedName extends CPPASTNode implements
|
||||||
public IBinding resolveBinding() {
|
public IBinding resolveBinding() {
|
||||||
// The full qualified name resolves to the same thing as the last name
|
// The full qualified name resolves to the same thing as the last name
|
||||||
removeNullNames();
|
removeNullNames();
|
||||||
return names[names.length - 1].resolveBinding();
|
IASTName lastName = getLastName();
|
||||||
|
return lastName != null ? lastName.resolveBinding() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IBinding[] resolvePrefix() {
|
public IBinding[] resolvePrefix() {
|
||||||
removeNullNames();
|
removeNullNames();
|
||||||
return names[names.length - 1].resolvePrefix();
|
IASTName lastName = getLastName();
|
||||||
|
return lastName != null ? lastName.resolvePrefix() : new IBinding[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -96,6 +98,13 @@ public class CPPASTQualifiedName extends CPPASTNode implements
|
||||||
return names;
|
return names;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IASTName getLastName() {
|
||||||
|
if (names == null || names.length == 0)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
return names[names.length - 1];
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
|
|
|
@ -162,7 +162,8 @@ public class CPPVisitor {
|
||||||
parent instanceof ICPPASTTemplateId )
|
parent instanceof ICPPASTTemplateId )
|
||||||
{
|
{
|
||||||
binding = CPPSemantics.resolveBinding( name );
|
binding = CPPSemantics.resolveBinding( name );
|
||||||
if( binding instanceof IProblemBinding && parent instanceof ICPPASTQualifiedName )
|
if( binding instanceof IProblemBinding && parent instanceof ICPPASTQualifiedName
|
||||||
|
&& !(parent.getParent() instanceof ICPPASTNamespaceAlias))
|
||||||
{
|
{
|
||||||
if( ((IProblemBinding)binding).getID() == IProblemBinding.SEMANTIC_MEMBER_DECLARATION_NOT_FOUND ){
|
if( ((IProblemBinding)binding).getID() == IProblemBinding.SEMANTIC_MEMBER_DECLARATION_NOT_FOUND ){
|
||||||
IASTNode node = getContainingBlockItem( name.getParent() );
|
IASTNode node = getContainingBlockItem( name.getParent() );
|
||||||
|
|
|
@ -19,10 +19,14 @@ import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.IProblemBinding;
|
import org.eclipse.cdt.core.dom.ast.IProblemBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNamespaceAlias;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
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.ICPPField;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
|
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.dom.ast.cpp.ICPPVariable;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPVariable;
|
||||||
import org.eclipse.cdt.core.dom.ast.gnu.cpp.GPPLanguage;
|
import org.eclipse.cdt.core.dom.ast.gnu.cpp.GPPLanguage;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPBlockScope;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPBlockScope;
|
||||||
|
@ -30,6 +34,8 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPClassType;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPField;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPField;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPFunction;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPFunction;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPMethod;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPMethod;
|
||||||
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPNamespace;
|
||||||
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPNamespaceAlias;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPVariable;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPVariable;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOMDatabase;
|
import org.eclipse.cdt.internal.core.pdom.PDOMDatabase;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
||||||
|
@ -65,6 +71,8 @@ public class PDOMCPPLinkage extends PDOMLinkage {
|
||||||
public static final int CPPCLASSTYPE = 3;
|
public static final int CPPCLASSTYPE = 3;
|
||||||
public static final int CPPFIELD = 4;
|
public static final int CPPFIELD = 4;
|
||||||
public static final int CPPMETHOD = 5;
|
public static final int CPPMETHOD = 5;
|
||||||
|
public static final int CPPNAMESPACE = 6;
|
||||||
|
public static final int CPPNAMESPACEALIAS = 7;
|
||||||
|
|
||||||
public PDOMNode getParent(IBinding binding) throws CoreException {
|
public PDOMNode getParent(IBinding binding) throws CoreException {
|
||||||
PDOMNode parent = this;
|
PDOMNode parent = this;
|
||||||
|
@ -82,7 +90,8 @@ public class PDOMCPPLinkage extends PDOMLinkage {
|
||||||
}
|
}
|
||||||
|
|
||||||
public PDOMBinding addName(IASTName name) throws CoreException {
|
public PDOMBinding addName(IASTName name) throws CoreException {
|
||||||
if (name == null || name.toCharArray().length == 0)
|
if (name == null || name.toCharArray().length == 0
|
||||||
|
|| name instanceof ICPPASTQualifiedName)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
IBinding binding = name.resolveBinding();
|
IBinding binding = name.resolveBinding();
|
||||||
|
@ -105,6 +114,10 @@ public class PDOMCPPLinkage extends PDOMLinkage {
|
||||||
pdomBinding = new PDOMCPPFunction(pdom, parent, name);
|
pdomBinding = new PDOMCPPFunction(pdom, parent, name);
|
||||||
} else if (binding instanceof CPPClassType) {
|
} else if (binding instanceof CPPClassType) {
|
||||||
pdomBinding = new PDOMCPPClassType(pdom, parent, name);
|
pdomBinding = new PDOMCPPClassType(pdom, parent, name);
|
||||||
|
} else if (binding instanceof CPPNamespaceAlias) {
|
||||||
|
pdomBinding = new PDOMCPPNamespaceAlias(pdom, parent, name);
|
||||||
|
} else if (binding instanceof CPPNamespace) {
|
||||||
|
pdomBinding = new PDOMCPPNamespace(pdom, parent, name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -150,6 +163,10 @@ public class PDOMCPPLinkage extends PDOMLinkage {
|
||||||
return CPPFIELD;
|
return CPPFIELD;
|
||||||
else if (binding instanceof ICPPMethod)
|
else if (binding instanceof ICPPMethod)
|
||||||
return CPPMETHOD;
|
return CPPMETHOD;
|
||||||
|
else if (binding instanceof ICPPNamespaceAlias)
|
||||||
|
return CPPNAMESPACEALIAS;
|
||||||
|
else if (binding instanceof ICPPNamespace)
|
||||||
|
return CPPNAMESPACE;
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -190,13 +207,23 @@ public class PDOMCPPLinkage extends PDOMLinkage {
|
||||||
return new PDOMCPPField(pdom, record);
|
return new PDOMCPPField(pdom, record);
|
||||||
case CPPMETHOD:
|
case CPPMETHOD:
|
||||||
return new PDOMCPPMethod(pdom, record);
|
return new PDOMCPPMethod(pdom, record);
|
||||||
|
case CPPNAMESPACE:
|
||||||
|
return new PDOMCPPNamespace(pdom, record);
|
||||||
|
case CPPNAMESPACEALIAS:
|
||||||
|
return new PDOMCPPNamespaceAlias(pdom, record);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PDOMBinding resolveBinding(IASTName name) throws CoreException {
|
public PDOMBinding resolveBinding(IASTName name) throws CoreException {
|
||||||
|
if (name instanceof ICPPASTQualifiedName) {
|
||||||
|
IASTName lastName = ((ICPPASTQualifiedName)name).getLastName();
|
||||||
|
return lastName != null ? resolveBinding(lastName) : null;
|
||||||
|
}
|
||||||
IASTNode parent = name.getParent();
|
IASTNode parent = name.getParent();
|
||||||
|
if (parent instanceof ICPPASTQualifiedName)
|
||||||
|
parent = parent.getParent();
|
||||||
if (parent instanceof IASTIdExpression) {
|
if (parent instanceof IASTIdExpression) {
|
||||||
// reference
|
// reference
|
||||||
IASTNode eParent = parent.getParent();
|
IASTNode eParent = parent.getParent();
|
||||||
|
@ -205,7 +232,10 @@ public class PDOMCPPLinkage extends PDOMLinkage {
|
||||||
getIndex().visit(visitor);
|
getIndex().visit(visitor);
|
||||||
return visitor.pdomBinding;
|
return visitor.pdomBinding;
|
||||||
} else {
|
} else {
|
||||||
FindBinding visitor = new FindBinding(pdom, name.toCharArray(), CPPVARIABLE);
|
FindBinding visitor = new FindBinding(pdom, name.toCharArray(),
|
||||||
|
(name.getParent() instanceof ICPPASTQualifiedName
|
||||||
|
&& ((ICPPASTQualifiedName)name.getParent()).getLastName() != name)
|
||||||
|
? CPPNAMESPACE : CPPVARIABLE);
|
||||||
getIndex().visit(visitor);
|
getIndex().visit(visitor);
|
||||||
return visitor.pdomBinding;
|
return visitor.pdomBinding;
|
||||||
}
|
}
|
||||||
|
@ -213,7 +243,12 @@ public class PDOMCPPLinkage extends PDOMLinkage {
|
||||||
FindBinding visitor = new FindBinding(pdom, name.toCharArray(), CPPCLASSTYPE);
|
FindBinding visitor = new FindBinding(pdom, name.toCharArray(), CPPCLASSTYPE);
|
||||||
getIndex().visit(visitor);
|
getIndex().visit(visitor);
|
||||||
return visitor.pdomBinding;
|
return visitor.pdomBinding;
|
||||||
|
} else if (parent instanceof ICPPASTNamespaceAlias) {
|
||||||
|
FindBinding visitor = new FindBinding(pdom, name.toCharArray(), CPPNAMESPACE);
|
||||||
|
getIndex().visit(visitor);
|
||||||
|
return visitor.pdomBinding;
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,194 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2006 QNX Software Systems and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* QNX - Initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTFunctionCallExpression;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTIdExpression;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTNamedTypeSpecifier;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespace;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespaceScope;
|
||||||
|
import org.eclipse.cdt.internal.core.pdom.PDOMDatabase;
|
||||||
|
import org.eclipse.cdt.internal.core.pdom.db.BTree;
|
||||||
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
||||||
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
|
||||||
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNotImplementedError;
|
||||||
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Doug Schaefer
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class PDOMCPPNamespace extends PDOMBinding
|
||||||
|
implements ICPPNamespace, ICPPNamespaceScope {
|
||||||
|
|
||||||
|
private static final int INDEX_OFFSET = PDOMBinding.RECORD_SIZE + 0;
|
||||||
|
|
||||||
|
protected static final int RECORD_SIZE = PDOMBinding.RECORD_SIZE + 4;
|
||||||
|
|
||||||
|
public PDOMCPPNamespace(PDOMDatabase pdom, PDOMNode parent, IASTName name) throws CoreException {
|
||||||
|
super(pdom, parent, name, PDOMCPPLinkage.CPPNAMESPACE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public PDOMCPPNamespace(PDOMDatabase pdom, int record) {
|
||||||
|
super(pdom, record);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected int getRecordSize() {
|
||||||
|
return RECORD_SIZE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BTree getIndex() throws CoreException {
|
||||||
|
return new BTree(pdom.getDB(), record + INDEX_OFFSET);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addChild(PDOMNode child) throws CoreException {
|
||||||
|
getIndex().insert(child.getRecord(), child.getIndexComparator());
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[] getQualifiedName() throws DOMException {
|
||||||
|
throw new PDOMNotImplementedError();
|
||||||
|
}
|
||||||
|
|
||||||
|
public char[][] getQualifiedNameCharArray() throws DOMException {
|
||||||
|
throw new PDOMNotImplementedError();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isGloballyQualified() throws DOMException {
|
||||||
|
throw new PDOMNotImplementedError();
|
||||||
|
}
|
||||||
|
|
||||||
|
public IBinding[] getMemberBindings() throws DOMException {
|
||||||
|
throw new PDOMNotImplementedError();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ICPPNamespaceScope getNamespaceScope() throws DOMException {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addUsingDirective(IASTNode directive) throws DOMException {
|
||||||
|
throw new PDOMNotImplementedError();
|
||||||
|
}
|
||||||
|
|
||||||
|
public IASTNode[] getUsingDirectives() throws DOMException {
|
||||||
|
// TODO
|
||||||
|
return new IASTNode[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addBinding(IBinding binding) throws DOMException {
|
||||||
|
throw new PDOMNotImplementedError();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addName(IASTName name) throws DOMException {
|
||||||
|
throw new PDOMNotImplementedError();
|
||||||
|
}
|
||||||
|
|
||||||
|
public IBinding[] find(String name) throws DOMException {
|
||||||
|
throw new PDOMNotImplementedError();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void flushCache() throws DOMException {
|
||||||
|
throw new PDOMNotImplementedError();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final class FindBinding extends PDOMNode.NodeVisitor {
|
||||||
|
PDOMBinding pdomBinding;
|
||||||
|
final int desiredType;
|
||||||
|
public FindBinding(PDOMDatabase pdom, char[] name, int desiredType) {
|
||||||
|
super(pdom, name);
|
||||||
|
this.desiredType = desiredType;
|
||||||
|
}
|
||||||
|
public boolean visit(int record) throws CoreException {
|
||||||
|
if (record == 0)
|
||||||
|
return true;
|
||||||
|
PDOMBinding tBinding = pdom.getBinding(record);
|
||||||
|
if (!tBinding.hasName(name))
|
||||||
|
// no more bindings with our desired name
|
||||||
|
return false;
|
||||||
|
if (tBinding.getBindingType() != desiredType)
|
||||||
|
// wrong type, try again
|
||||||
|
return true;
|
||||||
|
|
||||||
|
// got it
|
||||||
|
pdomBinding = tBinding;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public IBinding getBinding(IASTName name, boolean resolve) throws DOMException {
|
||||||
|
try {
|
||||||
|
if (name instanceof ICPPASTQualifiedName) {
|
||||||
|
IASTName lastName = ((ICPPASTQualifiedName)name).getLastName();
|
||||||
|
return lastName != null ? lastName.resolveBinding() : null;
|
||||||
|
}
|
||||||
|
IASTNode parent = name.getParent();
|
||||||
|
if (parent instanceof ICPPASTQualifiedName)
|
||||||
|
parent = parent.getParent();
|
||||||
|
if (parent instanceof IASTIdExpression) {
|
||||||
|
// reference
|
||||||
|
IASTNode eParent = parent.getParent();
|
||||||
|
if (eParent instanceof IASTFunctionCallExpression) {
|
||||||
|
FindBinding visitor = new FindBinding(pdom, name.toCharArray(), PDOMCPPLinkage.CPPFUNCTION);
|
||||||
|
getIndex().visit(visitor);
|
||||||
|
return visitor.pdomBinding;
|
||||||
|
} else {
|
||||||
|
FindBinding visitor = new FindBinding(pdom, name.toCharArray(),
|
||||||
|
(name.getParent() instanceof ICPPASTQualifiedName
|
||||||
|
&& ((ICPPASTQualifiedName)name.getParent()).getLastName() != name)
|
||||||
|
? PDOMCPPLinkage.CPPNAMESPACE : PDOMCPPLinkage.CPPVARIABLE);
|
||||||
|
getIndex().visit(visitor);
|
||||||
|
return visitor.pdomBinding;
|
||||||
|
}
|
||||||
|
} else if (parent instanceof IASTNamedTypeSpecifier) {
|
||||||
|
FindBinding visitor = new FindBinding(pdom, name.toCharArray(), PDOMCPPLinkage.CPPCLASSTYPE);
|
||||||
|
getIndex().visit(visitor);
|
||||||
|
return visitor.pdomBinding;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
} catch (CoreException e) {
|
||||||
|
CCorePlugin.log(e);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public IScope getParent() throws DOMException {
|
||||||
|
// TODO
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IASTNode getPhysicalNode() throws DOMException {
|
||||||
|
throw new PDOMNotImplementedError();
|
||||||
|
}
|
||||||
|
|
||||||
|
public IASTName getScopeName() throws DOMException {
|
||||||
|
throw new PDOMNotImplementedError();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isFullyCached() throws DOMException {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeBinding(IBinding binding) throws DOMException {
|
||||||
|
throw new PDOMNotImplementedError();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFullyCached(boolean b) throws DOMException {
|
||||||
|
throw new PDOMNotImplementedError();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,73 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2006 QNX Software Systems and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* QNX - Initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
|
||||||
|
|
||||||
|
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.cpp.ICPPNamespaceAlias;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespaceScope;
|
||||||
|
import org.eclipse.cdt.internal.core.pdom.PDOMDatabase;
|
||||||
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
||||||
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
|
||||||
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNotImplementedError;
|
||||||
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Doug Schaefer
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class PDOMCPPNamespaceAlias extends PDOMBinding implements
|
||||||
|
ICPPNamespaceAlias {
|
||||||
|
|
||||||
|
public PDOMCPPNamespaceAlias(PDOMDatabase pdom, PDOMNode parent,
|
||||||
|
IASTName name) throws CoreException {
|
||||||
|
super(pdom, parent, name, PDOMCPPLinkage.CPPNAMESPACEALIAS);
|
||||||
|
}
|
||||||
|
|
||||||
|
public PDOMCPPNamespaceAlias(PDOMDatabase pdom, int record) {
|
||||||
|
super(pdom, record);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected int getRecordSize() {
|
||||||
|
return RECORD_SIZE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ICPPNamespaceScope getNamespaceScope() throws DOMException {
|
||||||
|
throw new PDOMNotImplementedError();
|
||||||
|
}
|
||||||
|
|
||||||
|
public IBinding[] getMemberBindings() throws DOMException {
|
||||||
|
throw new PDOMNotImplementedError();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[] getQualifiedName() throws DOMException {
|
||||||
|
throw new PDOMNotImplementedError();
|
||||||
|
}
|
||||||
|
|
||||||
|
public char[][] getQualifiedNameCharArray() throws DOMException {
|
||||||
|
throw new PDOMNotImplementedError();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isGloballyQualified() throws DOMException {
|
||||||
|
throw new PDOMNotImplementedError();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getDelegateType() {
|
||||||
|
throw new PDOMNotImplementedError();
|
||||||
|
}
|
||||||
|
|
||||||
|
public IBinding getBinding() {
|
||||||
|
throw new PDOMNotImplementedError();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -11,8 +11,6 @@
|
||||||
|
|
||||||
package org.eclipse.cdt.internal.ui.indexview;
|
package org.eclipse.cdt.internal.ui.indexview;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.IPDOM;
|
import org.eclipse.cdt.core.dom.IPDOM;
|
||||||
import org.eclipse.cdt.core.dom.PDOM;
|
import org.eclipse.cdt.core.dom.PDOM;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTFileLocation;
|
import org.eclipse.cdt.core.dom.ast.IASTFileLocation;
|
||||||
|
@ -21,6 +19,7 @@ import org.eclipse.cdt.core.dom.ast.ICompositeType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IFunction;
|
import org.eclipse.cdt.core.dom.ast.IFunction;
|
||||||
import org.eclipse.cdt.core.dom.ast.IVariable;
|
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.ICPPClassType;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespace;
|
||||||
import org.eclipse.cdt.core.model.CModelException;
|
import org.eclipse.cdt.core.model.CModelException;
|
||||||
import org.eclipse.cdt.core.model.CoreModel;
|
import org.eclipse.cdt.core.model.CoreModel;
|
||||||
import org.eclipse.cdt.core.model.ICModel;
|
import org.eclipse.cdt.core.model.ICModel;
|
||||||
|
@ -35,6 +34,7 @@ import org.eclipse.cdt.internal.core.pdom.dom.PDOMMember;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMMemberOwner;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMMemberOwner;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMName;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMName;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
|
||||||
|
import org.eclipse.cdt.internal.core.pdom.dom.cpp.PDOMCPPNamespace;
|
||||||
import org.eclipse.cdt.internal.ui.util.EditorUtility;
|
import org.eclipse.cdt.internal.ui.util.EditorUtility;
|
||||||
import org.eclipse.cdt.internal.ui.viewsupport.CElementImageProvider;
|
import org.eclipse.cdt.internal.ui.viewsupport.CElementImageProvider;
|
||||||
import org.eclipse.cdt.ui.CUIPlugin;
|
import org.eclipse.cdt.ui.CUIPlugin;
|
||||||
|
@ -217,6 +217,19 @@ public class IndexView extends ViewPart implements PDOMDatabase.IListener {
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
CUIPlugin.getDefault().log(e);
|
CUIPlugin.getDefault().log(e);
|
||||||
}
|
}
|
||||||
|
} else if (parentElement instanceof PDOMCPPNamespace) {
|
||||||
|
try {
|
||||||
|
PDOMCPPNamespace namespace = (PDOMCPPNamespace)parentElement;
|
||||||
|
PDOMDatabase pdom = namespace.getPDOM();
|
||||||
|
Counter counter = new Counter(pdom);
|
||||||
|
namespace.getIndex().visit(counter);
|
||||||
|
PDOMBinding[] bindings = new PDOMBinding[counter.count];
|
||||||
|
Children children = new Children(pdom, bindings);
|
||||||
|
namespace.getIndex().visit(children);
|
||||||
|
return bindings;
|
||||||
|
} catch (CoreException e) {
|
||||||
|
CUIPlugin.getDefault().log(e);
|
||||||
|
}
|
||||||
} else if (parentElement instanceof PDOMMemberOwner) {
|
} else if (parentElement instanceof PDOMMemberOwner) {
|
||||||
try {
|
try {
|
||||||
PDOMMemberOwner owner = (PDOMMemberOwner)parentElement;
|
PDOMMemberOwner owner = (PDOMMemberOwner)parentElement;
|
||||||
|
@ -251,7 +264,8 @@ public class IndexView extends ViewPart implements PDOMDatabase.IListener {
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
CUIPlugin.getDefault().log(e);
|
CUIPlugin.getDefault().log(e);
|
||||||
}
|
}
|
||||||
} else if (element instanceof PDOMLinkage) {
|
} else if (element instanceof PDOMLinkage
|
||||||
|
|| element instanceof PDOMCPPNamespace) {
|
||||||
return true;
|
return true;
|
||||||
} else if (element instanceof PDOMMemberOwner) {
|
} else if (element instanceof PDOMMemberOwner) {
|
||||||
try {
|
try {
|
||||||
|
@ -318,6 +332,9 @@ public class IndexView extends ViewPart implements PDOMDatabase.IListener {
|
||||||
else if (element instanceof ICompositeType)
|
else if (element instanceof ICompositeType)
|
||||||
return CUIPlugin.getImageDescriptorRegistry().get(
|
return CUIPlugin.getImageDescriptorRegistry().get(
|
||||||
CElementImageProvider.getStructImageDescriptor());
|
CElementImageProvider.getStructImageDescriptor());
|
||||||
|
else if (element instanceof ICPPNamespace)
|
||||||
|
return CUIPlugin.getImageDescriptorRegistry().get(
|
||||||
|
CElementImageProvider.getNamespaceImageDescriptor());
|
||||||
else if (element instanceof IBinding)
|
else if (element instanceof IBinding)
|
||||||
return PlatformUI.getWorkbench().getSharedImages().getImage(
|
return PlatformUI.getWorkbench().getSharedImages().getImage(
|
||||||
ISharedImages.IMG_OBJ_ELEMENT);
|
ISharedImages.IMG_OBJ_ELEMENT);
|
||||||
|
|
Loading…
Add table
Reference in a new issue