pixwhile/blankie/serializer.h

31 lines
778 B
C++

#pragma once
#include <string>
#include <vector>
#include <variant>
#include <utility>
namespace blankie {
namespace html {
struct Element;
typedef std::pair<const char*, std::string> Attribute;
typedef std::variant<Element, const char*, std::string> Node;
struct Element {
const char* tag;
std::vector<Attribute> attributes;
std::vector<Node> nodes;
Element(const char* tag_) : tag(tag_) {}
Element(const char* tag_, std::vector<Node> nodes_)
: tag(tag_), nodes(std::move(nodes_)) {}
Element(const char* tag_, std::vector<Attribute> attributes_, std::vector<Node> nodes_)
: tag(tag_), attributes(std::move(attributes_)), nodes(std::move(nodes_)) {}
std::string serialize() const;
};
} // namespace html
} // namespace blankie