sbuild-config.h

00001 /* Copyright © 2005  Roger Leigh <rleigh@debian.org>
00002  *
00003  * schroot is free software; you can redistribute it and/or modify it
00004  * under the terms of the GNU General Public License as published by
00005  * the Free Software Foundation; either version 2 of the License, or
00006  * (at your option) any later version.
00007  *
00008  * schroot is distributed in the hope that it will be useful, but
00009  * WITHOUT ANY WARRANTY; without even the implied warranty of
00010  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011  * General Public License for more details.
00012  *
00013  * You should have received a copy of the GNU General Public License
00014  * along with this program; if not, write to the Free Software
00015  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
00016  * MA  02111-1307  USA
00017  *
00018  *********************************************************************/
00019 
00020 #ifndef SBUILD_CONFIG_H
00021 #define SBUILD_CONFIG_H
00022 
00023 #include <map>
00024 #include <ostream>
00025 #include <vector>
00026 #include <string>
00027 
00028 #include "sbuild-chroot.h"
00029 #include "sbuild-error.h"
00030 
00031 namespace sbuild
00032 {
00033 
00043  class Config
00044   {
00045   public:
00047     typedef std::vector<Chroot *> chroot_list;
00049     typedef std::map<std::string, std::string> string_map;
00051     typedef std::map<std::string, Chroot *> chroot_map;
00052 
00054     typedef runtime_error_custom<Config> error;
00055 
00057     Config();
00058 
00065     Config(const std::string& file);
00066 
00068     virtual ~Config();
00069 
00076     void
00077     add_config_file (const std::string& file);
00078 
00085     void
00086     add_config_directory (const std::string& dir);
00087 
00094     chroot_list
00095     get_chroots () const;
00096 
00103     const Chroot *
00104     find_chroot (const std::string& name) const;
00105 
00112     const Chroot *
00113     find_alias (const std::string& name) const;
00114 
00122     string_list
00123     get_chroot_list () const;
00124 
00130     void
00131     print_chroot_list (std::ostream& stream) const;
00132 
00140     void
00141     print_chroot_info (const string_list& chroots,
00142                        std::ostream&      stream) const;
00143 
00151     string_list
00152     validate_chroots(const string_list& chroots) const;
00153 
00154   private:
00164     void
00165     check_security(int fd) const;
00166 
00173     void
00174     load (const std::string& file);
00175 
00177     chroot_map chroots;
00179     string_map aliases;
00180   };
00181 
00182 }
00183 
00184 #endif /* SBUILD_CONFIG_H */
00185 
00186 /*
00187  * Local Variables:
00188  * mode:C++
00189  * End:
00190  */

Generated on Thu Dec 29 17:20:01 2005 for schroot by  doxygen 1.4.5