mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-08 18:26:01 +02:00
Added C++ Methods to PDOM.
This commit is contained in:
parent
6535d63ad3
commit
8c0214ebfd
2 changed files with 129 additions and 2 deletions
|
@ -18,6 +18,7 @@ import org.eclipse.cdt.core.dom.ast.IScope;
|
||||||
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.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;
|
||||||
|
@ -59,6 +60,7 @@ public class PDOMCPPLinkage extends PDOMLinkage {
|
||||||
public static final int CPPFUNCTION = 2;
|
public static final int CPPFUNCTION = 2;
|
||||||
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 PDOMNode getParent(IBinding binding) throws CoreException {
|
public PDOMNode getParent(IBinding binding) throws CoreException {
|
||||||
PDOMNode parent = this;
|
PDOMNode parent = this;
|
||||||
|
@ -93,8 +95,8 @@ public class PDOMCPPLinkage extends PDOMLinkage {
|
||||||
else if (binding instanceof CPPVariable) {
|
else if (binding instanceof CPPVariable) {
|
||||||
if (!(binding.getScope() instanceof CPPBlockScope))
|
if (!(binding.getScope() instanceof CPPBlockScope))
|
||||||
pdomBinding = new PDOMCPPVariable(pdom, parent, name);
|
pdomBinding = new PDOMCPPVariable(pdom, parent, name);
|
||||||
} else if (binding instanceof CPPMethod) {
|
} else if (binding instanceof CPPMethod && parent instanceof PDOMCPPClassType) {
|
||||||
; // TODO
|
pdomBinding = new PDOMCPPMethod(pdom, (PDOMCPPClassType)parent, name);
|
||||||
} else if (binding instanceof CPPFunction) {
|
} else if (binding instanceof CPPFunction) {
|
||||||
pdomBinding = new PDOMCPPFunction(pdom, parent, name);
|
pdomBinding = new PDOMCPPFunction(pdom, parent, name);
|
||||||
} else if (binding instanceof CPPClassType) {
|
} else if (binding instanceof CPPClassType) {
|
||||||
|
@ -139,6 +141,10 @@ public class PDOMCPPLinkage extends PDOMLinkage {
|
||||||
if (binding instanceof ICPPField)
|
if (binding instanceof ICPPField)
|
||||||
pdomBinding = tBinding;
|
pdomBinding = tBinding;
|
||||||
break;
|
break;
|
||||||
|
case CPPMETHOD:
|
||||||
|
if (binding instanceof ICPPMethod)
|
||||||
|
pdomBinding = tBinding;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return pdomBinding == null;
|
return pdomBinding == null;
|
||||||
}
|
}
|
||||||
|
@ -172,6 +178,8 @@ public class PDOMCPPLinkage extends PDOMLinkage {
|
||||||
return new PDOMCPPClassType(pdom, record);
|
return new PDOMCPPClassType(pdom, record);
|
||||||
case CPPFIELD:
|
case CPPFIELD:
|
||||||
return new PDOMCPPField(pdom, record);
|
return new PDOMCPPField(pdom, record);
|
||||||
|
case CPPMETHOD:
|
||||||
|
return new PDOMCPPMethod(pdom, record);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -0,0 +1,119 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* 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.IASTName;
|
||||||
|
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.ICPPClassType;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
|
||||||
|
import org.eclipse.cdt.internal.core.pdom.PDOMDatabase;
|
||||||
|
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.PDOMNotImplementedError;
|
||||||
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Doug Schaefer
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class PDOMCPPMethod extends PDOMMember implements ICPPMethod {
|
||||||
|
|
||||||
|
public PDOMCPPMethod(PDOMDatabase pdom, PDOMMemberOwner parent, IASTName name) throws CoreException {
|
||||||
|
super(pdom, parent, name, PDOMCPPLinkage.CPPMETHOD);
|
||||||
|
}
|
||||||
|
|
||||||
|
public PDOMCPPMethod(PDOMDatabase pdom, int record) {
|
||||||
|
super(pdom, record);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected int getRecordSize() {
|
||||||
|
return RECORD_SIZE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isVirtual() throws DOMException {
|
||||||
|
throw new PDOMNotImplementedError();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isDestructor() throws DOMException {
|
||||||
|
throw new PDOMNotImplementedError();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isMutable() throws DOMException {
|
||||||
|
throw new PDOMNotImplementedError();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isInline() throws DOMException {
|
||||||
|
throw new PDOMNotImplementedError();
|
||||||
|
}
|
||||||
|
|
||||||
|
public IParameter[] getParameters() throws DOMException {
|
||||||
|
throw new PDOMNotImplementedError();
|
||||||
|
}
|
||||||
|
|
||||||
|
public IScope getFunctionScope() throws DOMException {
|
||||||
|
throw new PDOMNotImplementedError();
|
||||||
|
}
|
||||||
|
|
||||||
|
public IFunctionType getType() throws DOMException {
|
||||||
|
throw new PDOMNotImplementedError();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isStatic() throws DOMException {
|
||||||
|
throw new PDOMNotImplementedError();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isExtern() throws DOMException {
|
||||||
|
throw new PDOMNotImplementedError();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isAuto() throws DOMException {
|
||||||
|
throw new PDOMNotImplementedError();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isRegister() throws DOMException {
|
||||||
|
throw new PDOMNotImplementedError();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean takesVarArgs() 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 getVisibility() throws DOMException {
|
||||||
|
throw new PDOMNotImplementedError();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ICPPClassType getClassOwner() throws DOMException {
|
||||||
|
try {
|
||||||
|
return (ICPPClassType)getMemberOwner();
|
||||||
|
} catch (CoreException e) {
|
||||||
|
CCorePlugin.log(e);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue