aboutsummaryrefslogtreecommitdiff
path: root/FileReader.h
diff options
context:
space:
mode:
Diffstat (limited to 'FileReader.h')
-rw-r--r--FileReader.h32
1 files changed, 15 insertions, 17 deletions
diff --git a/FileReader.h b/FileReader.h
index 0829985..f896ec8 100644
--- a/FileReader.h
+++ b/FileReader.h
@@ -1,27 +1,25 @@
#pragma once
-#include <string>
-#include <map>
-#include <memory>
-
-#include "FileReader.h"
+class FileReaderFactory;
-using FactoryMap = std::map<std::string, const FileReader *>;
+#include <string>
-class FileReaderFactory {
+class FileReader {
+protected:
+ virtual void open(const std::string url) = 0;
public:
- static std::unique_ptr<FileReader> open(const std::string url);
+ virtual void close() = 0;
+ virtual const std::string read() = 0;
-private:
- FileReaderFactory() = default;
- virtual ~FileReaderFactory() = default;
+public:
+ virtual ~FileReader() = 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);
+protected:
+ FileReader() = default;
+ virtual FileReader * clone() const = 0;
-private:
- friend FileReader;
+protected:
+ FileReader(const std::string protocol);
+ friend FileReaderFactory;
};