misc/libphyslayer/physfsrwops.h
branchphysfslayer
changeset 8524 a65e9bcf0a03
parent 8522 1853628ae285
child 9991 3858d99476f5
equal deleted inserted replaced
8522:1853628ae285 8524:a65e9bcf0a03
       
     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 
       
    23 #ifndef _INCLUDE_PHYSFSRWOPS_H_
       
    24 #define _INCLUDE_PHYSFSRWOPS_H_
       
    25 
       
    26 #include "physfs.h"
       
    27 #include "SDL.h"
       
    28 
       
    29 #ifdef __cplusplus
       
    30 extern "C" {
       
    31 #endif
       
    32 
       
    33 /**
       
    34  * Open a platform-independent filename for reading, and make it accessible
       
    35  *  via an SDL_RWops structure. The file will be closed in PhysicsFS when the
       
    36  *  RWops is closed. PhysicsFS should be configured to your liking before
       
    37  *  opening files through this method.
       
    38  *
       
    39  *   @param filename File to open in platform-independent notation.
       
    40  *  @return A valid SDL_RWops structure on success, NULL on error. Specifics
       
    41  *           of the error can be gleaned from PHYSFS_getLastError().
       
    42  */
       
    43 PHYSFS_DECL SDL_RWops *PHYSFSRWOPS_openRead(const char *fname);
       
    44 
       
    45 /**
       
    46  * Open a platform-independent filename for writing, and make it accessible
       
    47  *  via an SDL_RWops structure. The file will be closed in PhysicsFS when the
       
    48  *  RWops is closed. PhysicsFS should be configured to your liking before
       
    49  *  opening files through this method.
       
    50  *
       
    51  *   @param filename File to open in platform-independent notation.
       
    52  *  @return A valid SDL_RWops structure on success, NULL on error. Specifics
       
    53  *           of the error can be gleaned from PHYSFS_getLastError().
       
    54  */
       
    55 PHYSFS_DECL SDL_RWops *PHYSFSRWOPS_openWrite(const char *fname);
       
    56 
       
    57 /**
       
    58  * Open a platform-independent filename for appending, and make it accessible
       
    59  *  via an SDL_RWops structure. The file will be closed in PhysicsFS when the
       
    60  *  RWops is closed. PhysicsFS should be configured to your liking before
       
    61  *  opening files through this method.
       
    62  *
       
    63  *   @param filename File to open in platform-independent notation.
       
    64  *  @return A valid SDL_RWops structure on success, NULL on error. Specifics
       
    65  *           of the error can be gleaned from PHYSFS_getLastError().
       
    66  */
       
    67 PHYSFS_DECL SDL_RWops *PHYSFSRWOPS_openAppend(const char *fname);
       
    68 
       
    69 /**
       
    70  * Make a SDL_RWops from an existing PhysicsFS file handle. You should
       
    71  *  dispose of any references to the handle after successful creation of
       
    72  *  the RWops. The actual PhysicsFS handle will be destroyed when the
       
    73  *  RWops is closed.
       
    74  *
       
    75  *   @param handle a valid PhysicsFS file handle.
       
    76  *  @return A valid SDL_RWops structure on success, NULL on error. Specifics
       
    77  *           of the error can be gleaned from PHYSFS_getLastError().
       
    78  */
       
    79 PHYSFS_DECL SDL_RWops *PHYSFSRWOPS_makeRWops(PHYSFS_File *handle);
       
    80 
       
    81 #ifdef __cplusplus
       
    82 }
       
    83 #endif
       
    84 
       
    85 #endif /* include-once blocker */
       
    86 
       
    87 /* end of physfsrwops.h ... */
       
    88