From 76e61d68bbf568ec0d7fc4632e52d4de5496b003 Mon Sep 17 00:00:00 2001 From: Loek Le Blansch Date: Fri, 18 Oct 2024 15:43:25 +0200 Subject: (1/2) rename --- Parser.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'Parser.cpp') diff --git a/Parser.cpp b/Parser.cpp index 4597a76..49c4d00 100644 --- a/Parser.cpp +++ b/Parser.cpp @@ -1,16 +1,16 @@ #include -#include "Parser.h" +#include "ParserFactory.h" #include "Exception.h" -void Parser::parse(FileStrategy & file, Deserializer & deserializer) { - auto & col = Parser::get_collection(); +void ParserFactory::parse(FileReader & file, MuseumDeserializer & deserializer) { + auto & col = ParserFactory::get_collection(); if (col.size() < 1) throw Exception("no parsers registered"); unsigned int best_score = 0; - ParserStrategy * best_strategy = nullptr; - for (ParserStrategy * strategy : col) { + Parser * best_strategy = nullptr; + for (Parser * strategy : col) { unsigned int score = strategy->heuristic(file); if (score <= best_score) continue; @@ -24,8 +24,8 @@ void Parser::parse(FileStrategy & file, Deserializer & deserializer) { best_strategy->parse(file, deserializer); } -void Parser::register_strategy(ParserStrategy * ps) { - auto & col = Parser::get_collection(); +void ParserFactory::register_strategy(Parser * ps) { + auto & col = ParserFactory::get_collection(); if (std::find(col.begin(), col.end(), ps) != col.end()) return; col.push_back(ps); } -- cgit v1.2.3