Disk ARchive  2.4.8
 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 skip(const infinint & pos);
46  bool skip_to_eof();
47  bool skip_relative(S_I x);
48  infinint get_position();
49 
50 protected:
51  struct partie
52  {
53  infinint debut, longueur; // debut is the offset in ref file
54  infinint offset; // offset in the resulting file
55  };
56 
57  vector <partie> morceau;
58  generic_file *ref;
59 
60  U_I inherited_read(char *a, U_I size);
61  void inherited_write(const char *a, size_t size);
62  void inherited_sync_write() {};
63  void inherited_terminate() {};
64 
65  virtual void fill_morceau() = 0;
66  // the inherited classes have with this method
67  // to fill the "morceau" variable that defines
68  // the portions
69 
70 private:
71  U_I pos_index;
72  infinint pos_relicat;
73  bool is_init;
74 
75  void init();
76 };
77 
79 
80 
81 #endif