Shinichiro Hamaji | 5f86e1a | 2015-06-29 14:25:39 +0900 | [diff] [blame] | 1 | // Copyright 2015 Google Inc. All rights reserved |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
| 15 | #ifndef COMMAND_H_ |
| 16 | #define COMMAND_H_ |
| 17 | |
| 18 | #include <memory> |
| 19 | #include <vector> |
| 20 | |
Shinichiro Hamaji | e799275 | 2015-06-29 18:38:35 +0900 | [diff] [blame] | 21 | #include "symtab.h" |
Shinichiro Hamaji | 5f86e1a | 2015-06-29 14:25:39 +0900 | [diff] [blame] | 22 | |
| 23 | using namespace std; |
| 24 | |
| 25 | struct DepNode; |
| 26 | class Evaluator; |
| 27 | |
| 28 | struct Command { |
Shinichiro Hamaji | e799275 | 2015-06-29 18:38:35 +0900 | [diff] [blame] | 29 | explicit Command(Symbol o) |
| 30 | : output(o), echo(true), ignore_error(false) { |
Shinichiro Hamaji | 5f86e1a | 2015-06-29 14:25:39 +0900 | [diff] [blame] | 31 | } |
Shinichiro Hamaji | e799275 | 2015-06-29 18:38:35 +0900 | [diff] [blame] | 32 | Symbol output; |
Shinichiro Hamaji | 5f86e1a | 2015-06-29 14:25:39 +0900 | [diff] [blame] | 33 | shared_ptr<string> cmd; |
| 34 | bool echo; |
| 35 | bool ignore_error; |
| 36 | //StringPiece shell; |
| 37 | }; |
| 38 | |
| 39 | class CommandEvaluator { |
| 40 | public: |
| 41 | explicit CommandEvaluator(Evaluator* ev); |
| 42 | void Eval(DepNode* n, vector<Command*>* commands); |
| 43 | const DepNode* current_dep_node() const { return current_dep_node_; } |
| 44 | |
| 45 | private: |
| 46 | Evaluator* ev_; |
| 47 | DepNode* current_dep_node_; |
| 48 | }; |
| 49 | |
| 50 | #endif // COMMAND_H_ |