1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-01 06:05:24 +02:00

Cosmetics.

This commit is contained in:
Sergey Prigogin 2010-05-12 06:26:04 +00:00
parent 207ec8f911
commit 65d630c31c

View file

@ -25,44 +25,43 @@ import org.eclipse.cdt.internal.core.dom.parser.ITypeMarshalBuffer;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
public class CQualifierType implements ICQualifierType, ITypeContainer, ISerializableType { public class CQualifierType implements ICQualifierType, ITypeContainer, ISerializableType {
private boolean isConst; private boolean isConst;
private boolean isVolatile; private boolean isVolatile;
private boolean isRestrict; private boolean isRestrict;
private IType type = null; private IType type;
/** /**
* CQualifierType has an IBasicType to keep track of the basic type information. * CQualifierType has an IBasicType to keep track of the basic type information.
*/ */
public CQualifierType(ICASTDeclSpecifier declSpec) { public CQualifierType(ICASTDeclSpecifier declSpec) {
this.type = resolveType( declSpec ); this.type = resolveType(declSpec);
this.isConst = declSpec.isConst(); this.isConst = declSpec.isConst();
this.isVolatile = declSpec.isVolatile(); this.isVolatile = declSpec.isVolatile();
this.isRestrict = declSpec.isRestrict(); this.isRestrict = declSpec.isRestrict();
} }
public CQualifierType( IType type, boolean isConst, boolean isVolatile, boolean isRestrict ){ public CQualifierType(IType type, boolean isConst, boolean isVolatile, boolean isRestrict) {
this.type = type; this.type = type;
this.isConst = isConst; this.isConst = isConst;
this.isVolatile = isVolatile; this.isVolatile = isVolatile;
this.isRestrict = isRestrict; this.isRestrict = isRestrict;
} }
public boolean isSameType( IType obj ){ public boolean isSameType(IType obj) {
if( obj == this ) if (obj == this)
return true; return true;
if( obj instanceof ITypedef ) if (obj instanceof ITypedef)
return obj.isSameType( this ); return obj.isSameType(this);
if( obj instanceof ICQualifierType ){ if (obj instanceof ICQualifierType) {
ICQualifierType qt = (ICQualifierType) obj; ICQualifierType qt = (ICQualifierType) obj;
if( isConst() != qt.isConst() ) return false; if (isConst() != qt.isConst()) return false;
if( isRestrict() != qt.isRestrict() ) return false; if (isRestrict() != qt.isRestrict()) return false;
if( isVolatile() != qt.isVolatile() ) return false; if (isVolatile() != qt.isVolatile()) return false;
if( type == null ) if (type == null)
return false; return false;
return type.isSameType( qt.getType() ); return type.isSameType(qt.getType());
} }
return false; return false;
} }
@ -91,15 +90,15 @@ public class CQualifierType implements ICQualifierType, ITypeContainer, ISeriali
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IQualifierType#getType() * @see org.eclipse.cdt.core.dom.ast.IQualifierType#getType()
*/ */
private IType resolveType( ICASTDeclSpecifier declSpec ) { private IType resolveType(ICASTDeclSpecifier declSpec) {
IType t = null; IType t = null;
if( declSpec instanceof ICASTTypedefNameSpecifier ){ if (declSpec instanceof ICASTTypedefNameSpecifier) {
ICASTTypedefNameSpecifier nameSpec = (ICASTTypedefNameSpecifier) declSpec; ICASTTypedefNameSpecifier nameSpec = (ICASTTypedefNameSpecifier) declSpec;
t = (IType) nameSpec.getName().resolveBinding(); t = (IType) nameSpec.getName().resolveBinding();
} else if( declSpec instanceof IASTElaboratedTypeSpecifier ){ } else if (declSpec instanceof IASTElaboratedTypeSpecifier) {
IASTElaboratedTypeSpecifier elabTypeSpec = (IASTElaboratedTypeSpecifier) declSpec; IASTElaboratedTypeSpecifier elabTypeSpec = (IASTElaboratedTypeSpecifier) declSpec;
t = (IType) elabTypeSpec.getName().resolveBinding(); t = (IType) elabTypeSpec.getName().resolveBinding();
} 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) { } else if (declSpec instanceof IASTEnumerationSpecifier) {
@ -111,19 +110,20 @@ public class CQualifierType implements ICQualifierType, ITypeContainer, ISeriali
return t; return t;
} }
public IType getType(){ public IType getType() {
return type; return type;
} }
public void setType( IType t ){
public void setType(IType t) {
type = t; type = t;
} }
@Override @Override
public Object clone(){ public Object clone() {
IType t = null; IType t = null;
try { try {
t = (IType) super.clone(); t = (IType) super.clone();
} catch ( CloneNotSupportedException e ) { } catch (CloneNotSupportedException e) {
//not going to happen //not going to happen
} }
return t; return t;