aboutsummaryrefslogtreecommitdiffstats
path: root/src/app.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/app.hpp')
-rw-r--r--src/app.hpp52
1 files changed, 52 insertions, 0 deletions
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 <json.hpp>
+#include <experimental/optional>
+
+namespace wm {
+
+ using std::experimental::optional;
+ using std::experimental::nullopt;
+
+ template <typename E, typename T>
+ struct result {
+ optional<E> e;
+ optional<T> t;
+
+ bool is_ok() const { return this->t != nullopt; }
+ bool is_err() const { return this->e != nullopt; }
+ T unwrap() { return this->t.value(); }
+ };
+
+ template <typename E, typename T>
+ struct result<E, T> Err(E e) { return result<E, T>{e, nullopt}; }
+
+ template <typename E, typename T>
+ struct result<E, T> Ok(T t) { return result<E, T>{nullopt, t}; }
+
+ using json = nlohmann::json;
+
+ struct App {
+ struct API {
+ struct App *app;
+
+ result<char const *, json> debug_status() const;
+ result<char const *, json> debug_layers() const;
+ result<char const *, json> debug_surfaces() const;
+
+ result<char const *, json> register_surface(uint32_t appid, uint32_t surfid);
+ };
+
+ struct API api;
+
+ App();
+ };
+
+} // namespace wm
+
+#endif //TMCAGLWM_APP_HPP