aboutsummaryrefslogtreecommitdiff
path: root/FileReaderFactory.h
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-10-18 15:48:14 +0200
committerLoek Le Blansch <loek@pipeframe.xyz>2024-10-18 15:48:14 +0200
commitd8289105193707daede1a5b59137f18e20f20aeb (patch)
tree939908b9c4c6f7aaef8aa61ee2e04be3e85610b6 /FileReaderFactory.h
parent76e61d68bbf568ec0d7fc4632e52d4de5496b003 (diff)
(2/2) rename
Diffstat (limited to 'FileReaderFactory.h')
-rw-r--r--FileReaderFactory.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/FileReaderFactory.h b/FileReaderFactory.h
new file mode 100644
index 0000000..0829985
--- /dev/null
+++ b/FileReaderFactory.h
@@ -0,0 +1,27 @@
+#pragma once
+
+#include <string>
+#include <map>
+#include <memory>
+
+#include "FileReader.h"
+
+using FactoryMap = std::map<std::string, const FileReader *>;
+
+class FileReaderFactory {
+public:
+ static std::unique_ptr<FileReader> open(const std::string url);
+
+private:
+ FileReaderFactory() = default;
+ virtual ~FileReaderFactory() = default;
+
+private:
+ static void register_strategy(const std::string type, const FileReader * node);
+ static FactoryMap & get_map();
+ static const FileReader * find_reader(const std::string type);
+
+private:
+ friend FileReader;
+};
+