📄 resarrayhandle.h
字号:
// ResArrayHandle.h
//
// Author: Lea Hayes
// Date Created: 12/03/2006
// Date Modified: 12/03/2006
#pragma once
#include "ResListNode.h"
#include "DirectXTexture.h"
#include "DirectXObject.h"
#include "DirectXFont.h"
namespace Resources
{
class ResArrayHandle
{
// Construction and deconstruction.
public:
ResArrayHandle(LPRESLISTNODE pNode);
ResArrayHandle(const ResArrayHandle &handle);
virtual ~ResArrayHandle();
// Properties.
inline bool IsValid() const
{
return m_pItem != NULL;
}
inline bool IsResourceValid() const
{
return IsValid() && m_pItem->IsResourceValid();
}
inline LPRESOURCE GetResource()
{
return IsValid() ? m_pItem->m_pRes : NULL;
}
inline size_t GetIndex() const
{
return IsValid() ? m_pItem->GetIndex() : NULL;
}
// Helper inline type-casting functions.
inline DirectXTexture* ToDirectXTexture()
{
return reinterpret_cast<DirectXTexture*>(GetResource());
}
inline DirectXObject* ToDirectXObject()
{
return reinterpret_cast<DirectXObject*>(GetResource());
}
inline DirectXFont* ToDirectXFont()
{
return reinterpret_cast<DirectXFont*>(GetResource());
}
// Operator overloads.
inline bool operator== (const ResArrayHandle& handle)
{
return m_pItem == handle.m_pItem;
}
inline bool operator!= (const ResArrayHandle& handle)
{
return m_pItem != handle.m_pItem;
}
inline LPRESOURCE operator*()
{
return m_pItem->m_pRes;
}
inline LPRESOURCE operator-> ()
{
return m_pItem->m_pRes;
}
inline operator LPRESLISTNODE ()
{
return m_pItem;
}
// Only resource arrays and of course the iterator itself have access to
// protected iterator members.
friend class ResourceArray;
// Attributes.
protected:
LPRESLISTNODE m_pItem; // Pointer to array item.
};
}; // namespace Resources
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -