aboutsummaryrefslogtreecommitdiff
path: root/FileReader.h
blob: 1cf62bac7a923e0562edc4548227ee2db10950c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#pragma once

#include <string>
#include <map>
#include <memory>

#include "FileStrategy.h"

using FactoryMap = std::map<std::string, const FileStrategy *>;

class FileReader {
public:
	static std::unique_ptr<FileStrategy> open(const std::string url);

private:
	FileReader() = default;
	virtual ~FileReader() = default;

private:
	static void register_strategy(const std::string type, const FileStrategy * node);
	static FactoryMap & get_map();
	static const FileStrategy * find_reader(const std::string type);

private:
	friend FileStrategy;
};