sbuild
1.7.1
Main Page
Related Pages
Namespaces
Classes
Files
File List
lib
sbuild
mntstream.h
1
/* Copyright © 2003-2013 Roger Leigh <rleigh@debian.org>
2
*
3
* schroot is free software: you can redistribute it and/or modify it
4
* under the terms of the GNU General Public License as published by
5
* the Free Software Foundation, either version 3 of the License, or
6
* (at your option) any later version.
7
*
8
* schroot is distributed in the hope that it will be useful, but
9
* WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
* General Public License for more details.
12
*
13
* You should have received a copy of the GNU General Public License
14
* along with this program. If not, see
15
* <http://www.gnu.org/licenses/>.
16
*
17
*********************************************************************/
18
19
#ifndef SBUILD_MNTSTREAM_H
20
#define SBUILD_MNTSTREAM_H
21
22
#include <sbuild/custom-error.h>
23
24
#include <iostream>
25
#include <deque>
26
#include <string>
27
28
#include <stdio.h>
29
#include <sys/types.h>
30
#include <mntent.h>
31
32
namespace
sbuild
33
{
34
46
class
mntstream
47
{
48
public
:
50
enum
error_code
51
{
52
MNT_OPEN
,
53
MNT_READ
54
};
55
57
typedef
sbuild::custom_error<error_code>
error
;
58
65
struct
mntentry
66
{
68
mntentry
()
69
{};
70
76
mntentry
(
const
struct
mntent& entry);
77
79
std::string
filesystem_name
;
81
std::string
directory
;
83
std::string
type
;
85
std::string
options
;
87
int
dump_frequency
;
89
int
fsck_pass
;
90
};
91
97
mntstream
(
const
std::string&
file
);
98
100
virtual
~mntstream
();
101
112
void
open
(
const
std::string&
file
);
113
121
void
close
();
122
130
bool
eof
()
const
;
131
139
bool
bad
()
const
;
140
147
operator
bool ();
148
155
bool
156
operator !
();
157
158
friend
mntstream
&
159
operator >>
(
mntstream
& stream,
160
mntentry
& entry);
161
162
private
:
173
void
read
(
int
quantity=1);
174
176
std::string
file
;
177
179
FILE *
mntfile
;
180
185
std::deque<mntentry>
data
;
186
188
bool
error_status
;
189
191
bool
eof_status
;
192
};
193
202
mntstream
&
203
operator >>
(
mntstream
& stream,
204
mntstream::mntentry
& entry);
205
206
}
207
208
#endif
/* SBUILD_MNTSTREAM_H */
209
210
/*
211
* Local Variables:
212
* mode:C++
213
* End:
214
*/
Generated on Wed Oct 2 2013 10:21:07 for sbuild by
1.8.4