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 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_BASE_OPTIONS_H
00021 #define SCHROOT_BASE_OPTIONS_H
00022 
00023 #include <sbuild/sbuild-session.h>
00024 #include <sbuild/sbuild-types.h>
00025 
00026 #include <schroot-base/schroot-base-option-action.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_base
00042 {
00043 
00050   class options
00051   {
00052   public:
00054     typedef std::tr1::shared_ptr<options> ptr;
00055     typedef option_action::action_type action_type;
00056 
00058     options ();
00059 
00061     virtual ~options ();
00062 
00069     void
00070     parse (int   argc,
00071            char *argv[]);
00072 
00074     static const action_type ACTION_HELP;
00076     static const action_type ACTION_VERSION;
00077 
00079     option_action action;
00080 
00082     bool          quiet;
00084     bool          verbose;
00085 
00092     boost::program_options::options_description const&
00093     get_visible_options() const;
00094 
00095   protected:
00099     virtual void
00100     add_options ();
00101 
00105     virtual void
00106     add_option_groups ();
00107 
00111     virtual void
00112     check_options ();
00113 
00117     virtual void
00118     check_actions ();
00119 
00121     boost::program_options::options_description            actions;
00123     boost::program_options::options_description            general;
00125     boost::program_options::options_description            hidden;
00127     boost::program_options::positional_options_description positional;
00129     boost::program_options::options_description            visible;
00131     boost::program_options::options_description            global;
00133     boost::program_options::variables_map                  vm;
00134 
00135   private:
00137     std::string debug_level;
00138   };
00139 
00140 }
00141 
00142 #endif /* SCHROOT_BASE_OPTIONS_H */
00143 
00144 /*
00145  * Local Variables:
00146  * mode:C++
00147  * End:
00148  */
00149 

Generated on Sun Jul 8 21:23:55 2007 for schroot by  doxygen 1.5.2