aiFileIO.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /** @file Defines generic routines to access memory-mapped files
  2. *
  3. */
  4. #ifndef AI_FILEIO_H_INC
  5. #define AI_FILEIO_H_INC
  6. #include "aiTypes.h"
  7. #ifdef __cplusplus
  8. extern "C" {
  9. #endif
  10. struct aiFileIO;
  11. //enum aiOrigin;
  12. typedef aiFileIO (*aiFileOpenProc)(aiFileIO*, const char*, const char*);
  13. typedef aiReturn (*aiFileCloseProc)(aiFileIO*);
  14. typedef unsigned long (*aiFileReadWriteProc)(aiFileIO*, char*, unsigned int, unsigned int);
  15. typedef unsigned long (*aiFileTellProc)(aiFileIO*);
  16. // ---------------------------------------------------------------------------
  17. /** Define seek origins in fseek()-style.
  18. */
  19. // ---------------------------------------------------------------------------
  20. enum aiOrigin
  21. {
  22. aiOrigin_SET = 0x0, //!< Set position
  23. aiOrigin_CUR = 0x1, //!< Current position
  24. aiOrigin_END = 0x2 //!< End of file
  25. };
  26. typedef aiReturn (*aiFileSeek)(aiFileIO*, unsigned long, aiOrigin);
  27. typedef char* aiUserData;
  28. // ---------------------------------------------------------------------------
  29. /** Data structure to wrap a set of fXXXX (e.g fopen) replacement functions
  30. *
  31. * The functions behave the same way as their appropriate fXXXX
  32. * counterparts in the CRT.
  33. */
  34. // ---------------------------------------------------------------------------
  35. struct aiFileIO
  36. {
  37. aiUserData UserData;
  38. aiFileOpenProc OpenFunc;
  39. aiFileCloseProc CloseFunc;
  40. aiFileReadWriteProc ReadFunc;
  41. aiFileReadWriteProc WriteFunc;
  42. aiFileTellProc TellProc;
  43. aiFileSeek SeekProc;
  44. };
  45. #ifdef __cplusplus
  46. }
  47. #endif
  48. #endif // AI_FILEIO_H_INC