source: trunk/Include/Classes/System/IO/Exception.ab @ 435

Last change on this file since 435 was 435, checked in by イグトランス (egtra), 16 years ago

Consoleをスレッド安全化(クリティカルセクション使用)。
Exception.HResultをPublicにした。
StringBuilder?.Replaceが正しく機能しない問題を解消。

File size: 1.7 KB
Line 
1/*!
2@file
3@brief  System.IOに属す例外クラスの定義
4*/
5
6Namespace ActiveBasic
7
8Const AB_E_IO = &h80041620 '80131620
9
10End Namespace
11
12Namespace System
13Namespace IO
14
15/*!
16@brief  IO処理に関する例外のクラス
17@author Egtra
18@date   2007/12/06
19*/
20Class IOException
21    Inherits SystemException
22Public
23    /*!
24    @biref  コンストラクタ
25    */
26    Sub IOException()
27        Exception(GetType().FullName, Nothing)
28        HResult = ActiveBasic.AB_E_IO
29    End Sub
30    /*!
31    @biref  コンストラクタ
32    @param[in] message  エラーメッセージ
33    */
34    Sub IOException(message As String)
35        Exception(message, Nothing)
36        HResult = ActiveBasic.AB_E_IO
37    End Sub
38    /*!
39    @biref  コンストラクタ
40    @param[in] message  エラーメッセージ
41    @param[in] innerException   内部例外
42    */
43    Sub IOException(message As String, innerException As Exception)
44        Exception(message, innerException)
45        HResult = ActiveBasic.AB_E_IO
46    End Sub
47    /*!
48    @biref  コンストラクタ
49    @param[in] message  エラーメッセージ
50    @param[in] hr   HRESULT例外値
51    */
52    Sub IOException(message As String, hr As HRESULT)
53        Exception(message, Nothing)
54        HResult = hr
55    End Sub
56End Class
57
58Namespace Detail
59    /*!
60    @brief  Windowsエラー値を基にIOExceptionを投げる。
61    @param[in] message  エラーメッセージ
62    @author Egtra
63    @date   2007/12/06
64    */
65    Sub ThrowWinIOException(msg As String, error As DWord)
66        Throw New IOException(msg, HRESULT_FROM_WIN32(error))
67    End Sub
68
69    /*!
70    @brief  GetLastError()の値を基にIOExceptionを投げる。
71    @param[in] message  エラーメッセージ
72    @author Egtra
73    @date   2007/12/06
74    */
75    Sub ThrowWinLastErrorIOException(msg As String)
76        Throw New IOException(msg, HRESULT_FROM_WIN32(GetLastError()))
77    End Sub
78End Namespace
79
80End Namespace 'IO
81End Namespace 'System
Note: See TracBrowser for help on using the repository browser.