You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

31 lines
1.1 KiB

#ifndef COMPONENTBUILDER_H
#define COMPONENTBUILDER_H
#include <algorithm>
#include <memory>
#include <unordered_map>
#include "Component.h"
//#include "DocumentComponent.h"
//#include "../elements/Element.h"
#include "../../parsers/markup/TagNode.h"
#include "../../parsers/markup/TextNode.h"
#include "../../parsers/markup/Node.h"
class DocumentComponent;
class Element;
typedef std::unordered_map<std::string, std::function<std::unique_ptr<Component>(const Node &node, int y, int windowWidth, int windowHeight)>> ElementRendererMap;
class ComponentBuilder {
private:
const static std::unordered_map<std::string, std::shared_ptr<Element>> elementMap;
public:
// FIXME: consider passing the documentComponent we're bound too
std::shared_ptr<Component> build(const std::shared_ptr<Node> node, const std::shared_ptr<Component> &parentComponent, const std::shared_ptr<Window> win, DocumentComponent *docComponent);
};
// getComponentType
std::string typeOfComponent(const std::shared_ptr<Component> &component);
std::string typeOfComponent(Component *component);
#endif