Webdar 1.0.0
Web user interface to libdar
html_mask_form_filename.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_MASK_FORM_FILENAME_HPP
25#define HTML_MASK_FORM_FILENAME_HPP
26
27 // C system header files
28#include "my_config.h"
29extern "C"
30{
31
32}
33
34 // C++ system header files
35
36 // webdar headers
37#include "body_builder.hpp"
38#include "actor.hpp"
39#include "events.hpp"
40#include "html_form_dynamic_table.hpp"
41#include "jsoner.hpp"
42#include "html_form.hpp"
43#include "html_mask.hpp"
44#include "bibliotheque_subconfig.hpp"
45#include "html_form_mask_bool.hpp"
46#include "html_form_mask_expression.hpp"
47
49
52
54 public actor,
55 public events,
57 public jsoner,
58 public html_mask,
60{
61public:
62 static const std::string changed;
63
65
68 html_mask_form_filename(const std::string & subject);
70 html_mask_form_filename(html_mask_form_filename && ref) noexcept = delete;
71 html_mask_form_filename & operator = (const html_mask_form_filename & ref) = delete;
72 html_mask_form_filename & operator = (html_mask_form_filename && ref) noexcept = delete;
73 ~html_mask_form_filename() = default;
74
76 void set_child(const std::shared_ptr<bibliotheque> & ptr,
78
80 virtual std::unique_ptr<libdar::mask> get_mask() const override { return root.get_mask(); };
81
83 virtual bool is_relative() const override { return root.is_relative(); };
84
86 virtual std::unique_ptr<body_builder> provide_object_of_type(unsigned int num,
87 const std::string & context,
88 std::string & changed_event) const override;
89
91 virtual void load_json(const json & source) override;
92
94 virtual json save_json() const override;
95
97 virtual void clear_json() override;
98
100 virtual bibliotheque::using_set get_using_set() const override;
101
103 virtual void on_event(const std::string & event_name) override;
104
106
109 void manually_set_bool_mode(const std::string & mode) { root.manually_set_bool_mode(mode); };
110
112
114 std::shared_ptr<body_builder> manually_add_object(const std::string & type_name);
115
117 std::deque<std::string> get_labels() const { return labels; };
118
120 virtual void bind_to_anchor(const std::string & val) override { form.bind_to_anchor(val); };
121
122protected:
123
125 virtual std::string inherited_get_body_part(const chemin & path,
126 const request & req) override;
127
129 virtual void css_classes_have_changed() override;
130
131private:
132 std::deque<std::string> labels;
133 std::string sujet;
135
136 std::shared_ptr<bibliotheque> biblio;
137 html_form form;
139
140 void init();
141 template <class T> void init_bool_obj(T & obj) const;
142
143 static constexpr const unsigned int format_version = 1;
144 static constexpr const char* myclass_id = "html_mask_form_filename";
145
146 static constexpr const char* jlabel_bool_config = "bool-config";
147
148};
149
150template <class T> void html_mask_form_filename::init_bool_obj(T & obj) const
151{
152 obj.set_obj_type_provider(this);
153 for(std::deque<std::string>::const_iterator it = labels.begin(); it != labels.end(); ++it)
154 obj.add_mask_type(*it);
155}
156
157#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 html_form_dynamic_table_object_provider
Definition: html_form_dynamic_table.hpp:60
class html_form_mask_bool provide mean to combines with OR and AND different html_masks
Definition: html_form_mask_bool.hpp:88
void manually_set_bool_mode(const std::string &mode)
manually change the bool mode
Definition: html_form_mask_bool.cpp:199
virtual std::unique_ptr< libdar::mask > get_mask() const override
inherited from html_mask
Definition: html_form_mask_bool.cpp:83
virtual bool is_relative() const override
inherited from html_mask
Definition: html_form_mask_bool.cpp:144
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
class html_mask_form_filename let user define mask applied to strings (filename, extended attributes,...
Definition: html_mask_form_filename.hpp:60
virtual std::string inherited_get_body_part(const chemin &path, const request &req) override
inherited from body_builder
Definition: html_mask_form_filename.cpp:205
virtual void clear_json() override
inherited from jsoner
Definition: html_mask_form_filename.cpp:171
virtual void css_classes_have_changed() override
inherited from body_builder
Definition: html_mask_form_filename.cpp:211
std::deque< std::string > get_labels() const
obtain the available labels defining the different available types of this mask
Definition: html_mask_form_filename.hpp:117
virtual void load_json(const json &source) override
inherited from jsoner
Definition: html_mask_form_filename.cpp:124
virtual json save_json() const override
inherited from jsoner
Definition: html_mask_form_filename.cpp:155
virtual bool is_relative() const override
inherited from html_mask
Definition: html_mask_form_filename.hpp:83
virtual void on_event(const std::string &event_name) override
inherited from actor
Definition: html_mask_form_filename.cpp:183
virtual std::unique_ptr< libdar::mask > get_mask() const override
inherited from html_mask
Definition: html_mask_form_filename.hpp:80
void set_child(const std::shared_ptr< bibliotheque > &ptr, bibliotheque::category cat)
should be invoked ASAP after object construction
Definition: html_mask_form_filename.cpp:62
std::shared_ptr< body_builder > manually_add_object(const std::string &type_name)
manually add an object and return its address
Definition: html_mask_form_filename.cpp:191
virtual std::unique_ptr< body_builder > provide_object_of_type(unsigned int num, const std::string &context, std::string &changed_event) const override
inherited from html_form_dynamic_table
Definition: html_mask_form_filename.cpp:69
virtual void bind_to_anchor(const std::string &val) override
inherited from body_builder
Definition: html_mask_form_filename.hpp:120
html_mask_form_filename(const std::string &subject)
constructor
Definition: html_mask_form_filename.cpp:45
void manually_set_bool_mode(const std::string &mode)
manually set the bool mode of the root bool object
Definition: html_mask_form_filename.hpp:109
virtual bibliotheque::using_set get_using_set() const override
inherited from bibliotheque_subconfig
Definition: html_mask_form_filename.cpp:178
class html_mask defines the interface of all masks
Definition: html_mask.hpp:44
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