Disk ARchive 2.7.14
Full featured and portable backup and archiving tool
Loading...
Searching...
No Matches
escape_catalogue.hpp
Go to the documentation of this file.
1/*********************************************************************/
2// dar - disk archive - a backup/restoration program
3// Copyright (C) 2002-2024 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
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 virtual void set_in_place(const path & arg) override;
96 virtual void clear_in_place() override;
97
98 private:
99 enum state
100 {
101 ec_init,
102 ec_marks,
103 ec_eod,
104 ec_signature,
105 ec_detruits,
106 ec_completed
107 };
108
109 smart_pointer<pile_descriptor> pdesc;
110 header_version x_ver;
111 std::list<signator> known_sig;
112 bool x_lax;
113 std::map <infinint, cat_etoile *> corres;
114 state status;
115 catalogue *cat_det;
116 infinint min_read_offset;
117 infinint depth;
118 infinint wait_parent_depth;
119
120 void set_esc_and_stack(const pile_descriptor & x_pdesc);
121 void copy_from(const escape_catalogue & ref);
122 void destroy();
123 void merge_cat_det();
124 void reset_reading_process();
125 };
126
128
129} // end of namespace
130
131#endif
here is defined the classe used to manage catalogue of archives
bool is_null() const
return whether the smart_pointer is pointing to nullptr
const smart_pointer & assign(T *arg)
assignment operator from a base type pointer (not from a smart_pointer)
class escape definition, used for sequential reading of archives
archive global header/trailer structure is defined here
include macro defined by the configure script and some specific additional ones
libdar namespace encapsulate all libdar symbols
optimization structure to quickly access some commonly used layers of a stack of generic_file
template class implementing memory efficient smart pointer