00001 /* Copyright © 2005-2007 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 3 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, see 00015 * <http://www.gnu.org/licenses/>. 00016 * 00017 *********************************************************************/ 00018 00019 #ifndef SCHROOT_MAIN_BASE_H 00020 #define SCHROOT_MAIN_BASE_H 00021 00022 #include <schroot-base/schroot-base-main.h> 00023 #include <schroot/schroot-options-base.h> 00024 00025 #include <sbuild/sbuild-custom-error.h> 00026 00027 namespace schroot 00028 { 00029 00035 class main_base : public schroot_base::main 00036 { 00037 public: 00039 enum error_code 00040 { 00041 CHROOTS_NOTFOUND, 00042 CHROOT_FILE, 00043 CHROOT_FILE2, 00044 CHROOT_NOTDEFINED, 00045 CHROOT_NOTFOUND 00046 }; 00047 00049 typedef sbuild::custom_error<error_code> error; 00050 00060 main_base (std::string const& program_name, 00061 std::string const& program_usage, 00062 options_base::ptr& options, 00063 bool use_syslog); 00064 00066 virtual ~main_base (); 00067 00071 virtual void 00072 action_list () = 0; 00073 00077 virtual void 00078 action_info (); 00079 00083 virtual void 00084 action_location (); 00085 00089 virtual void 00090 action_config () = 0; 00091 00092 protected: 00100 virtual int 00101 run_impl (); 00102 00108 virtual sbuild::string_list 00109 get_chroot_options (); 00110 00115 virtual void 00116 compat_check (); 00117 00121 virtual void 00122 load_config (); 00123 00129 virtual void 00130 create_session (sbuild::session::operation sess_op) = 0; 00131 00132 protected: 00134 options_base::ptr options; 00136 sbuild::chroot_config::ptr config; 00138 sbuild::string_list chroots; 00140 sbuild::session::ptr session; 00141 }; 00142 00143 } 00144 00145 #endif /* SCHROOT_MAIN_BASE_H */ 00146 00147 /* 00148 * Local Variables: 00149 * mode:C++ 00150 * End: 00151 */