IBR-DTNSuite
0.12
Main Page
Namespaces
Classes
Files
File List
File Members
FatImageReader.h
Go to the documentation of this file.
1
/*
2
* FatImageReader.h
3
*
4
* Copyright (C) 2014 IBR, TU Braunschweig
5
*
6
* Written-by: Johannes Morgenroth <morgenroth@ibr.cs.tu-bs.de>
7
*
8
* Licensed under the Apache License, Version 2.0 (the "License");
9
* you may not use this file except in compliance with the License.
10
* You may obtain a copy of the License at
11
*
12
* http://www.apache.org/licenses/LICENSE-2.0
13
*
14
* Unless required by applicable law or agreed to in writing, software
15
* distributed under the License is distributed on an "AS IS" BASIS,
16
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
* See the License for the specific language governing permissions and
18
* limitations under the License.
19
*
20
* Created on: Mar 14, 2014
21
*/
22
23
#ifndef FATIMAGEREADER_H_
24
#define FATIMAGEREADER_H_
25
26
#include "
io/FATFile.h
"
27
#include <
ibrcommon/data/File.h
>
28
#include <list>
29
30
extern
"C"
//libtffs does not support c++
31
{
32
#include <tffs.h>
33
}
34
35
namespace
io
36
{
37
class
FatImageReader
38
{
39
public
:
40
class
FatImageException
:
public
ibrcommon::IOException
41
{
42
public
:
43
FatImageException
(
int
errcode,
const
std::string &operation,
const
ibrcommon::File
&file);
44
virtual
~FatImageException
()
throw
();
45
46
int
getErrorCode
()
const
;
47
48
private
:
49
static
std::string create_message(
int
errcode,
const
std::string &operation,
const
ibrcommon::File
&file);
50
const
int
_errorcode;
51
};
52
53
class
FileHandle
54
{
55
public
:
56
FileHandle
(
const
ibrcommon::File
&image,
const
std::string &path);
57
virtual
~FileHandle
();
58
59
size_t
read
(
unsigned
char
*buffer,
size_t
buf_size);
60
61
void
close
();
62
63
private
:
64
tdir_handle_t _hdir;
65
tffs_handle_t _htffs;
66
tfile_handle_t _hfile;
67
bool
_open;
68
};
69
70
FatImageReader
(
const
ibrcommon::File
&filename);
71
virtual
~FatImageReader
();
72
73
typedef
std::list<FATFile>
filelist
;
74
75
void
list
(
filelist
&files)
const
throw
(
FatImageException
);
76
void
list
(
const
FATFile
&directory,
filelist
&files)
const
throw
(
FatImageException
);
77
78
bool
exists
(
const
FATFile
&file)
const
throw
();
79
80
time_t
lastaccess
(
const
FATFile
&file)
const
throw
();
81
82
size_t
size
(
const
FATFile
&file)
const
throw
();
83
84
bool
isDirectory
(
const
FATFile
&file)
const
throw
();
85
86
FileHandle
open
(
const
FATFile
&file)
const
;
87
88
private
:
89
void
update(
const
FATFile
&path, dirent_t &d)
const
throw
(
ibrcommon::IOException
);
90
91
const
static
std::string TAG;
92
93
const
ibrcommon::File
_filename;
94
};
95
}
/* namespace io */
96
97
#endif
/* FATIMAGEREADER_H_ */
tools
src
io
FatImageReader.h
Generated on Thu Mar 27 2014 09:26:21 for IBR-DTNSuite by
1.8.4