diff options
| author | Shinichiro Hamaji <shinichiro.hamaji@gmail.com> | 2015-06-18 16:18:13 +0900 |
|---|---|---|
| committer | Shinichiro Hamaji <shinichiro.hamaji@gmail.com> | 2015-06-19 12:49:19 +0900 |
| commit | cf0cd68ef4d2b8268ade22418c17e0079e9c85e1 (patch) | |
| tree | 2901ced625193a66e3f993ba981f92a7375cf6e5 /var.h | |
| parent | 0ec7dacff3bd7b106ad68deb29013405da1409bf (diff) | |
[C++] Implement foreach
Diffstat (limited to 'var.h')
| -rw-r--r-- | var.h | 18 |
1 files changed, 15 insertions, 3 deletions
@@ -47,7 +47,7 @@ class SimpleVar : public Var { virtual void AppendVar(Evaluator* ev, Value* v); - string DebugString() const override; + virtual string DebugString() const override; private: shared_ptr<string> v_; @@ -69,7 +69,7 @@ class RecursiveVar : public Var { virtual void AppendVar(Evaluator* ev, Value* v); - string DebugString() const override; + virtual string DebugString() const override; private: Value* v_; @@ -90,7 +90,7 @@ class UndefinedVar : public Var { virtual void Eval(Evaluator* ev, string* s) const override; - string DebugString() const override; + virtual string DebugString() const override; }; extern UndefinedVar* kUndefined; @@ -104,4 +104,16 @@ class Vars : public unordered_map<StringPiece, Var*> { void Assign(StringPiece name, Var* v); }; +class ScopedVar { + public: + // Does not take ownerships of arguments. + ScopedVar(Vars* vars, StringPiece name, Var* var); + ~ScopedVar(); + + private: + Vars* vars_; + Var* orig_; + Vars::iterator iter_; +}; + #endif // VAR_H_ |
