OSDN Git Service

SDKサンプルを参考にXAudio2でストリーミング再生してみた。
[shooting3/shootinggame.git] / ShootingGame / exception.h
1 #pragma once
2
3 namespace sf
4 {
5         template <typename ExceptionTag> class ExceptionT :  public std::exception
6         {
7         public:
8                 typedef ExceptionTag tag;
9                 explicit ExceptionT(const std::wstring& reason)
10                 {
11                         m_reason = reason;
12                 };
13                 const wchar_t * what() {return m_reason.c_str();};
14                 const std::wstring& what_str() { return m_reason;};
15         protected:
16                 std::wstring m_reason;
17         };
18
19         #define DefineException(x) struct x {}; typedef ExceptionT<x> x## Exception;
20
21         inline void ThrowIfErr(HRESULT hr) {if(hr != S_OK){throw Platform::Exception::CreateException(hr);}}
22
23 }
24