Webdar 1.0.0
Web user interface to libdar
html_slicing.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_SLICING_HPP
25#define HTML_SLICING_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 <dar/libdar.hpp>
36#include <string>
37
38 // webdar headers
39#include "body_builder.hpp"
40#include "actor.hpp"
41#include "events.hpp"
42#include "html_form.hpp"
43#include "html_form_fieldset.hpp"
44#include "html_form_input.hpp"
45#include "html_form_input_unit.hpp"
46#include "jsoner.hpp"
47
49
51 public actor,
52 public events,
53 public jsoner
54{
55public:
56 static const std::string changed;
57
59 html_slicing(const html_slicing & ref) = delete;
60 html_slicing(html_slicing && ref) noexcept = delete;
61 html_slicing & operator = (const html_slicing & ref) = delete;
62 html_slicing & operator = (html_slicing && ref) noexcept = delete;
63 ~html_slicing() = default;
64
65 void set_slicing(const libdar::infinint & x_slice_size,
66 const libdar::infinint & x_first_slice_size);
67 void set_permission(const std::string & perm);
68 void set_user_ownership(const std::string & username);
69 void set_group_ownership(const std::string & groupname);
70 void set_min_digits(const libdar::infinint & val);
71
72 void get_slicing(libdar::infinint & x_slice_size,
73 libdar::infinint & x_first_slice_size) const;
74 libdar::infinint get_min_digits() const;
75 std::string get_permission() const;
76 std::string get_user_ownership() const;
77 std::string get_group_ownership() const;
78
80 virtual void load_json(const json & source) override;
81
83 virtual json save_json() const override;
84
86 virtual void clear_json() override;
87
89 virtual void on_event(const std::string & event_name) override;
90
93
95 virtual void bind_to_anchor(const std::string & val) override { form_slicing.bind_to_anchor(val); };
96
97
98protected:
99
101 virtual std::string inherited_get_body_part(const chemin & path,
102 const request & req) override;
103
105 virtual void css_classes_have_changed() override;
106
108 virtual void new_css_library_available() override;
109
110private:
111 html_form form_slicing;
112 html_form_fieldset slicing_fs;
113 html_form_input slicing;
114 html_form_input_unit slice_size;
115 html_form_input different_first_slice;
116 html_form_input_unit first_slice_size;
117 html_form_input slice_permission;
118 html_form_input slice_user_ownership;
119 html_form_input slice_group_ownership;
120 html_form_input slice_min_digits;
121
122 static constexpr const unsigned int format_version = 1;
123 static constexpr const char* myclass_id = "html_slicing";
124
125 static constexpr const char* jlabel_slicing = "slicing"; // bool
126 static constexpr const char* jlabel_diff_first = "specific-first-slice"; // bool
127 static constexpr const char* jlabel_slice_size = "slice-size"; // infinint
128 static constexpr const char* jlabel_first_slice_size = "first-slice-size"; // infinint
129 static constexpr const char* jlabel_slice_permission = "permission"; // string
130 static constexpr const char* jlabel_user_owner = "user-ownership"; // string
131 static constexpr const char* jlabel_group_owner = "group-ownership"; // string
132 static constexpr const char* jlabel_min_digits = "min-digits"; // num
133};
134
135#endif
class of object that are pointed/triggered to by others
Definition: actor.hpp:55
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 html_form_fieldset implements HTML fieldset feature
Definition: html_form_fieldset.hpp:51
class html_form_input_unit implements HTML input::number feature with added unit box
Definition: html_form_input_unit.hpp:51
class html_form_input implements HTML input feature
Definition: html_form_input.hpp:57
class html_form implements HTML form feature
Definition: html_form.hpp:51
virtual void bind_to_anchor(const std::string &value) override
inherited from body_builder
Definition: html_form.hpp:83
html component used for the user to define a has algorithm
Definition: html_slicing.hpp:54
virtual std::string inherited_get_body_part(const chemin &path, const request &req) override
inherited from body_builder
Definition: html_slicing.cpp:300
virtual void bind_to_anchor(const std::string &val) override
inherited from body_builder
Definition: html_slicing.hpp:95
void set_to_webdar_defaults()
set the object to webdar defaults
Definition: html_slicing.cpp:295
virtual void new_css_library_available() override
inherited from body_builder
Definition: html_slicing.cpp:317
virtual void on_event(const std::string &event_name) override
inherited from class actor
Definition: html_slicing.cpp:268
virtual void clear_json() override
inherited from jsoner
Definition: html_slicing.cpp:253
virtual void css_classes_have_changed() override
inherited from body_builder
Definition: html_slicing.cpp:306
virtual void load_json(const json &source) override
inherited from jsoner
Definition: html_slicing.cpp:200
virtual json save_json() const override
inherited from jsoner
Definition: html_slicing.cpp:235
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