📄 errorhandling.h
字号:
#ifndef ERRORHANDLING_H__INCLUDED
#define ERRORHANDLING_H__INCLUDED
#include <windows.h>
#include <string>
#include "dxerr8.h"
namespace AudioEngine {
extern bool ThrowCError(HRESULT hr, std::string err, std::string filename, int line);
#define ThrowIfFailed(result, err) { \
if(FAILED(result)) { \
if (!ThrowCError(result, err, __FILE__, __LINE__)) { \
_asm { int 3 } \
} \
} \
} \
#define Throw(err) { \
if (!ThrowCError(NULL, err, __FILE__, __LINE__)) { \
_asm { int 3 } \
} \
} \
class CError
{
public:
CError(HRESULT hr, std::string err, std::string filename, int line) {
SetFile(filename);
SetError(err);
SetLine(line);
if (hr) SetReason(DXGetErrorString8(hr));
}
virtual ~CError() { }
std::string GetFile() { return(m_File); }
void SetFile(std::string f) { m_File = f; }
std::string GetError() { return(m_Error); }
void SetError(std::string f) { m_Error = f; }
int GetLine() { return(m_Line); }
void SetLine(int l) { m_Line = l; }
std::string GetReason() { return(m_Reason); }
void SetReason(std::string f) { m_Reason = f; }
std::string GetMessageBoxString();
protected:
std::string m_File;
int m_Line;
std::string m_Error;
std::string m_Reason;
};
}; // namespace
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -