1 //
2 //	aegis - project change supervisor
3 //	Copyright (C) 1997, 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_TREE_THIS_H
21 #define AEFIND_TREE_THIS_H
22 
23 #include <aefind/tree.h>
24 
25 /**
26   * The tree_this class is used to represent the {} family of expression
27   * tree nodes.
28   */
29 class tree_this:
30     public tree
31 {
32 public:
33     /**
34       * The destructor.
35       */
36     virtual ~tree_this();
37 
38 private:
39     /**
40       * The constructor.
41       *
42       * @param arg
43       *     Set to -1 for {}, 0 for {-}, or 1 for {+}
44       */
45     tree_this(int arg);
46 
47 public:
48     /**
49       * The create class method is used to create a new {} expression tree
50       * node, allocated in dynamic memory.
51       *
52       * @param arg
53       *     Set to -1 for {}, 0 for {-}, or 1 for {+}
54       */
55     static tree::pointer create(int arg = -1);
56 
57 protected:
58     // See base class for documentation.
59     const char *name() const;
60 
61     // See base class for documentation.
62     void print() 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() const;
70 
71     // See base class for documentation.
72     bool constant() const;
73 
74     // See base class for documentation.
75     tree::pointer optimize() const;
76 
77 private:
78     /**
79       * The resolved instance variable is used to remember was kind of
80       * {} this is.  Set to -1 for {}, 0 for {-}, or 1 for {+}
81       */
82     int resolved;
83 
84     /**
85       * The default constructor.  Do not use.
86       */
87     tree_this();
88 
89     /**
90       * The copy constructor.  Do not use.
91       */
92     tree_this(const tree_this &);
93 
94     /**
95       * The assignment operator.  Do not use.
96       */
97     tree_this &operator=(const tree_this &);
98 };
99 
100 #endif // AEFIND_TREE_THIS_H
101