📄 mldirectxerror.h
字号:
///////////////////////////////////////////////////////////////////////////////
//
// File: mlDirectXError.h
//
// Author: Frank Luna (C) All Rights Reserved
//
// System: Athlon 1800+ XP, 512 DDR, Radeon 9500 Pro, Windows XP, MSVC++ 7.0
//
// Desc: Contains exception classes for handling DirectX errors.
//
///////////////////////////////////////////////////////////////////////////////
#ifndef __mlDirectXErrorH__
#define __mlDirectXErrorH__
#include "mlWinAppUtility.h"
namespace dx_err
{
class DirectXError
{
public:
DirectXError();
DirectXError(HRESULT& hrCode, cstring& filename, uint32& lineNum);
cstring& getHRCode();
cstring& getFilename();
cstring& getLineNum();
std::string getFullError();
private:
std::string _hrCode;
std::string _filename;
std::string _lineNum;
};
inline void ThrowDxErr(HRESULT hr, cstring& filename, uint32 lineNum)
{
if(FAILED(hr))
{
throw DirectXError(hr, filename, lineNum);
}
}
// We do not want the client to have to enter in the __FILE__ and __LINE__
// macros everytime. So we provide a simpler interface. Note that we must
// use a macro, instead of a function, since __FILE__ and __LINE__ are
// relative to the file they are called in. So we need the macro to be
// expanded in the actual file we write THROW_DXERR. If we used a function
// __FILE__ and __LINE__ would be relative to this file "mlDirectXError.h".
// Note: '#' operator, in '#hr' for example, returns the value of hr
// as a string.
#define THROW_DXERR(hr) ThrowDxErr(hr, __FILE__, __LINE__);
}
#endif // __mlDirectXErrorH__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -