00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
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
00185
00186
00187
00188
00189
00190