From 84428c144e54170ec629b379e1daf86857da2be8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20Gassmann?= Date: Thu, 17 Mar 2022 16:14:17 +0100 Subject: [~] Refactoring of the FileAssembler, Extraction of methods in PParser --- inc/PParser.h | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 inc/PParser.h (limited to 'inc/PParser.h') diff --git a/inc/PParser.h b/inc/PParser.h new file mode 100644 index 0000000..dad379b --- /dev/null +++ b/inc/PParser.h @@ -0,0 +1,45 @@ +#ifndef PP_H +#define PP_H + +#include +#include +#include +#include +#include + +using namespace std; + +class PParser{ + +private: + map *variables; + map *templates; + map *pages; + map *posts; + + vector ordered_posts_indexes; + + string parse_text(string title, string content, bool is_post); + static string* parse_function(string to_parse); + static string* parse_separator(string to_parse, string separator); + vector get_ordered_posts_indexes(); + static bool cmp_posts(pair& a, pair& b); + + static string lowercase(string s){ + string low = ""; + for (int i = 0; i < s.length(); i++) { + low += tolower(s[i]); + } + return low; + } + +public: + PParser( + map *variables, + map *templates, + map *pages, + map *posts); + + map* parse(); +}; +#endif -- cgit v1.2.3