nis-util  1.0.D108
lib/space/auto_master/functor.h
Go to the documentation of this file.
00001 //
00002 // nis-util - NIS Administration Utilities
00003 // Copyright (C) 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 2 of the License, or (at
00008 // 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 GNU
00013 // General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU General Public License along
00016 // with this program. If not, see <http://www.gnu.org/licenses/>.
00017 //
00018 
00019 #ifndef LIB_SPACE_AUTO_MASTER_FUNCTOR_H
00020 #define LIB_SPACE_AUTO_MASTER_FUNCTOR_H
00021 
00022 #include <list>
00023 
00024 #include <lib/space/auto_master.h>
00025 
00030 class space_auto_master_functor
00031 {
00032 public:
00036     virtual ~space_auto_master_functor();
00037 
00045     void
00046     operator()(const space_auto_master_row::pointer &rp)
00047     {
00048         walk(rp);
00049     }
00050 
00051     static void add_include_search_path(const rcstring &path);
00052 
00053     static void add_suffix(const rcstring &path);
00054 
00055 protected:
00060     space_auto_master_functor();
00061 
00068     virtual void walk(const space_auto_master_row::pointer &rp) = 0;
00069 
00070     rcstring find_file(const rcstring &filename);
00071 
00072 private:
00073     typedef std::list<rcstring> string_list_t;
00074 
00075     static string_list_t include_search_path;
00076 
00077     static string_list_t suffixes;
00078 
00086     space_auto_master_functor(const space_auto_master_functor &rhs);
00087 
00095     space_auto_master_functor &operator=(const space_auto_master_functor &rhs);
00096 };
00097 
00098 // vim: set ts=8 sw=4 et :
00099 #endif // LIB_SPACE_AUTO_MASTER_FUNCTOR_H