Eclipse CDT
7.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 char[] createNameForAnonymous(IBinding binding)
           
static boolean functionTakesParameters(IFunction function)
           
static String getArgumentListString(ICPPTemplateArgument[] args, boolean normalize)
          Returns a comma-separated list of the string representations of the arguments, enclosed in angle brackets.
static String getArgumentString(ICPPTemplateArgument arg, boolean normalize)
          Returns a string representation for an template argument.
static String getNodeType(IASTNode node)
          For testing purposes, only.
static String getParameterTypeString(IFunctionType type)
          Returns a string representation for the parameters of the given function type.
static String[] getParameterTypeStringArray(IFunctionType type)
          Returns an array of normalized string representations for the parameter types of the given function type.
static String getType(IASTDeclarator decltor)
          For testing purposes, only.
static String getType(IASTTypeId typeId)
          Returns the type representation of the IASTTypeId as a String.
static String getType(IType type)
          Returns the normalized string representation of the type.
static String getType(IType type, boolean normalize)
          Returns a string representation of a type.
static String getTypeListString(IType[] types)
          Returns a string representation for the type array.
static String getTypeListString(IType[] types, boolean normalize)
          Returns a String representation of the type array as a comma-separated list.
static boolean isConst(IType type)
          Deprecated. don't use it does something strange
 
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 representation for the parameters of the given function type. The representation contains the comma-separated list of the normalized parameter type representations wrapped in parentheses.


functionTakesParameters

public static boolean functionTakesParameters(IFunction function)
                                       throws DOMException
Returns:
Whether the function matching the given function binding takes parameters or not.
Throws:
DOMException
Since:
5.1

getTypeListString

public static String getTypeListString(IType[] types)
Returns a string representation for the type array. The representation is a comma-separated list of the normalized string representations of the provided types.

See Also:
getTypeListString(IType[], boolean)

getTypeListString

public static String getTypeListString(IType[] types,
                                       boolean normalize)
Returns a String representation of the type array as a comma-separated list.

Parameters:
types -
Returns:
representation of the type array as a comma-separated list
Since:
5.1

getArgumentListString

public static String getArgumentListString(ICPPTemplateArgument[] args,
                                           boolean normalize)
Returns a comma-separated list of the string representations of the arguments, enclosed in angle brackets. Optionally normalization is performed:
template parameter names are represented by their parameter position,
further normalization may be performed in future versions.

Parameters:
normalize - indicates whether normalization shall be performed
Since:
5.1

getArgumentString

public static String getArgumentString(ICPPTemplateArgument arg,
                                       boolean normalize)
Returns a string representation for an template argument. Optionally normalization is performed:
template parameter names are represented by their parameter position,
further normalization may be performed in future versions.

Parameters:
normalize - indicates whether normalization shall be performed
Since:
5.1

getParameterTypeStringArray

public static String[] getParameterTypeStringArray(IFunctionType type)
Returns an array of normalized string representations for the parameter types of the given function type.

See Also:
getType(IType, boolean)

getType

public static String getType(IType type)
Returns the normalized string representation of the type.

See Also:
getType(IType, boolean)

getType

public static String getType(IType type,
                             boolean normalize)
Returns a string representation of a type. Optionally the representation is normalized:
typedefs are resolved
template parameter names are represented by their parameter position
further normalization may be performed in the future.

Parameters:
type - a type to compute the string representation for.
normalize - whether or not normalization should be performed.
Returns:
the type representation of the IType

getType

public static String getType(IASTDeclarator decltor)
For testing purposes, only. Returns the normalized string representation of the type defined by the given declarator.


getNodeType

public static String getNodeType(IASTNode node)
For testing purposes, only. Return's the String representation of a node's type (if available).


getType

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

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

isConst

@Deprecated
public static boolean isConst(IType type)
Deprecated. don't use it does something strange


createNameForAnonymous

public static char[] createNameForAnonymous(IBinding binding)

Eclipse CDT
7.0

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