Eclipse CDT
Pre-release 3.0

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

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

public class ASTSignatureUtil
extends Object

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


Constructor Summary
ASTSignatureUtil()
           
 
Method Summary
static String getBinaryOperatorString(IASTBinaryExpression be)
          Returns the String representation of the IASTBinaryExpression's operator.
static String getCastOperatorString(IASTCastExpression expression)
          Returns the String representation of the IASTCastExpression's operator.
static String getExpressionString(IASTExpression expression)
          Return a string representation for the given IASTExpression.
static String getInitializerString(IASTInitializer init)
          This function is used to return the signature of an IASTInitializer.
static String getNodeSignature(IASTNode node)
          Return's the String representation of a node's type (if available).
static String getParameterSignature(IASTDeclarator decltor)
          Returns the parameter signature for an IASTDeclarator as a comma separated list wrapped in parenthesis.
static String[] getParameterSignatureArray(IASTDeclarator decltor)
          Returns a String[] corresponding to the signatures of individual parameters for an IASTDeclarator.
static String getSignature(IASTDeclarator declarator)
          Returns the String signature corresponding to an IASTDeclarator.
static String getSignature(IASTDeclSpecifier declSpec)
          Returns the String representation of the signature for the IASTDeclSpecifier.
static String getSignature(IASTTypeId typeId)
          Returns the String representation of the signature for the IASTTypeId.
static String getUnaryOperatorString(IASTUnaryExpression ue)
          Returns the String representation of the IASTUnaryExpression's operator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ASTSignatureUtil

public ASTSignatureUtil()
Method Detail

getNodeSignature

public static String getNodeSignature(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:

getParameterSignature

public static String getParameterSignature(IASTDeclarator decltor)
Returns the parameter signature for an IASTDeclarator as a comma separated list wrapped in parenthesis. This method uses ASTSignatureUtil#getParametersSignatureArray(IASTArray) to build a comma separated list of the parameter's signatures and then wraps them in parenthesis.

Parameters:
decltor -
Returns:
the parameter signature for an IASTDeclarator as a comma separated list wrapped in parenthesis

getParameterSignatureArray

public static String[] getParameterSignatureArray(IASTDeclarator decltor)
Returns a String[] corresponding to the signatures of individual parameters for an IASTDeclarator.

Parameters:
decltor -
Returns:
a String[] corresponding to the signatures of individual parameters for an IASTDeclarator

getInitializerString

public static String getInitializerString(IASTInitializer init)
This function is used to return the signature of an IASTInitializer. TODO this function is used for testing and probably should not public once this Utility class has been finalized as it will likely never be used publicly except for testing

Parameters:
init -
Returns:
the signature of an IASTInitializer

getSignature

public static String getSignature(IASTDeclarator declarator)
Returns the String signature corresponding to an IASTDeclarator. This includes the signature of the parameters which is built via ASTSignatureUtil#getParameterSignature(IASTDeclarator) if the declarator is for a function.

Parameters:
declarator -
Returns:
the String signature corresponding to an IASTDeclarator

getSignature

public static String getSignature(IASTDeclSpecifier declSpec)
Returns the String representation of the signature for the IASTDeclSpecifier.

Parameters:
declSpec -
Returns:
the String representation of the signature for the IASTDeclSpecifier

getSignature

public static String getSignature(IASTTypeId typeId)
Returns the String representation of the signature for the IASTTypeId.

Parameters:
typeId -
Returns:
the String representation of the signature for the IASTTypeId

getExpressionString

public static String getExpressionString(IASTExpression expression)
Return a string representation for the given IASTExpression. Expressions having an extension kind should provide their own toString method which will be called by this.

Parameters:
expression -
Returns:
a string representation for the given IASTExpression

getCastOperatorString

public static String getCastOperatorString(IASTCastExpression expression)
Returns the String representation of the IASTCastExpression's operator.

Parameters:
expression -
Returns:
the String representation of the IASTCastExpression's operator

getUnaryOperatorString

public static String getUnaryOperatorString(IASTUnaryExpression ue)
Returns the String representation of the IASTUnaryExpression's operator.

Parameters:
ue -
Returns:
the String representation of the IASTUnaryExpression's operator

getBinaryOperatorString

public static String getBinaryOperatorString(IASTBinaryExpression be)
Returns the String representation of the IASTBinaryExpression's operator.

Parameters:
be -
Returns:
the String representation of the IASTBinaryExpression's operator

Eclipse CDT
Pre-release 3.0

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