summaryrefslogtreecommitdiff
path: root/src/static_files.hh
diff options
context:
space:
mode:
authorJoel Klinghed <the_jk@spawned.biz>2021-11-17 22:34:57 +0100
committerJoel Klinghed <the_jk@spawned.biz>2021-11-17 22:34:57 +0100
commit6232d13f5321b87ddf12a1aa36b4545da45f173d (patch)
tree23f3316470a14136debd9d02f9e920ca2b06f4cc /src/static_files.hh
Travel3: Simple image and video display site
Reads the images and videos from filesystem and builds a site in memroy.
Diffstat (limited to 'src/static_files.hh')
-rw-r--r--src/static_files.hh33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/static_files.hh b/src/static_files.hh
new file mode 100644
index 0000000..ecff987
--- /dev/null
+++ b/src/static_files.hh
@@ -0,0 +1,33 @@
+#ifndef STATIC_FILES_HH
+#define STATIC_FILES_HH
+
+#include "transport.hh"
+
+#include <filesystem>
+#include <memory>
+
+class Logger;
+class SendFile;
+class TaskRunner;
+
+class StaticFiles {
+public:
+ virtual ~StaticFiles() = default;
+
+ static std::unique_ptr<StaticFiles> create(
+ std::shared_ptr<Logger> logger,
+ std::shared_ptr<TaskRunner> runner,
+ std::shared_ptr<SendFile> send_file,
+ std::filesystem::path path,
+ size_t threads = 1);
+
+ virtual std::unique_ptr<Transport::Response> request(
+ Transport* transport, std::string_view path) = 0;
+
+protected:
+ StaticFiles() = default;
+ StaticFiles(StaticFiles const&) = delete;
+ StaticFiles& operator=(StaticFiles const&) = delete;
+};
+
+#endif // STATIC_FILES_HH