PUMA Library Reference Manual
Loading...
Searching...
No Matches
Puma::PreIncludeDirective Class Reference

#include <Puma/PreTreeNodes.h>

+ Inheritance diagram for Puma::PreIncludeDirective:

Description

Preprocessor tree node representing an #include or #include_next directive.

Example:

#include <stdio.h>

Public Member Functions

 PreIncludeDirective (PreTree *i, PreTree *tl)
 Constructor.
 
void accept (PreVisitor &v)
 Part of the tree visitor pattern.
 
int depth () const
 Get the depth of nested inclusion.
 
void depth (int d)
 Set the depth of nested inclusion.
 
bool is_forced () const
 Check if this is a forced include (given by command line).
 
- Public Member Functions inherited from Puma::PreTreeComposite
virtual ~PreTreeComposite ()
 Destructor.
 
virtual void add_son (PreTree *s)
 Add a son (syntactic child node).
 
virtual void replace_son (int n, PreTree *new_s)
 Replace the n-th son.
 
virtual PreTreeson (int n) const
 Get the n-th son.
 
virtual int sons () const
 Get the number of sons.
 
virtual void add_daughter (PreTree *d)
 Add a daughter (semantic child node).
 
virtual void replace_daughter (int n, PreTree *new_d)
 Replace the n-th daughter.
 
virtual PreTreedaughter (int n) const
 Get the n-th daughter.
 
virtual int daughters () const
 Get the number of daughters.
 
virtual TokenstartToken () const
 Get the first token of the syntactic construct represented by the sub-tree.
 
virtual TokenendToken () const
 Get the last token of the syntactic construct represented by the sub-tree.
 
- Public Member Functions inherited from Puma::PreTree
virtual ~PreTree ()
 Destructor.
 
virtual bool isLeaf () const
 Check if the node is a leaf, i.e.
 

Additional Inherited Members

- Static Public Attributes inherited from Puma::PreTreeComposite
static const int DYNAMIC = -1
 Dynamic number of sons and daughters.
 
- Protected Member Functions inherited from Puma::PreTreeComposite
 PreTreeComposite (int s, int d)
 Constructor.
 
- Protected Member Functions inherited from Puma::PreTree
 PreTree ()
 Constructor.
 

Constructor & Destructor Documentation

◆ PreIncludeDirective()

Puma::PreIncludeDirective::PreIncludeDirective ( PreTree * i,
PreTree * tl )
inline

Constructor.

Parameters
iThe #include or #include_next token.
tlThe remaining tokens of the line containing the file to include.

Member Function Documentation

◆ accept()

void Puma::PreIncludeDirective::accept ( PreVisitor & v)
inlinevirtual

Part of the tree visitor pattern.

Calls the node visiting functions suitable for this node type.

Parameters
vThe visitor object on which to call the visiting functions.

Implements Puma::PreTreeComposite.

◆ depth() [1/2]

int Puma::PreIncludeDirective::depth ( ) const
inline

Get the depth of nested inclusion.

Returns
The depth or -1 for a top-level include.

◆ depth() [2/2]

void Puma::PreIncludeDirective::depth ( int d)
inline

Set the depth of nested inclusion.

Parameters
dThe depth of inclusion.

◆ is_forced()

bool Puma::PreIncludeDirective::is_forced ( ) const
inline

Check if this is a forced include (given by command line).