diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2024-10-18 15:48:14 +0200 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2024-10-18 15:48:14 +0200 |
commit | d8289105193707daede1a5b59137f18e20f20aeb (patch) | |
tree | 939908b9c4c6f7aaef8aa61ee2e04be3e85610b6 /FileReader.h | |
parent | 76e61d68bbf568ec0d7fc4632e52d4de5496b003 (diff) |
(2/2) rename
Diffstat (limited to 'FileReader.h')
-rw-r--r-- | FileReader.h | 32 |
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; }; |