summaryrefslogtreecommitdiff
path: root/src/xcb_resources.hh
diff options
context:
space:
mode:
authorJoel Klinghed <the_jk@spawned.biz>2021-01-27 22:06:49 +0100
committerJoel Klinghed <the_jk@spawned.biz>2021-01-27 22:06:49 +0100
commit06950aab233de6a2f47293d59575bb42f6131660 (patch)
tree62f6eed4a6d35414f656d22b9ac7420849018a11 /src/xcb_resources.hh
parent1ef9c463f1efc1adfb62e42ab3dd17e8c6394373 (diff)
Complete rewrite using C++ and with shared state support
Diffstat (limited to 'src/xcb_resources.hh')
-rw-r--r--src/xcb_resources.hh35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/xcb_resources.hh b/src/xcb_resources.hh
new file mode 100644
index 0000000..5e04e26
--- /dev/null
+++ b/src/xcb_resources.hh
@@ -0,0 +1,35 @@
+#ifndef XCB_RESOURCES_HH
+#define XCB_RESOURCES_HH
+
+#include "xcb_connection.hh"
+
+#include <memory>
+#include <optional>
+#include <string>
+
+namespace xcb {
+
+class Resources {
+public:
+ virtual ~Resources() = default;
+
+ virtual std::optional<std::string> get_string(std::string const& name,
+ std::string const& clazz) = 0;
+
+ virtual std::optional<long> get_long(std::string const& name,
+ std::string const& clazz) = 0;
+
+ virtual std::optional<bool> get_bool(std::string const& name,
+ std::string const& clazz) = 0;
+
+ static std::unique_ptr<Resources> create(shared_conn conn);
+
+protected:
+ Resources() = default;
+ Resources(Resources const&) = delete;
+ Resources& operator=(Resources const&) = delete;
+};
+
+} // namespace xcb
+
+#endif // XCB_RESOURCES_HH