45 lines
950 B
C++
45 lines
950 B
C++
#ifndef FORSTATEMENT_HPP
|
|
#define FORSTATEMENT_HPP
|
|
|
|
#include <map>
|
|
|
|
#include "../Statement.hpp"
|
|
#include "../SourceLocation.hpp"
|
|
#include "AssignStatement.h"
|
|
|
|
|
|
class ForStatement : public Statement
|
|
{
|
|
public:
|
|
ForStatement(SourceLocation forLocation, AssignStatement* init, Expr* cond, Statement* body, Expr* inc = NULL);
|
|
|
|
AssignStatement *getInit();
|
|
const AssignStatement *getInit() const;
|
|
void setInit(AssignStatement *);
|
|
|
|
Expr *getCond();
|
|
const Expr *getCond() const;
|
|
void setCond(Expr *);
|
|
|
|
Expr *getInc();
|
|
const Expr *getInc() const;
|
|
void setInc(Expr *);
|
|
|
|
Statement *getBody();
|
|
const Statement *getBody() const;
|
|
void setBody(Statement *);
|
|
|
|
SourceLocation getForLocation() const;
|
|
void setForLocation(SourceLocation);
|
|
|
|
private:
|
|
SourceLocation _forLocation;
|
|
|
|
enum StmtIdentifier
|
|
{
|
|
INIT, BODY, COND, INC
|
|
};
|
|
std::map<StmtIdentifier, Statement*> _subStmts;
|
|
};
|
|
|
|
#endif |