Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-21 09:30:07

0001 /*
0002 ---------------------------------------------------------------------------
0003 Open Asset Import Library (assimp)
0004 ---------------------------------------------------------------------------
0005 
0006 Copyright (c) 2006-2024, assimp team
0007 
0008 All rights reserved.
0009 
0010 Redistribution and use of this software in source and binary forms,
0011 with or without modification, are permitted provided that the following
0012 conditions are met:
0013 
0014 * Redistributions of source code must retain the above
0015   copyright notice, this list of conditions and the
0016   following disclaimer.
0017 
0018 * Redistributions in binary form must reproduce the above
0019   copyright notice, this list of conditions and the
0020   following disclaimer in the documentation and/or other
0021   materials provided with the distribution.
0022 
0023 * Neither the name of the assimp team, nor the names of its
0024   contributors may be used to endorse or promote products
0025   derived from this software without specific prior
0026   written permission of the assimp team.
0027 
0028 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
0029 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
0030 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
0031 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
0032 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
0033 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
0034 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
0035 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
0036 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
0037 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
0038 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0039 ---------------------------------------------------------------------------
0040 */
0041 
0042 /** @file cfileio.h
0043  *  @brief Defines generic C routines to access memory-mapped files
0044  */
0045 #pragma once
0046 #ifndef AI_FILEIO_H_INC
0047 #define AI_FILEIO_H_INC
0048 
0049 #ifdef __GNUC__
0050 #   pragma GCC system_header
0051 #endif
0052 
0053 #include <assimp/types.h>
0054 
0055 #ifdef __cplusplus
0056 extern "C" {
0057 #endif
0058 
0059 struct aiFileIO;
0060 struct aiFile;
0061 
0062 // aiFile callbacks
0063 typedef size_t          (*aiFileWriteProc) (C_STRUCT aiFile*,   const char*, size_t, size_t);
0064 typedef size_t          (*aiFileReadProc)  (C_STRUCT aiFile*,   char*, size_t,size_t);
0065 typedef size_t          (*aiFileTellProc)  (C_STRUCT aiFile*);
0066 typedef void            (*aiFileFlushProc) (C_STRUCT aiFile*);
0067 typedef C_ENUM aiReturn (*aiFileSeek)      (C_STRUCT aiFile*, size_t, C_ENUM aiOrigin);
0068 
0069 // aiFileIO callbacks
0070 typedef C_STRUCT aiFile* (*aiFileOpenProc)  (C_STRUCT aiFileIO*, const char*, const char*);
0071 typedef void             (*aiFileCloseProc) (C_STRUCT aiFileIO*, C_STRUCT aiFile*);
0072 
0073 // Represents user-defined data
0074 typedef char* aiUserData;
0075 
0076 // ----------------------------------------------------------------------------------
0077 /** @brief C-API: File system callbacks
0078  *
0079  *  Provided are functions to open and close files. Supply a custom structure to
0080  *  the import function. If you don't, a default implementation is used. Use custom
0081  *  file systems to enable reading from other sources, such as ZIPs
0082  *  or memory locations. */
0083 struct aiFileIO
0084 {
0085     /** Function used to open a new file
0086      */
0087     aiFileOpenProc OpenProc;
0088 
0089     /** Function used to close an existing file
0090      */
0091     aiFileCloseProc CloseProc;
0092 
0093     /** User-defined, opaque data */
0094     aiUserData UserData;
0095 };
0096 
0097 // ----------------------------------------------------------------------------------
0098 /** @brief C-API: File callbacks
0099  *
0100  *  Actually, it's a data structure to wrap a set of fXXXX (e.g fopen)
0101  *  replacement functions.
0102  *
0103  *  The default implementation of the functions utilizes the fXXX functions from
0104  *  the CRT. However, you can supply a custom implementation to Assimp by
0105  *  delivering a custom aiFileIO. Use this to enable reading from other sources,
0106  *  such as ZIP archives or memory locations. */
0107 struct aiFile {
0108     /** Callback to read from a file */
0109     aiFileReadProc ReadProc;
0110 
0111     /** Callback to write to a file */
0112     aiFileWriteProc WriteProc;
0113 
0114     /** Callback to retrieve the current position of
0115      *  the file cursor (ftell())
0116      */
0117     aiFileTellProc TellProc;
0118 
0119     /** Callback to retrieve the size of the file,
0120      *  in bytes
0121      */
0122     aiFileTellProc FileSizeProc;
0123 
0124     /** Callback to set the current position
0125      * of the file cursor (fseek())
0126      */
0127     aiFileSeek SeekProc;
0128 
0129     /** Callback to flush the file contents
0130      */
0131     aiFileFlushProc FlushProc;
0132 
0133     /** User-defined, opaque data
0134      */
0135     aiUserData UserData;
0136 };
0137 
0138 #ifdef __cplusplus
0139 }
0140 #endif
0141 #endif // AI_FILEIO_H_INC