From 628df48e0238391658dab54f81dfa1c62dbfb3ec Mon Sep 17 00:00:00 2001 From: Marcus Fritzsch Date: Tue, 11 Jul 2017 15:18:42 +0200 Subject: main/app: started to move things to app Started implementing App, as the actual implementation, that is, to pull out all the stuff that is actually the application and only have glue code reside in main. Signed-off-by: Marcus Fritzsch --- src/app.hpp | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 src/app.hpp (limited to 'src/app.hpp') diff --git a/src/app.hpp b/src/app.hpp new file mode 100644 index 0000000..a3108b3 --- /dev/null +++ b/src/app.hpp @@ -0,0 +1,52 @@ +// +// Created by mfritzsc on 7/11/17. +// + +#ifndef TMCAGLWM_APP_HPP +#define TMCAGLWM_APP_HPP + +#include +#include + +namespace wm { + + using std::experimental::optional; + using std::experimental::nullopt; + + template + struct result { + optional e; + optional t; + + bool is_ok() const { return this->t != nullopt; } + bool is_err() const { return this->e != nullopt; } + T unwrap() { return this->t.value(); } + }; + + template + struct result Err(E e) { return result{e, nullopt}; } + + template + struct result Ok(T t) { return result{nullopt, t}; } + + using json = nlohmann::json; + + struct App { + struct API { + struct App *app; + + result debug_status() const; + result debug_layers() const; + result debug_surfaces() const; + + result register_surface(uint32_t appid, uint32_t surfid); + }; + + struct API api; + + App(); + }; + +} // namespace wm + +#endif //TMCAGLWM_APP_HPP -- cgit 1.2.3-korg