IBR-DTNSuite
0.12
Main Page
Namespaces
Classes
Files
File List
File Members
IBR-DTNSuite
Namespaces
Classes
Files
File List
daemon
ibrcommon
ibrdtn
tools
src
io
FATFile.cpp
FATFile.h
FatImageReader.cpp
FatImageReader.h
FileHash.cpp
FileHash.h
ObservedFile.cpp
ObservedFile.h
TarUtils.cpp
TarUtils.h
streaming
config.h
dtnconvert.cpp
dtninbox.cpp
dtnoutbox.cpp
dtnping.cpp
dtnrecv.cpp
dtnsend.cpp
dtnstream.cpp
dtntracepath.cpp
dtntrigger.cpp
dtntunnel.cpp
File Members
FATFile.cpp
Go to the documentation of this file.
1
/*
2
* FATFile.h
3
*
4
* Copyright (C) 2013 IBR, TU Braunschweig
5
*
6
* Written-by: David Goltzsche <goltzsch@ibr.cs.tu-bs.de>
7
* Johannes Morgenroth <morgenroth@ibr.cs.tu-bs.de>
8
*
9
* Licensed under the Apache License, Version 2.0 (the "License");
10
* you may not use this file except in compliance with the License.
11
* You may obtain a copy of the License at
12
*
13
* http://www.apache.org/licenses/LICENSE-2.0
14
*
15
* Unless required by applicable law or agreed to in writing, software
16
* distributed under the License is distributed on an "AS IS" BASIS,
17
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
* See the License for the specific language governing permissions and
19
* limitations under the License.
20
*
21
* Created on: Sep 23, 2013
22
*/
23
24
#include "
io/FATFile.h
"
25
#include "
io/FatImageReader.h
"
26
27
namespace
io
28
{
29
FATFile::FATFile
(
const
FatImageReader
&reader)
30
: ibrcommon::File(
"/"
, DT_DIR), _reader(reader)
31
{
32
}
33
34
FATFile::FATFile
(
const
FatImageReader
&reader,
const
std::string &file_path)
35
: ibrcommon::File(file_path), _reader(reader)
36
{
37
update
();
38
}
39
40
FATFile::~FATFile
()
41
{
42
}
43
44
int
FATFile::getFiles
(std::list<FATFile> &files)
const
45
{
46
try
{
47
_reader.
list
(*
this
, files);
48
}
catch
(
const
FatImageReader::FatImageException
&e) {
49
return
e.
getErrorCode
();
50
}
51
return
0;
52
}
53
54
int
FATFile::remove
(
bool
recursive)
55
{
56
// deletion is not supported
57
return
1;
58
}
59
60
FATFile
FATFile::get
(
const
std::string &filename)
const
61
{
62
const
ibrcommon::File
child =
ibrcommon::File::get
(filename);
63
return
FATFile
(_reader, child.
getPath
());
64
}
65
66
FATFile
FATFile::getParent
()
const
67
{
68
const
ibrcommon::File
parent =
ibrcommon::File::getParent
();
69
return
FATFile
(_reader, parent.
getPath
());
70
}
71
72
bool
FATFile::exists
()
const
73
{
74
return
_reader.
exists
(*
this
);
75
}
76
77
void
FATFile::update
()
78
{
79
if
(_reader.
isDirectory
(*
this
)) {
80
_type
= DT_DIR;
81
}
else
{
82
_type
= DT_REG;
83
}
84
}
85
86
size_t
FATFile::size
()
const
87
{
88
return
_reader.
size
(*
this
);
89
}
90
91
time_t
FATFile::lastaccess
()
const
92
{
93
return
_reader.
lastaccess
(*
this
);
94
}
95
96
time_t
FATFile::lastmodify
()
const
97
{
98
return
lastaccess
();
99
}
100
101
time_t
FATFile::laststatchange
()
const
102
{
103
return
lastaccess
();
104
}
105
106
const
FatImageReader
&
FATFile::getReader
()
const
107
{
108
return
_reader;
109
}
110
}
tools
src
io
FATFile.cpp
Generated on Thu Mar 27 2014 09:26:21 for IBR-DTNSuite by
1.8.4