physfsrwops.h 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. This code has
  13. * NO WARRANTY.
  14. *
  15. * Unless otherwise stated, the rest of PhysicsFS falls under the zlib license.
  16. * Please see LICENSE.txt in the root of the source tree.
  17. *
  18. * SDL falls under the LGPL license. You can get SDL at http://www.libsdl.org/
  19. *
  20. * This file was written by Ryan C. Gordon. (icculus@icculus.org).
  21. */
  22. #ifndef _INCLUDE_PHYSFSRWOPS_H_
  23. #define _INCLUDE_PHYSFSRWOPS_H_
  24. #include "physfs.h"
  25. #include "SDL.h"
  26. #ifdef __cplusplus
  27. extern "C" {
  28. #endif
  29. /**
  30. * Open a platform-independent filename for reading, and make it accessible
  31. * via an SDL_RWops structure. The file will be closed in PhysicsFS when the
  32. * RWops is closed. PhysicsFS should be configured to your liking before
  33. * opening files through this method.
  34. *
  35. * @param filename File to open in platform-independent notation.
  36. * @return A valid SDL_RWops structure on success, NULL on error. Specifics
  37. * of the error can be gleaned from PHYSFS_getLastError().
  38. */
  39. __EXPORT__ SDL_RWops *PHYSFSRWOPS_openRead(const char *fname);
  40. /**
  41. * Open a platform-independent filename for writing, and make it accessible
  42. * via an SDL_RWops structure. The file will be closed in PhysicsFS when the
  43. * RWops is closed. PhysicsFS should be configured to your liking before
  44. * opening files through this method.
  45. *
  46. * @param filename File to open in platform-independent notation.
  47. * @return A valid SDL_RWops structure on success, NULL on error. Specifics
  48. * of the error can be gleaned from PHYSFS_getLastError().
  49. */
  50. __EXPORT__ SDL_RWops *PHYSFSRWOPS_openWrite(const char *fname);
  51. /**
  52. * Open a platform-independent filename for appending, and make it accessible
  53. * via an SDL_RWops structure. The file will be closed in PhysicsFS when the
  54. * RWops is closed. PhysicsFS should be configured to your liking before
  55. * opening files through this method.
  56. *
  57. * @param filename File to open in platform-independent notation.
  58. * @return A valid SDL_RWops structure on success, NULL on error. Specifics
  59. * of the error can be gleaned from PHYSFS_getLastError().
  60. */
  61. __EXPORT__ SDL_RWops *PHYSFSRWOPS_openAppend(const char *fname);
  62. /**
  63. * Make a SDL_RWops from an existing PhysicsFS file handle. You should
  64. * dispose of any references to the handle after successful creation of
  65. * the RWops. The actual PhysicsFS handle will be destroyed when the
  66. * RWops is closed.
  67. *
  68. * @param handle a valid PhysicsFS file handle.
  69. * @return A valid SDL_RWops structure on success, NULL on error. Specifics
  70. * of the error can be gleaned from PHYSFS_getLastError().
  71. */
  72. __EXPORT__ SDL_RWops *PHYSFSRWOPS_makeRWops(PHYSFS_File *handle);
  73. #ifdef __cplusplus
  74. }
  75. #endif
  76. #endif /* include-once blocker */
  77. /* end of physfsrwops.h ... */