aboutsummaryrefslogtreecommitdiff
path: root/NodeFactory.h
blob: 3c8c4f4096c5416776690bfaca931a4104910f21 (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
28
29
30
31
#pragma once

#include <string>
#include <map>

#include "Node.h"

using std::string;

using NodeFactoryMap = std::map<string, const Node *>;

class NodeFactory {
public:
	NodeFactory() = default;
	virtual ~NodeFactory() = default;

public:
	static bool has_type(const char * type);
	static bool has_type(string type);
	static Node * create(string type);

private:
	static void assign(const char * type, const Node * node);
	static NodeFactoryMap & get_map();
	static string normalize_type(string type);
	static const Node * find_type(string type);

private:
	friend Node;
};