orx  stable
Portable Game Engine
OrxResource

Data Structures

struct  orxRESOURCE_EVENT_PAYLOAD
 
struct  orxRESOURCE_TYPE_INFO
 

Macros

#define orxRESOURCE_KC_LOCATION_SEPARATOR   ':'
 

Typedefs

typedef void(orxFASTCALL * orxRESOURCE_FUNCTION_CLOSE) (orxHANDLE _hResource)
 
typedef orxS64(orxFASTCALL * orxRESOURCE_FUNCTION_GET_SIZE) (orxHANDLE _hResource)
 
typedef orxS64(orxFASTCALL * orxRESOURCE_FUNCTION_GET_TIME) (const orxSTRING _zPath)
 
typedef const orxSTRING(orxFASTCALL * orxRESOURCE_FUNCTION_LOCATE) (const orxSTRING _zStorage, const orxSTRING _zName, orxBOOL _bRequireExistence)
 
typedef orxHANDLE(orxFASTCALL * orxRESOURCE_FUNCTION_OPEN) (const orxSTRING _zPath, 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 ()
 
orxDLLAPI void orxFASTCALL orxResource_Close (orxHANDLE _hResource)
 
orxDLLAPI void orxFASTCALL orxResource_Exit ()
 
orxDLLAPI const orxSTRING orxFASTCALL orxResource_GetGroup (orxU32 _u32Index)
 
orxDLLAPI orxU32 orxFASTCALL orxResource_GetGroupCounter ()
 
orxDLLAPI const orxSTRING orxFASTCALL orxResource_GetLocation (orxHANDLE _hResource)
 
orxDLLAPI const orxSTRING orxFASTCALL orxResource_GetPath (const orxSTRING _zLocation)
 
orxDLLAPI orxU32 orxFASTCALL orxResource_GetPendingOpCounter (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_GetStorageCounter (const orxSTRING _zGroup)
 
orxDLLAPI orxS64 orxFASTCALL orxResource_GetTime (const orxSTRING _zLocation)
 
orxDLLAPI orxU32 orxFASTCALL orxResource_GetTotalPendingOpCounter ()
 
orxDLLAPI const orxRESOURCE_TYPE_INFO *orxFASTCALL orxResource_GetType (const orxSTRING _zLocation)
 
orxDLLAPI orxU32 orxFASTCALL orxResource_GetTypeCounter ()
 
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 orxS64 orxFASTCALL orxResource_Tell (orxHANDLE _hResource)
 
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   ':'

Definition at line 47 of file orxResource.h.

Typedef Documentation

typedef void(orxFASTCALL * orxRESOURCE_FUNCTION_CLOSE) (orxHANDLE _hResource)

Definition at line 60 of file orxResource.h.

typedef orxS64(orxFASTCALL * orxRESOURCE_FUNCTION_GET_SIZE) (orxHANDLE _hResource)

Definition at line 61 of file orxResource.h.

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

Definition at line 58 of file orxResource.h.

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

Resource handlers

Definition at line 57 of file orxResource.h.

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

Definition at line 59 of file orxResource.h.

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

Definition at line 64 of file orxResource.h.

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

Definition at line 62 of file orxResource.h.

typedef orxS64(orxFASTCALL * orxRESOURCE_FUNCTION_TELL) (orxHANDLE _hResource)

Definition at line 63 of file orxResource.h.

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

Definition at line 65 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 52 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 86 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 ( )

Clears cache

Returns
orxSTATUS_SUCCESS / orxSTATUS_FAILURE
orxDLLAPI void orxFASTCALL orxResource_Close ( orxHANDLE  _hResource)

Closes a resource

Parameters
[in]_hResourceConcerned resource
orxDLLAPI void orxFASTCALL orxResource_Exit ( )

Exits from the resource module

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_GetGroupCounter ( )

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 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_GetPendingOpCounter ( const orxHANDLE  _hResource)

Gets pending operation counter 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_GetStorageCounter ( 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_GetTotalPendingOpCounter ( )

Gets total pending operation counter

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_GetTypeCounter ( )

Gets number of registered resource types

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

Gets registered type info 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 a storage for a given resource group

Parameters
[in]_zGroupConcerned resource group
[in]_zStorageConcerned storage
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
orxDLLAPI void orxFASTCALL orxResource_Setup ( )

Resource module setup

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 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.5.6