Webdar 1.0.0
Web user interface to libdar
html_form_mask_subdir.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_FORM_MASK_SUBDIR_HPP
25#define HTML_FORM_MASK_SUBDIR_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 <memory>
37
38 // webdar headers
39#include "body_builder.hpp"
40#include "html_mask.hpp"
41#include "actor.hpp"
42#include "jsoner.hpp"
43#include "html_form_fieldset.hpp"
44#include "html_form_input.hpp"
45#include "html_form_select.hpp"
46
47
49
52
75
76
78 public html_mask,
79 public actor,
80 public events,
81 public jsoner
82{
83public:
84 static const std::string changed;
85
87
94 static const std::string update;
95
96
97 html_form_mask_subdir(bool absolute_path_accepted,
98 const std::shared_ptr<const libdar::path> & fs_root);
100 html_form_mask_subdir(html_form_mask_subdir && ref) noexcept = delete;
101 html_form_mask_subdir & operator = (const html_form_mask_subdir & ref) = delete;
102 html_form_mask_subdir & operator = (html_form_mask_subdir && ref) noexcept = delete;
103 ~html_form_mask_subdir() = default;
104
106 void clear();
107
109 virtual std::unique_ptr<libdar::mask> get_mask() const override;
110
112 virtual bool is_relative() const override;
113
114
116 virtual void load_json(const json & source) override;
117
119 virtual json save_json() const override;
120
122 virtual void clear_json() override { clear(); };
123
124
126 virtual void on_event(const std::string & event_name) override;
127
128protected:
130 virtual std::string inherited_get_body_part(const chemin & path,
131 const request & req) override;
132
134 virtual void new_css_library_available() override;
135
136private:
137 bool absolute_ok;
138 std::shared_ptr<const libdar::path> prefix;
140 html_form_select mask_type;
141 html_form_input casesensitivity;
142 html_form_input regex;
143 html_form_input mask_subdir;
144
145 void init();
146 std::string tell_action() const;
147 void check_ptr() const;
148 libdar::path check_absolute_path_requirement() const;
149
150 static constexpr const unsigned int format_version = 1;
151 static constexpr const char* myclass_id = "html_form_mask_subdir";
152
153 static constexpr const char* jlabel_type = "type";
154 static constexpr const char* jlabel_casesensit = "casesensit";
155 static constexpr const char* jlabel_regex = "regex";
156 static constexpr const char* jlabel_mask = "mask";
157
158};
159
160#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 implements HTML input feature
Definition: html_form_input.hpp:57
class html_form_mask_subdir provide mean to setup libdar::mask component for included directories or ...
Definition: html_form_mask_subdir.hpp:82
virtual void new_css_library_available() override
inherited from body_builder
Definition: html_form_mask_subdir.cpp:272
virtual void load_json(const json &source) override
inherited from jsoner
Definition: html_form_mask_subdir.cpp:176
virtual std::string inherited_get_body_part(const chemin &path, const request &req) override
inherited methods from body_builder
Definition: html_form_mask_subdir.cpp:246
virtual json save_json() const override
inherited from jsoner
Definition: html_form_mask_subdir.cpp:206
virtual void on_event(const std::string &event_name) override
inherited from actor
Definition: html_form_mask_subdir.cpp:222
static const std::string update
event to be used to trigger this object to reconsider absolute_path and root_prefix
Definition: html_form_mask_subdir.hpp:94
virtual void clear_json() override
inherited from jsoner
Definition: html_form_mask_subdir.hpp:122
virtual bool is_relative() const override
inherited from html_mask
Definition: html_form_mask_subdir.cpp:162
void clear()
reset object to default
Definition: html_form_mask_subdir.cpp:94
virtual std::unique_ptr< libdar::mask > get_mask() const override
inherited from html_mask
Definition: html_form_mask_subdir.cpp:102
class html_form_select implements HTML input of type "select"
Definition: html_form_select.hpp:53
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 jsoner class and class exception_json