Webdar 1.0.0
Web user interface to libdar
archive_init_list.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 ARCHIVE_INIT_LIST_HPP
25#define ARCHIVE_INIT_LIST_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 <string>
36#include <dar/libdar.hpp>
37#include <libthreadar/libthreadar.hpp>
38#include <memory>
39
40 // webdar headers
41#include "html_web_user_interaction.hpp"
42#include "saisie.hpp"
43
45
53
54class archive_init_list : public libthreadar::thread_signal
55{
56public:
58 archive_init_list(const archive_init_list & ref) = delete;
59 archive_init_list(archive_init_list && ref) noexcept = delete;
60 archive_init_list & operator = (const archive_init_list & ref) = delete;
61 archive_init_list & operator = (archive_init_list && ref) noexcept = delete;
62 ~archive_init_list() { cancel(); join(); };
63
64
66 void set_user_interaction(std::shared_ptr<html_web_user_interaction> ref) { ui = ref; };
67 void set_parametrage(const saisie* x_param) { param = x_param; };
68
72 bool opened() const { return ptr != nullptr; };
73
75 const std::vector<libdar::list_entry> get_children_in_table(const std::string & dir) const;
76 bool has_subdirectory(const std::string & dir) const;
77
79 libdar::archive_summary get_summary() const;
80 std::string get_archive_full_name() const;
81
83 void close_archive() { ptr.reset(); };
84
85protected:
86
88 virtual void inherited_run() override;
89
91 virtual void signaled_inherited_cancel() override;
92
93
94private:
95 const saisie* param;
96 std::unique_ptr<libdar::archive> ptr;
97 std::shared_ptr<html_web_user_interaction> ui;
98
99};
100
101#endif
this objects is a thread object that provide access to the content of an existing archive
Definition: archive_init_list.hpp:55
libdar::archive_summary get_summary() const
obtain the archive summary
Definition: archive_init_list.cpp:64
virtual void signaled_inherited_cancel() override
inherited from libthreadar::thread
Definition: archive_init_list.cpp:133
const std::vector< libdar::list_entry > get_children_in_table(const std::string &dir) const
obtains contents from the opened archive in the calling thread
Definition: archive_init_list.cpp:50
bool opened() const
Definition: archive_init_list.hpp:72
void close_archive()
close the opened archive run in the calling thread
Definition: archive_init_list.hpp:83
void set_user_interaction(std::shared_ptr< html_web_user_interaction > ref)
set the user interaction to report on when running the thread
Definition: archive_init_list.hpp:66
virtual void inherited_run() override
inherited from class libthreadar::thread
Definition: archive_init_list.cpp:82
class saisie
Definition: saisie.hpp:106