#include #include "XMLParser.h" #include "Parser.h" using namespace std; XMLParser XMLParser::instance {}; XMLParser::XMLParser() { Parser::register_strategy(this); } unsigned int XMLParser::heuristic(File & f) { const string content = f.read(); int open_backets = 0; int close_brackets = 0; for (char c : content) { if (c == '<') open_backets++; if (c == '>') close_brackets++; } int balance = abs(open_backets - close_brackets); int penalty = 1 + balance * 10; return (open_backets + close_brackets) / penalty; } void XMLParser::parse(File & f, Deserializer & d) { printf("%s\n", __PRETTY_FUNCTION__); }