1 // 2 // aegis - project change supervisor 3 // Copyright (C) 2002, 2005-2008 Peter Miller 4 // 5 // This program is free software; you can redistribute it and/or modify 6 // it under the terms of the GNU General Public License as published by 7 // the Free Software Foundation; either version 3 of the License, or 8 // (at your option) any later version. 9 // 10 // This program is distributed in the hope that it will be useful, 11 // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 // GNU General Public License for more details. 14 // 15 // You should have received a copy of the GNU General Public License 16 // along with this program. If not, see 17 // <http://www.gnu.org/licenses/>. 18 // 19 20 #ifndef AEFIND_FUNCTION_EXECUTE_H 21 #define AEFIND_FUNCTION_EXECUTE_H 22 23 #include <aefind/tree/monadic.h> 24 25 class tree_list; // forward 26 27 28 /** 29 * The tree_execute class is used to represent an expression tree 30 * which evaluates to true or false, depending on the exit status of a 31 * command it runs. 32 */ 33 class tree_execute: 34 public tree_monadic 35 { 36 public: 37 /** 38 * The destructor. 39 */ 40 virtual ~tree_execute(); 41 42 private: 43 /** 44 * The constructor. It is private on purpose, use the "create" 45 * class method instead. 46 */ 47 tree_execute(const tree::pointer &arg); 48 49 public: 50 /** 51 * The create class method is used to create new dynamically 52 * allocated instance of this class. 53 */ 54 static pointer create(const tree::pointer &arg); 55 56 /** 57 * The create_l class method is used to create new dynamically 58 * allocated instance of this class. 59 */ 60 static pointer create_l(const tree_list &args); 61 62 protected: 63 // See base class for documentation. 64 const char *name() const; 65 66 // See base class for documentation. 67 rpt_value::pointer evaluate(string_ty *, string_ty *, string_ty *, 68 struct stat *) const; 69 70 // See base class for documentation. 71 bool useful() const; 72 73 // See base class for documentation. 74 tree::pointer optimize() const; 75 76 private: 77 /** 78 * The default constructor. Do not use. 79 */ 80 tree_execute(); 81 82 /** 83 * The copy constructor. Do not use. 84 */ 85 tree_execute(const tree_execute &); 86 87 /** 88 * The assignment operator. Do not use. 89 */ 90 tree_execute &operator=(const tree_execute &); 91 }; 92 93 #endif // AEFIND_FUNCTION_EXECUTE_H 94