aboutsummaryrefslogtreecommitdiff
path: root/FileReaderFactory.h
blob: 0829985fbfcf1510081b8206e10f04351804fdb5 (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 "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;
};