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
string_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 STRING_FILE_HPP
27
#define STRING_FILE_HPP
28
29
#include "../my_config.h"
30
#include "
infinint.hpp
"
31
#include "
generic_file.hpp
"
32
#include "
integers.hpp
"
33
#include "
erreurs.hpp
"
34
35
namespace
libdar
36
{
37
39
41
class
string_file
:
public
generic_file
42
{
43
public
:
44
46
string_file
(
const
std::string & contents):
generic_file
(
gf_read_only
) { data = contents; cur = 0; len = data.size(); };
47
48
// inherited from generic_file
49
bool
skip
(
const
infinint
& pos);
50
bool
skip_to_eof
() { cur = len;
return
true
; };
51
bool
skip_relative
(S_I x);
52
infinint
get_position
() {
return
cur; };
53
54
#ifdef LIBDAR_SPECIAL_ALLOC
55
USE_SPECIAL_ALLOC(
string_file
);
56
#endif
57
protected
:
58
// inherited from generic_file
59
U_I
inherited_read
(
char
*a, U_I size);
60
void
inherited_write
(
const
char
*a, U_I size) {
throw
Efeature
(
"Writing on a string_file is not allowed"
); };
61
void
inherited_sync_write
() {};
62
void
inherited_terminate
() {};
63
64
private
:
65
std::string data;
66
infinint
cur;
67
infinint
len;
68
};
69
70
}
// end of namespace
71
72
#endif
Generated on Thu Sep 20 2012 08:17:10 for Disk ARchive by
1.8.1.2