mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 17:56:01 +02:00
toString method.
This commit is contained in:
parent
e34b9fc378
commit
648ade1628
7 changed files with 71 additions and 22 deletions
|
@ -18,7 +18,7 @@ import org.eclipse.cdt.core.dom.ast.DOMException;
|
|||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
|
||||
/**
|
||||
* internal interface representing types that contain other types
|
||||
* Internal interface representing types that contain other types
|
||||
* @author aniefer
|
||||
*/
|
||||
public interface ITypeContainer extends IType {
|
||||
|
|
|
@ -22,11 +22,12 @@ import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer;
|
|||
*/
|
||||
public class ArrayTypeClone implements IIndexType, IArrayType, ITypeContainer {
|
||||
private final IArrayType delegate;
|
||||
private IType type = null;
|
||||
private IType type;
|
||||
|
||||
public ArrayTypeClone(IArrayType array) {
|
||||
this.delegate = array;
|
||||
}
|
||||
|
||||
public boolean isSameType(IType type) {
|
||||
if (type instanceof ITypedef)
|
||||
return ((ITypedef) type).isSameType(this);
|
||||
|
@ -45,20 +46,29 @@ public class ArrayTypeClone implements IIndexType, IArrayType, ITypeContainer {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public IASTExpression getArraySizeExpression() throws DOMException {
|
||||
return delegate.getArraySizeExpression();
|
||||
}
|
||||
|
||||
public IType getType() throws DOMException {
|
||||
if (type == null) {
|
||||
return delegate.getType();
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(IType type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object clone() {
|
||||
return new ArrayTypeClone(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return delegate.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,17 +21,19 @@ import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer;
|
|||
*/
|
||||
public class CPPReferenceTypeClone implements ICPPReferenceType, ITypeContainer, IIndexType {
|
||||
private final ICPPReferenceType delegate;
|
||||
private IType type = null;
|
||||
private IType type;
|
||||
|
||||
public CPPReferenceTypeClone(ICPPReferenceType reference) {
|
||||
this.delegate = reference;
|
||||
}
|
||||
|
||||
public IType getType() throws DOMException {
|
||||
if (type == null) {
|
||||
return delegate.getType();
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
public boolean isSameType(IType type) {
|
||||
if (type instanceof ITypedef)
|
||||
return type.isSameType(this);
|
||||
|
@ -49,11 +51,18 @@ public class CPPReferenceTypeClone implements ICPPReferenceType, ITypeContainer,
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setType(IType type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object clone() {
|
||||
return new CPPReferenceTypeClone(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return delegate.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,36 +25,44 @@ import org.eclipse.core.runtime.CoreException;
|
|||
*/
|
||||
public class CPPTypedefClone implements ITypedef, ITypeContainer, IIndexType, ICPPBinding {
|
||||
protected final ITypedef delegate;
|
||||
private IType type = null;
|
||||
private IType type;
|
||||
|
||||
public CPPTypedefClone(ITypedef typedef) {
|
||||
this.delegate = typedef;
|
||||
}
|
||||
|
||||
public IType getType() throws DOMException {
|
||||
if (type == null) {
|
||||
return delegate.getType();
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
public ILinkage getLinkage() throws CoreException {
|
||||
return delegate.getLinkage();
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return delegate.getName();
|
||||
}
|
||||
|
||||
public char[] getNameCharArray() {
|
||||
return delegate.getNameCharArray();
|
||||
}
|
||||
|
||||
public IScope getScope() throws DOMException {
|
||||
return delegate.getScope();
|
||||
}
|
||||
|
||||
public IBinding getOwner() throws DOMException {
|
||||
return delegate.getOwner();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public Object getAdapter(Class adapter) {
|
||||
return delegate.getAdapter(adapter);
|
||||
}
|
||||
|
||||
public boolean isSameType(IType type) {
|
||||
try {
|
||||
IType myrtype = getType();
|
||||
|
@ -69,20 +77,30 @@ public class CPPTypedefClone implements ITypedef, ITypeContainer, IIndexType, IC
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setType(IType type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String[] getQualifiedName() throws DOMException {
|
||||
return ((ICPPBinding) delegate).getQualifiedName();
|
||||
}
|
||||
|
||||
public char[][] getQualifiedNameCharArray() throws DOMException {
|
||||
return ((ICPPBinding) delegate).getQualifiedNameCharArray();
|
||||
}
|
||||
|
||||
public boolean isGloballyQualified() throws DOMException {
|
||||
return ((ICPPBinding) delegate).isGloballyQualified();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object clone() {
|
||||
return new CPPTypedefClone(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return delegate.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer;
|
|||
*/
|
||||
public class PointerTypeClone implements IPointerType, ITypeContainer, IIndexType {
|
||||
protected final IPointerType delegate;
|
||||
private IType type = null;
|
||||
private IType type;
|
||||
|
||||
public PointerTypeClone(IPointerType pointer) {
|
||||
this.delegate = pointer;
|
||||
|
|
|
@ -26,18 +26,22 @@ public class QualifierTypeClone implements IQualifierType, ITypeContainer, IInde
|
|||
public QualifierTypeClone(IQualifierType qualifier) {
|
||||
this.delegate = qualifier;
|
||||
}
|
||||
|
||||
public IType getType() throws DOMException {
|
||||
if (type == null) {
|
||||
return delegate.getType();
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
public boolean isConst() {
|
||||
return delegate.isConst();
|
||||
}
|
||||
|
||||
public boolean isVolatile() {
|
||||
return delegate.isVolatile();
|
||||
}
|
||||
|
||||
public boolean isSameType(IType type) {
|
||||
if (type instanceof ITypedef)
|
||||
return type.isSameType(this);
|
||||
|
@ -54,12 +58,19 @@ public class QualifierTypeClone implements IQualifierType, ITypeContainer, IInde
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setType(IType type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object clone() {
|
||||
return new QualifierTypeClone(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return delegate.toString();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,6 @@ import org.eclipse.cdt.internal.core.pdom.dom.PDOMPointerType;
|
|||
import org.eclipse.core.runtime.CoreException;
|
||||
|
||||
class PDOMCPPPointerToMemberType extends PDOMPointerType implements ICPPPointerToMemberType {
|
||||
|
||||
private static final int TYPE = PDOMPointerType.RECORD_SIZE;
|
||||
@SuppressWarnings("hiding")
|
||||
private static final int RECORD_SIZE= TYPE + 4;
|
||||
|
@ -79,9 +78,11 @@ class PDOMCPPPointerToMemberType extends PDOMPointerType implements ICPPPointerT
|
|||
public PDOMCPPPointerToMemberTypeClone(ICPPPointerToMemberType pointer) {
|
||||
super(pointer);
|
||||
}
|
||||
|
||||
public IType getMemberOfClass() {
|
||||
return ((ICPPPointerToMemberType) delegate).getMemberOfClass();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object clone() {
|
||||
return new PDOMCPPPointerToMemberTypeClone((ICPPPointerToMemberType) delegate);
|
||||
|
|
Loading…
Add table
Reference in a new issue