Disk ARchive  2.5.0
Full featured and portable backup and archiving tool
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
hide_file.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 
25 
26 #ifndef HIDE_FILE_HPP
27 #define HIDE_FILE_HPP
28 
29 #include "../my_config.h"
30 #include <vector>
31 #include "infinint.hpp"
32 #include "generic_file.hpp"
33 
34 using namespace libdar;
35 using namespace std;
36 
39 
40 class hide_file : public generic_file
41 {
42 public:
43  hide_file(generic_file &f);
44 
45  bool skippable(skippability direction, const infinint & amount) { return true; };
46  bool skip(const infinint & pos);
47  bool skip_to_eof();
48  bool skip_relative(S_I x);
49  infinint get_position() const;
50 
51 protected:
52  struct partie
53  {
54  infinint debut, longueur; // debut is the offset in ref file
55  infinint offset; // offset in the resulting file
56  };
57 
58  vector <partie> morceau;
59  generic_file *ref;
60 
61  void inherited_read_ahead(const infinint & amount) { ref->read_ahead(amount); };
62  U_I inherited_read(char *a, U_I size);
63  void inherited_write(const char *a, size_t size);
64  void inherited_sync_write() {};
65  void inherited_flush_read() {};
66  void inherited_terminate() {};
67 
68  virtual void fill_morceau() = 0;
69  // the inherited classes have with this method
70  // to fill the "morceau" variable that defines
71  // the portions
72 
73 private:
74  U_I pos_index;
75  infinint pos_relicat;
76  bool is_init;
77 
78  void init() const;
79 };
80 
82 
83 
84 #endif
class generic_file is defined here as well as class fichierthe generic_file interface is widely used ...
virtual void read_ahead(const infinint &amount)
switch module to limitint (32 ou 64 bits integers) or infinint
this is the interface class from which all other data transfer classes inherit
the arbitrary large positive integer class