1 /* cclive
2  * Copyright (C) 2010-2013  Toni Gundogdu <legatvs@gmail.com>
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef cclive_options_h
19 #define cclive_options_h
20 
21 #include <boost/program_options.hpp>
22 
23 namespace cc
24 {
25 
26 struct flags_s
27 {
28   bool verbose_libcurl;
29   bool print_streams;
30   bool query_formats;
31   bool print_config;
32   bool no_download;
33   bool no_resolve;
34   bool background;
35   bool overwrite;
36   bool timestamp;
37   bool no_proxy;
38   bool version;
39   bool license;
40   bool support;
41   bool quiet;
42   bool cont/*inue*/;
43   bool help;
44 };
45 
46 class options
47 {
48   inline friend std::ostream& operator<<(std::ostream& os, const options& o)
49     {
50       return os << o._visible;
51     }
52 public:
map()53   inline const boost::program_options::variables_map& map()const {return _map;}
54   void parse(int argc, char **argv);
55   void dump();
56 private:
57   void _validate();
58 private:
59   boost::program_options::options_description _visible;
60   boost::program_options::variables_map _map;
61 public:
62   struct flags_s flags;
63 };
64 
65 extern options opts;
66 
67 } // namespace cc
68 
69 #endif // cclive_options_h
70 
71 // vim: set ts=2 sw=2 tw=72 expandtab:
72