Webdar 1.0.0
Web user interface to libdar
html_archive_read.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_ARCHIVE_READ_HPP
25#define HTML_ARCHIVE_READ_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 <memory>
36#include <libthreadar/libthreadar.hpp>
37
38 // webdar headers
39#include "body_builder.hpp"
40#include "html_form.hpp"
41#include "html_form_input.hpp"
42#include "html_form_input_file.hpp"
43#include "html_form_fieldset.hpp"
44#include "html_options_read.hpp"
45#include "html_libdar_running_popup.hpp"
46#include "actor.hpp"
47#include "guichet.hpp"
48#include "jsoner.hpp"
49#include "bibliotheque_subconfig.hpp"
50#include "events.hpp"
51#include "html_derouleur.hpp"
52
54
56
58 public actor,
59 public libthreadar::thread_signal,
60 public jsoner,
62 public events
63{
64public:
65 static const std::string changed;
66
67 html_archive_read(const std::string & archive_description);
68 html_archive_read(const html_archive_read & ref) = delete;
69 html_archive_read(html_archive_read && ref) noexcept = delete;
70 html_archive_read & operator = (const html_archive_read & ref) = delete;
71 html_archive_read & operator = (html_archive_read && ref) noexcept = delete;
72 ~html_archive_read() { cancel(); join(); };
73
75 void set_biblio(const std::shared_ptr<bibliotheque> & ptr);
76
77 // available fields for libdar
78
79 std::string get_archive_path() const;
80 std::string get_archive_basename() const;
81 libdar::archive_options_read get_read_options(std::shared_ptr<html_web_user_interaction> dialog) const { return opt_read->get_options(dialog); };
82
84 virtual void load_json(const json & source) override;
85
87 virtual json save_json() const override;
88
90 virtual void clear_json() override;
91
93 virtual void on_event(const std::string & event_name) override;
94
96 virtual bibliotheque::using_set get_using_set() const override { return guichet_opt_read.get_using_set(); };
97
98protected:
100 virtual std::string inherited_get_body_part(const chemin & path,
101 const request & req) override;
102
104 virtual void new_css_library_available() override;
105
107 virtual void inherited_run() override;
108
110 virtual void signaled_inherited_cancel() override;
111
112private:
114
117 bool need_entrepot_update;
118 enum { event_propagated, event_ignored, event_pending } ignore_events_st;
119
120 html_derouleur deroule;
121 html_form form;
123 html_form_input_file arch_path;
124 html_libdar_running_popup libdarexec;
125
126 guichet guichet_opt_read;
127 std::shared_ptr<html_options_read> opt_read;
128
129 void update_entrepot();
130 void trigger_changed();
131 void ignore_events(bool mode);
132
133 static constexpr const unsigned int format_version = 1;
134 static constexpr const char* myclass_id = "html_archive_read";
135
136 static constexpr const char* jlabel_path = "archive-path";
137 static constexpr const char* jlabel_opt_read = "read-options";
138
139};
140
141#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
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 guichet let one fetch config from a bibliotheque, save as or setup manually for a given compone...
Definition: guichet.hpp:92
virtual bibliotheque::using_set get_using_set() const override
inherited from bibliotheque_subconfig
Definition: guichet.cpp:308
class html_archive_read let user define the archive path, basename and option to read
Definition: html_archive_read.hpp:63
virtual void new_css_library_available() override
inherited from body_builder
Definition: html_archive_read.cpp:246
virtual void clear_json() override
inherited from jsoner
Definition: html_archive_read.cpp:180
virtual void inherited_run() override
inherited from class libthreadar::thread
Definition: html_archive_read.cpp:281
virtual std::string inherited_get_body_part(const chemin &path, const request &req) override
inherited from body_builder
Definition: html_archive_read.cpp:238
virtual void signaled_inherited_cancel() override
inherited from libthreadar::thread
Definition: html_archive_read.cpp:286
virtual bibliotheque::using_set get_using_set() const override
inherited from bibliotheque_subconfig
Definition: html_archive_read.hpp:96
virtual void on_event(const std::string &event_name) override
inherited from actor
Definition: html_archive_read.cpp:196
virtual void load_json(const json &source) override
inherited from jsoner
Definition: html_archive_read.cpp:130
virtual json save_json() const override
inherited from jsoner
Definition: html_archive_read.cpp:168
void set_biblio(const std::shared_ptr< bibliotheque > &ptr)
mandatory call to invoke ASAP after constructor
Definition: html_archive_read.cpp:104
class html_derouleur is a pure virtual class
Definition: html_derouleur.hpp:55
class html_form_fieldset implements HTML fieldset feature
Definition: html_form_fieldset.hpp:51
class html_form_input_file provides a mean to the user to navigate in a file system to select a file ...
Definition: html_form_input_file.hpp:60
class html_form implements HTML form feature
Definition: html_form.hpp:51
html_libdar_running_popup wraps up an html_web_user_interaction in a html_popup component
Definition: html_libdar_running_popup.hpp:48
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