Blang/src/lib/src/Statement/IfStatement.h

49 lines
1.0 KiB
C++

#ifndef IFSTATEMENT_HPP
#define IFSTATEMENT_HPP
#include <map>
#include "../Statement.hpp"
#include "Expr.hpp"
#include "../SourceLocation.hpp"
class IfStatement : public Statement
{
public:
IfStatement(SourceLocation IfLocation, Expr* cond, Statement* then, SourceLocation EL = SourceLocation(), Statement* elses = NULL);
Expr* getCond();
const Expr *getCond() const;
void setCond(Expr *);
Statement *getThen();
const Statement *getThen() const;
void setThen(Statement *);
Statement *getElse();
const Statement *getElse() const;
void setElse(Statement *);
SourceLocation getIfLocation() const;
void setIfLocation(SourceLocation);
SourceLocation getThenLocation() const;
void setThenLocation(SourceLocation);
SourceLocation getElseLocation() const;
void setElseLocation(SourceLocation);
private:
enum StmtIdentifier
{
COND, THEN, ELSE
};
std::map<StmtIdentifier, Statement*> _subStmts;
SourceLocation _IfLoc;
SourceLocation _ElseLoc;
};
#endif