physfsrwops.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /*
  2. * This code provides a glue layer between PhysicsFS and Simple Directmedia
  3. * Layer's (SDL) RWops i/o abstraction.
  4. *
  5. * License: this code is public domain. I make no warranty that it is useful,
  6. * correct, harmless, or environmentally safe.
  7. *
  8. * This particular file may be used however you like, including copying it
  9. * verbatim into a closed-source project, exploiting it commercially, and
  10. * removing any trace of my name from the source (although I hope you won't
  11. * do that). I welcome enhancements and corrections to this file, but I do
  12. * not require you to send me patches if you make changes.
  13. *
  14. * Unless otherwise stated, the rest of PhysicsFS falls under the GNU Lesser
  15. * General Public License: http://www.gnu.org/licenses/lgpl.txt
  16. *
  17. * SDL falls under the LGPL, too. You can get SDL at http://www.libsdl.org/
  18. *
  19. * This file was written by Ryan C. Gordon. (icculus@icculus.org).
  20. */
  21. #ifndef _INCLUDE_PHYSFSRWOPS_H_
  22. #define _INCLUDE_PHYSFSRWOPS_H_
  23. #include "physfs.h"
  24. #include "SDL.h"
  25. #ifdef __cplusplus
  26. extern "C" {
  27. #endif
  28. /**
  29. * Open a platform-independent filename for reading, and make it accessible
  30. * via an SDL_RWops structure. The file will be closed in PhysicsFS when the
  31. * RWops is closed. PhysicsFS should be configured to your liking before
  32. * opening files through this method.
  33. *
  34. * @param filename File to open in platform-independent notation.
  35. * @return A valid SDL_RWops structure on success, NULL on error. Specifics
  36. * of the error can be gleaned from PHYSFS_getLastError().
  37. */
  38. __EXPORT__ SDL_RWops *PHYSFSRWOPS_openRead(const char *fname);
  39. /**
  40. * Open a platform-independent filename for writing, and make it accessible
  41. * via an SDL_RWops structure. The file will be closed in PhysicsFS when the
  42. * RWops is closed. PhysicsFS should be configured to your liking before
  43. * opening files through this method.
  44. *
  45. * @param filename File to open in platform-independent notation.
  46. * @return A valid SDL_RWops structure on success, NULL on error. Specifics
  47. * of the error can be gleaned from PHYSFS_getLastError().
  48. */
  49. __EXPORT__ SDL_RWops *PHYSFSRWOPS_openWrite(const char *fname);
  50. /**
  51. * Open a platform-independent filename for appending, and make it accessible
  52. * via an SDL_RWops structure. The file will be closed in PhysicsFS when the
  53. * RWops is closed. PhysicsFS should be configured to your liking before
  54. * opening files through this method.
  55. *
  56. * @param filename File to open in platform-independent notation.
  57. * @return A valid SDL_RWops structure on success, NULL on error. Specifics
  58. * of the error can be gleaned from PHYSFS_getLastError().
  59. */
  60. __EXPORT__ SDL_RWops *PHYSFSRWOPS_openAppend(const char *fname);
  61. /**
  62. * Make a SDL_RWops from an existing PhysicsFS file handle. You should
  63. * dispose of any references to the handle after successful creation of
  64. * the RWops. The actual PhysicsFS handle will be destroyed when the
  65. * RWops is closed.
  66. *
  67. * @param handle a valid PhysicsFS file handle.
  68. * @return A valid SDL_RWops structure on success, NULL on error. Specifics
  69. * of the error can be gleaned from PHYSFS_getLastError().
  70. */
  71. __EXPORT__ SDL_RWops *PHYSFSRWOPS_makeRWops(PHYSFS_file *handle);
  72. #ifdef __cplusplus
  73. }
  74. #endif
  75. #endif /* include-once blocker */
  76. /* end of physfsrwops.h ... */