| Disk ARchive 2.8.1 Full featured and portable backup and archiving tool

Loading...
Searching...
No Matches
hide_file.hpp
Go to the documentation of this file.
1/*********************************************************************/
2// dar - disk archive - a backup/restoration program
3// Copyright (C) 2002-2025 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18//
19// to contact the author, see the AUTHOR file
20/*********************************************************************/
21
25
26#ifndef HIDE_FILE_HPP
27#define HIDE_FILE_HPP
28
29#include "../my_config.h"
30#include <vector>
31#include "libdar.hpp"
32#include "generic_file.hpp"
33
34using namespace libdar;
35using namespace std;
36
39
40class hide_file : public generic_file
41{
42public:
43 hide_file(generic_file &f);
44 hide_file(const hide_file & ref) = default;
45 hide_file & operator = (const hide_file & ref) = default;
46 ~hide_file() = default;
47
48 virtual bool skippable(skippability direction, const infinint & amount) override { return true; };
49 virtual bool skip(const infinint & pos) override;
50 virtual bool skip_to_eof() override;
51 virtual bool skip_relative(S_I x) override;
52 virtual bool truncatable(const infinint & pos) const override { return false; };
53 virtual infinint get_position() const override;
54
55protected:
56 struct partie
57 {
58 infinint debut, longueur; // debut is the offset in ref file
59 infinint offset; // offset in the resulting file
60 };
61
62 vector <partie> morceau;
63 generic_file *ref;
64
65 virtual void inherited_read_ahead(const infinint & amount) override { ref->read_ahead(amount); };
66 virtual U_I inherited_read(char *a, U_I size) override;
67 virtual void inherited_write(const char *a, size_t size) override;
68 virtual void inherited_truncate(const infinint & pos) override { throw Efeature("truncate a hide file"); };
69 virtual void inherited_sync_write() override {};
70 virtual void inherited_flush_read() override {};
71 virtual void inherited_terminate() override {};
72 virtual void fill_morceau() = 0;
73 // the inherited classes have with this method
74 // to fill the "morceau" variable that defines
75 // the portions
76
77private:
78 U_I pos_index;
79 infinint pos_relicat;
80 bool is_init;
81
82 void init() const;
83};
84
86
87
88#endif
libdar::Efeature
exception used when a requested feature is not (yet) implemented
Definition erreurs.hpp:257
libdar::generic_file
this is the interface class from which all other data transfer classes inherit
Definition generic_file.hpp:77
libdar::generic_file::read_ahead
void read_ahead(const infinint &amount)
libdar::infinint
the arbitrary large positive integer class
Definition real_infinint.hpp:62
generic_file.hpp
class generic_file is defined here as well as class fichier
libdar.hpp
the main file of the libdar API definitions
my_config.h
include macro defined by the configure script and some specific additional ones
libdar
libdar namespace encapsulate all libdar symbols
Definition archive.hpp:47