Disk ARchive 2.7.18
Full featured and portable backup and archiving tool
escape_catalogue.hpp
Go to the documentation of this file.
1/*********************************************************************/
2// dar - disk archive - a backup/restoration program
3// Copyright (C) 2002-2025 Denis Corbin
4//
5// This program is free software; you can redistribute it and/or
6// modify it under the terms of the GNU General Public License
7// as published by the Free Software Foundation; either version 2
8// of the License, or (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program; if not, write to the Free Software
17// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18//
19// to contact the author, see the AUTHOR file
20/*********************************************************************/
21
33
34#ifndef ESCAPE_CATALOGUE_HPP
35#define ESCAPE_CATALOGUE_HPP
36
37#include "../my_config.h"
38
39#include "catalogue.hpp"
40#include "escape.hpp"
41#include "pile_descriptor.hpp"
42#include "smart_pointer.hpp"
43#include "header_version.hpp"
44
45namespace libdar
46{
47
50
51 class escape_catalogue : public catalogue
52 {
53 public:
54
56 escape_catalogue(const std::shared_ptr<user_interaction> & dialog,
57 const pile_descriptor & x_pdesc,
58 const datetime & root_last_modif,
59 const label & data_name);
60
62 escape_catalogue(const std::shared_ptr<user_interaction> & dialog,
63 const pile_descriptor & x_pdesc,
64 const header_version & ver,
65 const std::list<signator> & known_signatories,
66 bool lax = false
67 );
68 escape_catalogue(const escape_catalogue & ref) : catalogue(ref) { copy_from(ref); };
69 escape_catalogue(escape_catalogue && ref) = delete;
70 escape_catalogue & operator = (const escape_catalogue &ref);
71 escape_catalogue & operator = (escape_catalogue && ref) = delete;
72 ~escape_catalogue() { destroy(); };
73
74 // inherited from catalogue
75 virtual void pre_add(const cat_entree *ref, const pile_descriptor* dest) const override;
76 virtual void pre_add_ea(const cat_entree *ref, const pile_descriptor* dest) const override;
77 virtual void pre_add_crc(const cat_entree *ref, const pile_descriptor* dest) const override;
78 virtual void pre_add_dirty(const pile_descriptor* dest) const override;
79 virtual void pre_add_ea_crc(const cat_entree *ref, const pile_descriptor* dest) const override;
80 virtual void pre_add_waste_mark(const pile_descriptor* dest) const override;
81 virtual void pre_add_failed_mark(const pile_descriptor* dest) const override;
82 virtual void pre_add_fsa(const cat_entree *ref, const pile_descriptor* dest) const override;
83 virtual void pre_add_fsa_crc(const cat_entree *ref, const pile_descriptor* dest) const override;
84 virtual void pre_add_delta_sig(const pile_descriptor* dest) const override;
85 virtual escape *get_escape_layer() const override { return pdesc.is_null() ? nullptr : pdesc->esc; };
86 virtual void drop_escape_layer() override { pdesc.assign(nullptr); };
87 virtual void set_escape_layer(escape* ptr) override { throw SRC_BUG; };
88
89 virtual void reset_read() const override;
90 virtual void end_read() const override;
91 virtual void skip_read_to_parent_dir() const override;
92 virtual bool read(const cat_entree * & ref) const override;
93 virtual bool read_if_present(std::string *name, const cat_nomme * & ref) const override;
94 virtual void tail_catalogue_to_current_read(bool including_last_read) override;
95 virtual bool read_second_time_dir() const override { return status == ec_detruits; };
96 virtual void set_in_place(const path & arg) override;
97 virtual void clear_in_place() override;
98
99 private:
100 enum state
101 {
102 ec_init,
103 ec_marks,
104 ec_eod,
105 ec_signature,
106 ec_detruits,
107 ec_completed
108 };
109
110 smart_pointer<pile_descriptor> pdesc;
111 header_version x_ver;
112 std::list<signator> known_sig;
113 bool x_lax;
114 std::map <infinint, cat_etoile *> corres;
115 state status;
116 catalogue *cat_det;
117 infinint min_read_offset;
118 infinint depth;
119 infinint wait_parent_depth;
120
121 void set_esc_and_stack(const pile_descriptor & x_pdesc);
122 void copy_from(const escape_catalogue & ref);
123 void destroy();
124 void merge_cat_det();
125 void reset_reading_process();
126 };
127
129
130} // end of namespace
131
132#endif
here is defined the classe used to manage catalogue of archives
class escape definition, used for sequential reading of archives
archive global header/trailer structure is defined here
libdar namespace encapsulate all libdar symbols
Definition: archive.hpp:47
optimization structure to quickly access some commonly used layers of a stack of generic_file
template class implementing memory efficient smart pointer