Webdar 1.0.0
Web user interface to libdar
html_page.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_PAGE_HPP
25#define HTML_PAGE_HPP
26
27 // C system header files
28#include "my_config.h"
29extern "C"
30{
31
32}
33
34 // C++ system header files
35#include <string>
36#include <vector>
37
38 // webdar headers
39#include "html_level.hpp"
40#include "exceptions.hpp"
41
43
44class html_page : public html_level
45{
46public:
47 html_page(const std::string & title = "") { x_title = title; store_css_library(); };
48 html_page(const html_page & ref) = delete;
49 html_page(html_page && ref) noexcept = delete;
50 html_page & operator = (const html_page & ref) = delete;
51 html_page & operator = (html_page && ref) noexcept = delete;
52 ~html_page() = default;
53
55 void set_title(const std::string & title);
56
58 const std::string & get_title() const { return x_title; };
59
69 void set_refresh_redirection(unsigned int seconds, const std::string & url);
70
71
73 const std::string & get_refresh_redirection() const { return redirect; };
74
75protected:
77 virtual std::string inherited_get_body_part(const chemin & path,
78 const request & req) override;
79
80
82 std::string get_body_part_given_the_body(const chemin & path,
83 const request & req,
84 const std::string & body);
85
86private:
87 std::string x_title;
88 std::string redirect;
89};
90
91
92#endif
void store_css_library()
this creates a css_library accessible from adopted objects to hold html class definitions
Definition: body_builder.hpp:336
class chemin definition
Definition: chemin.hpp:51
class html_level is a pure virtual class
Definition: html_level.hpp:49
html page root component
Definition: html_page.hpp:45
void set_refresh_redirection(unsigned int seconds, const std::string &url)
Definition: html_page.cpp:52
const std::string & get_title() const
get current title
Definition: html_page.hpp:58
void set_title(const std::string &title)
change page title
Definition: html_page.cpp:43
virtual std::string inherited_get_body_part(const chemin &path, const request &req) override
inherited from body_builder
Definition: html_page.cpp:65
std::string get_body_part_given_the_body(const chemin &path, const request &req, const std::string &body)
encapsulate the provided body into an complete html formatted page
Definition: html_page.cpp:71
const std::string & get_refresh_redirection() const
get current deridection url
Definition: html_page.hpp:73
class holding fields of an HTTP request (method, URI, header, cookies, and so on)
Definition: request.hpp:45