1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-23 17:05:26 +02:00

toString methods.

This commit is contained in:
Sergey Prigogin 2009-08-02 00:39:51 +00:00
parent ea15b5e2bd
commit e22010288b
8 changed files with 66 additions and 24 deletions

View file

@ -181,4 +181,9 @@ public class CEnumeration extends PlatformObject implements IEnumeration, ICInte
// either local or global, never part of structs
return CVisitor.findEnclosingFunction(node);
}
@Override
public String toString() {
return getName();
}
}

View file

@ -46,6 +46,7 @@ public class CEnumerator extends PlatformObject implements IEnumerator {
}
private final IASTName enumeratorName;
public CEnumerator( IASTEnumerator enumtor ){
this.enumeratorName = enumtor.getName();
enumeratorName.setBinding( this );
@ -96,4 +97,9 @@ public class CEnumerator extends PlatformObject implements IEnumerator {
return Value.UNKNOWN;
}
@Override
public String toString() {
return getName();
}
}

View file

@ -35,9 +35,9 @@ import org.eclipse.core.runtime.PlatformObject;
public class CPPEnumeration extends PlatformObject implements IEnumeration, ICPPInternalBinding {
private IASTName enumName;
public CPPEnumeration( IASTName name ) {
public CPPEnumeration(IASTName name) {
this.enumName = name;
name.setBinding( this );
name.setBinding(this);
}
public IASTNode[] getDeclarations() {
@ -57,7 +57,7 @@ public class CPPEnumeration extends PlatformObject implements IEnumeration, ICPP
}
public IScope getScope() {
return CPPVisitor.getContainingScope( enumName );
return CPPVisitor.getContainingScope(enumName);
}
public IASTNode getPhysicalNode() {
@ -65,38 +65,39 @@ public class CPPEnumeration extends PlatformObject implements IEnumeration, ICPP
}
@Override
public Object clone(){
public Object clone() {
IType t = null;
try {
t = (IType) super.clone();
} catch ( CloneNotSupportedException e ) {
} catch (CloneNotSupportedException e) {
//not going to happen
}
return t;
}
public IEnumerator[] getEnumerators() {
IASTEnumerationSpecifier.IASTEnumerator[] enums = ((IASTEnumerationSpecifier)enumName.getParent()).getEnumerators();
IEnumerator [] bindings = new IEnumerator [ enums.length ];
IASTEnumerationSpecifier.IASTEnumerator[] enums =
((IASTEnumerationSpecifier) enumName.getParent()).getEnumerators();
IEnumerator[] bindings = new IEnumerator[enums.length];
for( int i = 0; i < enums.length; i++ ){
for (int i = 0; i < enums.length; i++) {
bindings[i] = (IEnumerator) enums[i].getName().resolveBinding();
}
return bindings;
}
public String[] getQualifiedName() {
return CPPVisitor.getQualifiedName( this );
return CPPVisitor.getQualifiedName(this);
}
public char[][] getQualifiedNameCharArray() {
return CPPVisitor.getQualifiedNameCharArray( this );
return CPPVisitor.getQualifiedNameCharArray(this);
}
public boolean isGloballyQualified() throws DOMException {
IScope scope = getScope();
while( scope != null ){
if( scope instanceof ICPPBlockScope )
while (scope != null) {
if (scope instanceof ICPPBlockScope)
return false;
scope = scope.getParent();
}
@ -109,11 +110,11 @@ public class CPPEnumeration extends PlatformObject implements IEnumeration, ICPP
public void addDeclaration(IASTNode node) {
}
public boolean isSameType( IType type ) {
if( type == this )
public boolean isSameType(IType type) {
if (type == this)
return true;
if( type instanceof ITypedef || type instanceof IIndexType)
return type.isSameType( this );
if (type instanceof ITypedef || type instanceof IIndexType)
return type.isSameType(this);
return false;
}
@ -124,4 +125,9 @@ public class CPPEnumeration extends PlatformObject implements IEnumeration, ICPP
public IBinding getOwner() throws DOMException {
return CPPVisitor.findDeclarationOwner(enumName, true);
}
@Override
public String toString() {
return getName();
}
}

View file

@ -144,4 +144,9 @@ public class CPPEnumerator extends PlatformObject implements IEnumerator, ICPPIn
return Value.UNKNOWN;
}
@Override
public String toString() {
return getName();
}
}

View file

@ -25,7 +25,7 @@ class CompositeCEnumeration extends CompositeCBinding implements IEnumeration, I
public IEnumerator[] getEnumerators() throws DOMException {
IEnumerator[] result = ((IEnumeration)rbinding).getEnumerators();
for(int i=0; i<result.length; i++)
for (int i= 0; i < result.length; i++)
result[i] = (IEnumerator) cf.getCompositeBinding((IIndexFragmentBinding) result[i]);
return result;
}
@ -35,5 +35,10 @@ class CompositeCEnumeration extends CompositeCBinding implements IEnumeration, I
}
@Override
public Object clone() {fail(); return null;}
public Object clone() { fail(); return null; }
@Override
public String toString() {
return getName();
}
}

View file

@ -24,10 +24,15 @@ class CompositeCEnumerator extends CompositeCBinding implements IEnumerator {
}
public IType getType() throws DOMException {
return cf.getCompositeType((IIndexType)((IEnumerator)rbinding).getType());
return cf.getCompositeType((IIndexType) ((IEnumerator) rbinding).getType());
}
public IValue getValue() {
return ((IEnumerator)rbinding).getValue();
return ((IEnumerator) rbinding).getValue();
}
@Override
public String toString() {
return getName();
}
}

View file

@ -25,7 +25,7 @@ class CompositeCPPEnumeration extends CompositeCPPBinding implements IEnumeratio
public IEnumerator[] getEnumerators() throws DOMException {
IEnumerator[] result = ((IEnumeration)rbinding).getEnumerators();
for(int i=0; i<result.length; i++)
for (int i= 0; i < result.length; i++)
result[i] = (IEnumerator) cf.getCompositeBinding((IIndexFragmentBinding) result[i]);
return result;
}
@ -36,4 +36,9 @@ class CompositeCPPEnumeration extends CompositeCPPBinding implements IEnumeratio
@Override
public Object clone() { fail(); return null; }
@Override
public String toString() {
return getName();
}
}

View file

@ -23,11 +23,16 @@ class CompositeCPPEnumerator extends CompositeCPPBinding implements IEnumerator
}
public IType getType() throws DOMException {
IType type = ((IEnumerator)rbinding).getType();
return cf.getCompositeType((IIndexType)type);
IType type = ((IEnumerator) rbinding).getType();
return cf.getCompositeType((IIndexType) type);
}
public IValue getValue() {
return ((IEnumerator)rbinding).getValue();
return ((IEnumerator) rbinding).getValue();
}
@Override
public String toString() {
return getName();
}
}