orx  1.14
Portable Game Engine
OrxResource

Data Structures

struct  orxRESOURCE_EVENT_PAYLOAD
 
struct  orxRESOURCE_TYPE_INFO
 

Macros

#define orxRESOURCE_KC_LOCATION_SEPARATOR   ':'
 
#define orxRESOURCE_KZ_DEFAULT_STORAGE   "."
 
#define orxRESOURCE_KZ_TYPE_TAG_FILE   "file"
 

Typedefs

typedef void(orxFASTCALL * orxRESOURCE_FUNCTION_CLOSE) (orxHANDLE _hResource)
 
typedef orxSTATUS(orxFASTCALL * orxRESOURCE_FUNCTION_DELETE) (const orxSTRING _zLocation)
 
typedef orxS64(orxFASTCALL * orxRESOURCE_FUNCTION_GET_SIZE) (orxHANDLE _hResource)
 
typedef orxS64(orxFASTCALL * orxRESOURCE_FUNCTION_GET_TIME) (const orxSTRING _zLocation)
 
typedef const orxSTRING(orxFASTCALL * orxRESOURCE_FUNCTION_LOCATE) (const orxSTRING _zGroup, const orxSTRING _zStorage, const orxSTRING _zName, orxBOOL _bRequireExistence)
 
typedef orxHANDLE(orxFASTCALL * orxRESOURCE_FUNCTION_OPEN) (const orxSTRING _zLocation, orxBOOL _bEraseMode)
 
typedef orxS64(orxFASTCALL * orxRESOURCE_FUNCTION_READ) (orxHANDLE _hResource, orxS64 _s64Size, void *_pBuffer)
 
typedef orxS64(orxFASTCALL * orxRESOURCE_FUNCTION_SEEK) (orxHANDLE _hResource, orxS64 _s64Offset, orxSEEK_OFFSET_WHENCE _eWhence)
 
typedef orxS64(orxFASTCALL * orxRESOURCE_FUNCTION_TELL) (orxHANDLE _hResource)
 
typedef orxS64(orxFASTCALL * orxRESOURCE_FUNCTION_WRITE) (orxHANDLE _hResource, orxS64 _s64Size, const void *_pBuffer)
 
typedef void(orxFASTCALL * orxRESOURCE_OP_FUNCTION) (orxHANDLE _hResource, orxS64 _s64Size, void *_pBuffer, void *_pContext)
 

Enumerations

enum  orxRESOURCE_EVENT {
  orxRESOURCE_EVENT_UPDATE = 0, orxRESOURCE_EVENT_ADD, orxRESOURCE_EVENT_REMOVE, orxRESOURCE_EVENT_NUMBER,
  orxRESOURCE_EVENT_NONE = orxENUM_NONE
}
 

Functions

orxDLLAPI orxSTATUS orxFASTCALL orxResource_AddStorage (const orxSTRING _zGroup, const orxSTRING _zStorage, orxBOOL _bAddFirst)
 
orxDLLAPI orxSTATUS orxFASTCALL orxResource_ClearCache (const orxSTRING _zGroup)
 
orxDLLAPI void orxFASTCALL orxResource_Close (orxHANDLE _hResource)
 
orxDLLAPI orxSTATUS orxFASTCALL orxResource_Delete (const orxSTRING _zLocation)
 
orxDLLAPI void orxFASTCALL orxResource_Exit ()
 
orxDLLAPI orxU32 orxFASTCALL orxResource_GetCacheCount (const orxSTRING _zGroup)
 
orxDLLAPI const orxSTRING orxFASTCALL orxResource_GetGroup (orxU32 _u32Index)
 
orxDLLAPI orxU32 orxFASTCALL orxResource_GetGroupCount ()
 
orxDLLAPI const orxSTRING orxFASTCALL orxResource_GetLocation (orxHANDLE _hResource)
 
orxDLLAPI orxHANDLE orxFASTCALL orxResource_GetNextCachedLocation (const orxSTRING _zGroup, orxHANDLE _hIterator, const orxSTRING *_pzLocation, const orxSTRING *_pzStorage, const orxSTRING *_pzName)
 
orxDLLAPI const orxSTRING orxFASTCALL orxResource_GetPath (const orxSTRING _zLocation)
 
orxDLLAPI orxU32 orxFASTCALL orxResource_GetPendingOpCount (const orxHANDLE _hResource)
 
orxDLLAPI orxS64 orxFASTCALL orxResource_GetSize (orxHANDLE _hResource)
 
orxDLLAPI const orxSTRING orxFASTCALL orxResource_GetStorage (const orxSTRING _zGroup, orxU32 _u32Index)
 
orxDLLAPI orxU32 orxFASTCALL orxResource_GetStorageCount (const orxSTRING _zGroup)
 
orxDLLAPI orxS64 orxFASTCALL orxResource_GetTime (const orxSTRING _zLocation)
 
orxDLLAPI orxU32 orxFASTCALL orxResource_GetTotalPendingOpCount ()
 
orxDLLAPI const orxRESOURCE_TYPE_INFO *orxFASTCALL orxResource_GetType (const orxSTRING _zLocation)
 
orxDLLAPI orxU32 orxFASTCALL orxResource_GetTypeCount ()
 
orxDLLAPI const orxSTRING orxFASTCALL orxResource_GetTypeTag (orxU32 _u32Index)
 
orxDLLAPI orxSTATUS orxFASTCALL orxResource_Init ()
 
orxDLLAPI const orxSTRING orxFASTCALL orxResource_Locate (const orxSTRING _zGroup, const orxSTRING _zName)
 
orxDLLAPI const orxSTRING orxFASTCALL orxResource_LocateInStorage (const orxSTRING _zGroup, const orxSTRING _zStorage, const orxSTRING _zName)
 
orxDLLAPI orxHANDLE orxFASTCALL orxResource_Open (const orxSTRING _zLocation, orxBOOL _bEraseMode)
 
orxDLLAPI orxS64 orxFASTCALL orxResource_Read (orxHANDLE _hResource, orxS64 _s64Size, void *_pBuffer, orxRESOURCE_OP_FUNCTION _pfnCallback, void *_pContext)
 
orxDLLAPI orxSTATUS orxFASTCALL orxResource_RegisterType (const orxRESOURCE_TYPE_INFO *_pstInfo)
 
orxDLLAPI orxSTATUS orxFASTCALL orxResource_ReloadStorage ()
 
orxDLLAPI orxSTATUS orxFASTCALL orxResource_RemoveStorage (const orxSTRING _zGroup, const orxSTRING _zStorage)
 
orxDLLAPI orxS64 orxFASTCALL orxResource_Seek (orxHANDLE _hResource, orxS64 _s64Offset, orxSEEK_OFFSET_WHENCE _eWhence)
 
orxDLLAPI void orxFASTCALL orxResource_Setup ()
 
orxDLLAPI orxSTATUS orxFASTCALL orxResource_Sync (const orxSTRING _zGroup)
 
orxDLLAPI orxS64 orxFASTCALL orxResource_Tell (orxHANDLE _hResource)
 
orxDLLAPI orxSTATUS orxFASTCALL orxResource_UnregisterType (const orxSTRING _zTypeTag)
 
orxDLLAPI orxS64 orxFASTCALL orxResource_Write (orxHANDLE _hResource, orxS64 _s64Size, const void *_pBuffer, orxRESOURCE_OP_FUNCTION _pfnCallback, void *_pContext)
 

Detailed Description

Resource module Module that handles resource mapping

Macro Definition Documentation

#define orxRESOURCE_KC_LOCATION_SEPARATOR   ':'

Misc

Definition at line 49 of file orxResource.h.

#define orxRESOURCE_KZ_DEFAULT_STORAGE   "."

Definition at line 51 of file orxResource.h.

#define orxRESOURCE_KZ_TYPE_TAG_FILE   "file"

Definition at line 52 of file orxResource.h.

Typedef Documentation

typedef void(orxFASTCALL * orxRESOURCE_FUNCTION_CLOSE) (orxHANDLE _hResource)

Definition at line 65 of file orxResource.h.

typedef orxSTATUS(orxFASTCALL * orxRESOURCE_FUNCTION_DELETE) (const orxSTRING _zLocation)

Definition at line 71 of file orxResource.h.

typedef orxS64(orxFASTCALL * orxRESOURCE_FUNCTION_GET_SIZE) (orxHANDLE _hResource)

Definition at line 66 of file orxResource.h.

typedef orxS64(orxFASTCALL * orxRESOURCE_FUNCTION_GET_TIME) (const orxSTRING _zLocation)

Definition at line 63 of file orxResource.h.

typedef const orxSTRING(orxFASTCALL * orxRESOURCE_FUNCTION_LOCATE) (const orxSTRING _zGroup, const orxSTRING _zStorage, const orxSTRING _zName, orxBOOL _bRequireExistence)

Resource handlers

Definition at line 62 of file orxResource.h.

typedef orxHANDLE(orxFASTCALL * orxRESOURCE_FUNCTION_OPEN) (const orxSTRING _zLocation, orxBOOL _bEraseMode)

Definition at line 64 of file orxResource.h.

typedef orxS64(orxFASTCALL * orxRESOURCE_FUNCTION_READ) (orxHANDLE _hResource, orxS64 _s64Size, void *_pBuffer)

Definition at line 69 of file orxResource.h.

typedef orxS64(orxFASTCALL * orxRESOURCE_FUNCTION_SEEK) (orxHANDLE _hResource, orxS64 _s64Offset, orxSEEK_OFFSET_WHENCE _eWhence)

Definition at line 67 of file orxResource.h.

typedef orxS64(orxFASTCALL * orxRESOURCE_FUNCTION_TELL) (orxHANDLE _hResource)

Definition at line 68 of file orxResource.h.

typedef orxS64(orxFASTCALL * orxRESOURCE_FUNCTION_WRITE) (orxHANDLE _hResource, orxS64 _s64Size, const void *_pBuffer)

Definition at line 70 of file orxResource.h.

typedef void(orxFASTCALL * orxRESOURCE_OP_FUNCTION) (orxHANDLE _hResource, orxS64 _s64Size, void *_pBuffer, void *_pContext)

Resource asynchronous operation callback function

Definition at line 57 of file orxResource.h.

Enumeration Type Documentation

Event enum

Enumerator
orxRESOURCE_EVENT_UPDATE 
orxRESOURCE_EVENT_ADD 
orxRESOURCE_EVENT_REMOVE 
orxRESOURCE_EVENT_NUMBER 
orxRESOURCE_EVENT_NONE 

Definition at line 93 of file orxResource.h.

Function Documentation

orxDLLAPI orxSTATUS orxFASTCALL orxResource_AddStorage ( const orxSTRING  _zGroup,
const orxSTRING  _zStorage,
orxBOOL  _bAddFirst 
)

Adds a storage for a given resource group

Parameters
[in]_zGroupConcerned resource group
[in]_zStorageDescription of the storage, as understood by one of the resource type
[in]_bAddFirstIf true this storage will be used before any already added ones, otherwise it'll be used after all those
Returns
orxSTATUS_SUCCESS / orxSTATUS_FAILURE
orxDLLAPI orxSTATUS orxFASTCALL orxResource_ClearCache ( const orxSTRING  _zGroup)

Clears cache for specific resource group(s)

Parameters
[in]_zGroupConcerned resource group, orxNULL for all groups
Returns
orxSTATUS_SUCCESS / orxSTATUS_FAILURE
orxDLLAPI void orxFASTCALL orxResource_Close ( orxHANDLE  _hResource)

Closes a resource

Parameters
[in]_hResourceConcerned resource
orxDLLAPI orxSTATUS orxFASTCALL orxResource_Delete ( const orxSTRING  _zLocation)

Deletes a resource, given its location

Parameters
[in]_zLocationLocation of the resource to delete
Returns
orxSTATUS_SUCCESS upon success, orxSTATUS_FAILURE otherwise
orxDLLAPI void orxFASTCALL orxResource_Exit ( )

Exits from the resource module

orxDLLAPI orxU32 orxFASTCALL orxResource_GetCacheCount ( const orxSTRING  _zGroup)

Gets the cached location count for a given group

Parameters
[in]_zGroupConcerned resource group
Returns
Item number
orxDLLAPI const orxSTRING orxFASTCALL orxResource_GetGroup ( orxU32  _u32Index)

Gets resource group at given index

Parameters
[in]_u32IndexIndex of resource group
Returns
Resource group if index is valid, orxNULL otherwise
orxDLLAPI orxU32 orxFASTCALL orxResource_GetGroupCount ( )

Gets number of resource groups

Returns
Number of resource groups
orxDLLAPI const orxSTRING orxFASTCALL orxResource_GetLocation ( orxHANDLE  _hResource)

Gets the literal location of a resource

Parameters
[in]_hResourceConcerned resource
Returns
Literal location string
orxDLLAPI orxHANDLE orxFASTCALL orxResource_GetNextCachedLocation ( const orxSTRING  _zGroup,
orxHANDLE  _hIterator,
const orxSTRING *  _pzLocation,
const orxSTRING *  _pzStorage,
const orxSTRING *  _pzName 
)

Gets the next cached location for the given group and returns an iterator for next search

Parameters
[in]_zGroupConcerned resource group
[in]_hIteratorIterator from previous search or orxHANDLE_UNDEFINED/orxNULL for a new search
[out]_pzLocationCurrent resource's location, orxNULL to ignore
[out]_pzStorageCurrent resource's storage, orxNULL to ignore
[out]_pzNameCurrent resource's name, orxNULL to ignore
Returns
Iterator for next element if an element has been found, orxHANDLE_UNDEFINED otherwise
orxDLLAPI const orxSTRING orxFASTCALL orxResource_GetPath ( const orxSTRING  _zLocation)

Gets the resource path from a location

Parameters
[in]_zLocationLocation of the concerned resource
Returns
Path string if valid, orxSTRING_EMPTY otherwise
orxDLLAPI orxU32 orxFASTCALL orxResource_GetPendingOpCount ( const orxHANDLE  _hResource)

Gets pending operation count for a given resource

Parameters
[in]_hResourceConcerned resource
Returns
Number of pending asynchronous operations for that resource
orxDLLAPI orxS64 orxFASTCALL orxResource_GetSize ( orxHANDLE  _hResource)

Gets the size, in bytes, of a resource

Parameters
[in]_hResourceConcerned resource
Returns
Size of the resource, in bytes
orxDLLAPI const orxSTRING orxFASTCALL orxResource_GetStorage ( const orxSTRING  _zGroup,
orxU32  _u32Index 
)

Gets storage at given index for a given resource group

Parameters
[in]_zGroupConcerned resource group
[in]_u32IndexIndex of storage
Returns
Storage if index is valid, orxNULL otherwise
orxDLLAPI orxU32 orxFASTCALL orxResource_GetStorageCount ( const orxSTRING  _zGroup)

Gets number of storages for a given resource group

Parameters
[in]_zGroupConcerned resource group
Returns
Number of storages for this resource group
orxDLLAPI orxS64 orxFASTCALL orxResource_GetTime ( const orxSTRING  _zLocation)

Gets the time of last modification of a resource

Parameters
[in]_zLocationLocation of the concerned resource
Returns
Time of last modification, in seconds since epoch, if found, 0 otherwise
orxDLLAPI orxU32 orxFASTCALL orxResource_GetTotalPendingOpCount ( )

Gets total pending operation count

Returns
Number of total pending asynchronous operations
orxDLLAPI const orxRESOURCE_TYPE_INFO* orxFASTCALL orxResource_GetType ( const orxSTRING  _zLocation)

Gets the resource type from a location

Parameters
[in]_zLocationLocation of the concerned resource
Returns
orxRESOURCE_TYPE_INFO if valid, orxNULL otherwise
orxDLLAPI orxU32 orxFASTCALL orxResource_GetTypeCount ( )

Gets number of registered resource types

Returns
Number of registered resource types
orxDLLAPI const orxSTRING orxFASTCALL orxResource_GetTypeTag ( orxU32  _u32Index)

Gets registered type tag at given index

Parameters
[in]_u32IndexIndex of storage
Returns
Type tag string if index is valid, orxNULL otherwise
orxDLLAPI orxSTATUS orxFASTCALL orxResource_Init ( )

Inits the resource module

Returns
orxSTATUS_SUCCESS / orxSTATUS_FAILURE
orxDLLAPI const orxSTRING orxFASTCALL orxResource_Locate ( const orxSTRING  _zGroup,
const orxSTRING  _zName 
)

Gets the location of an existing resource for a given group, location gets cached if found

Parameters
[in]_zGroupConcerned resource group
[in]_zNameName of the resource to locate
Returns
Location string if found, orxNULL otherwise
orxDLLAPI const orxSTRING orxFASTCALL orxResource_LocateInStorage ( const orxSTRING  _zGroup,
const orxSTRING  _zStorage,
const orxSTRING  _zName 
)

Gets the location for a resource (existing or not) in a specific storage, for a given group. The location doesn't get cached and thus needs to be copied by the caller before the next call

Parameters
[in]_zGroupConcerned resource group
[in]_zStorageConcerned storage, if orxNULL then the highest priority storage will be used
[in]_zNameName of the resource
Returns
Location string if found, orxNULL otherwise
orxDLLAPI orxHANDLE orxFASTCALL orxResource_Open ( const orxSTRING  _zLocation,
orxBOOL  _bEraseMode 
)

Opens the resource at the given location

Parameters
[in]_zLocationLocation of the resource to open
[in]_bEraseModeIf true, the file will be erased if existing or created otherwise, if false, no content will get destroyed when opening
Returns
Handle to the open location, orxHANDLE_UNDEFINED otherwise
orxDLLAPI orxS64 orxFASTCALL orxResource_Read ( orxHANDLE  _hResource,
orxS64  _s64Size,
void _pBuffer,
orxRESOURCE_OP_FUNCTION  _pfnCallback,
void _pContext 
)

Reads data from a resource

Parameters
[in]_hResourceConcerned resource
[in]_s64SizeSize to read (in bytes)
[out]_pBufferBuffer that will be filled by the read data
[in]_pfnCallbackCallback that will get called after asynchronous operation; if orxNULL, operation will be synchronous
[in]_pContextContext that will be transmitted to the callback when called
Returns
Size of the read data, in bytes or -1 for successful asynchronous call
orxDLLAPI orxSTATUS orxFASTCALL orxResource_RegisterType ( const orxRESOURCE_TYPE_INFO _pstInfo)

Registers a new resource type

Parameters
[in]_pstInfoInfo describing the new resource type and how to handle it
Returns
orxSTATUS_SUCCESS / orxSTATUS_FAILURE
orxDLLAPI orxSTATUS orxFASTCALL orxResource_ReloadStorage ( )

Reloads storage from config

Returns
orxSTATUS_SUCCESS / orxSTATUS_FAILURE
orxDLLAPI orxSTATUS orxFASTCALL orxResource_RemoveStorage ( const orxSTRING  _zGroup,
const orxSTRING  _zStorage 
)

Removes storage(s) for specific resource group(s)

Parameters
[in]_zGroupConcerned resource group, orxNULL for all groups
[in]_zStorageConcerned storage, orxNULL for all storages (except default one)
Returns
orxSTATUS_SUCCESS / orxSTATUS_FAILURE
orxDLLAPI orxS64 orxFASTCALL orxResource_Seek ( orxHANDLE  _hResource,
orxS64  _s64Offset,
orxSEEK_OFFSET_WHENCE  _eWhence 
)

Seeks a position in a given resource (moves cursor)

Parameters
[in]_hResourceConcerned resource
[in]_s64OffsetNumber of bytes to offset from 'origin'
[in]_eWhenceStarting point for the offset computation (start, current position or end)
Returns
Absolute cursor position if successful, -1 otherwise
orxDLLAPI void orxFASTCALL orxResource_Setup ( )

Resource module setup

orxDLLAPI orxSTATUS orxFASTCALL orxResource_Sync ( const orxSTRING  _zGroup)

Syncs all cached resources for specific resource group(s): update, add or remove events will be sent for all resources that are not located in their original storage anymore

Parameters
[in]_zGroupConcerned resource group, orxNULL for all groups
Returns
orxSTATUS_SUCCESS / orxSTATUS_FAILURE
orxDLLAPI orxS64 orxFASTCALL orxResource_Tell ( orxHANDLE  _hResource)

Tells the position of the cursor in a given resource

Parameters
[in]_hResourceConcerned resource
Returns
Position (offset), in bytes
orxDLLAPI orxSTATUS orxFASTCALL orxResource_UnregisterType ( const orxSTRING  _zTypeTag)

Unregisters a resource type

Parameters
[in]_zTypeTagTag of the resource type to unregister
Returns
orxSTATUS_SUCCESS / orxSTATUS_FAILURE
orxDLLAPI orxS64 orxFASTCALL orxResource_Write ( orxHANDLE  _hResource,
orxS64  _s64Size,
const void _pBuffer,
orxRESOURCE_OP_FUNCTION  _pfnCallback,
void _pContext 
)

Writes data to a resource

Parameters
[in]_hResourceConcerned resource
[in]_s64SizeSize to write (in bytes)
[out]_pBufferBuffer that will be written
[in]_pfnCallbackCallback that will get called after asynchronous operation; if orxNULL, operation will be synchronous
[in]_pContextContext that will be transmitted to the callback when called
Returns
Size of the written data, in bytes, 0 if nothing could be written/no write support for this resource type or -1 for successful asynchronous call

Generated for orx by doxygen 1.8.11