TPTP 4.5.0 Platform Project
Public API Specification

org.eclipse.tptp.platform.analysis.codereview.cpp
Class ClassMembersHelper

java.lang.Object
  extended by org.eclipse.tptp.platform.analysis.codereview.cpp.ClassMembersHelper

public class ClassMembersHelper
extends java.lang.Object


Constructor Summary
ClassMembersHelper()
           
 
Method Summary
static java.util.List astNodeArrayToList(org.eclipse.cdt.core.dom.ast.IASTNode[] nodes)
          Converts an array of nodes into a list of nodes
static java.util.List getMemberFieldsListFromArray(CodeReviewResource resource, org.eclipse.cdt.core.dom.ast.IASTDeclaration[] members, boolean bindingsNeeded, boolean includeConstantFields, boolean getStructureFields)
          Returns a list with members.
static java.util.List getMemberFieldsOfClass(CodeReviewResource resource, org.eclipse.cdt.core.dom.ast.IBinding classNameBinding, boolean bindingsNeeded, boolean includeConstantFields, boolean getStructureFields)
          This method retrieves the field names of the variables in the class specified.
static org.eclipse.cdt.core.dom.ast.IASTName getMemberFunctionName(org.eclipse.cdt.core.dom.ast.IASTDeclaration member)
          If given an IASTSimpleDeclaration (which is a function declaration) or a IASTFunctionDefinition, return the IASTName name of that function
static org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration[] getMemberFunctionParameters(org.eclipse.cdt.core.dom.ast.IASTDeclaration member)
          If given an IASTSimpleDeclaration (which is a function declaration) or a IASTFunctionDefinition, returns the parameters of that function as an array
static java.util.List getMemberFunctionsListFromArray(org.eclipse.cdt.core.dom.ast.IASTDeclaration[] members, boolean bindingsNeeded)
          Returns a list with members.
static java.util.List getMemberFunctionsOfClass(CodeReviewResource resource, org.eclipse.cdt.core.dom.ast.IBinding classNameBinding, boolean bindingsNeeded)
          This method retrieves the functions from the class definition of the class specified.
static org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier getMemberFunctionSpecifier(org.eclipse.cdt.core.dom.ast.IASTDeclaration member)
          Gets the specifier of the member function if the member was a function declaration or definition.
static java.util.List getMembersListWithVisibility(org.eclipse.cdt.core.dom.ast.IASTDeclaration[] members, int visibility, boolean bindingsNeeded)
          Returns a list with members having the given visibility.
static boolean memberIsConstructor(org.eclipse.cdt.core.dom.ast.IASTDeclaration member)
          Identifies whether a class member is a constructor function
static boolean memberIsDestructor(org.eclipse.cdt.core.dom.ast.IASTDeclaration member)
          Identifies whether a class member is a destructor function
static boolean memberIsFriendDeclaration(org.eclipse.cdt.core.dom.ast.IASTDeclaration member)
          Identifies if a IASTSimpleDeclaration is a friend function.
static boolean memberIsFunction(org.eclipse.cdt.core.dom.ast.IASTDeclaration member)
          Determines if the given class member is a function.
static boolean memberIsVirtual(org.eclipse.cdt.core.dom.ast.IASTDeclaration member)
          Determines if the given class member is a virtual function.
static boolean variableIsClassMember(CodeReviewResource resource, org.eclipse.cdt.core.dom.ast.IASTName varName)
          If the variable of varName is in a function in a class or one belongs to a class, this method tries to find the class and checks if the class declares the variable given by the name varName.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClassMembersHelper

public ClassMembersHelper()
Method Detail

variableIsClassMember

public static boolean variableIsClassMember(CodeReviewResource resource,
                                            org.eclipse.cdt.core.dom.ast.IASTName varName)
If the variable of varName is in a function in a class or one belongs to a class, this method tries to find the class and checks if the class declares the variable given by the name varName. The implementation of this method illustrates the difference between the following methods in this helper class: getMemberFieldsListFromArray(CodeReviewResource, IASTDeclaration[], boolean, boolean, boolean) #getMemberFieldsOfClass(CodeReviewResource, String, boolean, boolean, boolean)

Parameters:
resource -
varName - the variable name to check if declared in the member's class
Returns:
true if the variable is a class member

memberIsConstructor

public static boolean memberIsConstructor(org.eclipse.cdt.core.dom.ast.IASTDeclaration member)
Identifies whether a class member is a constructor function

Parameters:
member - IASTDeclaration, a member of a class
Returns:
boolean true if the member is a constructor function
See Also:
IASTCompositeTypeSpecifier.getMembers()

memberIsDestructor

public static boolean memberIsDestructor(org.eclipse.cdt.core.dom.ast.IASTDeclaration member)
Identifies whether a class member is a destructor function

Parameters:
member - IASTDeclaration, a member of a class
Returns:
boolean true if the member is a destructor function
See Also:
IASTCompositeTypeSpecifier.getMembers()

memberIsFriendDeclaration

public static boolean memberIsFriendDeclaration(org.eclipse.cdt.core.dom.ast.IASTDeclaration member)
Identifies if a IASTSimpleDeclaration is a friend function.

Parameters:
member - IASTDeclaration, a member of a class
Returns:
boolean true if the member is a friend function declaration
See Also:
IASTCompositeTypeSpecifier.getMembers()

memberIsVirtual

public static boolean memberIsVirtual(org.eclipse.cdt.core.dom.ast.IASTDeclaration member)
Determines if the given class member is a virtual function.

Parameters:
member - IASTDeclaration, a member of a class
Returns:
boolean true if it is a virtual function
See Also:
IASTCompositeTypeSpecifier.getMembers()

memberIsFunction

public static boolean memberIsFunction(org.eclipse.cdt.core.dom.ast.IASTDeclaration member)
Determines if the given class member is a function.

Parameters:
member - IASTDeclaration, a member of a class
Returns:
boolean true if it is a virtual function
See Also:
IASTCompositeTypeSpecifier.getMembers()

getMembersListWithVisibility

public static java.util.List getMembersListWithVisibility(org.eclipse.cdt.core.dom.ast.IASTDeclaration[] members,
                                                          int visibility,
                                                          boolean bindingsNeeded)
Returns a list with members having the given visibility. If bindingsNeeded is set to true, then the IBinding of the name of the variables or functions are returned in the list instead of the IASTDeclaration.

Parameters:
member - IASTDeclaration, a member of a class
visibility - see org.eclipse.cdt.core.dom.ast.IASTDeclaration.ICPPASTVisiblityLabel
bindingsNeeded, - true to get a list of bindings of the names, false to get keep full IASTDeclaration
Returns:
list of class members with the given visibility
See Also:
IASTCompositeTypeSpecifier.getMembers()

getMemberFieldsOfClass

public static java.util.List getMemberFieldsOfClass(CodeReviewResource resource,
                                                    org.eclipse.cdt.core.dom.ast.IBinding classNameBinding,
                                                    boolean bindingsNeeded,
                                                    boolean includeConstantFields,
                                                    boolean getStructureFields)
This method retrieves the field names of the variables in the class specified. If the class contains a structure, it will optionally add the structures fields instead of the structure Use this method if you do not have the class specifier, otherwise use getMemberFieldsListFromArray(CodeReviewResource, IASTDeclaration[], boolean, boolean, boolean)

Parameters:
resource -
IBinding - of className the class of interest
bindingsNeeded, - returns List of IBindings if true
includeConstantFields, - specify false to ignore constant fields
getStructureFields, - if the class contains a field which is a structure, you may want the fields of the structure instead of the field name
Returns:
List of strings names of the member fields in class specified by className

getMemberFunctionsOfClass

public static java.util.List getMemberFunctionsOfClass(CodeReviewResource resource,
                                                       org.eclipse.cdt.core.dom.ast.IBinding classNameBinding,
                                                       boolean bindingsNeeded)
This method retrieves the functions from the class definition of the class specified. It finds and returns a list of IASTSimpleDeclarations AND IASTFunctionDefinitions depending on what was in the class. Use this method if you do not have the class specifier, otherwise use getMemberFunctionsListFromArray(IASTDeclaration[], boolean)

Parameters:
resource -
classNameBinding - IBinding of className the class of interest
bindingsNeeded, - returns List of bindings if true
Returns:
List of IASTSimpleDeclaration or IASTFunctionDefinition from the class definition

getMemberFieldsListFromArray

public static java.util.List getMemberFieldsListFromArray(CodeReviewResource resource,
                                                          org.eclipse.cdt.core.dom.ast.IASTDeclaration[] members,
                                                          boolean bindingsNeeded,
                                                          boolean includeConstantFields,
                                                          boolean getStructureFields)
Returns a list with members. If bindingsNeeded is set to true, then the IBindings of the name of the fields (variables) are returned in the list instead of the IASTDeclaration. If you do not have the class specifier, but you have the class name, use #getMemberFieldsOfClass(CodeReviewResource, String, boolean, boolean, boolean)

Parameters:
resource -
members -
bindingsNeeded, - returns List of bindings if true
includeConstantFields, - specify false to ignore constant fields
getStructureFields, - if the class contains a field which is a structure, you may want the fields of the structure instead of the field name
Returns:
list of class member (fields)
See Also:
IASTCompositeTypeSpecifier.getMembers()

getMemberFunctionsListFromArray

public static java.util.List getMemberFunctionsListFromArray(org.eclipse.cdt.core.dom.ast.IASTDeclaration[] members,
                                                             boolean bindingsNeeded)
Returns a list with members. If bindingsNeeded is set to true, then the IBindings of the name of the functions are returned in the list instead of the IASTDeclaration. If you do not have the class specifier, but you have the class name, use getMemberFunctionsOfClass(CodeReviewResource, IBinding, boolean)

Parameters:
member - IASTDeclaration, a member of a class
bindingsNeeded, - true to get a list of name bindings, false to get keep full IASTDeclaration
Returns:
list of class members (functions)
See Also:
IASTCompositeTypeSpecifier.getMembers()

getMemberFunctionSpecifier

public static org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier getMemberFunctionSpecifier(org.eclipse.cdt.core.dom.ast.IASTDeclaration member)
Gets the specifier of the member function if the member was a function declaration or definition.

Parameters:
member - IASTDeclaration, a member of a class
Returns:
IASTDeclSpecifier the specifier of the function if the member was a function
See Also:
IASTCompositeTypeSpecifier.getMembers()

getMemberFunctionName

public static org.eclipse.cdt.core.dom.ast.IASTName getMemberFunctionName(org.eclipse.cdt.core.dom.ast.IASTDeclaration member)
If given an IASTSimpleDeclaration (which is a function declaration) or a IASTFunctionDefinition, return the IASTName name of that function

Parameters:
member - IASTDeclaration, a member of a class
Returns:
IASTName name of function or null if it wasn't a function
See Also:
IASTCompositeTypeSpecifier.getMembers()

getMemberFunctionParameters

public static org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration[] getMemberFunctionParameters(org.eclipse.cdt.core.dom.ast.IASTDeclaration member)
If given an IASTSimpleDeclaration (which is a function declaration) or a IASTFunctionDefinition, returns the parameters of that function as an array

Parameters:
member - IASTDeclaration, a member of a class
Returns:
IASTParameterDeclaration[] array of parameters or zero length array if it wasn't a function
See Also:
IASTCompositeTypeSpecifier.getMembers()

astNodeArrayToList

public static java.util.List astNodeArrayToList(org.eclipse.cdt.core.dom.ast.IASTNode[] nodes)
Converts an array of nodes into a list of nodes

Parameters:
nodes - array
Returns:
List of nodes

TPTP 4.5.0 Platform Project
Public API Specification