1 /* 2 This file is part of the metalink program 3 Copyright (C) 2008 A. Bram Neijt <bneijt@gmail.com> 4 5 This program is free software: you can redistribute it and/or modify 6 it under the terms of the GNU General Public License as published by 7 the Free Software Foundation, either version 3 of the License, or 8 (at your option) any later version. 9 10 This program is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 GNU General Public License for more details. 14 15 You should have received a copy of the GNU General Public License 16 along with this program. If not, see <http://www.gnu.org/licenses/>. 17 18 */ 19 20 21 22 23 24 #ifndef _Options_HH_INCLUDED_ 25 #define _Options_HH_INCLUDED_ 26 27 #include <glibmm/optiongroup.h> 28 29 namespace bneijt 30 { 31 32 class Options: public Glib::OptionGroup 33 { 34 public: 35 Options(); on_pre_parse(Glib::OptionContext & context,Glib::OptionGroup & group)36 virtual bool on_pre_parse(Glib::OptionContext& context, Glib::OptionGroup& group) 37 { 38 //This is called before the m_arg_* instances are given their values. 39 // You do not need to override this method. This is just here to show you how, 40 // in case you want to do any extra processing. 41 return Glib::OptionGroup::on_pre_parse(context, group); 42 } on_post_parse(Glib::OptionContext & context,Glib::OptionGroup & group)43 virtual bool on_post_parse(Glib::OptionContext& context, Glib::OptionGroup& group) 44 { 45 //This is called after the m_arg_* instances are given their values. 46 // You do not need to override this method. This is just here to show you how, 47 // in case you want to do any extra processing. 48 return Glib::OptionGroup::on_post_parse(context, group); 49 } on_error(Glib::OptionContext & context,Glib::OptionGroup & group)50 virtual void on_error(Glib::OptionContext& context, Glib::OptionGroup& group) 51 { 52 Glib::OptionGroup::on_error(context, group); 53 } 54 55 //These int instances should live as long as the OptionGroup to which they are added, 56 //and as long as the OptionContext to which those OptionGroups are added. 57 struct Values 58 { 59 bool help, version, nomirrors, hashlist, mindigests, somedigests, alldigests; 60 Glib::OptionGroup::vecustrings digests, md5files; 61 Glib::ustring addpath, headerfile, desc; 62 } opt; 63 64 }; 65 } //Namespace 66 #endif 67 68 69 70 71