Main Page   Modules   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members   Related Pages  

tdefNode Class Reference

Typedef type node. More...

#include <ast.h>

Inheritance diagram for tdefNode::

typeNode Node List of all members.

Public Methods

 tdefNode (Type_qualifiers tq, const char *name, const Coord coord=Coord::Unknown)
 Create a new typedef type. More...

 tdefNode (idNode *the_id, Type_qualifiers tq, typeNode *the_type)
 Create a typedef type from an identifier. More...

virtual ~tdefNode ()
 Destroy a tdefNode. More...

typeNodebase_type (bool TdefIndir) const
 Return the base data type of a node. More...

virtual Nodeclone () const
 Clone the input node. More...

virtual void output_type (output_context &ct, Node *par, Assoc context, Type_qualifiers q)
 Output a type. More...

Accessors
Methods to get and set fields in the class.

string & name ()
 Return the name of this typedef Node. More...

void name (string name)
 Set the name of this typedef Node to the given value. More...

typeNodedef () const
 Return this typedef Node's type definition. More...

void def (typeNode *d)
 Set this typedef Node's type definition. More...

AST Traversal
Methods to uniformly traverse the AST. See the documentation in the Node class.

virtual void visit (Visitor *the_visitor)
 Dispatch a Visitor. More...

virtual void walk (Walker &the_walker)
 Dispatch a Walker. More...

virtual Nodechange (Changer &the_changer, bool redispatch=false)
 Dispatch a Changer. More...


Private Attributes

string _name
 Name of the type. More...

REF typeNode_def
 The underlying type. More...


Detailed Description

Typedef type node.

This class represents a typedef type. Since these types are just names for other types, objects of this class refer to the real underlying types that they represent. The original types can by found on the declaration with the typedef storage class specifier.

Note:
This node does not refer to the declaration of the typedef, but rather the use of the type name.
The NodeType is Tdef.

See also:
declNode , Storage_class


Constructor & Destructor Documentation

tdefNode::tdefNode Type_qualifiers    tq,
const char *    name,
const Coord    coord = Coord::Unknown
 

Create a new typedef type.

The new typedef type has the given name and type qualifiers. The name should by in the scope of an appropriate typedef declaration.

Parameters:
tq  the type qualifiers
name  the name of the typedef type (copied; not deleted)
coord  the location of the construct in the source file.

tdefNode::tdefNode idNode   the_id,
Type_qualifiers    tq,
typeNode   the_type
 

Create a typedef type from an identifier.

tdefNode::~tdefNode   [virtual]
 

Destroy a tdefNode.

Warning:
Do not use the destructors to delete AST nodes. Instead, rely on the node garbage collector.


Member Function Documentation

typeNode * tdefNode::base_type bool    TdefIndir const [virtual]
 

Return the base data type of a node.

This method differs from the Node::type() method in two respects. First, it follows some of the simple type inferences. For example, calling it on an idNode will return the type of its declaration. Second, the boolean argument indicates whether or not to follow typedef links.

Parameters:
TdefIndir  pass true to follow typedefs to their definitions.

Reimplemented from typeNode.

Node * tdefNode::change Changer   the_changer,
bool    redispatch = false
[virtual]
 

Dispatch a Changer.

This abstract method works much the walker, but allows the tree to be changed.

Parameters:
the_changer  the specific Changer object to use.
redispatch  pass true to revisit parts of the tree that have changed.

Reimplemented from Node.

virtual Node* tdefNode::clone   const [inline, virtual]
 

Clone the input node.

This is not a "deep" clone, so be careful. For a deep clone, use the clone_changer class.

Returns:
a shallow copy of the node (no subtrees are copied).

Reimplemented from Node.

void tdefNode::def typeNode   d [inline]
 

Set this typedef Node's type definition.

To set the type definition to be empty, call this method with a value of NULL.

typeNode* tdefNode::def   const [inline]
 

Return this typedef Node's type definition.

void tdefNode::name string    name [inline]
 

Set the name of this typedef Node to the given value.

string& tdefNode::name   [inline]
 

Return the name of this typedef Node.

void tdefNode::output_type output_context   ct,
Node   parent,
Assoc    context,
Type_qualifiers    q
[virtual]
 

Output a type.

Reimplemented from typeNode.

void tdefNode::visit Visitor   the_visitor [virtual]
 

Dispatch a Visitor.

This abstract method is the entry point for the visitor design pattern. Each node subclass defines a visit() method that calls the appropriate at_ method in the visitor. For more information see the Visitor documentation.

Parameters:
the_visitor  the specific Visitor object to use.

Reimplemented from Node.

void tdefNode::walk Walker   the_walker [virtual]
 

Dispatch a Walker.

This abstract method works much like the visitor, but instead walks the entire underlying subtree calling the appropriate at_ method at each node. For more information see the Walker documentation.

Parameters:
the_walker  the specific Walker object to use.

Reimplemented from Node.


Member Data Documentation

REF typeNode* tdefNode::_def [private]
 

The underlying type.

This is a reference to the underlying type. This reference is set up by the id_lookup_walker.

See also:
id_lookup_walker

string tdefNode::_name [private]
 

Name of the type.

This name is the same as the name in the declaration that introduced the typedef.


The documentation for this class was generated from the following files:
Generated on Thu Jan 10 12:06:34 2002 for C-Breeze by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001