BRE12
cfileio.h
1 /*
2 ---------------------------------------------------------------------------
3 Open Asset Import Library (assimp)
4 ---------------------------------------------------------------------------
5 
6 Copyright (c) 2006-2012, assimp team
7 
8 All rights reserved.
9 
10 Redistribution and use of this software in source and binary forms,
11 with or without modification, are permitted provided that the following
12 conditions are met:
13 
14 * Redistributions of source code must retain the above
15  copyright notice, this list of conditions and the
16  following disclaimer.
17 
18 * Redistributions in binary form must reproduce the above
19  copyright notice, this list of conditions and the
20  following disclaimer in the documentation and/or other
21  materials provided with the distribution.
22 
23 * Neither the name of the assimp team, nor the names of its
24  contributors may be used to endorse or promote products
25  derived from this software without specific prior
26  written permission of the assimp team.
27 
28 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
31 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
32 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
33 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
34 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
35 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
36 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
37 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
38 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39 ---------------------------------------------------------------------------
40 */
41 
45 #ifndef AI_FILEIO_H_INC
46 #define AI_FILEIO_H_INC
47 
48 #include "types.h"
49 #ifdef __cplusplus
50 extern "C" {
51 #endif
52 struct aiFileIO;
53 struct aiFile;
54 
55 // aiFile callbacks
56 typedef size_t (*aiFileWriteProc) (C_STRUCT aiFile*, const char*, size_t, size_t);
57 typedef size_t (*aiFileReadProc) (C_STRUCT aiFile*, char*, size_t,size_t);
58 typedef size_t (*aiFileTellProc) (C_STRUCT aiFile*);
59 typedef void (*aiFileFlushProc) (C_STRUCT aiFile*);
60 typedef aiReturn (*aiFileSeek)(C_STRUCT aiFile*, size_t, aiOrigin);
61 
62 // aiFileIO callbacks
63 typedef aiFile* (*aiFileOpenProc) (C_STRUCT aiFileIO*, const char*, const char*);
64 typedef void (*aiFileCloseProc) (C_STRUCT aiFileIO*, C_STRUCT aiFile*);
65 
66 // Represents user-defined data
67 typedef char* aiUserData;
68 
69 // ----------------------------------------------------------------------------------
76 struct aiFileIO
77 {
80  aiFileOpenProc OpenProc;
81 
84  aiFileCloseProc CloseProc;
85 
87  aiUserData UserData;
88 };
89 
90 // ----------------------------------------------------------------------------------
100 struct aiFile
101 {
103  aiFileReadProc ReadProc;
104 
106  aiFileWriteProc WriteProc;
107 
111  aiFileTellProc TellProc;
112 
116  aiFileTellProc FileSizeProc;
117 
121  aiFileSeek SeekProc;
122 
125  aiFileFlushProc FlushProc;
126 
129  aiUserData UserData;
130 };
131 
132 #ifdef __cplusplus
133 }
134 #endif
135 #endif // AI_FILEIO_H_INC
Basic data types and primitives, such as vectors or colors.
aiFileFlushProc FlushProc
Callback to flush the file contents.
Definition: cfileio.h:125
C-API: File system callbacks.
Definition: cfileio.h:76
aiFileSeek SeekProc
Callback to set the current position of the file cursor (fseek())
Definition: cfileio.h:121
C-API: File callbacks.
Definition: cfileio.h:100
aiFileTellProc TellProc
Callback to retrieve the current position of the file cursor (ftell())
Definition: cfileio.h:111
aiFileOpenProc OpenProc
Function used to open a new file.
Definition: cfileio.h:80
aiFileTellProc FileSizeProc
Callback to retrieve the size of the file, in bytes.
Definition: cfileio.h:116
aiUserData UserData
User-defined, opaque data.
Definition: cfileio.h:129
aiFileReadProc ReadProc
Callback to read from a file.
Definition: cfileio.h:103
aiFileCloseProc CloseProc
Function used to close an existing file.
Definition: cfileio.h:84
aiFileWriteProc WriteProc
Callback to write to a file.
Definition: cfileio.h:106
aiUserData UserData
User-defined, opaque data.
Definition: cfileio.h:87