comparison server/web_component.h @ 0:a4671277546c tip

created the repository for the thymian project
author ferencd
date Tue, 17 Aug 2021 11:19:54 +0200
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:a4671277546c
1 #ifndef WEB_COMPONENT_H
2 #define WEB_COMPONENT_H
3
4 #include <tnt/httprequest.h>
5 #include <tnt/httpreply.h>
6 #include <tnt/mimedb.h>
7
8 #include "template_struct.h"
9
10 static const std::string RECIPES_ROOT = "/recipes/";
11 static const std::string path = "/theme/current/";
12 static std::map<std::string, std::string> ctg_to_name = { {"0", "Soups"}, {"2", "Side Dishes"}, {"3", "Main Courses"}, {"4", "Sweets"}, {"1", "Appetizers"} };
13
14 class web_component
15 {
16 public:
17
18 // generic not found page
19 static const std::string WEB_NOT_FOUND;
20
21 web_component(tnt::HttpRequest& request, tnt::HttpReply& reply, const std::string& sessionId);
22 virtual ~web_component() = default;
23
24 virtual unsigned send() = 0;
25
26 static tnt::MimeDb mimeDb;
27
28 std::string prepareLangJs(const std::map<std::string, std::map<std::string, std::string> > &translations);
29
30 protected:
31
32 void prepareLanguages();
33
34 tnt::HttpRequest& mrequest;
35 tnt::HttpReply& mreply;
36
37 std::string m_sessionId;
38 std::string m_originatingIp;
39
40 std::vector<template_struct> m_languageStructs;
41
42 };
43
44 #endif // WEB_COMPONENT_H