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