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
xiiStringView GetResourceID () const
xiiStringView GetResourceIdOrDescription () const
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 xiiRTTI * GetResourceType () const
 Returns the type information of the resource or nullptr if the handle is invalid.

Protected Attributes

xiiResource * m_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.

Constructor & Destructor Documentation

◆ xiiTypelessResourceHandle()

xiiTypelessResourceHandle::xiiTypelessResourceHandle ( xiiResource * pResource)

[internal] Increases the refcount of the given resource.

Copyright (c) Theophilus Eriata. All Rights Reserved.

Member Function Documentation

◆ GetResourceID()

xiiStringView xiiTypelessResourceHandle::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.

◆ GetResourceIDHash()

xiiUInt64 xiiTypelessResourceHandle::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.

◆ GetResourceIdOrDescription()

xiiStringView xiiTypelessResourceHandle::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.


The documentation for this class was generated from the following files:
  • /home/runner/work/XII/XII/Source/Engine/Core/ResourceManager/ResourceHandle.h
  • /home/runner/work/XII/XII/Source/Engine/Core/ResourceManager/Implementation/ResourceHandle.cpp