XII Release 0.1.0
Loading...
Searching...
No Matches
xiiTypelessResourceHandle Class Reference

The typeless implementation of resource handles. A typed interface is provided by xiiTypedResourceHandle. More...

#include <ResourceHandle.h>

Public Member Functions

 xiiTypelessResourceHandle (xiiResource *pResource)
 [internal] Increases the refcount of the given resource.
 
XII_ALWAYS_INLINE xiiTypelessResourceHandle (const xiiTypelessResourceHandle &rhs)
 Increases the refcount of the given resource.
 
XII_ALWAYS_INLINE xiiTypelessResourceHandle (xiiTypelessResourceHandle &&rhs)
 Move constructor, no refcount change is necessary.
 
XII_ALWAYS_INLINE ~xiiTypelessResourceHandle ()
 Releases any referenced resource.
 
XII_ALWAYS_INLINE bool IsValid () const
 Returns whether the handle stores a valid pointer to a resource.
 
void Invalidate ()
 Clears any reference to a resource and reduces its refcount.
 
xiiUInt64 GetResourceIDHash () const
 Returns the Resource ID hash of the exact resource that this handle points to, without acquiring the resource. The handle must be valid.
 
xiiStringView GetResourceID () const
 Returns the Resource ID of the exact resource that this handle points to, without acquiring the resource. If the handle is not valid, an empty string is returned.
 
xiiStringView GetResourceIdOrDescription () const
 The returns the resource description, if available, otherwise the resource ID. This is mainly for logging, where you want the more user friendly description, but the ID, if no description is available. If the handle is not valid, an empty string is returned.
 
void operator= (const xiiTypelessResourceHandle &rhs)
 Releases the current reference and increases the refcount of the given resource.
 
void operator= (xiiTypelessResourceHandle &&rhs)
 Move operator, no refcount change is necessary.
 
XII_ALWAYS_INLINE bool operator== (const xiiTypelessResourceHandle &rhs) const
 Checks whether the two handles point to the same resource.
 
XII_ALWAYS_INLINE bool operator< (const xiiTypelessResourceHandle &rhs) const
 For storing handles as keys in maps.
 
XII_ALWAYS_INLINE bool operator== (const xiiResource *rhs) const
 Checks whether the handle points to the given resource.
 
const xiiRTTIGetResourceType () const
 Returns the type information of the resource or nullptr if the handle is invalid.
 

Protected Attributes

xiiResourcem_pResource = nullptr
 

Friends

class xiiResourceManager
 
class xiiResourceHandleWriteContext
 
class xiiResourceHandleReadContext
 
class xiiResourceHandleStreamOperations
 

Detailed Description

The typeless implementation of resource handles. A typed interface is provided by xiiTypedResourceHandle.


The documentation for this class was generated from the following files: