Program Listing for File runner.h¶
↰ Return to documentation for file (include/miral/miral/runner.h
)
/*
* Copyright © Canonical Ltd.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 or 3 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MIRAL_RUNNER_H
#define MIRAL_RUNNER_H
#include "mir/optional_value.h"
#include "mir/fd.h"
#include <functional>
#include <initializer_list>
#include <memory>
namespace mir { class Server; }
namespace miral
{
struct FdHandle { public: virtual ~FdHandle(); };
class MirRunner
{
public:
MirRunner(int argc, char const* argv[]);
MirRunner(int argc, char const* argv[], char const* config_file);
~MirRunner();
void add_start_callback(std::function<void()> const& start_callback);
void add_stop_callback(std::function<void()> const& stop_callback);
void register_signal_handler(
std::initializer_list<int> signals,
std::function<void(int)> const& handler);
auto register_fd_handler(
mir::Fd fd,
std::function<void(int)> const& handler)
-> std::unique_ptr<miral::FdHandle>;
void set_exception_handler(std::function<void()> const& handler);
auto run_with(std::initializer_list<std::function<void(::mir::Server&)>> options) -> int;
void stop();
auto config_file() const -> std::string;
auto display_config_file() const -> std::string;
auto wayland_display() const -> mir::optional_value<std::string>;
auto x11_display() const -> mir::optional_value<std::string>;
private:
MirRunner(MirRunner const&) = delete;
MirRunner& operator=(MirRunner const&) = delete;
struct Self;
std::unique_ptr<Self> const self;
};
}
#endif //MIRAL_RUNNER_H