Class If::Case#

Nested Relationships#

This class is a nested type of Class If.

Class Documentation#

class Case

Stores one case of a preprocessor ‘#if’ directive.

A If::Case object stores a particular case, identified through a (PreprocessingInfo, SgLocatedNode) pair. It also stores pointers to child If objects, representing nested ‘#if’ directives.

Iterators over the child directives of this case.

typedef Ifs_t::iterator iterator
typedef Ifs_t::const_iterator const_iterator
typedef Ifs_t::reverse_iterator reverse_iterator
typedef Ifs_t::const_reverse_iterator const_reverse_iterator
iterator begin(void)
const_iterator begin(void) const
reverse_iterator rbegin(void)
const_reverse_iterator rbegin(void) const
iterator end(void)
const_iterator end(void) const
reverse_iterator rend(void)
const_reverse_iterator rend(void) const
void appendChild(If*)

Makes the given ‘#if’ a child of this case.

Gets the ‘#if’ of which this case is a part.

If *getIf(void)
const If *getIf(void) const
void setIf(If*)

Associates this case with a particular directive.

Get the node represented by this case.

SgLocatedNode *getNode(void)
const SgLocatedNode *getNode(void) const

Get the preprocessing info represented by this case.

PreprocessingInfo *getInfo(void)
const PreprocessingInfo *getInfo(void) const

Public Functions

Case(PreprocessingInfo*, SgLocatedNode*, If* = 0)
Case(const Case&)
void dump(size_t level = 0)
bool isIf(void) const

Returns ‘true’ if this case is a ‘#if’.

bool isIfdef(void) const

Returns ‘true’ if this case is a ‘#ifdef’.

bool isIfndef(void) const

Returns ‘true’ if this case is a ‘#ifndef’.

bool isElif(void) const

Returns ‘true’ if this case is an ‘#elif’.

bool isElse(void) const

Returns ‘true’ if this case is an ‘#else’.

bool isEndif(void) const

Returns ‘true’ if this case is an ‘#endif’.

std::string getRaw(void) const

Returns the complete, raw directive, as a string.

std::string getDirective(void) const

Returns the directive as a string (i.e., ‘#if’).

std::string getCondition(void) const

Get the condition represented by this case.

Protected Functions

Case(void)

The default constructor, hidden to prevent users from instantiating a case without specifying the actual directive (PreprocessingInfo object and AST node).