239 #ifndef INCLUDED_H_MGR
240 #define INCLUDED_H_MGR
249 #ifndef INCLUDED_HANDLE
268 no boilerplate init, h_alloc calls ctor directly, make sure it fits in the memory slot
269 vtbl contains sizeof resource data, and name!
270 but- has to handle variable params, a bit ugly
296 void (*
init)(
void* user, va_list);
307 #define H_TYPE_DEFINE(type)\
309 static void type##_init(type*, va_list);\
310 static Status type##_reload(type*, const PIVFS&, const VfsPath&, Handle);\
311 static void type##_dtor(type*);\
312 static Status type##_validate(const type*);\
313 static Status type##_to_string(const type*, wchar_t* buf);\
314 static H_VTbl V_##type =\
316 (void (*)(void*, va_list))type##_init,\
317 (Status (*)(void*, const PIVFS&, const VfsPath&, Handle))type##_reload,\
318 (void (*)(void*))type##_dtor,\
319 (Status (*)(const void*))type##_validate,\
320 (Status (*)(const void*, wchar_t*))type##_to_string,\
324 static H_Type H_##type = &V_##type
334 #define H_USER_DATA(h, type) (type*)h_user_data(h, H_##type)
341 #define H_DEREF(h, type, var)\
345 WARN_RETURN((Status)h);\
346 type* const var = H_USER_DATA(h, type);\
348 WARN_RETURN(ERR::INVALID_HANDLE);
432 #endif // #ifndef INCLUDED_H_MGR
Status h_free(Handle &h, H_Type type)
Status(* to_string)(const void *user, wchar_t *buf)
Status h_force_free(Handle h, H_Type type)
VfsPath h_filename(const Handle h)
Handle h_alloc(H_Type type, const PIVFS &vfs, const VfsPath &pathname, size_t flags,...)
intptr_t h_get_refcnt(Handle h)
Status h_reload(const PIVFS &vfs, const VfsPath &pathname)
Status(* reload)(void *user, const PIVFS &vfs, const VfsPath &pathname, Handle)
Handle h_find(H_Type type, uintptr_t key)
i64 Status
Error handling system.
i64 Handle
`handle' representing a reference to a resource (sound, texture, etc.)
void h_mgr_free_type(const H_Type type)
void(* init)(void *user, va_list)
void * h_user_data(const Handle h, const H_Type type)
Status(* validate)(const void *user)
const size_t H_STRING_LEN