Webdar 1.0.0
Web user interface to libdar
html_table.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_TABLE_HPP
25#define HTML_TABLE_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 <vector>
36#include <string>
37
38 // webdar headers
39#include "html_level.hpp"
40#include "webdar_tools.hpp"
41#include "exceptions.hpp"
42
44
50
52{
53public:
54 html_table(unsigned int width);
55 html_table(const html_table & ref) = delete;
56 html_table(html_table && ref) noexcept = delete;
57 const html_table & operator = (const html_table & ref) = delete;
58 html_table & operator = (html_table && ref) noexcept = delete;
60
62 void css_border_collapsed(bool mode);
63
65 void set_css_class_first_row(const std::string & val);
66
69
71 void set_css_class_first_column(const std::string & val);
72
75
77 void set_css_class_cells(const std::string & val);
78
81
83 void clear() { clear_children(); };
84
86 unsigned int get_width() const { return dim_x; };
87
88protected:
89
91 virtual std::string inherited_get_body_part(const chemin & path,
92 const request & req) override;
93
94private:
95 unsigned int dim_x;
96 std::string border_collapsed;
97 bool cells_title_set;
98 bool cells_first_column_set;
99 std::string css_class_title;
100 std::string css_class_cells;
101 std::string css_class_column1;
102};
103
104#endif
class chemin definition
Definition: chemin.hpp:51
class html_level is a pure virtual class
Definition: html_level.hpp:49
void clear_children()
clear all adopted data
Definition: html_level.cpp:62
html component implementing the html table structure
Definition: html_table.hpp:52
void css_border_collapsed(bool mode)
whether border are collapsed or separated (collasped by default)
Definition: html_table.cpp:52
void clear()
clear table content
Definition: html_table.hpp:83
void set_css_class_first_column()
clears a previously assigned css object to the first column
Definition: html_table.cpp:94
unsigned int get_width() const
get value provided at construction time
Definition: html_table.hpp:86
void set_css_class_first_row()
clear a previously assigned css object to the title row
Definition: html_table.cpp:73
virtual std::string inherited_get_body_part(const chemin &path, const request &req) override
inherited from body_builder
Definition: html_table.cpp:122
void set_css_class_cells()
clears a previously assigned css object to the non-title rows
Definition: html_table.cpp:113
class holding fields of an HTTP request (method, URI, header, cookies, and so on)
Definition: request.hpp:45