vrshoot

view libs/assimp/assimp/cfileio.h @ 0:b2f14e535253

initial commit
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 01 Feb 2014 19:58:19 +0200
parents
children
line source
1 /*
2 ---------------------------------------------------------------------------
3 Open Asset Import Library (assimp)
4 ---------------------------------------------------------------------------
6 Copyright (c) 2006-2012, assimp team
8 All rights reserved.
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:
14 * Redistributions of source code must retain the above
15 copyright notice, this list of conditions and the
16 following disclaimer.
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.
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.
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 */
42 /** @file aiFileIO.h
43 * @brief Defines generic C routines to access memory-mapped files
44 */
45 #ifndef AI_FILEIO_H_INC
46 #define AI_FILEIO_H_INC
48 #include "types.h"
49 #ifdef __cplusplus
50 extern "C" {
51 #endif
52 struct aiFileIO;
53 struct aiFile;
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);
62 // aiFileIO callbacks
63 typedef aiFile* (*aiFileOpenProc) (C_STRUCT aiFileIO*, const char*, const char*);
64 typedef void (*aiFileCloseProc) (C_STRUCT aiFileIO*, C_STRUCT aiFile*);
66 // Represents user-defined data
67 typedef char* aiUserData;
69 // ----------------------------------------------------------------------------------
70 /** @brief C-API: File system callbacks
71 *
72 * Provided are functions to open and close files. Supply a custom structure to
73 * the import function. If you don't, a default implementation is used. Use custom
74 * file systems to enable reading from other sources, such as ZIPs
75 * or memory locations. */
76 struct aiFileIO
77 {
78 /** Function used to open a new file
79 */
80 aiFileOpenProc OpenProc;
82 /** Function used to close an existing file
83 */
84 aiFileCloseProc CloseProc;
86 /** User-defined, opaque data */
87 aiUserData UserData;
88 };
90 // ----------------------------------------------------------------------------------
91 /** @brief C-API: File callbacks
92 *
93 * Actually, it's a data structure to wrap a set of fXXXX (e.g fopen)
94 * replacement functions.
95 *
96 * The default implementation of the functions utilizes the fXXX functions from
97 * the CRT. However, you can supply a custom implementation to Assimp by
98 * delivering a custom aiFileIO. Use this to enable reading from other sources,
99 * such as ZIP archives or memory locations. */
100 struct aiFile
101 {
102 /** Callback to read from a file */
103 aiFileReadProc ReadProc;
105 /** Callback to write to a file */
106 aiFileWriteProc WriteProc;
108 /** Callback to retrieve the current position of
109 * the file cursor (ftell())
110 */
111 aiFileTellProc TellProc;
113 /** Callback to retrieve the size of the file,
114 * in bytes
115 */
116 aiFileTellProc FileSizeProc;
118 /** Callback to set the current position
119 * of the file cursor (fseek())
120 */
121 aiFileSeek SeekProc;
123 /** Callback to flush the file contents
124 */
125 aiFileFlushProc FlushProc;
127 /** User-defined, opaque data
128 */
129 aiUserData UserData;
130 };
132 #ifdef __cplusplus
133 }
134 #endif
135 #endif // AI_FILEIO_H_INC