schroot-base-options.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 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_BASE_OPTIONS_H
00020 #define SCHROOT_BASE_OPTIONS_H
00021 
00022 #include <sbuild/sbuild-session.h>
00023 #include <sbuild/sbuild-types.h>
00024 
00025 #include <schroot-base/schroot-base-option-action.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_base
00041 {
00042 
00049   class options
00050   {
00051   public:
00053     typedef std::tr1::shared_ptr<options> ptr;
00054     typedef option_action::action_type action_type;
00055 
00057     options ();
00058 
00060     virtual ~options ();
00061 
00068     void
00069     parse (int   argc,
00070            char *argv[]);
00071 
00073     static const action_type ACTION_HELP;
00075     static const action_type ACTION_VERSION;
00076 
00078     option_action action;
00079 
00081     bool          quiet;
00083     bool          verbose;
00084 
00091     boost::program_options::options_description const&
00092     get_visible_options() const;
00093 
00094   protected:
00098     virtual void
00099     add_options ();
00100 
00104     virtual void
00105     add_option_groups ();
00106 
00110     virtual void
00111     check_options ();
00112 
00116     virtual void
00117     check_actions ();
00118 
00120     boost::program_options::options_description            actions;
00122     boost::program_options::options_description            general;
00124     boost::program_options::options_description            hidden;
00126     boost::program_options::positional_options_description positional;
00128     boost::program_options::options_description            visible;
00130     boost::program_options::options_description            global;
00132     boost::program_options::variables_map                  vm;
00133 
00134   private:
00136     std::string debug_level;
00137   };
00138 
00139 }
00140 
00141 #endif /* SCHROOT_BASE_OPTIONS_H */
00142 
00143 /*
00144  * Local Variables:
00145  * mode:C++
00146  * End:
00147  */
00148 

Generated on Sat Jul 5 12:00:17 2008 for schroot by  doxygen 1.5.6