diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPLinkage.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPLinkage.java index 6d55a82b320..decd4f95034 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPLinkage.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPLinkage.java @@ -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.ICPPField; 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.gnu.cpp.GPPLanguage; 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 CPPCLASSTYPE = 3; public static final int CPPFIELD = 4; + public static final int CPPMETHOD = 5; public PDOMNode getParent(IBinding binding) throws CoreException { PDOMNode parent = this; @@ -93,8 +95,8 @@ public class PDOMCPPLinkage extends PDOMLinkage { else if (binding instanceof CPPVariable) { if (!(binding.getScope() instanceof CPPBlockScope)) pdomBinding = new PDOMCPPVariable(pdom, parent, name); - } else if (binding instanceof CPPMethod) { - ; // TODO + } else if (binding instanceof CPPMethod && parent instanceof PDOMCPPClassType) { + pdomBinding = new PDOMCPPMethod(pdom, (PDOMCPPClassType)parent, name); } else if (binding instanceof CPPFunction) { pdomBinding = new PDOMCPPFunction(pdom, parent, name); } else if (binding instanceof CPPClassType) { @@ -139,6 +141,10 @@ public class PDOMCPPLinkage extends PDOMLinkage { if (binding instanceof ICPPField) pdomBinding = tBinding; break; + case CPPMETHOD: + if (binding instanceof ICPPMethod) + pdomBinding = tBinding; + break; } return pdomBinding == null; } @@ -172,6 +178,8 @@ public class PDOMCPPLinkage extends PDOMLinkage { return new PDOMCPPClassType(pdom, record); case CPPFIELD: return new PDOMCPPField(pdom, record); + case CPPMETHOD: + return new PDOMCPPMethod(pdom, record); } return null; diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethod.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethod.java new file mode 100644 index 00000000000..9ad3ed9244b --- /dev/null +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethod.java @@ -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; + } + } + +}