Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] Refactoring of ICVariable

Moved the type and value related methods from ICVariable to ICType and ICValue.

 

Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.ui/ChangeLog,v
retrieving revision 1.158
diff -u -r1.158 ChangeLog
--- ChangeLog	9 Jun 2003 18:11:40 -0000	1.158
+++ ChangeLog	10 Jun 2003 22:30:31 -0000
@@ -1,3 +1,7 @@
+2003-06-10 Mikhail Khodjaiants
+	Refactoring: moved the type and value related methods from ICVariable to ICType and ICValue.
+	* CDTDebugModelPresentation.java
+
 2003-06-09 Mikhail Khodjaiants
 	Added default format preferences for variables, registers and expressions.
 	* CDebugPreferencePage.java
Index: src/org/eclipse/cdt/debug/internal/ui/CDTDebugModelPresentation.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDTDebugModelPresentation.java,v
retrieving revision 1.60
diff -u -r1.60 CDTDebugModelPresentation.java
--- src/org/eclipse/cdt/debug/internal/ui/CDTDebugModelPresentation.java	5 Jun 2003 22:05:07 -0000	1.60
+++ src/org/eclipse/cdt/debug/internal/ui/CDTDebugModelPresentation.java	10 Jun 2003 22:30:32 -0000
@@ -25,6 +25,8 @@
 import org.eclipse.cdt.debug.core.model.ICFunctionBreakpoint;
 import org.eclipse.cdt.debug.core.model.ICLineBreakpoint;
 import org.eclipse.cdt.debug.core.model.ICSharedLibrary;
+import org.eclipse.cdt.debug.core.model.ICType;
+import org.eclipse.cdt.debug.core.model.ICValue;
 import org.eclipse.cdt.debug.core.model.ICVariable;
 import org.eclipse.cdt.debug.core.model.ICWatchpoint;
 import org.eclipse.cdt.debug.core.model.IDummyStackFrame;
@@ -542,15 +544,16 @@
 		StringBuffer label = new StringBuffer();
 		if ( var instanceof ICVariable )
 		{
-			if ( isShowVariableTypeNames() )
+			ICType type = ((ICVariable)var).getType();
+			if ( type != null && isShowVariableTypeNames() )
 			{
-				String type = getVariableTypeName( var );
-				if ( type != null && type.length() > 0 )
+				String typeName = getVariableTypeName( type );
+				if ( typeName != null && typeName.length() > 0 )
 				{
-					label.append( type );
-					if ( ((ICVariable)var).isArray() )
+					label.append( typeName );
+					if ( type.isArray() )
 					{
-						int[] dims = ((ICVariable)var).getArrayDimensions();
+						int[] dims = type.getArrayDimensions();
 						for ( int i = 0; i < dims.length; ++i )
 						{
 							label.append( '[' );					
@@ -563,31 +566,29 @@
 			}
 			label.append( var.getName() );
 			IValue value = var.getValue();
-			if ( value != null )
+			if ( value instanceof ICValue && value.getValueString() != null )
 			{
-				if ( ((ICVariable)var).isCharacter() && value.getValueString() != null )
+				String valueString = value.getValueString().trim();
+				if ( type != null && type.isCharacter() )
 				{
-					String valueString = value.getValueString().trim();
 					if ( valueString.length() == 0 )
 						valueString = ".";
 					label.append( "= " );
 					label.append( valueString );
 				}
-				else if ( ((ICVariable)var).isFloatingPointType() && value.getValueString() != null )
+				else if ( type != null && type.isFloatingPointType() )
 				{
-					String valueString = value.getValueString().trim();
-					if ( ((ICVariable)var).isNaN() )
+					if ( ((ICValue)value).isNaN() )
 						valueString = "NAN";
-					if ( ((ICVariable)var).isPositiveInfinity() )
+					if ( ((ICValue)value).isPositiveInfinity() )
 						valueString = "Infinity";
-					if ( ((ICVariable)var).isNegativeInfinity() )
+					if ( ((ICValue)value).isNegativeInfinity() )
 						valueString = "-Infinity";
 					label.append( "= " );
 					label.append( valueString );
 				}
-				else if ( !((ICVariable)var).isArray() && !((ICVariable)var).isStructure() && value.getValueString() != null )
+				else if ( type == null || ( !type.isArray() && !type.isStructure() ) )
 				{
-					String valueString = value.getValueString().trim();
 					if ( valueString.length() > 0 )
 					{
 						label.append( "= " );
@@ -937,23 +938,16 @@
 		return null;
 	}
 
-	private String getVariableTypeName( IVariable variable )
+	private String getVariableTypeName( ICType type )
 	{
-		String type = null;
-		try
-		{
-			type = variable.getReferenceTypeName();
-			if ( type != null )
-			{
-				int index = type.indexOf( '[' );
-				if ( index != -1 )
-					return type.substring( 0, index ).trim();
-			}
-		}
-		catch( DebugException e )
+		String typeName = type.getName();
+		if ( type.isArray() && typeName != null )
 		{
+			int index = typeName.indexOf( '[' );
+			if ( index != -1 )
+				return typeName.substring( 0, index ).trim();
 		}
-		return type;
+		return typeName;
 	}
 
 	/* (non-Javadoc)
Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.core/ChangeLog,v
retrieving revision 1.204
diff -u -r1.204 ChangeLog
--- ChangeLog	9 Jun 2003 18:11:39 -0000	1.204
+++ ChangeLog	10 Jun 2003 22:30:10 -0000
@@ -1,3 +1,13 @@
+2003-06-10 Mikhail Khodjaiants
+	Refactoring: moved the type and value related methods from ICVariable to ICType and ICValue.
+	* ICType.java: new
+	* ICVariable.java
+	* ICValue.java
+	* CArrayPartitionValue.java
+	* CType.java
+	* CValue.java
+	* CVariable.java
+
 2003-06-09 Mikhail Khodjaiants
 	Added default format preferences for variables, registers and expressions.
 	* CExpression.java
Index: src/org/eclipse/cdt/debug/core/model/ICType.java
===================================================================
RCS file: src/org/eclipse/cdt/debug/core/model/ICType.java
diff -N src/org/eclipse/cdt/debug/core/model/ICType.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/cdt/debug/core/model/ICType.java	10 Jun 2003 22:30:10 -0000
@@ -0,0 +1,33 @@
+/*
+ *(c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ * 
+ */
+
+package org.eclipse.cdt.debug.core.model;
+
+import org.eclipse.core.runtime.IAdaptable;
+
+/**
+ * Enter type comment.
+ * 
+ * @since Jun 10, 2003
+ */
+public interface ICType extends IAdaptable
+{
+	String getName();
+	
+	boolean isArray();
+
+	int[] getArrayDimensions();
+
+	boolean isStructure();
+
+	boolean isCharacter();
+
+	boolean isFloatingPointType();
+
+	boolean isPointer();
+
+	void dispose();
+}
Index: src/org/eclipse/cdt/debug/core/model/ICValue.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICValue.java,v
retrieving revision 1.6
diff -u -r1.6 ICValue.java
--- src/org/eclipse/cdt/debug/core/model/ICValue.java	5 Jun 2003 20:44:45 -0000	1.6
+++ src/org/eclipse/cdt/debug/core/model/ICValue.java	10 Jun 2003 22:30:10 -0000
@@ -31,4 +31,10 @@
 	String evaluateAsExpression();
 
 	void setChanged(  boolean changed ) throws DebugException;
+
+	boolean isNaN();
+
+	boolean isPositiveInfinity();
+
+	boolean isNegativeInfinity();
 }
Index: src/org/eclipse/cdt/debug/core/model/ICVariable.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICVariable.java,v
retrieving revision 1.7
diff -u -r1.7 ICVariable.java
--- src/org/eclipse/cdt/debug/core/model/ICVariable.java	9 Jun 2003 15:45:07 -0000	1.7
+++ src/org/eclipse/cdt/debug/core/model/ICVariable.java	10 Jun 2003 22:30:10 -0000
@@ -22,27 +22,11 @@
 	
 	void reset() throws DebugException;
 	
+	ICType getType() throws DebugException;
+	
 	boolean isEditable();
 	
 	boolean hasChildren();
-
-	boolean isArray();
-
-	int[] getArrayDimensions();
-
-	boolean isStructure();
-
-	boolean isCharacter();
-
-	boolean isFloatingPointType();
-
-	boolean isNaN();
-
-	boolean isPositiveInfinity();
-
-	boolean isNegativeInfinity();
-
-	boolean isPointer();
 
 	String getQualifiedName() throws DebugException;
 }
Index: src/org/eclipse/cdt/debug/internal/core/model/CArrayPartitionValue.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CArrayPartitionValue.java,v
retrieving revision 1.9
diff -u -r1.9 CArrayPartitionValue.java
--- src/org/eclipse/cdt/debug/internal/core/model/CArrayPartitionValue.java	6 Jun 2003 19:27:17 -0000	1.9
+++ src/org/eclipse/cdt/debug/internal/core/model/CArrayPartitionValue.java	10 Jun 2003 22:30:10 -0000
@@ -163,4 +163,28 @@
 	{
 		return fParent;
 	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.cdt.debug.core.model.ICValue#isNaN()
+	 */
+	public boolean isNaN()
+	{
+		return false;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.cdt.debug.core.model.ICValue#isNegativeInfinity()
+	 */
+	public boolean isNegativeInfinity()
+	{
+		return false;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.cdt.debug.core.model.ICValue#isPositiveInfinity()
+	 */
+	public boolean isPositiveInfinity()
+	{
+		return false;
+	}
 }
Index: src/org/eclipse/cdt/debug/internal/core/model/CType.java
===================================================================
RCS file: src/org/eclipse/cdt/debug/internal/core/model/CType.java
diff -N src/org/eclipse/cdt/debug/internal/core/model/CType.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/cdt/debug/internal/core/model/CType.java	10 Jun 2003 22:30:10 -0000
@@ -0,0 +1,129 @@
+/*
+ *(c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ * 
+ */
+
+package org.eclipse.cdt.debug.internal.core.model;
+
+import org.eclipse.cdt.debug.core.cdi.model.type.ICDIArrayType;
+import org.eclipse.cdt.debug.core.cdi.model.type.ICDICharType;
+import org.eclipse.cdt.debug.core.cdi.model.type.ICDIDerivedType;
+import org.eclipse.cdt.debug.core.cdi.model.type.ICDIFloatingPointType;
+import org.eclipse.cdt.debug.core.cdi.model.type.ICDIPointerType;
+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.model.ICType;
+
+/**
+ * Enter type comment.
+ * 
+ * @since Jun 10, 2003
+ */
+public class CType implements ICType
+{
+	private ICDIType fCDIType;
+
+	public CType( ICDIType cdiType )
+	{
+		setCDIType( cdiType );
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.cdt.debug.core.model.type.ICType#getName()
+	 */
+	public String getName()
+	{
+		return ( fCDIType != null ) ? fCDIType.getTypeName() : null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
+	 */
+	public Object getAdapter( Class adapter )
+	{
+		if ( ICType.class.equals( adapter ) )
+			return this;
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.cdt.debug.core.model.type.ICType#dispose()
+	 */
+	public void dispose()
+	{
+		fCDIType = null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.cdt.debug.core.model.type.ICType#getArrayDimensions()
+	 */
+	public int[] getArrayDimensions()
+	{
+		int length = 0;
+		ICDIType type = getCDIType();
+		while( type instanceof ICDIArrayType )
+		{
+			++length;
+			type = ( type instanceof ICDIDerivedType ) ? ((ICDIDerivedType)type).getComponentType() : null;
+		}
+		int[] dims = new int[length];
+		type = getCDIType();
+		for ( int i = length; i > 0; --i )
+		{
+			dims[i - 1] = ((ICDIArrayType)type).getDimension();
+			type = ((ICDIDerivedType)type).getComponentType();
+		}
+		return dims;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.cdt.debug.core.model.type.ICType#isArray()
+	 */
+	public boolean isArray()
+	{
+		return ( getCDIType() instanceof ICDIArrayType );
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.cdt.debug.core.model.type.ICType#isCharacter()
+	 */
+	public boolean isCharacter()
+	{
+		return ( getCDIType() instanceof ICDICharType );
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.cdt.debug.core.model.type.ICType#isFloatingPointType()
+	 */
+	public boolean isFloatingPointType()
+	{
+		return ( getCDIType() instanceof ICDIFloatingPointType );
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.cdt.debug.core.model.type.ICType#isPointer()
+	 */
+	public boolean isPointer()
+	{
+		return ( getCDIType() instanceof ICDIPointerType );
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.cdt.debug.core.model.type.ICType#isStructure()
+	 */
+	public boolean isStructure()
+	{
+		return ( getCDIType() instanceof ICDIStructType );
+	}
+
+	protected ICDIType getCDIType()
+	{
+		return fCDIType;
+	}
+
+	protected void setCDIType( ICDIType type )
+	{
+		fCDIType = type;
+	}
+}
Index: src/org/eclipse/cdt/debug/internal/core/model/CValue.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CValue.java,v
retrieving revision 1.28
diff -u -r1.28 CValue.java
--- src/org/eclipse/cdt/debug/internal/core/model/CValue.java	9 Jun 2003 15:45:07 -0000	1.28
+++ src/org/eclipse/cdt/debug/internal/core/model/CValue.java	10 Jun 2003 22:30:10 -0000
@@ -79,9 +79,9 @@
 		String typeName = null;
 		try
 		{
-			if ( fCDIValue != null )
+			if ( getUnderlyingValue() != null )
 			{
-				typeName = fCDIValue.getTypeName();
+				typeName = getUnderlyingValue().getTypeName();
 			}
 		}
 		catch( CDIException e )
@@ -566,5 +566,78 @@
 		{
 			((CVariable)it.next()).reset();
 		}
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.cdt.debug.core.model.ICValue#isNaN()
+	 */
+	public boolean isNaN()
+	{
+		try 
+		{
+			ICDIValue value = getUnderlyingValue();
+			if ( value instanceof ICDIDoubleValue )
+			{
+				return Double.isNaN( ((ICDIDoubleValue)value).doubleValue() );
+			}
+			if ( value instanceof ICDIFloatValue )
+			{
+				return Float.isNaN( ((ICDIFloatValue)value).floatValue() );
+			}
+		}
+		catch( CDIException e ) 
+		{
+		}
+		return false;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.cdt.debug.core.model.ICValue#isNegativeInfinity()
+	 */
+	public boolean isNegativeInfinity()
+	{
+		try 
+		{
+			ICDIValue value = getUnderlyingValue();
+			if ( value instanceof ICDIDoubleValue )
+			{
+				double dbl = ((ICDIDoubleValue)value).doubleValue();
+				return ( Double.isInfinite( dbl ) && Double.NEGATIVE_INFINITY == dbl );
+			}
+			if ( value instanceof ICDIFloatValue )
+			{
+				float flt = ((ICDIFloatValue)value).floatValue();
+				return ( Float.isInfinite( flt ) && Float.NEGATIVE_INFINITY == flt );
+			}
+		}
+		catch( CDIException e ) 
+		{
+		}
+		return false;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.cdt.debug.core.model.ICValue#isPositiveInfinity()
+	 */
+	public boolean isPositiveInfinity()
+	{
+		try 
+		{
+			ICDIValue value = getUnderlyingValue();
+			if ( value instanceof ICDIDoubleValue )
+			{
+				double dbl = ((ICDIDoubleValue)value).doubleValue();
+				return ( Double.isInfinite( dbl ) && Double.POSITIVE_INFINITY == dbl );
+			}
+			if ( value instanceof ICDIFloatValue )
+			{
+				float flt = ((ICDIFloatValue)value).floatValue();
+				return ( Float.isInfinite( flt ) && Float.POSITIVE_INFINITY == flt );
+			}
+		}
+		catch( CDIException e ) 
+		{
+		}
+		return false;
 	}
 }
Index: src/org/eclipse/cdt/debug/internal/core/model/CVariable.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CVariable.java,v
retrieving revision 1.37
diff -u -r1.37 CVariable.java
--- src/org/eclipse/cdt/debug/internal/core/model/CVariable.java	9 Jun 2003 18:11:39 -0000	1.37
+++ src/org/eclipse/cdt/debug/internal/core/model/CVariable.java	10 Jun 2003 22:30:11 -0000
@@ -19,15 +19,7 @@
 import org.eclipse.cdt.debug.core.cdi.model.ICDIValue;
 import org.eclipse.cdt.debug.core.cdi.model.ICDIVariable;
 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.ICDICharType;
-import org.eclipse.cdt.debug.core.cdi.model.type.ICDIDerivedType;
-import org.eclipse.cdt.debug.core.cdi.model.type.ICDIDoubleValue;
-import org.eclipse.cdt.debug.core.cdi.model.type.ICDIFloatValue;
-import org.eclipse.cdt.debug.core.cdi.model.type.ICDIFloatingPointType;
-import org.eclipse.cdt.debug.core.cdi.model.type.ICDIPointerType;
-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.model.ICType;
 import org.eclipse.cdt.debug.core.model.ICValue;
 import org.eclipse.cdt.debug.core.model.ICVariable;
 import org.eclipse.cdt.debug.core.model.ICastToArray;
@@ -97,9 +89,9 @@
 	protected boolean fChanged = false;
 
 	/**
-	 * The type name of this variable.
+	 * The type of this variable.
 	 */
-	private String fTypeName = null;
+	private ICType fType = null;
 
 	/**
 	 * The current format of this variable.
@@ -363,7 +355,7 @@
 				{
 					parent = parent.getParentVariable();
 				}
-				if ( parent instanceof CVariable && parent.getType() instanceof ICDIArrayType )
+				if ( parent instanceof CVariable && parent.getType().isArray() )
 				{
 					fName = parent.getName() + '[' + cdiName + ']';
 				}
@@ -377,18 +369,7 @@
 	 */
 	public String getReferenceTypeName() throws DebugException
 	{
-		if ( fTypeName == null )
-		{
-			try
-			{
-				fTypeName = getCDIVariable().getTypeName();
-			}
-			catch( CDIException e )
-			{
-				targetRequestFailed( e.getMessage(), null );
-			}
-		}
-		return fTypeName;
+		return getType().getName();
 	}
 
 	protected void updateParentVariable( CValue parentValue ) throws DebugException
@@ -447,7 +428,9 @@
 				fValue = null;
 			}
 			fEditable = null;
-			fTypeName = null;
+			if ( fType != null )
+				fType.dispose();
+			fType = null;
 			fireChangeEvent( DebugEvent.STATE );
 		}
 	}
@@ -483,7 +466,9 @@
 			fValue = null;
 		}
 		fEditable = null;
-		fTypeName = null;
+		if ( fType != null )
+			fType.dispose();
+		fType = null;
 		fireChangeEvent( DebugEvent.STATE );
 	}
 	
@@ -584,7 +569,9 @@
 				fValue = null;
 			}
 			fEditable = null;
-			fTypeName = null;
+			if ( fType != null )
+				fType.dispose();
+			fType = null;
 			fireChangeEvent( DebugEvent.STATE );
 		}
 	}
@@ -632,143 +619,6 @@
 		}
 		return ( fEditable != null ) ? fEditable.booleanValue() : false;
 	}
-	
-	public boolean isPointer()
-	{
-		return ( getType() instanceof ICDIPointerType );
-	}
-
-	public boolean isArray()
-	{
-		return ( getType() instanceof ICDIArrayType );
-	}
-
-	public int[] getArrayDimensions()
-	{
-		int length = 0;
-		ICDIType type = getType();
-		while( type instanceof ICDIArrayType )
-		{
-			++length;
-			type = ( type instanceof ICDIDerivedType ) ? ((ICDIDerivedType)type).getComponentType() : null;
-		}
-		int[] dims = new int[length];
-		type = getType();
-		for ( int i = length; i > 0; --i )
-		{
-			dims[i - 1] = ((ICDIArrayType)type).getDimension();
-			type = ((ICDIDerivedType)type).getComponentType();
-		}
-		return dims;
-	}
-
-	public boolean isStructure()
-	{
-		return ( getType() instanceof ICDIStructType );
-	}
-
-	private ICDIType getType()
-	{
-		ICDIType type = null;
-		try
-		{
-			if ( getCDIVariable() != null )
-				type = getCDIVariable().getType();
-		}
-		catch( CDIException e )
-		{
-		}
-		return type;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.eclipse.cdt.debug.core.model.ICVariable#isCharacter()
-	 */
-	public boolean isCharacter()
-	{
-		return ( getType() instanceof ICDICharType );
-	}
-
-	/* (non-Javadoc)
-	 * @see org.eclipse.cdt.debug.core.model.ICVariable#isNaN()
-	 */
-	public boolean isNaN() 
-	{
-		try 
-		{
-			ICDIValue value = getCDIVariable().getValue();
-			if ( value instanceof ICDIDoubleValue )
-			{
-				return Double.isNaN( ((ICDIDoubleValue)value).doubleValue() );
-			}
-			if ( value instanceof ICDIFloatValue )
-			{
-				return Float.isNaN( ((ICDIFloatValue)value).floatValue() );
-			}
-		}
-		catch( CDIException e ) 
-		{
-		}
-		return false;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.eclipse.cdt.debug.core.model.ICVariable#isNegativeInfinity()
-	 */
-	public boolean isNegativeInfinity()
-	{
-		try 
-		{
-			ICDIValue value = getCDIVariable().getValue();
-			if ( value instanceof ICDIDoubleValue )
-			{
-				double dbl = ((ICDIDoubleValue)value).doubleValue();
-				return ( Double.isInfinite( dbl ) && Double.NEGATIVE_INFINITY == dbl );
-			}
-			if ( value instanceof ICDIFloatValue )
-			{
-				float flt = ((ICDIFloatValue)value).floatValue();
-				return ( Float.isInfinite( flt ) && Float.NEGATIVE_INFINITY == flt );
-			}
-		}
-		catch( CDIException e ) 
-		{
-		}
-		return false;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.eclipse.cdt.debug.core.model.ICVariable#isPositiveInfinity()
-	 */
-	public boolean isPositiveInfinity()
-	{
-		try 
-		{
-			ICDIValue value = getCDIVariable().getValue();
-			if ( value instanceof ICDIDoubleValue )
-			{
-				double dbl = ((ICDIDoubleValue)value).doubleValue();
-				return ( Double.isInfinite( dbl ) && Double.POSITIVE_INFINITY == dbl );
-			}
-			if ( value instanceof ICDIFloatValue )
-			{
-				float flt = ((ICDIFloatValue)value).floatValue();
-				return ( Float.isInfinite( flt ) && Float.POSITIVE_INFINITY == flt );
-			}
-		}
-		catch( CDIException e ) 
-		{
-		}
-		return false;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.eclipse.cdt.debug.core.model.ICVariable#isFloatingPointType()
-	 */
-	public boolean isFloatingPointType() 
-	{
-		return  ( getType() instanceof ICDIFloatingPointType );
-	}
 
 	/* (non-Javadoc)
 	 * @see org.eclipse.cdt.debug.core.model.ICVariable#getQualifiedName()
@@ -782,7 +632,7 @@
 			CVariable var = getParentVariable();
 			while( var != null )
 			{
-				if ( !( var.getType() instanceof ICDIArrayType ) && !( var instanceof CArrayPartition ) && !var.isAccessSpecifier() )
+				if ( !( var.getType().isArray() ) && !( var instanceof CArrayPartition ) && !var.isAccessSpecifier() )
 					list.addFirst( var );
 				var = var.getParentVariable();
 			}
@@ -793,7 +643,7 @@
 				sb.insert( 0, '(' );
 				if ( i > 0 )
 				{
-					if ( vars[i - 1].isPointer() )
+					if ( vars[i - 1].getType().isPointer() )
 					{
 						if ( vars[i].getName().charAt( 0 ) == '*' && vars[i-1].getName().equals( vars[i].getName().substring( 1 ) ) )
 						{
@@ -832,5 +682,24 @@
 		if ( getParent() instanceof CArrayPartitionValue )
 			return ((CArrayPartitionValue)getParent()).getParentVariable();
 		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.cdt.debug.core.model.ICVariable#getType()
+	 */
+	public ICType getType() throws DebugException
+	{
+		if ( fType == null && getCDIVariable() != null )
+		{
+			try
+			{
+				fType = new CType( getCDIVariable().getType() );
+			}
+			catch( CDIException e )
+			{
+				requestFailed( "Type is not available.", e );
+			}
+		}
+		return fType;
 	}
 }

Back to the top