Disk ARchive  2.5.0
Full featured and portable backup and archiving tool
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
escape_catalogue.hpp
Go to the documentation of this file.
1 /*********************************************************************/
2 // dar - disk archive - a backup/restoration program
3 // Copyright (C) 2002-2052 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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.hpp"
42 
43 namespace libdar
44 {
45 
48 
49  class escape_catalogue : public catalogue
50  {
51  public:
52 
54  escape_catalogue(user_interaction & dialog,
55  const pile_descriptor & x_pdesc,
56  const datetime & root_last_modif,
57  const label & data_name);
58 
60  escape_catalogue(user_interaction & dialog, //< user interaction
61  const pile_descriptor & x_pdesc, //< stack descriptor where to write to
62  const header_version & ver, //< archive header version read
63  const std::list<signator> & known_signatories, //< signatories that signed the archive header, to be compared with internal catalogue when reaching the end of the archive
64  bool lax = false); //< whether to use lax mode
65  escape_catalogue(const escape_catalogue & ref) : catalogue(ref) { copy_from(ref); };
66  const escape_catalogue & operator = (const escape_catalogue &ref);
67  ~escape_catalogue() { destroy(); };
68 
69  // inherited from catalogue
70  void pre_add(const cat_entree *ref) const;
71  void pre_add_ea(const cat_entree *ref) const;
72  void pre_add_crc(const cat_entree *ref) const;
73  void pre_add_dirty() const;
74  void pre_add_ea_crc(const cat_entree *ref) const;
75  void pre_add_waste_mark() const;
76  void pre_add_failed_mark() const;
77  void pre_add_fsa(const cat_entree *ref) const;
78  void pre_add_fsa_crc(const cat_entree *ref) const;
79  escape *get_escape_layer() const { return pdesc.esc; };
80 
81  void reset_read() const;
82  void end_read() const;
83  void skip_read_to_parent_dir() const;
84  bool read(const cat_entree * & ref) const;
85  bool read_if_present(std::string *name, const cat_nomme * & ref) const;
86  void tail_catalogue_to_current_read();
87  bool read_second_time_dir() const { return status == ec_detruits; };
88 
89  private:
90  enum state
91  {
92  ec_init, //< state in which no one file has yet been searched in the archive
93  ec_marks, //< state in which we find the next file using escape sequence marks
94  ec_eod, //< state in which the archive is missing trailing EOD entries, due to user interruption, thus returning EOD in enough number to get back to the root directory
95  ec_signature, //< state in which we compare inline and internal catalogues
96  ec_detruits, //< state in which which detruits objects are returned from the catalogue
97  ec_completed //< state in which the escape_catalogue object is completed and has all information in memory as a normal catalogue
98  };
99 
100  pile_descriptor pdesc;
101  header_version x_ver;
102  std::list<signator> known_sig;
103  bool x_lax;
104  std::map <infinint, cat_etoile *> corres;
105  state status;
106  catalogue *cat_det; //< holds the final catalogue's detruit objects when no more file can be read from the archive
107  infinint min_read_offset; //< next offset in archive should be greater than that to identify a mark
108  infinint depth; //< directory depth of archive being read sequentially
109  infinint wait_parent_depth; //< ignore any further entry while depth is less than wait_parent_depth. disabled is set to zero
110 
111  void set_esc_and_stack(const pile_descriptor & x_pdesc);
112  void copy_from(const escape_catalogue & ref);
113  void destroy();
114  void merge_cat_det();
115  void reset_reading_process();
116  };
117 
119 
120 } // end of namespace
121 
122 #endif
class pile definition. Used to manage a stack of generic_file objects
class escape definition, used for sequential reading of archivesThe class escape is used to insert es...
here is defined the many classed which is build of the catalogue