Subversion Repositories Games.Descent

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 pmbaty 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 1.2 falls under the LGPL license. SDL 1.3+ is zlib, like PhysicsFS.
19
 *  You can get SDL at https://www.libsdl.org/
20
 *
21
 *  This file was written by Ryan C. Gordon. (icculus@icculus.org).
22
 */
23
 
24
#ifndef _INCLUDE_PHYSFSRWOPS_H_
25
#define _INCLUDE_PHYSFSRWOPS_H_
26
 
27
#include "physfs.h"
28
#include "SDL.h"
29
 
30
#ifdef __cplusplus
31
extern "C" {
32
#endif
33
 
34
/**
35
 * Open a platform-independent filename for reading, and make it accessible
36
 *  via an SDL_RWops structure. The file will be closed in PhysicsFS when the
37
 *  RWops is closed. PhysicsFS should be configured to your liking before
38
 *  opening files through this method.
39
 *
40
 *   @param filename File to open in platform-independent notation.
41
 *  @return A valid SDL_RWops structure on success, NULL on error. Specifics
42
 *           of the error can be gleaned from PHYSFS_getLastError().
43
 */
44
PHYSFS_DECL SDL_RWops *PHYSFSRWOPS_openRead(const char *fname);
45
 
46
/**
47
 * Open a platform-independent filename for writing, and make it accessible
48
 *  via an SDL_RWops structure. The file will be closed in PhysicsFS when the
49
 *  RWops is closed. PhysicsFS should be configured to your liking before
50
 *  opening files through this method.
51
 *
52
 *   @param filename File to open in platform-independent notation.
53
 *  @return A valid SDL_RWops structure on success, NULL on error. Specifics
54
 *           of the error can be gleaned from PHYSFS_getLastError().
55
 */
56
PHYSFS_DECL SDL_RWops *PHYSFSRWOPS_openWrite(const char *fname);
57
 
58
/**
59
 * Open a platform-independent filename for appending, and make it accessible
60
 *  via an SDL_RWops structure. The file will be closed in PhysicsFS when the
61
 *  RWops is closed. PhysicsFS should be configured to your liking before
62
 *  opening files through this method.
63
 *
64
 *   @param filename File to open in platform-independent notation.
65
 *  @return A valid SDL_RWops structure on success, NULL on error. Specifics
66
 *           of the error can be gleaned from PHYSFS_getLastError().
67
 */
68
PHYSFS_DECL SDL_RWops *PHYSFSRWOPS_openAppend(const char *fname);
69
 
70
/**
71
 * Make a SDL_RWops from an existing PhysicsFS file handle. You should
72
 *  dispose of any references to the handle after successful creation of
73
 *  the RWops. The actual PhysicsFS handle will be destroyed when the
74
 *  RWops is closed.
75
 *
76
 *   @param handle a valid PhysicsFS file handle.
77
 *  @return A valid SDL_RWops structure on success, NULL on error. Specifics
78
 *           of the error can be gleaned from PHYSFS_getLastError().
79
 */
80
PHYSFS_DECL SDL_RWops *PHYSFSRWOPS_makeRWops(PHYSFS_File *handle);
81
 
82
#ifdef __cplusplus
83
}
84
#endif
85
 
86
#endif /* include-once blocker */
87
 
88
/* end of physfsrwops.h ... */
89