Mir
command_line_option.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2016 Canonical Ltd.
3  *
4  * This program is free software: you can redistribute it and/or modify it
5  * under the terms of the GNU General Public License version 2 or 3 as
6  * 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 General Public License for more details.
12  *
13  * You should have received a copy of the GNU 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 MIRAL_COMMAND_LINE_OPTION_H
20 #define MIRAL_COMMAND_LINE_OPTION_H
21 
22 #include <mir/optional_value.h>
23 
24 #include <functional>
25 #include <memory>
26 #include <string>
27 
28 namespace mir { class Server; }
29 
30 namespace miral
31 {
40 {
41 public:
43  std::function<void(int value)> callback,
44  std::string const& option,
45  std::string const& description,
46  int default_value);
47 
49  std::function<void(double value)> callback,
50  std::string const& option,
51  std::string const& description,
52  double default_value);
53 
55  std::function<void(std::string const& value)> callback,
56  std::string const& option,
57  std::string const& description,
58  std::string const& default_value);
59 
61  std::function<void(std::string const& value)> callback,
62  std::string const& option,
63  std::string const& description,
64  char const* default_value);
65 
67  std::function<void(bool value)> callback,
68  std::string const& option,
69  std::string const& description,
70  bool default_value);
71 
73  std::function<void(mir::optional_value<int> const& value)> callback,
74  std::string const& option,
75  std::string const& description);
76 
78  std::function<void(mir::optional_value<std::string> const& value)> callback,
79  std::string const& option,
80  std::string const& description);
81 
83  std::function<void(mir::optional_value<bool> const& value)> callback,
84  std::string const& option,
85  std::string const& description);
86 
88  std::function<void(bool is_set)> callback,
89  std::string const& option,
90  std::string const& description);
91 
92  void operator()(mir::Server& server) const;
93 
94  // Call the callback *before* Mir initialization starts
95  friend auto pre_init(CommandLineOption const& clo) -> CommandLineOption;
96 
99  auto operator=(CommandLineOption const&) -> CommandLineOption&;
100 
101 private:
102  struct Self;
103  std::shared_ptr<Self> self;
104 };
105 
111 auto pre_init(CommandLineOption const& clo) -> CommandLineOption;
112 }
113 
114 #endif //MIRAL_COMMAND_LINE_OPTION_H
AutoUnblockThread is a helper thread class that can gracefully shutdown at destruction time...
Definition: sw_splash.h:26
auto pre_init(CommandLineOption const &clo) -> CommandLineOption
Update the option to be called back before Mir initialization starts.
Definition: optional_value.h:28
Add a user configuration option to Mir&#39;s option handling. By default the callback will be invoked fol...
Definition: command_line_option.h:39
Mir Abstraction Layer.
Definition: floating_window_manager.h:32

Copyright © 2012-2017 Canonical Ltd.
Generated on Mon Oct 30 19:44:55 UTC 2017