1 // 2 // aegis - project change supervisor 3 // Copyright (C) 1997, 2002, 2005-2008, 2012 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 (at 8 // 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 GNU 13 // 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 <http://www.gnu.org/licenses/>. 17 // 18 19 #ifndef AEFIND_FUNCTION_PRINT_H 20 #define AEFIND_FUNCTION_PRINT_H 21 22 #include <aefind/tree/monadic.h> 23 24 class tree_list; // forward 25 26 /** 27 * The tree_print class is used to represent an expression tree which 28 * evaluates to true, and prints its argument on the standard output as 29 * a side effect. 30 */ 31 class tree_print: 32 public tree_monadic 33 { 34 public: 35 /** 36 * The destructor. 37 */ 38 virtual ~tree_print(); 39 40 private: 41 /** 42 * The constructor. It is private on purpose, use the "create" 43 * class method instead. 44 */ 45 tree_print(const tree::pointer &arg); 46 47 public: 48 /** 49 * The create class method is used to create new dynamically 50 * allocated instance of this class. 51 */ 52 static pointer create(const tree::pointer &arg); 53 54 /** 55 * The create class method is used to create new dynamically 56 * allocated instance of this class. 57 */ 58 static pointer create_l(const tree_list &arg); 59 60 protected: 61 // See base class for documentation. 62 const char *name(void) const; 63 64 // See base class for documentation. 65 rpt_value::pointer evaluate(string_ty *, string_ty *, string_ty *, 66 struct stat *) const; 67 68 // See base class for documentation. 69 bool useful(void) const; 70 71 // See base class for documentation. 72 bool constant(void) const; 73 74 // See base class for documentation. 75 tree::pointer optimize(void) const; 76 77 private: 78 /** 79 * The default constructor. Do not use. 80 */ 81 tree_print(); 82 83 /** 84 * The copy constructor. Do not use. 85 */ 86 tree_print(const tree_print &); 87 88 /** 89 * The assignment operator. Do not use. 90 */ 91 tree_print &operator=(const tree_print &); 92 }; 93 94 #endif // AEFIND_FUNCTION_PRINT_H 95 // vim: set ts=8 sw=4 et : 96