schroot-options-base.h

Go to the documentation of this file.
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 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 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-base/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     static const action_type ACTION_SESSION_AUTO;
00056     static const action_type ACTION_SESSION_BEGIN;
00058     static const action_type ACTION_SESSION_RECOVER;
00060     static const action_type ACTION_SESSION_RUN;
00062     static const action_type ACTION_SESSION_END;
00064     static const action_type ACTION_LIST;
00066     static const action_type ACTION_INFO;
00068     static const action_type ACTION_LOCATION;
00070     static const action_type ACTION_CONFIG;
00071 
00073     typedef std::tr1::shared_ptr<options_base> ptr;
00074 
00076     options_base ();
00077 
00079     virtual ~options_base ();
00080 
00082     sbuild::string_list  chroots;
00084     std::string          chroot_path;
00086     sbuild::string_list  command;
00088     std::string          directory;
00090     std::string          user;
00092     bool                 preserve;
00094     bool                 all;
00096     bool                 all_chroots;
00098     bool                 all_sessions;
00100     bool                 load_chroots;
00102     bool                 load_sessions;
00104     bool                 session_force;
00105 
00106   protected:
00113     bool
00114     all_used () const
00115     {
00116       return (this->all || this->all_chroots || this->all_sessions);
00117     }
00118 
00119     virtual void
00120     add_options ();
00121 
00122     virtual void
00123     add_option_groups ();
00124 
00125     virtual void
00126     check_options ();
00127 
00128     virtual void
00129     check_actions ();
00130 
00132     boost::program_options::options_description chroot;
00134     boost::program_options::options_description chrootenv;
00136     boost::program_options::options_description session;
00137   };
00138 
00139 }
00140 
00141 #endif /* SCHROOT_OPTIONS_BASE_H */
00142 
00143 /*
00144  * Local Variables:
00145  * mode:C++
00146  * End:
00147  */
00148 

Generated on Thu May 10 23:11:36 2007 for schroot by  doxygen 1.5.2