ezEngine  Release 25.03
ezTypelessResourceHandle Class Reference

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

#include <ResourceHandle.h>

Public Member Functions

 ezTypelessResourceHandle (ezResource *pResource)
 [internal] Increases the refcount of the given resource.
 
EZ_ALWAYS_INLINE ezTypelessResourceHandle (const ezTypelessResourceHandle &rhs)
 Increases the refcount of the given resource.
 
EZ_ALWAYS_INLINE ezTypelessResourceHandle (ezTypelessResourceHandle &&rhs)
 Move constructor, no refcount change is necessary.
 
EZ_ALWAYS_INLINE ~ezTypelessResourceHandle ()
 Releases any referenced resource.
 
EZ_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.
 
ezUInt64 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.
 
ezStringView 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.
 
ezStringView 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 ezTypelessResourceHandle &rhs)
 Releases the current reference and increases the refcount of the given resource.
 
void operator= (ezTypelessResourceHandle &&rhs)
 Move operator, no refcount change is necessary.
 
EZ_ALWAYS_INLINE bool operator== (const ezTypelessResourceHandle &rhs) const
 Checks whether the two handles point to the same resource.
 
EZ_ALWAYS_INLINE bool operator!= (const ezTypelessResourceHandle &rhs) const
 Checks whether the two handles point to the same resource.
 
EZ_ALWAYS_INLINE bool operator< (const ezTypelessResourceHandle &rhs) const
 For storing handles as keys in maps.
 
EZ_ALWAYS_INLINE bool operator== (const ezResource *rhs) const
 Checks whether the handle points to the given resource.
 
EZ_ALWAYS_INLINE bool operator!= (const ezResource *rhs) const
 Checks whether the handle points to the given resource.
 
const ezRTTIGetResourceType () const
 Returns the type information of the resource or nullptr if the handle is invalid.
 

Protected Attributes

ezResourcem_pResource = nullptr
 

Friends

class ezResourceManager
 
class ezResourceHandleWriteContext
 
class ezResourceHandleReadContext
 
class ezResourceHandleStreamOperations
 

Detailed Description

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


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