2 // Created by mfritzsc on 7/11/17.
5 #ifndef TMCAGLWM_APP_HPP
6 #define TMCAGLWM_APP_HPP
9 #include <experimental/optional>
13 using std::experimental::optional;
14 using std::experimental::nullopt;
16 template <typename E, typename T>
21 bool is_ok() const { return this->t != nullopt; }
22 bool is_err() const { return this->e != nullopt; }
23 T unwrap() { return this->t.value(); }
26 template <typename E, typename T>
27 struct result<E, T> Err(E e) { return result<E, T>{e, nullopt}; }
29 template <typename E, typename T>
30 struct result<E, T> Ok(T t) { return result<E, T>{nullopt, t}; }
32 using json = nlohmann::json;
38 result<char const *, json> debug_status() const;
39 result<char const *, json> debug_layers() const;
40 result<char const *, json> debug_surfaces() const;
42 result<char const *, json> register_surface(uint32_t appid, uint32_t surfid);
52 #endif //TMCAGLWM_APP_HPP