| Disk ARchive 2.6.11 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-2020 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 : http://dar.linux.free.fr/email.html
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
45 namespace 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
88 virtual void reset_read() const override;
89 virtual void end_read() const override;
90 virtual void skip_read_to_parent_dir() const override;
91 virtual bool read(const cat_entree * & ref) const override;
92 virtual bool read_if_present(std::string *name, const cat_nomme * & ref) const override;
93 virtual void tail_catalogue_to_current_read() override;
94 virtual bool read_second_time_dir() const override { return status == ec_detruits; };
95
96 private:
97 enum state
98 {
99 ec_init,
100 ec_marks,
101 ec_eod,
102 ec_signature,
103 ec_detruits,
104 ec_completed
105 };
106
107 smart_pointer<pile_descriptor> pdesc;
108 header_version x_ver;
109 std::list<signator> known_sig;
110 bool x_lax;
111 std::map <infinint, cat_etoile *> corres;
112 state status;
113 catalogue *cat_det;
114 infinint min_read_offset;
115 infinint depth;
116 infinint wait_parent_depth;
117
118 void set_esc_and_stack(const pile_descriptor & x_pdesc);
119 void copy_from(const escape_catalogue & ref);
120 void destroy();
121 void merge_cat_det();
122 void reset_reading_process();
123 };
124
126
127 } // end of namespace
128
129 #endif
header_version.hpp
archive global header/trailer structure is defined here
smart_pointer.hpp
template class implementing memory efficient smart pointer
escape.hpp
class escape definition, used for sequential reading of archives
catalogue.hpp
here is defined the classe used to manage catalogue of archives
pile_descriptor.hpp
optimization structure to quickly access some commonly used layers of a stack of generic_file
libdar
libdar namespace encapsulate all libdar symbols
Definition: archive.hpp:47