vbox的更動 36523 路徑 trunk/include
- 時間撮記:
- 2011-4-4 下午12:40:10 (14 年 以前)
- 位置:
- trunk/include/iprt/cpp
- 檔案:
-
- 修改 2 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/include/iprt/cpp/exception.h
r36508 r36523 28 28 29 29 #include <iprt/cpp/ministring.h> 30 31 namespace iprt 32 { 30 #include <exception> 33 31 34 32 /** @defgroup grp_rt_cpp_exceptions C++ Exceptions … … 41 39 * The XML exceptions are based on this. 42 40 */ 43 class RT_DECL_CLASS Error41 class RT_DECL_CLASS RTCError 44 42 : public std::exception 45 43 { 46 44 public: 47 45 48 Error(const char *pcszMessage)49 : m_s (pcszMessage)46 RTCError(const char *pszMessage) 47 : m_strMsg(pszMessage) 50 48 { 51 49 } 52 50 53 Error(const iprt::MiniString &s)54 : m_s (s)51 RTCError(const iprt::MiniString &a_rstrMessage) 52 : m_strMsg(a_rstrMessage) 55 53 { 56 54 } 57 55 58 Error(const Error &s)59 : std::exception( s),60 m_s (s.what())56 RTCError(const RTCError &a_rSrc) 57 : std::exception(a_rSrc), 58 m_strMsg(a_rSrc.what()) 61 59 { 62 60 } 63 61 64 virtual ~ Error() throw()62 virtual ~RTCError() throw() 65 63 { 66 64 } 67 65 68 void operator=(const Error &s)66 void operator=(const RTCError &a_rSrc) 69 67 { 70 m_s = s.what();68 m_strMsg = a_rSrc.what(); 71 69 } 72 70 73 void setWhat(const char * pcszMessage)71 void setWhat(const char *a_pszMessage) 74 72 { 75 m_s = pcszMessage;73 m_strMsg = a_pszMessage; 76 74 } 77 75 78 virtual const char *what() const throw()76 virtual const char *what() const throw() 79 77 { 80 return m_s .c_str();78 return m_strMsg.c_str(); 81 79 } 82 80 83 81 private: 84 /* Hide the default constructor to make sure the extended one above is 85 always used. */ 86 Error(); 82 /** 83 * Hidden default constructor making sure that the extended one above is 84 * always used. 85 */ 86 RTCError(); 87 87 88 iprt::MiniString m_s; 88 /** The exception message. */ 89 iprt::MiniString m_strMsg; 89 90 }; 90 91 91 92 /** @} */ 92 93 93 } /* namespace iprt */94 95 94 #endif 96 95 -
trunk/include/iprt/cpp/xml.h
r36508 r36523 65 65 ////////////////////////////////////////////////////////////////////////////// 66 66 67 class RT_DECL_CLASS LogicError : public iprt::Error67 class RT_DECL_CLASS LogicError : public RTCError 68 68 { 69 69 public: 70 70 71 71 LogicError(const char *aMsg = NULL) 72 : iprt::Error(aMsg)72 : RTCError(aMsg) 73 73 {} 74 74 … … 76 76 }; 77 77 78 class RT_DECL_CLASS RuntimeError : public iprt::Error78 class RT_DECL_CLASS RuntimeError : public RTCError 79 79 { 80 80 public: 81 81 82 82 RuntimeError(const char *aMsg = NULL) 83 : iprt::Error(aMsg)83 : RTCError(aMsg) 84 84 {} 85 85 };
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器