-
-
Notifications
You must be signed in to change notification settings - Fork 31
/
dfilebuilder.h
91 lines (75 loc) · 2.67 KB
/
dfilebuilder.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/**
* @file dfilebuilder.h
*
* @ingroup fs
*
* @author Copyright © 2012 Daniel Swanson <danij@dengine.net>
*
* @par License
* GPL: http://www.gnu.org/licenses/gpl.html
*
* <small>This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version. This program is distributed in the hope that it
* will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
* Public License for more details. You should have received a copy of the GNU
* General Public License along with this program; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA</small>
*/
#ifndef LIBDENG_FILESYS_DFILEBUILDER_H
#define LIBDENG_FILESYS_DFILEBUILDER_H
#include "fs_main.h"
#ifdef __cplusplus
namespace de {
class DFileBuilder
{
public:
static void init();
static void shutdown();
/**
* Create a new handle on the File @a file.
*
* @param af VFS object representing the file being opened.
*/
static DFile* fromFile(File1& file);
/**
* Create a new handle on a lump of File @a file.
*
* @param af VFS object representing the container of the lump to be opened.
* @param lumpIdx Logical index of the lump within @a file to be opened.
* @param dontBuffer @c true= do not buffer a copy of the lump.
*/
static DFile* fromFileLump(File1& file, int lumpIdx, bool dontBuffer);
/**
* Open a new handle on the specified native file.
*
* @param nativeFile Native file system handle to the file being opened.
* @param baseOffset Offset from the start of the file in bytes to begin.
*/
static DFile* fromNativeFile(FILE& nativeFile, size_t baseOffset);
/**
* Create a duplicate of handle @a hndl. Note that the duplicate is in
* fact a "reference" to the original, so all changes to the file which they
* represent are implicitly shared.
*
* @param hndl Handle to be duplicated.
*/
static DFile* dup(DFile const& hndl);
};
} // namespace de
extern "C" {
#endif
/**
* Non-public methods of DFile. Placed here temporarily.
*/
/// @return File object represented by this handle.
struct file1_s* DFile_File(DFile* hndl);
/// @return File object represented by this handle.
struct file1_s* DFile_File_const(DFile const* hndl);
#ifdef __cplusplus
} // extern "C"
#endif
#endif /* LIBDENG_FILESYS_DFILEBUILDER_H */