orx  1.10
Portable Game Engine
orxResource.h
Go to the documentation of this file.
1 /* Orx - Portable Game Engine
2  *
3  * Copyright (c) 2008-2019 Orx-Project
4  *
5  * This software is provided 'as-is', without any express or implied
6  * warranty. In no event will the authors be held liable for any damages
7  * arising from the use of this software.
8  *
9  * Permission is granted to anyone to use this software for any purpose,
10  * including commercial applications, and to alter it and redistribute it
11  * freely, subject to the following restrictions:
12  *
13  * 1. The origin of this software must not be misrepresented; you must not
14  * claim that you wrote the original software. If you use this software
15  * in a product, an acknowledgment in the product documentation would be
16  * appreciated but is not required.
17  *
18  * 2. Altered source versions must be plainly marked as such, and must not be
19  * misrepresented as being the original software.
20  *
21  * 3. This notice may not be removed or altered from any source
22  * distribution.
23  */
24 
40 #ifndef _orxRESOURCE_H_
41 #define _orxRESOURCE_H_
42 
43 
44 #include "orxInclude.h"
45 
46 
49 #define orxRESOURCE_KC_LOCATION_SEPARATOR ':'
50 
51 #define orxRESOURCE_KZ_DEFAULT_STORAGE "."
52 #define orxRESOURCE_KZ_TYPE_TAG_FILE "file"
53 
54 
57 typedef void (orxFASTCALL *orxRESOURCE_OP_FUNCTION)(orxHANDLE _hResource, orxS64 _s64Size, void *_pBuffer, void *_pContext);
58 
59 
62 typedef const orxSTRING (orxFASTCALL *orxRESOURCE_FUNCTION_LOCATE)(const orxSTRING _zStorage, const orxSTRING _zName, orxBOOL _bRequireExistence);
63 typedef orxS64 (orxFASTCALL *orxRESOURCE_FUNCTION_GET_TIME)(const orxSTRING _zLocation);
64 typedef orxHANDLE (orxFASTCALL *orxRESOURCE_FUNCTION_OPEN)(const orxSTRING _zLocation, orxBOOL _bEraseMode);
65 typedef void (orxFASTCALL *orxRESOURCE_FUNCTION_CLOSE)(orxHANDLE _hResource);
66 typedef orxS64 (orxFASTCALL *orxRESOURCE_FUNCTION_GET_SIZE)(orxHANDLE _hResource);
67 typedef orxS64 (orxFASTCALL *orxRESOURCE_FUNCTION_SEEK)(orxHANDLE _hResource, orxS64 _s64Offset, orxSEEK_OFFSET_WHENCE _eWhence);
68 typedef orxS64 (orxFASTCALL *orxRESOURCE_FUNCTION_TELL)(orxHANDLE _hResource);
69 typedef orxS64 (orxFASTCALL *orxRESOURCE_FUNCTION_READ)(orxHANDLE _hResource, orxS64 _s64Size, void *_pBuffer);
70 typedef orxS64 (orxFASTCALL *orxRESOURCE_FUNCTION_WRITE)(orxHANDLE _hResource, orxS64 _s64Size, const void *_pBuffer);
71 typedef orxSTATUS (orxFASTCALL *orxRESOURCE_FUNCTION_DELETE)(const orxSTRING _zLocation);
72 
75 typedef struct __orxRESOURCE_TYPE_INFO_t
76 {
77  const orxSTRING zTag;
90 
93 typedef enum __orxRESOURCE_EVENT_t
94 {
98 
100 
101  orxRESOURCE_EVENT_NONE = orxENUM_NONE
102 
104 
107 typedef struct __orxRESOURCE_EVENT_PAYLOAD_t
108 {
109  orxS64 s64Time;
110  const orxSTRING zLocation;
112  orxSTRINGID stGroupID;
113  orxSTRINGID stNameID;
116 
117 
120 extern orxDLLAPI void orxFASTCALL orxResource_Setup();
121 
125 extern orxDLLAPI orxSTATUS orxFASTCALL orxResource_Init();
126 
129 extern orxDLLAPI void orxFASTCALL orxResource_Exit();
130 
131 
135 extern orxDLLAPI orxU32 orxFASTCALL orxResource_GetGroupCount();
136 
141 extern orxDLLAPI const orxSTRING orxFASTCALL orxResource_GetGroup(orxU32 _u32Index);
142 
143 
150 extern orxDLLAPI orxSTATUS orxFASTCALL orxResource_AddStorage(const orxSTRING _zGroup, const orxSTRING _zStorage, orxBOOL _bAddFirst);
151 
157 extern orxDLLAPI orxSTATUS orxFASTCALL orxResource_RemoveStorage(const orxSTRING _zGroup, const orxSTRING _zStorage);
158 
163 extern orxDLLAPI orxU32 orxFASTCALL orxResource_GetStorageCount(const orxSTRING _zGroup);
164 
170 extern orxDLLAPI const orxSTRING orxFASTCALL orxResource_GetStorage(const orxSTRING _zGroup, orxU32 _u32Index);
171 
175 extern orxDLLAPI orxSTATUS orxFASTCALL orxResource_ReloadStorage();
176 
177 
183 extern orxDLLAPI const orxSTRING orxFASTCALL orxResource_Locate(const orxSTRING _zGroup, const orxSTRING _zName);
184 
191 extern orxDLLAPI const orxSTRING orxFASTCALL orxResource_LocateInStorage(const orxSTRING _zGroup, const orxSTRING _zStorage, const orxSTRING _zName);
192 
197 extern orxDLLAPI const orxSTRING orxFASTCALL orxResource_GetPath(const orxSTRING _zLocation);
198 
203 extern orxDLLAPI const orxRESOURCE_TYPE_INFO *orxFASTCALL orxResource_GetType(const orxSTRING _zLocation);
204 
205 
210 extern orxDLLAPI orxS64 orxFASTCALL orxResource_GetTime(const orxSTRING _zLocation);
211 
217 extern orxDLLAPI orxHANDLE orxFASTCALL orxResource_Open(const orxSTRING _zLocation, orxBOOL _bEraseMode);
218 
222 extern orxDLLAPI void orxFASTCALL orxResource_Close(orxHANDLE _hResource);
223 
228 extern orxDLLAPI const orxSTRING orxFASTCALL orxResource_GetLocation(orxHANDLE _hResource);
229 
234 extern orxDLLAPI orxS64 orxFASTCALL orxResource_GetSize(orxHANDLE _hResource);
235 
242 extern orxDLLAPI orxS64 orxFASTCALL orxResource_Seek(orxHANDLE _hResource, orxS64 _s64Offset, orxSEEK_OFFSET_WHENCE _eWhence);
243 
248 extern orxDLLAPI orxS64 orxFASTCALL orxResource_Tell(orxHANDLE _hResource);
249 
258 extern orxDLLAPI orxS64 orxFASTCALL orxResource_Read(orxHANDLE _hResource, orxS64 _s64Size, void *_pBuffer, orxRESOURCE_OP_FUNCTION _pfnCallback, void *_pContext);
259 
268 extern orxDLLAPI orxS64 orxFASTCALL orxResource_Write(orxHANDLE _hResource, orxS64 _s64Size, const void *_pBuffer, orxRESOURCE_OP_FUNCTION _pfnCallback, void *_pContext);
269 
274 extern orxDLLAPI orxSTATUS orxFASTCALL orxResource_Delete(const orxSTRING _zLocation);
275 
276 
281 extern orxDLLAPI orxU32 orxFASTCALL orxResource_GetPendingOpCount(const orxHANDLE _hResource);
282 
286 extern orxDLLAPI orxU32 orxFASTCALL orxResource_GetTotalPendingOpCount();
287 
288 
293 extern orxDLLAPI orxSTATUS orxFASTCALL orxResource_RegisterType(const orxRESOURCE_TYPE_INFO *_pstInfo);
294 
298 extern orxDLLAPI orxU32 orxFASTCALL orxResource_GetTypeCount();
299 
304 extern orxDLLAPI const orxSTRING orxFASTCALL orxResource_GetTypeTag(orxU32 _u32Index);
305 
306 
310 extern orxDLLAPI orxSTATUS orxFASTCALL orxResource_ClearCache();
311 
312 
313 #endif /* _orxRESOURCE_H_ */
314 
orxDLLAPI void orxFASTCALL orxResource_Exit()
orxHANDLE(orxFASTCALL * orxRESOURCE_FUNCTION_OPEN)(const orxSTRING _zLocation, orxBOOL _bEraseMode)
Definition: orxResource.h:64
const orxSTRING zLocation
Definition: orxResource.h:110
orxDLLAPI orxSTATUS orxFASTCALL orxResource_AddStorage(const orxSTRING _zGroup, const orxSTRING _zStorage, orxBOOL _bAddFirst)
orxDLLAPI orxSTATUS orxFASTCALL orxResource_ReloadStorage()
orxRESOURCE_FUNCTION_WRITE pfnWrite
Definition: orxResource.h:86
orxRESOURCE_FUNCTION_CLOSE pfnClose
Definition: orxResource.h:81
orxDLLAPI const orxSTRING orxFASTCALL orxResource_GetTypeTag(orxU32 _u32Index)
orxDLLAPI orxU32 orxFASTCALL orxResource_GetGroupCount()
orxRESOURCE_EVENT
Definition: orxResource.h:93
orxDLLAPI const orxSTRING orxFASTCALL orxResource_GetGroup(orxU32 _u32Index)
orxDLLAPI orxU32 orxFASTCALL orxResource_GetPendingOpCount(const orxHANDLE _hResource)
orxS64(orxFASTCALL * orxRESOURCE_FUNCTION_GET_TIME)(const orxSTRING _zLocation)
Definition: orxResource.h:63
orxDLLAPI orxS64 orxFASTCALL orxResource_Write(orxHANDLE _hResource, orxS64 _s64Size, const void *_pBuffer, orxRESOURCE_OP_FUNCTION _pfnCallback, void *_pContext)
orxDLLAPI const orxSTRING orxFASTCALL orxResource_LocateInStorage(const orxSTRING _zGroup, const orxSTRING _zStorage, const orxSTRING _zName)
orxS64(orxFASTCALL * orxRESOURCE_FUNCTION_WRITE)(orxHANDLE _hResource, orxS64 _s64Size, const void *_pBuffer)
Definition: orxResource.h:70
orxRESOURCE_FUNCTION_GET_SIZE pfnGetSize
Definition: orxResource.h:82
orxDLLAPI orxSTATUS orxFASTCALL orxResource_Delete(const orxSTRING _zLocation)
orxDLLAPI orxS64 orxFASTCALL orxResource_GetSize(orxHANDLE _hResource)
orxDLLAPI const orxSTRING orxFASTCALL orxResource_GetPath(const orxSTRING _zLocation)
orxS64(orxFASTCALL * orxRESOURCE_FUNCTION_SEEK)(orxHANDLE _hResource, orxS64 _s64Offset, orxSEEK_OFFSET_WHENCE _eWhence)
Definition: orxResource.h:67
orxRESOURCE_FUNCTION_DELETE pfnDelete
Definition: orxResource.h:87
orxDLLAPI orxS64 orxFASTCALL orxResource_GetTime(const orxSTRING _zLocation)
orxDLLAPI orxSTATUS orxFASTCALL orxResource_RemoveStorage(const orxSTRING _zGroup, const orxSTRING _zStorage)
orxDLLAPI orxS64 orxFASTCALL orxResource_Read(orxHANDLE _hResource, orxS64 _s64Size, void *_pBuffer, orxRESOURCE_OP_FUNCTION _pfnCallback, void *_pContext)
orxSTATUS(orxFASTCALL * orxRESOURCE_FUNCTION_DELETE)(const orxSTRING _zLocation)
Definition: orxResource.h:71
orxDLLAPI orxSTATUS orxFASTCALL orxResource_Init()
orxRESOURCE_FUNCTION_READ pfnRead
Definition: orxResource.h:85
orxDLLAPI const orxSTRING orxFASTCALL orxResource_GetLocation(orxHANDLE _hResource)
orxDLLAPI const orxSTRING orxFASTCALL orxResource_Locate(const orxSTRING _zGroup, const orxSTRING _zName)
orxSTATUS
Definition: orxType.h:246
const orxRESOURCE_TYPE_INFO * pstTypeInfo
Definition: orxResource.h:111
orxDLLAPI const orxRESOURCE_TYPE_INFO *orxFASTCALL orxResource_GetType(const orxSTRING _zLocation)
orxDLLAPI orxSTATUS orxFASTCALL orxResource_ClearCache()
const orxSTRING(orxFASTCALL * orxRESOURCE_FUNCTION_LOCATE)(const orxSTRING _zStorage, const orxSTRING _zName, orxBOOL _bRequireExistence)
Definition: orxResource.h:62
orxDLLAPI orxS64 orxFASTCALL orxResource_Tell(orxHANDLE _hResource)
void(orxFASTCALL * orxRESOURCE_OP_FUNCTION)(orxHANDLE _hResource, orxS64 _s64Size, void *_pBuffer, void *_pContext)
Definition: orxResource.h:57
void(orxFASTCALL * orxRESOURCE_FUNCTION_CLOSE)(orxHANDLE _hResource)
Definition: orxResource.h:65
orxSEEK_OFFSET_WHENCE
Definition: orxType.h:173
typedef void(orxFASTCALL *orxMODULE_EXIT_FUNCTION)()
#define orxDLLAPI
Definition: orxDecl.h:381
orxDLLAPI orxSTATUS orxFASTCALL orxResource_RegisterType(const orxRESOURCE_TYPE_INFO *_pstInfo)
orxDLLAPI orxU32 orxFASTCALL orxResource_GetTypeCount()
orxDLLAPI void orxFASTCALL orxResource_Setup()
orxDLLAPI orxU32 orxFASTCALL orxResource_GetTotalPendingOpCount()
orxS64(orxFASTCALL * orxRESOURCE_FUNCTION_TELL)(orxHANDLE _hResource)
Definition: orxResource.h:68
orxS64(orxFASTCALL * orxRESOURCE_FUNCTION_GET_SIZE)(orxHANDLE _hResource)
Definition: orxResource.h:66
orxDLLAPI orxS64 orxFASTCALL orxResource_Seek(orxHANDLE _hResource, orxS64 _s64Offset, orxSEEK_OFFSET_WHENCE _eWhence)
orxDLLAPI void orxFASTCALL orxResource_Close(orxHANDLE _hResource)
orxRESOURCE_FUNCTION_OPEN pfnOpen
Definition: orxResource.h:80
orxDLLAPI orxHANDLE orxFASTCALL orxResource_Open(const orxSTRING _zLocation, orxBOOL _bEraseMode)
orxRESOURCE_FUNCTION_SEEK pfnSeek
Definition: orxResource.h:83
const orxSTRING zTag
Definition: orxResource.h:77
orxDLLAPI const orxSTRING orxFASTCALL orxResource_GetStorage(const orxSTRING _zGroup, orxU32 _u32Index)
orxRESOURCE_FUNCTION_LOCATE pfnLocate
Definition: orxResource.h:78
orxDLLAPI orxU32 orxFASTCALL orxResource_GetStorageCount(const orxSTRING _zGroup)
orxRESOURCE_FUNCTION_GET_TIME pfnGetTime
Definition: orxResource.h:79
orxS64(orxFASTCALL * orxRESOURCE_FUNCTION_READ)(orxHANDLE _hResource, orxS64 _s64Size, void *_pBuffer)
Definition: orxResource.h:69
orxRESOURCE_FUNCTION_TELL pfnTell
Definition: orxResource.h:84

Generated for orx by doxygen 1.8.11