Class If#
Defined in File If.hh
Nested Relationships#
Nested Types#
Class Documentation#
-
class If#
Stores a preprocessor ‘#if’ directive and nested directives.
If represents one instance of a preprocessor ‘#if’ directive, including all its cases. That is, a If object corresponding to the following ‘#if’ directive,
#if C_1 … #elif C_2 … #elif C_k … #endif // k+1
stores a sequence of k cases plus the final ‘#endif’. One may view a If object as a container of cases (If::Cases).
In addition, If represents the complete tree of nested ‘#if’ directives. See the case object, If::Case, for more information.
Iterators over the cases of this directive.
-
const_iterator begin(void) const#
-
reverse_iterator rbegin(void)#
-
const_reverse_iterator rbegin(void) const#
-
const_iterator end(void) const#
-
reverse_iterator rend(void)#
-
const_reverse_iterator rend(void) const#
-
Case *appendCase(PreprocessingInfo*, SgLocatedNode*)#
Appends a new case.
Returns the parent directive, if any.
-
bool isValid(void) const#
Returns ‘true’ if this appears to be a complete ‘#if’ directive.
A ‘valid’ directive is one which begins with an ‘#if’, ends with an ‘#endif’, and contains zero or more ‘#elif’ in between.
Returns the first or last case.
Public Functions
-
If(void)#
Default constructor.
-
~If(void)#
Destructor—frees memory associated with cases.
-
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.
-
const_iterator begin(void) const#
-
reverse_iterator rbegin(void)#
-
const_reverse_iterator rbegin(void) const#
-
const_iterator end(void) const#
-
reverse_iterator rend(void)#
-
const_reverse_iterator rend(void) const#
Gets the ‘#if’ of which this case is a part.
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)#
-
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).
-
const_iterator begin(void) const#
-
const_iterator begin(void) const#