mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-29 20:05:35 +02:00
added new method hasChildren()
This commit is contained in:
parent
9fc30087ce
commit
9c4762f0b7
1 changed files with 38 additions and 28 deletions
|
@ -11,6 +11,8 @@ import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIVariableObject;
|
import org.eclipse.cdt.debug.core.cdi.model.ICDIVariableObject;
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIArrayType;
|
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIArrayType;
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIFunctionType;
|
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIFunctionType;
|
||||||
|
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIPointerType;
|
||||||
|
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIReferenceType;
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIStructType;
|
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIStructType;
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIType;
|
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIType;
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIVoidType;
|
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIVoidType;
|
||||||
|
@ -63,16 +65,6 @@ public class VariableObject extends CObject implements ICDIVariableObject {
|
||||||
castingLength = obj.getCastingArrayEnd();
|
castingLength = obj.getCastingArrayEnd();
|
||||||
castingType = obj.getCastingType();
|
castingType = obj.getCastingType();
|
||||||
}
|
}
|
||||||
// public VariableObject(VariableObject obj, String n) {
|
|
||||||
// super(obj.getTarget());
|
|
||||||
// name = n;
|
|
||||||
// try {
|
|
||||||
// frame = obj.getStackFrame();
|
|
||||||
// } catch (CDIException e) {
|
|
||||||
// }
|
|
||||||
// position = obj.getPosition();
|
|
||||||
// stackdepth = obj.getStackDepth();
|
|
||||||
// }
|
|
||||||
|
|
||||||
public VariableObject(ICDITarget target, String n, ICDIStackFrame stack, int pos, int depth) {
|
public VariableObject(ICDITarget target, String n, ICDIStackFrame stack, int pos, int depth) {
|
||||||
this(target, n, null, stack, pos, depth);
|
this(target, n, null, stack, pos, depth);
|
||||||
|
@ -125,21 +117,16 @@ public class VariableObject extends CObject implements ICDIVariableObject {
|
||||||
public String encodeVariable() {
|
public String encodeVariable() {
|
||||||
StringBuffer buffer = new StringBuffer();
|
StringBuffer buffer = new StringBuffer();
|
||||||
if (castingLength > 0 || castingIndex > 0) {
|
if (castingLength > 0 || castingIndex > 0) {
|
||||||
buffer.append("(");
|
buffer.append("*(");
|
||||||
//buffer.append('(');
|
buffer.append('(').append(getName()).append(')');
|
||||||
if (castingType != null && castingType.length() > 0) {
|
|
||||||
buffer.append('(').append(castingType).append(')');
|
|
||||||
}
|
|
||||||
buffer.append(getName());
|
|
||||||
//buffer.append(')');
|
|
||||||
if (castingIndex != 0) {
|
if (castingIndex != 0) {
|
||||||
buffer.append('+').append(castingIndex);
|
buffer.append('+').append(castingIndex);
|
||||||
}
|
}
|
||||||
buffer.append(')');
|
buffer.append(')');
|
||||||
buffer.append('@').append(castingLength - castingIndex);
|
buffer.append('@').append(castingLength);
|
||||||
} else if (castingType != null && castingType.length() > 0) {
|
} else if (castingType != null && castingType.length() > 0) {
|
||||||
buffer.append('(').append(castingType).append(')');
|
buffer.append("((").append(castingType).append(')');
|
||||||
buffer.append('(').append(getName()).append(')');
|
buffer.append(getName()).append(')');
|
||||||
} else {
|
} else {
|
||||||
buffer.append(getName());
|
buffer.append(getName());
|
||||||
}
|
}
|
||||||
|
@ -217,10 +204,10 @@ public class VariableObject extends CObject implements ICDIVariableObject {
|
||||||
*/
|
*/
|
||||||
public boolean isEditable() throws CDIException {
|
public boolean isEditable() throws CDIException {
|
||||||
ICDIType t = getType();
|
ICDIType t = getType();
|
||||||
if (t instanceof ICDIArrayType ||
|
if (t instanceof ICDIArrayType
|
||||||
t instanceof ICDIStructType ||
|
|| t instanceof ICDIStructType
|
||||||
t instanceof ICDIVoidType ||
|
|| t instanceof ICDIVoidType
|
||||||
t instanceof ICDIFunctionType) {
|
|| t instanceof ICDIFunctionType) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -257,6 +244,30 @@ public class VariableObject extends CObject implements ICDIVariableObject {
|
||||||
return typename;
|
return typename;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIVariableObject#hasChildren()
|
||||||
|
*/
|
||||||
|
public boolean hasChildren() throws CDIException {
|
||||||
|
ICDIType t = getType();
|
||||||
|
|
||||||
|
// For reference we need to get the referenced type
|
||||||
|
// to make a decision.
|
||||||
|
if (t instanceof ICDIReferenceType) {
|
||||||
|
t = ((ICDIReferenceType) t).getComponentType();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (t instanceof ICDIArrayType || t instanceof ICDIStructType) {
|
||||||
|
return true;
|
||||||
|
} else if (t instanceof ICDIPointerType) {
|
||||||
|
ICDIType sub = ((ICDIPointerType) t).getComponentType();
|
||||||
|
if (sub instanceof ICDIVoidType) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIVariableObject#getQualifiedName()
|
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIVariableObject#getQualifiedName()
|
||||||
*/
|
*/
|
||||||
|
@ -267,5 +278,4 @@ public class VariableObject extends CObject implements ICDIVariableObject {
|
||||||
return qualifiedName;
|
return qualifiedName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue