00001 // 00002 // aegis - project change supervisor 00003 // Copyright (C) 2007, 2008 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_GLUE_H 00021 #define LIBAEGIS_SUB_FUNCTOR_GLUE_H 00022 00023 #include <libaegis/sub/functor.h> 00024 00033 class sub_functor_glue: 00034 public sub_functor 00035 { 00036 public: 00040 virtual ~sub_functor_glue(); 00041 00042 typedef wstring (*func_p)(sub_context_ty *scp, const wstring_list &arg); 00043 00044 private: 00057 sub_functor_glue(const nstring &name, func_p what, bool resub); 00058 00059 public: 00069 static pointer create(const nstring &name, func_p what); 00070 00083 static pointer create(const nstring &name, func_p what, bool resub); 00084 00085 protected: 00086 // See base class for documentation. 00087 wstring evaluate(sub_context_ty *scp, const wstring_list &arg); 00088 00089 // See base class for documentation. 00090 bool resubstitute() const; 00091 00092 // See base class for documentation. 00093 bool append_if_unused() const; 00094 00095 // See base class for documentation. 00096 bool override() const; 00097 00098 // See base class for documentation. 00099 bool must_be_used() const; 00100 00101 // See base class for documentation. 00102 void resubstitute_set(); 00103 00104 // See base class for documentation. 00105 void optional_set(); 00106 00107 // See base class for documentation. 00108 void append_if_unused_set(); 00109 00110 // See base class for documentation. 00111 void override_set(); 00112 00113 private: 00118 func_p what; 00119 00125 bool resub; 00126 00130 sub_functor_glue(); 00131 00135 sub_functor_glue(const sub_functor_glue &); 00136 00140 sub_functor_glue &operator=(const sub_functor_glue &); 00141 }; 00142 00143 #endif // LIBAEGIS_SUB_FUNCTOR_GLUE_H