Disk ARchive
2.4.8
Main Page
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
src
libdar
tronc.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
28
29
#ifndef TRONC_HPP
30
#define TRONC_HPP
31
32
#include "../my_config.h"
33
#include "
infinint.hpp
"
34
#include "
generic_file.hpp
"
35
36
namespace
libdar
37
{
40
42
43
class
tronc
:
public
generic_file
44
{
45
public
:
47
52
tronc
(
generic_file
*f,
const
infinint
&offset,
const
infinint
&size,
bool
own_f =
false
);
53
tronc
(
generic_file
*f,
const
infinint
&offset,
const
infinint
&size,
gf_mode
mode,
bool
own_f =
false
);
54
57
tronc
(
generic_file
*f,
const
infinint
&offset,
bool
own_f =
false
);
58
tronc
(
generic_file
*f,
const
infinint
&offset,
gf_mode
mode,
bool
own_f =
false
);
59
61
~tronc
()
62
{
63
if
(own_ref)
64
delete
ref;
65
};
66
68
bool
skip
(
const
infinint
& pos);
70
bool
skip_to_eof
();
72
bool
skip_relative
(S_I x);
74
infinint
get_position
() {
return
current; };
75
76
#ifdef LIBDAR_SPECIAL_ALLOC
77
USE_SPECIAL_ALLOC(
tronc
);
78
#endif
79
protected
:
81
U_I
inherited_read
(
char
*a, U_I size);
83
void
inherited_write
(
const
char
*a, U_I size);
84
void
inherited_sync_write
() { ref->
sync_write
(); }
85
void
inherited_terminate
() {
if
(own_ref) ref->
terminate
(); };
86
87
private
:
88
infinint
start;
//< offset in the global generic file to start at
89
infinint
sz;
//< length of the portion to consider
90
generic_file
*ref;
//< global generic file of which to take a piece
91
infinint
current;
//< inside position of the next read or write
92
bool
own_ref;
//< whether we own ref (and must destroy it when no more needed)
93
bool
limited;
//< whether the sz argument is to be considered
94
95
void
set_back_current_position();
96
};
97
99
100
}
// end of namespace
101
102
#endif
Generated on Thu Sep 20 2012 08:17:10 for Disk ARchive by
1.8.1.2