mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-26 02:15:31 +02:00
Enough to get firefox indexed.
This commit is contained in:
parent
8710a1aaa2
commit
34ff5e15b0
6 changed files with 291 additions and 12 deletions
|
@ -13,6 +13,7 @@ package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier;
|
import org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTElaboratedTypeSpecifier;
|
import org.eclipse.cdt.core.dom.ast.IASTElaboratedTypeSpecifier;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.ITypedef;
|
import org.eclipse.cdt.core.dom.ast.ITypedef;
|
||||||
import org.eclipse.cdt.core.dom.ast.c.ICASTDeclSpecifier;
|
import org.eclipse.cdt.core.dom.ast.c.ICASTDeclSpecifier;
|
||||||
|
@ -108,6 +109,8 @@ public class CQualifierType implements ICQualifierType, ITypeContainer {
|
||||||
} else if( declSpec instanceof IASTCompositeTypeSpecifier ){
|
} else if( declSpec instanceof IASTCompositeTypeSpecifier ){
|
||||||
IASTCompositeTypeSpecifier compTypeSpec = (IASTCompositeTypeSpecifier) declSpec;
|
IASTCompositeTypeSpecifier compTypeSpec = (IASTCompositeTypeSpecifier) declSpec;
|
||||||
t = (IType) compTypeSpec.getName().resolveBinding();
|
t = (IType) compTypeSpec.getName().resolveBinding();
|
||||||
|
} else if (declSpec instanceof IASTEnumerationSpecifier) {
|
||||||
|
t = new CEnumeration(((IASTEnumerationSpecifier)declSpec).getName());
|
||||||
} else {
|
} else {
|
||||||
t = new CBasicType((ICASTSimpleDeclSpecifier)declSpec);
|
t = new CBasicType((ICASTSimpleDeclSpecifier)declSpec);
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,11 +67,12 @@ public class PDOM extends PlatformObject
|
||||||
private final IPath dbPath;
|
private final IPath dbPath;
|
||||||
private Database db;
|
private Database db;
|
||||||
|
|
||||||
public static final int VERSION = 3;
|
public static final int VERSION = 4;
|
||||||
// 0 - the beginning of it all
|
// 0 - the beginning of it all
|
||||||
// 1 - first change to kick off upgrades
|
// 1 - first change to kick off upgrades
|
||||||
// 2 - added file inclusions
|
// 2 - added file inclusions
|
||||||
// 3 - added macros and change string implementation
|
// 3 - added macros and change string implementation
|
||||||
|
// 4 - added parameters in C++
|
||||||
|
|
||||||
public static final int LINKAGES = Database.DATA_AREA;
|
public static final int LINKAGES = Database.DATA_AREA;
|
||||||
public static final int FILE_INDEX = Database.DATA_AREA + 4;
|
public static final int FILE_INDEX = Database.DATA_AREA + 4;
|
||||||
|
|
|
@ -11,13 +11,21 @@
|
||||||
|
|
||||||
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
|
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.DOMException;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.IFunctionType;
|
import org.eclipse.cdt.core.dom.ast.IFunctionType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IParameter;
|
import org.eclipse.cdt.core.dom.ast.IParameter;
|
||||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTParameterDeclaration;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPFunction;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionType;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPParameter;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
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.PDOMNode;
|
||||||
|
@ -28,10 +36,28 @@ import org.eclipse.core.runtime.CoreException;
|
||||||
* @author Doug Schaefer
|
* @author Doug Schaefer
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class PDOMCPPFunction extends PDOMBinding implements ICPPFunction {
|
public class PDOMCPPFunction extends PDOMBinding implements ICPPFunction, ICPPFunctionType {
|
||||||
|
|
||||||
|
public static final int NUM_PARAMS = PDOMBinding.RECORD_SIZE + 0;
|
||||||
|
public static final int FIRST_PARAM = PDOMBinding.RECORD_SIZE + 4;
|
||||||
|
|
||||||
|
public static final int RECORD_SIZE = PDOMBinding.RECORD_SIZE + 8;
|
||||||
|
|
||||||
public PDOMCPPFunction(PDOM pdom, PDOMNode parent, IASTName name) throws CoreException {
|
public PDOMCPPFunction(PDOM pdom, PDOMNode parent, IASTName name) throws CoreException {
|
||||||
super(pdom, parent, name, PDOMCPPLinkage.CPPFUNCTION);
|
super(pdom, parent, name, PDOMCPPLinkage.CPPFUNCTION);
|
||||||
|
IASTNode parentNode = name.getParent();
|
||||||
|
if (parentNode instanceof ICPPASTFunctionDeclarator) {
|
||||||
|
ICPPASTFunctionDeclarator funcDecl = (ICPPASTFunctionDeclarator)parentNode;
|
||||||
|
IASTParameterDeclaration[] params = funcDecl.getParameters();
|
||||||
|
pdom.getDB().putInt(record + NUM_PARAMS, params.length);
|
||||||
|
for (int i = 0; i < params.length; ++i) {
|
||||||
|
ICPPASTParameterDeclaration param = (ICPPASTParameterDeclaration)params[i];
|
||||||
|
IASTName paramName = param.getDeclarator().getName();
|
||||||
|
IBinding binding = paramName.resolveBinding();
|
||||||
|
ICPPParameter paramBinding = (ICPPParameter)binding;
|
||||||
|
setFirstParameter(new PDOMCPPParameter(pdom, this, paramName, paramBinding));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public PDOMCPPFunction(PDOM pdom, int bindingRecord) {
|
public PDOMCPPFunction(PDOM pdom, int bindingRecord) {
|
||||||
|
@ -42,6 +68,18 @@ public class PDOMCPPFunction extends PDOMBinding implements ICPPFunction {
|
||||||
return RECORD_SIZE;
|
return RECORD_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public PDOMCPPParameter getFirstParameter() throws CoreException {
|
||||||
|
int rec = pdom.getDB().getInt(record + FIRST_PARAM);
|
||||||
|
return rec != 0 ? new PDOMCPPParameter(pdom, rec) : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFirstParameter(PDOMCPPParameter param) throws CoreException {
|
||||||
|
if (param != null)
|
||||||
|
param.setNextParameter(getFirstParameter());
|
||||||
|
int rec = param != null ? param.getRecord() : 0;
|
||||||
|
pdom.getDB().putInt(record + FIRST_PARAM, rec);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isInline() throws DOMException {
|
public boolean isInline() throws DOMException {
|
||||||
throw new PDOMNotImplementedError();
|
throw new PDOMNotImplementedError();
|
||||||
}
|
}
|
||||||
|
@ -55,13 +93,23 @@ public class PDOMCPPFunction extends PDOMBinding implements ICPPFunction {
|
||||||
}
|
}
|
||||||
|
|
||||||
public IParameter[] getParameters() throws DOMException {
|
public IParameter[] getParameters() throws DOMException {
|
||||||
// TODO
|
try {
|
||||||
return new IParameter[0];
|
int n = pdom.getDB().getInt(record + NUM_PARAMS);
|
||||||
|
IParameter[] params = new IParameter[n];
|
||||||
|
PDOMCPPParameter param = getFirstParameter();
|
||||||
|
while (param != null) {
|
||||||
|
params[--n] = param;
|
||||||
|
param = param.getNextParameter();
|
||||||
|
}
|
||||||
|
return params;
|
||||||
|
} catch (CoreException e) {
|
||||||
|
CCorePlugin.log(e);
|
||||||
|
return new IParameter[0];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public IFunctionType getType() throws DOMException {
|
public IFunctionType getType() throws DOMException {
|
||||||
// TODO
|
return this;
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAuto() throws DOMException {
|
public boolean isAuto() throws DOMException {
|
||||||
|
@ -97,4 +145,30 @@ public class PDOMCPPFunction extends PDOMBinding implements ICPPFunction {
|
||||||
throw new PDOMNotImplementedError();
|
throw new PDOMNotImplementedError();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IType[] getParameterTypes() throws DOMException {
|
||||||
|
return new IType[0];
|
||||||
|
// TODO throw new PDOMNotImplementedError();
|
||||||
|
}
|
||||||
|
|
||||||
|
public IType getReturnType() throws DOMException {
|
||||||
|
return null;
|
||||||
|
// TODO throw new PDOMNotImplementedError();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isConst() {
|
||||||
|
throw new PDOMNotImplementedError();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isVolatile() {
|
||||||
|
throw new PDOMNotImplementedError();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isSameType(IType type) {
|
||||||
|
throw new PDOMNotImplementedError();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object clone() {
|
||||||
|
throw new PDOMNotImplementedError();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,7 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPBlockScope;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPClassType;
|
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.CPPImplicitMethod;
|
||||||
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.CPPNamespace;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPNamespaceAlias;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPNamespaceAlias;
|
||||||
|
@ -121,6 +122,8 @@ public class PDOMCPPLinkage extends PDOMLinkage {
|
||||||
pdomBinding = new PDOMCPPVariable(pdom, parent, name);
|
pdomBinding = new PDOMCPPVariable(pdom, parent, name);
|
||||||
} else if (binding instanceof CPPMethod && parent instanceof PDOMCPPClassType) {
|
} else if (binding instanceof CPPMethod && parent instanceof PDOMCPPClassType) {
|
||||||
pdomBinding = new PDOMCPPMethod(pdom, (PDOMCPPClassType)parent, name);
|
pdomBinding = new PDOMCPPMethod(pdom, (PDOMCPPClassType)parent, name);
|
||||||
|
} else if (binding instanceof CPPImplicitMethod) {
|
||||||
|
// skip these for now
|
||||||
} 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) {
|
||||||
|
|
|
@ -14,11 +14,19 @@ package org.eclipse.cdt.internal.core.pdom.dom.cpp;
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.IFunctionType;
|
import org.eclipse.cdt.core.dom.ast.IFunctionType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IParameter;
|
import org.eclipse.cdt.core.dom.ast.IParameter;
|
||||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTParameterDeclaration;
|
||||||
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.ICPPFunctionType;
|
||||||
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.ICPPParameter;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMMember;
|
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;
|
||||||
|
@ -29,10 +37,28 @@ import org.eclipse.core.runtime.CoreException;
|
||||||
* @author Doug Schaefer
|
* @author Doug Schaefer
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class PDOMCPPMethod extends PDOMMember implements ICPPMethod {
|
public class PDOMCPPMethod extends PDOMMember implements ICPPMethod, ICPPFunctionType {
|
||||||
|
|
||||||
|
public static final int NUM_PARAMS = PDOMMember.RECORD_SIZE + 0;
|
||||||
|
public static final int FIRST_PARAM = PDOMMember.RECORD_SIZE + 4;
|
||||||
|
|
||||||
|
public static final int RECORD_SIZE = PDOMMember.RECORD_SIZE + 8;
|
||||||
|
|
||||||
public PDOMCPPMethod(PDOM pdom, PDOMMemberOwner parent, IASTName name) throws CoreException {
|
public PDOMCPPMethod(PDOM pdom, PDOMMemberOwner parent, IASTName name) throws CoreException {
|
||||||
super(pdom, parent, name, PDOMCPPLinkage.CPPMETHOD);
|
super(pdom, parent, name, PDOMCPPLinkage.CPPMETHOD);
|
||||||
|
IASTNode parentNode = name.getParent();
|
||||||
|
if (parentNode instanceof ICPPASTFunctionDeclarator) {
|
||||||
|
ICPPASTFunctionDeclarator funcDecl = (ICPPASTFunctionDeclarator)parentNode;
|
||||||
|
IASTParameterDeclaration[] params = funcDecl.getParameters();
|
||||||
|
pdom.getDB().putInt(record + NUM_PARAMS, params.length);
|
||||||
|
for (int i = 0; i < params.length; ++i) {
|
||||||
|
ICPPASTParameterDeclaration param = (ICPPASTParameterDeclaration)params[i];
|
||||||
|
IASTName paramName = param.getDeclarator().getName();
|
||||||
|
IBinding binding = paramName.resolveBinding();
|
||||||
|
ICPPParameter paramBinding = (ICPPParameter)binding;
|
||||||
|
setFirstParameter(new PDOMCPPParameter(pdom, this, paramName, paramBinding));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public PDOMCPPMethod(PDOM pdom, int record) {
|
public PDOMCPPMethod(PDOM pdom, int record) {
|
||||||
|
@ -43,6 +69,18 @@ public class PDOMCPPMethod extends PDOMMember implements ICPPMethod {
|
||||||
return RECORD_SIZE;
|
return RECORD_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public PDOMCPPParameter getFirstParameter() throws CoreException {
|
||||||
|
int rec = pdom.getDB().getInt(record + FIRST_PARAM);
|
||||||
|
return rec != 0 ? new PDOMCPPParameter(pdom, rec) : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFirstParameter(PDOMCPPParameter param) throws CoreException {
|
||||||
|
if (param != null)
|
||||||
|
param.setNextParameter(getFirstParameter());
|
||||||
|
int rec = param != null ? param.getRecord() : 0;
|
||||||
|
pdom.getDB().putInt(record + FIRST_PARAM, rec);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isVirtual() throws DOMException {
|
public boolean isVirtual() throws DOMException {
|
||||||
throw new PDOMNotImplementedError();
|
throw new PDOMNotImplementedError();
|
||||||
}
|
}
|
||||||
|
@ -60,8 +98,19 @@ public class PDOMCPPMethod extends PDOMMember implements ICPPMethod {
|
||||||
}
|
}
|
||||||
|
|
||||||
public IParameter[] getParameters() throws DOMException {
|
public IParameter[] getParameters() throws DOMException {
|
||||||
// TODO - need some real parameters
|
try {
|
||||||
return new IParameter[0];
|
int n = pdom.getDB().getInt(record + NUM_PARAMS);
|
||||||
|
IParameter[] params = new IParameter[n];
|
||||||
|
PDOMCPPParameter param = getFirstParameter();
|
||||||
|
while (param != null) {
|
||||||
|
params[--n] = param;
|
||||||
|
param = param.getNextParameter();
|
||||||
|
}
|
||||||
|
return params;
|
||||||
|
} catch (CoreException e) {
|
||||||
|
CCorePlugin.log(e);
|
||||||
|
return new IParameter[0];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public IScope getFunctionScope() throws DOMException {
|
public IScope getFunctionScope() throws DOMException {
|
||||||
|
@ -69,8 +118,7 @@ public class PDOMCPPMethod extends PDOMMember implements ICPPMethod {
|
||||||
}
|
}
|
||||||
|
|
||||||
public IFunctionType getType() throws DOMException {
|
public IFunctionType getType() throws DOMException {
|
||||||
// TODO
|
return this;
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isStatic() throws DOMException {
|
public boolean isStatic() throws DOMException {
|
||||||
|
@ -120,4 +168,32 @@ public class PDOMCPPMethod extends PDOMMember implements ICPPMethod {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Object clone() {
|
||||||
|
throw new PDOMNotImplementedError();
|
||||||
|
}
|
||||||
|
|
||||||
|
public IType[] getParameterTypes() throws DOMException {
|
||||||
|
return new IType[0];
|
||||||
|
// TODO throw new PDOMNotImplementedError();
|
||||||
|
}
|
||||||
|
|
||||||
|
public IType getReturnType() throws DOMException {
|
||||||
|
return null;
|
||||||
|
// TODO throw new PDOMNotImplementedError();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isConst() {
|
||||||
|
return false;
|
||||||
|
// TODO throw new PDOMNotImplementedError();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isVolatile() {
|
||||||
|
return false;
|
||||||
|
// TODO throw new PDOMNotImplementedError();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isSameType(IType type) {
|
||||||
|
throw new PDOMNotImplementedError();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,122 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* 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.IASTInitializer;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPParameter;
|
||||||
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
|
||||||
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNotImplementedError;
|
||||||
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A parameter to a function or a method
|
||||||
|
*
|
||||||
|
* @author Doug Schaefer
|
||||||
|
*/
|
||||||
|
public class PDOMCPPParameter extends PDOMNode implements ICPPParameter {
|
||||||
|
|
||||||
|
public static final int NEXT_PARAM = PDOMNode.RECORD_SIZE + 0;
|
||||||
|
public static final int RECORD_SIZE = PDOMNode.RECORD_SIZE + 4;
|
||||||
|
|
||||||
|
public PDOMCPPParameter(PDOM pdom, int record) {
|
||||||
|
super(pdom, record);
|
||||||
|
}
|
||||||
|
|
||||||
|
public PDOMCPPParameter(PDOM pdom, PDOMNode parent, IASTName name, ICPPParameter param)
|
||||||
|
throws CoreException {
|
||||||
|
super(pdom, parent, name.toCharArray());
|
||||||
|
// IType type = param.getType();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected int getRecordSize() {
|
||||||
|
return RECORD_SIZE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNextParameter(PDOMCPPParameter nextParam) throws CoreException {
|
||||||
|
int rec = nextParam != null ? nextParam.getRecord() : 0;
|
||||||
|
pdom.getDB().putInt(record + NEXT_PARAM, rec);
|
||||||
|
}
|
||||||
|
|
||||||
|
public PDOMCPPParameter getNextParameter() throws CoreException {
|
||||||
|
int rec = pdom.getDB().getInt(record + NEXT_PARAM);
|
||||||
|
return rec != 0 ? new PDOMCPPParameter(pdom, rec) : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IASTInitializer getDefaultValue() {
|
||||||
|
return null;
|
||||||
|
// TODO 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 boolean isMutable() throws DOMException {
|
||||||
|
throw new PDOMNotImplementedError();
|
||||||
|
}
|
||||||
|
|
||||||
|
public IType getType() throws DOMException {
|
||||||
|
return null;
|
||||||
|
// TODO throw new PDOMNotImplementedError();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isAuto() throws DOMException {
|
||||||
|
throw new PDOMNotImplementedError();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isExtern() throws DOMException {
|
||||||
|
throw new PDOMNotImplementedError();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isRegister() throws DOMException {
|
||||||
|
throw new PDOMNotImplementedError();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isStatic() throws DOMException {
|
||||||
|
throw new PDOMNotImplementedError();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return new String(getNameCharArray());
|
||||||
|
}
|
||||||
|
|
||||||
|
public IScope getScope() throws DOMException {
|
||||||
|
throw new PDOMNotImplementedError();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getAdapter(Class adapter) {
|
||||||
|
throw new PDOMNotImplementedError();
|
||||||
|
}
|
||||||
|
|
||||||
|
public char[] getNameCharArray() {
|
||||||
|
try {
|
||||||
|
return super.getNameCharArray();
|
||||||
|
} catch (CoreException e) {
|
||||||
|
CCorePlugin.log(e);
|
||||||
|
return new char[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue