Aegis  4.25.D505
/home/archives/aegis/branch.4/branch.25/delta28933.505/libaegis/sub/functor.h
Go to the documentation of this file.
00001 //
00002 //      aegis - project change supervisor
00003 //      Copyright (C) 2007, 2008, 2012 Peter Miller
00004 //
00005 //      This program is free software; you can redistribute it and/or modify
00006 //      it under the terms of the GNU General Public License as published by
00007 //      the Free Software Foundation; either version 3 of the License, or
00008 //      (at your option) any later version.
00009 //
00010 //      This program is distributed in the hope that it will be useful,
00011 //      but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 //      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 //      GNU General Public License for more details.
00014 //
00015 //      You should have received a copy of the GNU General Public License
00016 //      along with this program. If not, see
00017 //      <http://www.gnu.org/licenses/>.
00018 //
00019 
00020 #ifndef LIBAEGIS_SUB_FUNCTOR_H
00021 #define LIBAEGIS_SUB_FUNCTOR_H
00022 
00023 #include <common/ac/shared_ptr.h>
00024 
00025 #include <common/nstring.h>
00026 #include <common/wstring.h>
00027 
00028 class sub_context_ty; // forward
00029 class wstring_list; // forward
00030 
00035 class sub_functor
00036 {
00037 public:
00044     typedef aegis_shared_ptr<sub_functor> pointer;
00045 
00049     virtual ~sub_functor();
00050 
00054     nstring name_get() const { return name; }
00055 
00067     virtual wstring evaluate(sub_context_ty *cp, const wstring_list &arg) = 0;
00068 
00081     wstring
00082     operator()(sub_context_ty *cp, const wstring_list &arg)
00083     {
00084         return evaluate(cp, arg);
00085     }
00086 
00093     virtual bool append_if_unused() const;
00094 
00100     virtual bool override() const;
00101 
00107     virtual bool resubstitute() const;
00108 
00114     virtual bool must_be_used() const;
00115 
00120     virtual void resubstitute_set();
00121 
00127     virtual void override_set();
00128 
00134     virtual void optional_set();
00135 
00142     virtual void append_if_unused_set();
00143 
00144 protected:
00148     sub_functor(const nstring &name);
00149 
00150 private:
00156     nstring name;
00157 
00161     sub_functor();
00162 
00166     sub_functor(const sub_functor &);
00167 
00171     sub_functor &operator=(const sub_functor &);
00172 };
00173 
00174 #endif // LIBAEGIS_SUB_FUNCTOR_H
00175 // vim: set ts=8 sw=4 et :