00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef SCHROOT_OPTIONS_BASE_H
00021 #define SCHROOT_OPTIONS_BASE_H
00022
00023 #include <sbuild/sbuild-session.h>
00024 #include <sbuild/sbuild-types.h>
00025
00026 #include <schroot/schroot-base-options.h>
00027
00028 #include <string>
00029
00030 #ifdef HAVE_TR1_MEMORY
00031 #include <tr1/memory>
00032 #elif HAVE_BOOST_SHARED_PTR_HPP
00033 #include <boost/shared_ptr.hpp>
00034 namespace std { namespace tr1 { using boost::shared_ptr; } }
00035 #else
00036 #error A shared_ptr implementation is not available
00037 #endif
00038
00039 #include <boost/program_options.hpp>
00040
00041 namespace schroot
00042 {
00043
00050 class options_base : public schroot_base::options
00051 {
00052 public:
00054 enum action_type
00055 {
00056 ACTION_SESSION_AUTO,
00057 ACTION_SESSION_BEGIN,
00058 ACTION_SESSION_RECOVER,
00059 ACTION_SESSION_RUN,
00060 ACTION_SESSION_END,
00061 ACTION_HELP,
00062 ACTION_VERSION,
00063 ACTION_LIST,
00064 ACTION_INFO,
00065 ACTION_LOCATION,
00066 ACTION_CONFIG
00067 };
00068
00070 typedef std::tr1::shared_ptr<options_base> ptr;
00071
00073 options_base ();
00074
00076 virtual ~options_base ();
00077
00079 action_type action;
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 bool session_force;
00104
00105 protected:
00112 void
00113 set_action (action_type action);
00114
00121 bool
00122 all_used () const
00123 {
00124 return (this->all || this->all_chroots || this->all_sessions);
00125 }
00126
00127 virtual void
00128 add_options ();
00129
00130 virtual void
00131 add_option_groups ();
00132
00133 virtual void
00134 check_options ();
00135
00136 virtual void
00137 check_actions ();
00138
00140 boost::program_options::options_description chroot;
00142 boost::program_options::options_description chrootenv;
00144 boost::program_options::options_description session;
00145 };
00146
00147 }
00148
00149 #endif
00150
00151
00152
00153
00154
00155
00156