Webdar 1.0.0
Web user interface to libdar
html_over_guichet.hpp
1/*********************************************************************/
2// webdar - a web server and interface program to libdar
3// Copyright (C) 2013-2025 Denis Corbin
4//
5// This file is part of Webdar
6//
7// Webdar is free software: you can redistribute it and/or modify
8// it under the terms of the GNU General Public License as published by
9// the Free Software Foundation, either version 3 of the License, or
10// (at your option) any later version.
11//
12// Webdar is distributed in the hope that it will be useful,
13// but WITHOUT ANY WARRANTY; without even the implied warranty of
14// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15// GNU General Public License for more details.
16//
17// You should have received a copy of the GNU General Public License
18// along with Webdar. If not, see <http://www.gnu.org/licenses/>
19//
20//----
21// to contact the author: dar.linux@free.fr
22/*********************************************************************/
23
24#ifndef HTML_OVER_GUICHET_HPP
25#define HTML_OVER_GUICHET_HPP
26
27#include "my_config.h"
28
29 // C system header files
30extern "C"
31{
32
33}
34
35 // C++ system header files
36
37
38 // webdar headers
39#include "body_builder.hpp"
40#include "html_mask.hpp"
41#include "jsoner.hpp"
42#include "bibliotheque_subconfig.hpp"
43#include "guichet.hpp"
44#include "events.hpp"
45#include "actor.hpp"
46
48
51
53 public html_mask,
54 public jsoner,
56 public actor,
57 public events
58{
59public:
60
61 static const std::string changed;
62
65
66 html_over_guichet(const html_over_guichet & ref) = delete;
67 html_over_guichet(html_over_guichet && ref) noexcept = delete;
68 html_over_guichet & operator = (const html_over_guichet & ref) = delete;
69 html_over_guichet & operator = (html_over_guichet && ref) noexcept = delete;
70 ~html_over_guichet() = default;
71
73
82 void set_child(const std::shared_ptr<bibliotheque> & ptr,
83 std::unique_ptr<body_builder> & to_give,
85 const std::string & changed_event);
86
88 virtual std::unique_ptr<libdar::mask> get_mask() const override;
89
91 virtual bool is_relative() const override;
92
93
95 virtual void load_json(const json & source) override;
96
98 virtual json save_json() const override;
99
101 virtual void clear_json() override;
102
104 virtual bibliotheque::using_set get_using_set() const override;
105
107 virtual void on_event(const std::string & event_name) override;
108
109protected:
110
112 virtual std::string inherited_get_body_part(const chemin & path,
113 const request & req) override;
114
115
116private:
117 std::string child_event;
118 guichet wicket;
119 std::shared_ptr<body_builder> inner;
120
121 void check_inner() const { if(!inner) throw WEBDAR_BUG; };
122};
123
124
125#endif
class of object that are pointed/triggered to by others
Definition: actor.hpp:55
class bibliotheque_subconfig is an interface (pure virtual class)
Definition: bibliotheque_subconfig.hpp:50
std::set< coordinates > using_set
list of configs a given config depends on
Definition: bibliotheque.hpp:117
category
change event is replaced by a static method with category in argument
Definition: bibliotheque.hpp:63
class body_builder is the root class of object generating HTML body
Definition: body_builder.hpp:99
class chemin definition
Definition: chemin.hpp:51
class events
Definition: events.hpp:52
class guichet let one fetch config from a bibliotheque, save as or setup manually for a given compone...
Definition: guichet.hpp:92
class html_mask defines the interface of all masks
Definition: html_mask.hpp:44
class html_over_guichet is used to insert configuration from a bibliotheque in-place of a subconfigur...
Definition: html_over_guichet.hpp:58
virtual void on_event(const std::string &event_name) override
inherited from actor parent class
Definition: html_over_guichet.cpp:138
void set_child(const std::shared_ptr< bibliotheque > &ptr, std::unique_ptr< body_builder > &to_give, bibliotheque::category cat, const std::string &changed_event)
mandatory call to provide the object to adopt and use to load/save json and get mask configurations
Definition: html_over_guichet.cpp:57
virtual std::string inherited_get_body_part(const chemin &path, const request &req) override
inherited from body_builder
Definition: html_over_guichet.cpp:147
virtual bool is_relative() const override
inherited from html_mask
Definition: html_over_guichet.cpp:106
virtual void load_json(const json &source) override
inherited_from jsoner
Definition: html_over_guichet.cpp:118
html_over_guichet()
constructor
Definition: html_over_guichet.cpp:44
virtual json save_json() const override
inherited_from jsoner
Definition: html_over_guichet.cpp:123
virtual void clear_json() override
inherited_from jsoner
Definition: html_over_guichet.cpp:128
virtual bibliotheque::using_set get_using_set() const override
inherited from bibliotheque_subconfig
Definition: html_over_guichet.cpp:133
virtual std::unique_ptr< libdar::mask > get_mask() const override
inherited from html_mask
Definition: html_over_guichet.cpp:95
class jsoner
Definition: jsoner.hpp:73
class holding fields of an HTTP request (method, URI, header, cookies, and so on)
Definition: request.hpp:45
defines the event class
defines jsoner class and class exception_json