Mir
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
default_configuration.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2013-2014 Canonical Ltd.
3  *
4  * This program is free software: you can redistribute it and/or modify it
5  * under the terms of the GNU Lesser General Public License version 3,
6  * as published by the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * Authored by: Alan Griffiths <alan@octopull.co.uk>
17  */
18 
19 #ifndef MIR_OPTIONS_DEFAULT_CONFIGURATION_H_
20 #define MIR_OPTIONS_DEFAULT_CONFIGURATION_H_
21 
24 #include <boost/program_options/options_description.hpp>
25 
26 namespace mir
27 {
28 namespace options
29 {
31 {
32 public:
33  DefaultConfiguration(int argc, char const* argv[]);
35  int argc,
36  char const* argv[],
37  std::function<void(int argc, char const* const* argv)> const& handler);
38  virtual ~DefaultConfiguration() = default;
39 
40  // add_options() allows users to add their own options. This MUST be called
41  // before the first invocation of the_options() - typically during initialization.
42  boost::program_options::options_description_easy_init add_options();
43 
44 private:
45  void add_platform_options();
46  // accessed via the base interface, when access to add_options() has been "lost"
47  std::shared_ptr<options::Option> the_options() const override;
48 
49  virtual void parse_arguments(
50  boost::program_options::options_description desc,
51  ProgramOption& options,
52  int argc,
53  char const* argv[]) const;
54 
55  virtual void parse_environment(
56  boost::program_options::options_description& desc,
57  ProgramOption& options) const;
58 
59  virtual void parse_config_file(
60  boost::program_options::options_description& desc,
61  ProgramOption& options) const;
62 
63  int const argc;
64  char const** const argv;
65  std::function<void(int argc, char const* const* argv)> const unparsed_arguments_handler;
66  std::shared_ptr<boost::program_options::options_description> const program_options;
67  std::shared_ptr<Option> mutable options;
68 };
69 }
70 }
71 
72 #endif /* MIR_OPTIONS_DEFAULT_CONFIGURATION_H_ */
All things Mir.
Definition: aging_buffer.h:24
Definition: program_option.h:32
Definition: configuration.h:61
virtual ~DefaultConfiguration()=default
Definition: default_configuration.h:30
DefaultConfiguration(int argc, char const *argv[])
Definition: default_configuration.cpp:85
boost::program_options::options_description_easy_init add_options()
Definition: default_configuration.cpp:200

Copyright © 2012,2013 Canonical Ltd.
Generated on Fri Oct 10 14:07:14 UTC 2014