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_OPTIONS_BASE_H 00020 #define SCHROOT_OPTIONS_BASE_H 00021 00022 #include <sbuild/sbuild-session.h> 00023 #include <sbuild/sbuild-types.h> 00024 00025 #include <schroot-base/schroot-base-options.h> 00026 00027 #include <string> 00028 00029 #ifdef HAVE_TR1_MEMORY 00030 #include <tr1/memory> 00031 #elif HAVE_BOOST_SHARED_PTR_HPP 00032 #include <boost/shared_ptr.hpp> 00033 namespace std { namespace tr1 { using boost::shared_ptr; } } 00034 #else 00035 #error A shared_ptr implementation is not available 00036 #endif 00037 00038 #include <boost/program_options.hpp> 00039 00040 namespace schroot 00041 { 00042 00049 class options_base : public schroot_base::options 00050 { 00051 public: 00053 static const action_type ACTION_SESSION_AUTO; 00055 static const action_type ACTION_SESSION_BEGIN; 00057 static const action_type ACTION_SESSION_RECOVER; 00059 static const action_type ACTION_SESSION_RUN; 00061 static const action_type ACTION_SESSION_END; 00063 static const action_type ACTION_LIST; 00065 static const action_type ACTION_INFO; 00067 static const action_type ACTION_LOCATION; 00069 static const action_type ACTION_CONFIG; 00070 00072 typedef std::tr1::shared_ptr<options_base> ptr; 00073 00075 options_base (); 00076 00078 virtual ~options_base (); 00079 00081 sbuild::string_list chroots; 00083 std::string chroot_path; 00085 sbuild::string_list command; 00087 std::string directory; 00089 std::string user; 00091 bool preserve; 00093 bool all; 00095 bool all_chroots; 00097 bool all_sessions; 00099 bool load_chroots; 00101 bool load_sessions; 00103 std::string session_name; 00105 bool session_force; 00106 00107 protected: 00114 bool 00115 all_used () const 00116 { 00117 return (this->all || this->all_chroots || this->all_sessions); 00118 } 00119 00120 virtual void 00121 add_options (); 00122 00123 virtual void 00124 add_option_groups (); 00125 00126 virtual void 00127 check_options (); 00128 00129 virtual void 00130 check_actions (); 00131 00133 boost::program_options::options_description chroot; 00135 boost::program_options::options_description chrootenv; 00137 boost::program_options::options_description session_actions; 00139 boost::program_options::options_description session_options; 00140 }; 00141 00142 } 00143 00144 #endif /* SCHROOT_OPTIONS_BASE_H */ 00145 00146 /* 00147 * Local Variables: 00148 * mode:C++ 00149 * End: 00150 */ 00151