Mercurial > thymian
annotate 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 |
| rev | line source |
|---|---|
| ferencd@0 | 1 #ifndef WEB_COMPONENT_H |
| ferencd@0 | 2 #define WEB_COMPONENT_H |
| ferencd@0 | 3 |
| ferencd@0 | 4 #include <tnt/httprequest.h> |
| ferencd@0 | 5 #include <tnt/httpreply.h> |
| ferencd@0 | 6 #include <tnt/mimedb.h> |
| ferencd@0 | 7 |
| ferencd@0 | 8 #include "template_struct.h" |
| ferencd@0 | 9 |
| ferencd@0 | 10 static const std::string RECIPES_ROOT = "/recipes/"; |
| ferencd@0 | 11 static const std::string path = "/theme/current/"; |
| ferencd@0 | 12 static std::map<std::string, std::string> ctg_to_name = { {"0", "Soups"}, {"2", "Side Dishes"}, {"3", "Main Courses"}, {"4", "Sweets"}, {"1", "Appetizers"} }; |
| ferencd@0 | 13 |
| ferencd@0 | 14 class web_component |
| ferencd@0 | 15 { |
| ferencd@0 | 16 public: |
| ferencd@0 | 17 |
| ferencd@0 | 18 // generic not found page |
| ferencd@0 | 19 static const std::string WEB_NOT_FOUND; |
| ferencd@0 | 20 |
| ferencd@0 | 21 web_component(tnt::HttpRequest& request, tnt::HttpReply& reply, const std::string& sessionId); |
| ferencd@0 | 22 virtual ~web_component() = default; |
| ferencd@0 | 23 |
| ferencd@0 | 24 virtual unsigned send() = 0; |
| ferencd@0 | 25 |
| ferencd@0 | 26 static tnt::MimeDb mimeDb; |
| ferencd@0 | 27 |
| ferencd@0 | 28 std::string prepareLangJs(const std::map<std::string, std::map<std::string, std::string> > &translations); |
| ferencd@0 | 29 |
| ferencd@0 | 30 protected: |
| ferencd@0 | 31 |
| ferencd@0 | 32 void prepareLanguages(); |
| ferencd@0 | 33 |
| ferencd@0 | 34 tnt::HttpRequest& mrequest; |
| ferencd@0 | 35 tnt::HttpReply& mreply; |
| ferencd@0 | 36 |
| ferencd@0 | 37 std::string m_sessionId; |
| ferencd@0 | 38 std::string m_originatingIp; |
| ferencd@0 | 39 |
| ferencd@0 | 40 std::vector<template_struct> m_languageStructs; |
| ferencd@0 | 41 |
| ferencd@0 | 42 }; |
| ferencd@0 | 43 |
| ferencd@0 | 44 #endif // WEB_COMPONENT_H |
