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
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_BASENAME_H
21 #define AEFIND_FUNCTION_BASENAME_H
22 
23 #include <aefind/tree/monadic.h>
24 
25 class tree_list; // forward
26 
27 /**
28   * The tree_basename class is used to rpresent an expression tree which
29   * returns the basename of its argument.
30   */
31 class tree_basename:
32     public tree_monadic
33 {
34 public:
35     /**
36       * The destructor.
37       */
38     virtual ~tree_basename();
39 
40 private:
41     /**
42       * The constructor.  It is private on purpose, use the "create"
43       * clas smethod instead.
44       */
45     tree_basename(const 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       * @param arg
53       *     The singel argument to this function.
54       */
55     static pointer create(const pointer &arg);
56 
57     /**
58       * The create_l class method is used to create new dynamically
59       * allocated instance of this class.
60       *
61       * @param args
62       *     The arguments to this function.
63       */
64     static pointer create_l(const tree_list &args);
65 
66 protected:
67     // See base class for documentation.
68     const char *name() const;
69 
70     // See base class for documentation.
71     rpt_value::pointer evaluate(string_ty *, string_ty *, string_ty *,
72         struct stat *) const;
73 
74     // See base class for documentation.
75     tree::pointer optimize() const;
76 
77 private:
78     /**
79       * The default constructor.  Do not use.
80       */
81     tree_basename();
82 
83     /**
84       * The copy constructor.  Do not use.
85       */
86     tree_basename(const tree_basename &);
87 
88     /**
89       * The assignment operator.  Do not use.
90       */
91     tree_basename &operator=(const tree_basename &);
92 };
93 
94 #endif // AEFIND_FUNCTION_BASENAME_H
95 // vim: set ts=8 sw=4 et :
96