Puma Reference Manual Puma: Puma::CFunctionInfo Class Reference



Puma::CFunctionInfo Class Reference

Semantic information about a function, method, overloaded operator, or user conversion function. More...

#include <Puma/CFunctionInfo.h>

Inherits Puma::CStructure.

Inherited by Puma::CFctInstance.

List of all members.

Public Member Functions

 CFunctionInfo ()
 Constructor.
 ~CFunctionInfo ()
 Destructor.
CFunctionInfoDefObject () const
 Get the semantic object of the function definition.
CTypeFunctionTypeInfo () const
 Get the type information for the function.
CTypeInfoConversionType () const
 Get the conversion type if this is a conversion function.
CTypeInfoReturnType () const
 Get the return type of the function.
CTemplateInfoTemplateInfo () const
 Get the template information if this is a function template.
CRecordRecord () const
 Get the class or union if this is a method of a class or union.
CNamespaceInfoNamespace () const
 Get the namespace if this function is declared in a namespace.
unsigned Labels () const
 Get the number of jump labels defined in the function body.
unsigned Arguments () const
 Get the number of function parameters.
CLabelInfoLabel (unsigned n) const
 Get the n-th jump label.
CLabelInfoLabel (const char *name) const
 Get the jump label with the given name.
CArgumentInfoArgument (unsigned n) const
 Get the n-th function parameter.
CArgumentInfoArgument (const char *name) const
 Get the function parameter with the given name.
CTreeDefaultArgument (unsigned n) const
 Get the default argument of the n-th function parameter.
CT_ExprListInit () const
 Get the initializer of the function.
void ConversionType (CTypeInfo *type)
 Set the conversion type of a conversion function.
void QualifiedScope (CStructure *scope)
 Set the qualification scope of a class/union method or function declared in a namespace.
void addArgument (CArgumentInfo *info)
 Add a function parameter.
void addLabel (CLabelInfo *label)
 Add a jump label.
void removeArgument (const CArgumentInfo *info)
 Remove the given function parameter.
void removeLabel (const CLabelInfo *label)
 Remove the given jump label.
void TemplateInfo (CTemplateInfo *info)
 Set the template information of a function template.
void isTemplate (bool v)
 Set whether the function is a function template.
CArgumentInfonewArgument ()
 Create a new function parameter.
CLabelInfonewLabel ()
 Create a new jump label.
void deleteArgument (const CArgumentInfo *info)
 Remove and destroy the given function parameter.
void deleteLabel (const CLabelInfo *info)
 Remove and destroy the given jump label.
bool hasEllipsis () const
 Check if the function accepts a variable argument list.
bool hasDefaultArgument (unsigned n) const
 Check if the n-th function parameter has a default argument.
bool isFctDef () const
 Check if this is a function definition.
bool isMethod () const
 Check if this is a method of a class or union.
bool isStaticMethod () const
 Check if this is a static method of a class or union.
bool isTemplate () const
 Check if this is a function template.
bool isDefined () const
 Check if the function is defined.
bool isDestructor () const
 Check if this is a destructor.
bool isConstructor () const
 Check if this is a constructor.
bool isOperator () const
 Check if this is an overloaded operator.
bool isConversion () const
 Check if this is a conversion function.
bool isPureVirtual () const
 Check if the function is pure virtual.
bool isDefaultConstructor () const
 Check if this is a default constructor.
bool isCopyConstructor () const
 Check if this is a copy constructor.
bool isCopyAssignOperator () const
 Check if this is a copy assignment operator.
void isDestructor (bool v)
 Set whether the function is a destructor.
void isConstructor (bool v)
 Set whether the function is a constructor.
void isOperator (bool v)
 Set whether the function is an overloaded operator.
void isConversion (bool v)
 Set whether the function is a conversion function.
bool hasSameNameAndArgs (const CFunctionInfo *fi) const
 Check if the given function has the same name and parameter types as this function.
bool overridesVirtual () const
 Check if the function is a non-static member function and if in any of the base classes there is a function definition of a virtual function with the same name and argument types.

Protected Member Functions

 CFunctionInfo (ObjectId id)
 Constructor.

Detailed Description

Semantic information about a function, method, overloaded operator, or user conversion function.


Constructor & Destructor Documentation

Puma::CFunctionInfo::CFunctionInfo ( ObjectId  id  )  [inline, protected]

Constructor.

Parameters:
id The object type.
Puma::CFunctionInfo::CFunctionInfo (  )  [inline]

Constructor.

Puma::CFunctionInfo::~CFunctionInfo (  ) 

Destructor.

If the object type is CObjectInfo::FUNCTION_INFO, then CObjectInfo::CleanUp() is called.


Member Function Documentation

void Puma::CFunctionInfo::addArgument ( CArgumentInfo info  ) 

Add a function parameter.

Parameters:
info The function parameter.
void Puma::CFunctionInfo::addLabel ( CLabelInfo label  ) 

Add a jump label.

Parameters:
label The jump label.
CArgumentInfo* Puma::CFunctionInfo::Argument ( const char *  name  )  const

Get the function parameter with the given name.

Parameters:
name The name of the function parameter.
Returns:
The function parameter or NULL if no such parameter.
CArgumentInfo * Puma::CFunctionInfo::Argument ( unsigned  n  )  const [inline]

Get the n-th function parameter.

Parameters:
n The index of the function parameter.
Returns:
The function parameter or NULL if n is invalid.
unsigned Puma::CFunctionInfo::Arguments (  )  const [inline]

Get the number of function parameters.

void Puma::CFunctionInfo::ConversionType ( CTypeInfo type  )  [inline]

Set the conversion type of a conversion function.

Parameters:
type The conversion type.
CTypeInfo * Puma::CFunctionInfo::ConversionType (  )  const [inline]

Get the conversion type if this is a conversion function.

Returns:
The conversion type or NULL if not a conversion function.
CTree* Puma::CFunctionInfo::DefaultArgument ( unsigned  n  )  const

Get the default argument of the n-th function parameter.

Parameters:
n The index of the function parameter.
Returns:
The syntax tree node of the default argument or NULL if the n-th parameter has no default argument.
CFunctionInfo* Puma::CFunctionInfo::DefObject (  )  const

Get the semantic object of the function definition.

See also:
CObjectInfo::DefObject()

Reimplemented from Puma::CObjectInfo.

void Puma::CFunctionInfo::deleteArgument ( const CArgumentInfo info  ) 

Remove and destroy the given function parameter.

Parameters:
info The function parameter.
void Puma::CFunctionInfo::deleteLabel ( const CLabelInfo info  ) 

Remove and destroy the given jump label.

Parameters:
info The jump label.
bool Puma::CFunctionInfo::hasDefaultArgument ( unsigned  n  )  const

Check if the n-th function parameter has a default argument.

Parameters:
n The index of the function parameter.
bool Puma::CFunctionInfo::hasEllipsis (  )  const

Check if the function accepts a variable argument list.

bool Puma::CFunctionInfo::hasSameNameAndArgs ( const CFunctionInfo fi  )  const

Check if the given function has the same name and parameter types as this function.

Parameters:
fi The function to compare with.
CT_ExprList* Puma::CFunctionInfo::Init (  )  const

Get the initializer of the function.

Only pure virtual functions have an initializer ("=0").

Returns:
The syntax tree node of the initializer or NULL if function is not pure virtual.

Reimplemented from Puma::CObjectInfo.

void Puma::CFunctionInfo::isConstructor ( bool  v  )  [inline]

Set whether the function is a constructor.

Parameters:
v true if the function is a constructor.
bool Puma::CFunctionInfo::isConstructor (  )  const [inline]

Check if this is a constructor.

void Puma::CFunctionInfo::isConversion ( bool  v  )  [inline]

Set whether the function is a conversion function.

Parameters:
v true if the function is a conversion function.
bool Puma::CFunctionInfo::isConversion (  )  const [inline]

Check if this is a conversion function.

bool Puma::CFunctionInfo::isCopyAssignOperator (  )  const

Check if this is a copy assignment operator.

bool Puma::CFunctionInfo::isCopyConstructor (  )  const

Check if this is a copy constructor.

bool Puma::CFunctionInfo::isDefaultConstructor (  )  const

Check if this is a default constructor.

bool Puma::CFunctionInfo::isDefined (  )  const

Check if the function is defined.

void Puma::CFunctionInfo::isDestructor ( bool  v  )  [inline]

Set whether the function is a destructor.

Parameters:
v true if the function is a destructor.
bool Puma::CFunctionInfo::isDestructor (  )  const [inline]

Check if this is a destructor.

bool Puma::CFunctionInfo::isFctDef (  )  const

Check if this is a function definition.

bool Puma::CFunctionInfo::isMethod (  )  const [inline]

Check if this is a method of a class or union.

Reimplemented from Puma::CScopeInfo.

void Puma::CFunctionInfo::isOperator ( bool  v  )  [inline]

Set whether the function is an overloaded operator.

Parameters:
v true if the function is an overloaded operator.
bool Puma::CFunctionInfo::isOperator (  )  const [inline]

Check if this is an overloaded operator.

bool Puma::CFunctionInfo::isPureVirtual (  )  const

Check if the function is pure virtual.

bool Puma::CFunctionInfo::isStaticMethod (  )  const [inline]

Check if this is a static method of a class or union.

bool Puma::CFunctionInfo::isTemplate (  )  const [inline]

Check if this is a function template.

Reimplemented from Puma::CObjectInfo.

void Puma::CFunctionInfo::isTemplate ( bool  v  )  [inline]

Set whether the function is a function template.

Parameters:
v true if the function is a template.
CLabelInfo* Puma::CFunctionInfo::Label ( const char *  name  )  const

Get the jump label with the given name.

Parameters:
name The name of the jump label.
Returns:
The label or NULL if no such label.
CLabelInfo * Puma::CFunctionInfo::Label ( unsigned  n  )  const [inline]

Get the n-th jump label.

Parameters:
n The index of the jump label.
Returns:
The label or NULL if n is invalid.
unsigned Puma::CFunctionInfo::Labels (  )  const [inline]

Get the number of jump labels defined in the function body.

CNamespaceInfo* Puma::CFunctionInfo::Namespace (  )  const

Get the namespace if this function is declared in a namespace.

Returns:
The namespace or NULL if not declared in a namespace.
CArgumentInfo* Puma::CFunctionInfo::newArgument (  ) 

Create a new function parameter.

The new function parameter is added to the function.

CLabelInfo* Puma::CFunctionInfo::newLabel (  ) 

Create a new jump label.

The new jump label is added to the function.

bool Puma::CFunctionInfo::overridesVirtual (  )  const

Check if the function is a non-static member function and if in any of the base classes there is a function definition of a virtual function with the same name and argument types.

void Puma::CFunctionInfo::QualifiedScope ( CStructure scope  )  [inline]

Set the qualification scope of a class/union method or function declared in a namespace.

Parameters:
scope The qualification scope.
CRecord* Puma::CFunctionInfo::Record (  )  const

Get the class or union if this is a method of a class or union.

Returns:
The class/union or NULL if not a method.

Reimplemented from Puma::CObjectInfo.

void Puma::CFunctionInfo::removeArgument ( const CArgumentInfo info  ) 

Remove the given function parameter.

Parameters:
info The function parameter.
void Puma::CFunctionInfo::removeLabel ( const CLabelInfo label  ) 

Remove the given jump label.

Parameters:
label The jump label.
CTypeInfo* Puma::CFunctionInfo::ReturnType (  )  const

Get the return type of the function.

void Puma::CFunctionInfo::TemplateInfo ( CTemplateInfo info  )  [inline]

Set the template information of a function template.

Parameters:
info The template information.
CTemplateInfo * Puma::CFunctionInfo::TemplateInfo (  )  const [inline]

Get the template information if this is a function template.

Returns:
The template information or NULL if not a function template.

Reimplemented from Puma::CObjectInfo.

CTypeFunction * Puma::CFunctionInfo::TypeInfo (  )  const [inline]

Get the type information for the function.

Reimplemented from Puma::CObjectInfo.




Puma Reference Manual. Created on 11 Sep 2009.