Disk ARchive  2.4.8
 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 
42 namespace libdar
43 {
44 
47 
48  class escape_catalogue : public catalogue
49  {
50  public:
51  escape_catalogue(user_interaction & dialog,
52  const infinint & root_last_modif,
53  const label & data_name, escape *esc_ptr);
54  escape_catalogue(user_interaction & dialog, //< user interaction
55  const archive_version & reading_ver, //< archive format
56  compression default_algo, //< default compression algorithm
57  generic_file *data_loc, //< at which layer to read data from
58  generic_file *ea_loc, //< at which layer to read EA from
59  escape *esc_ptr, //< the escape layer of the stack
60  bool lax = false); //< whether to use lax mode
61  escape_catalogue(const escape_catalogue & ref) : catalogue(ref) { copy_from(ref); };
62  const escape_catalogue & operator = (const escape_catalogue &ref);
63  ~escape_catalogue() { destroy(); };
64 
65  // inherited from catalogue
66  void pre_add(const entree *ref, compressor *compr) const;
67  void pre_add_ea(const entree *ref, compressor *compr) const;
68  void pre_add_crc(const entree *ref, compressor *compr) const;
69  void pre_add_dirty(compressor *compr) const;
70  void pre_add_ea_crc(const entree *ref, compressor *compr) const;
71  void pre_add_waste_mark(compressor *compr) const;
72  void pre_add_failed_mark(compressor *compr) const;
73  escape *get_escape_layer() const { return esc; };
74 
75  void reset_read() const;
76  void end_read() const;
77  void skip_read_to_parent_dir() const;
78  bool read(const entree * & ref) const;
79  bool read_if_present(std::string *name, const nomme * & ref) const;
80  void tail_catalogue_to_current_read();
81  bool read_second_time_dir() const { return status == ec_detruits; };
82 
83  private:
84  enum state
85  {
86  ec_init, //< state in which no one file has yet been searched in the archive
87  ec_marks, //< state in which we find the next file using escape sequence marks
88  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
89  ec_detruits, //< state in which which detruits objects are returned from the catalogue
90  ec_completed //< state in which the escape_catalogue object is completed and has all information in memory as a normal catalogue
91  };
92 
93  escape *esc;
94  archive_version x_reading_ver;
95  compression x_default_algo;
96  generic_file *x_data_loc;
97  generic_file *x_ea_loc;
98  bool x_lax;
99  std::map <infinint, etoile *> corres;
100  state status;
101  catalogue *cat_det; //< holds the final catalogue's detruit objects when no more file can be read from the archive
102  infinint min_read_offset; //< next offset in archive should be greater than that to identify a mark
103  infinint depth; //< directory depth of archive being read sequentially
104  infinint wait_parent_depth; //< ignore any further entry while depth is less than wait_parent_depth. disabled is set to zero
105 
106  void set_esc(escape *esc_ptr) { if(esc_ptr != NULL) esc = esc_ptr; else throw SRC_BUG; };
107  void copy_from(const escape_catalogue & ref);
108  void destroy();
109  void merge_cat_det();
110  void reset_reading_process();
111  };
112 
114 
115 } // end of namespace
116 
117 #endif
class escape definition, used for sequential reading of archivesThe class escape is used to insert es...
compression
the different compression algorithm available
Definition: compressor.hpp:43
here is defined the many classed which is build of the catalogue