Program Listing for File If.hh#
↰ Return to documentation for file (src/midend/programTransformation/astOutlining/If.hh)
#if !defined(INC_CPREPROC_IF_HH)
#define INC_CPREPROC_IF_HH
#include <list>
#include <string>
class SgBasicBlock;
class SgProject;
namespace CPreproc
{
// ======================================================================
class If;
typedef std::list<If *> Ifs_t;
void extractIfDirectives (SgNode* root, Ifs_t& ifs);
void dump (Ifs_t::const_iterator b, Ifs_t::const_iterator e,
size_t level = 0);
void dump (const Ifs_t ifs);
// ======================================================================
class If
{
public:
// ========= If::Case =========
class Case
{
protected:
Case (void);
public:
Case (PreprocessingInfo *, SgLocatedNode *, If * = 0);
Case (const Case &);
void dump(size_t level = 0);
bool isIf (void) const;
bool isIfdef (void) const;
bool isIfndef (void) const;
bool isElif (void) const;
bool isElse (void) const;
bool isEndif (void) const;
std::string getRaw (void) const;
std::string getDirective (void) const;
std::string getCondition (void) const;
SgLocatedNode* getNode (void);
const SgLocatedNode* getNode (void) const;
PreprocessingInfo* getInfo (void);
const PreprocessingInfo* getInfo (void) const;
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 *);
If* getIf (void);
const If* getIf (void) const;
void setIf (If *);
private:
PreprocessingInfo* info_;
SgLocatedNode* node_;
If* parent_;
Ifs_t kids_;
};
// ========= If::Case ==========
If (void);
~If (void);
typedef std::list<Case *> Cases_t;
typedef Cases_t::iterator iterator;
typedef Cases_t::const_iterator const_iterator;
typedef Cases_t::reverse_iterator reverse_iterator;
typedef Cases_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;
Case* appendCase (PreprocessingInfo *, SgLocatedNode *);
Case* firstCase (void);
const Case* firstCase (void) const;
Case* lastCase (void);
const Case* lastCase (void) const;
Case* getParent (void);
const Case* getParent (void) const;
void setParent (If::Case *);
bool isValid (void) const;
private:
Case* parent_;
Cases_t cases_;
}; // class If
// ======================================================================
void findIfDirectiveContext (const SgLocatedNode* target,
Ifs_t& ifs, If::Case*& top, If::Case*& bottom);
} // namespace CPreproc
#endif // !defined(INC_IF_HH)
// eof