Disk ARchive  2.4.2
 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 // $Id: hide_file.hpp,v 1.18 2011/04/17 13:12:29 edrusb Rel $
22 //
23 /*********************************************************************/
24 
28 
29 #ifndef HIDE_FILE_HPP
30 #define HIDE_FILE_HPP
31 
32 #include "../my_config.h"
33 #include <vector>
34 #include "infinint.hpp"
35 #include "generic_file.hpp"
36 
37 using namespace libdar;
38 using namespace std;
39 
42 
43 class hide_file : public generic_file
44 {
45 public:
46  hide_file(generic_file &f);
47 
48  bool skip(const infinint & pos);
49  bool skip_to_eof();
50  bool skip_relative(S_I x);
51  infinint get_position();
52 
53 protected:
54  struct partie
55  {
56  infinint debut, longueur; // debut is the offset in ref file
57  infinint offset; // offset in the resulting file
58  };
59 
60  vector <partie> morceau;
61  generic_file *ref;
62 
63  U_I inherited_read(char *a, U_I size);
64  void inherited_write(const char *a, size_t size);
65  void inherited_sync_write() {};
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();
79 };
80 
82 
83 
84 #endif