Eclipse CDT
Pre-release 3.0

org.eclipse.cdt.core.dom.ast
Class ASTTypeUtil

java.lang.Object
  extended by org.eclipse.cdt.core.dom.ast.ASTTypeUtil

public class ASTTypeUtil
extends Object

This is a utility class to help convert AST elements to Strings corresponding to the AST element's type.


Constructor Summary
ASTTypeUtil()
           
 
Method Summary
static String getNodeType(IASTNode node)
          Return's the String representation of a node's type (if available).
static String getParameterTypeString(IFunctionType type)
          Returns a String represnetation of the parameter type of an IFunctionType.
static String[] getParameterTypeStringArray(IFunctionType type)
          Returns String[] corresponding to the types of the parameters for the IFunctionType.
static String getType(IASTDeclarator decltor)
          Returns the type representation of the declarator (including parameters) as a String.
static String getType(IASTTypeId typeId)
          Retuns the type representation of the IASTTypeId as a String.
static String getType(IType type)
          Returns the type represntation of the IType as a String.
static boolean isConst(IType type)
          This can be used to invoke the IType's isConst() if it has an isConst() method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ASTTypeUtil

public ASTTypeUtil()
Method Detail

getParameterTypeString

public static String getParameterTypeString(IFunctionType type)
Returns a String represnetation of the parameter type of an IFunctionType. This function calls ASTTypeUtil#getParameterTypeStringArray(IFunctionType) and wraps the results in "()" with a comma separated list.

Parameters:
type -
Returns:
the represnetation of the parameter type of an IFunctionType

getParameterTypeStringArray

public static String[] getParameterTypeStringArray(IFunctionType type)
Returns String[] corresponding to the types of the parameters for the IFunctionType.

Parameters:
type -
Returns:
the types of the parameters for the IFunctionType

getType

public static String getType(IType type)
Returns the type represntation of the IType as a String. This function uses the IType interfaces to build the String representation of the IType.

Parameters:
type -
Returns:
the type represntation of the IType

getType

public static String getType(IASTDeclarator decltor)
Returns the type representation of the declarator (including parameters) as a String.

Parameters:
decltor -
Returns:
the type representation of the IASTDeclarator (including parameters)

getNodeType

public static String getNodeType(IASTNode node)
Return's the String representation of a node's type (if available). This is currently only being used for testing. TODO Remove this function when done testing if it is no longer needed

Parameters:
node -
Returns:
the String representation of a node's type (if available)

getType

public static String getType(IASTTypeId typeId)
Retuns the type representation of the IASTTypeId as a String.

Parameters:
typeId -
Returns:
the type representation of the IASTTypeId as a String

isConst

public static boolean isConst(IType type)
This can be used to invoke the IType's isConst() if it has an isConst() method. This returns the result of that invoked isConst() method. It is a convenience function so that the structure of IType does not need to be known to determine if the IType is const or not. Note: false is returned if no isConst() method is found

Parameters:
type -
Returns:

Eclipse CDT
Pre-release 3.0

Copyright (c) IBM Corp. and others 2004. All Rights Reserved.