1 | /*!
|
---|
2 | @file
|
---|
3 | @brief System.IOに属す例外クラスの定義
|
---|
4 | */
|
---|
5 |
|
---|
6 | Namespace ActiveBasic
|
---|
7 |
|
---|
8 | Const AB_E_IO = &h80041620 '80131620
|
---|
9 | Const AB_E_FILENOTFOUND = STG_E_FILENOTFOUND '0x80070002
|
---|
10 |
|
---|
11 | End Namespace
|
---|
12 |
|
---|
13 | Namespace System
|
---|
14 | Namespace IO
|
---|
15 |
|
---|
16 | /*!
|
---|
17 | @brief IO処理に関する例外のクラス
|
---|
18 | @author Egtra
|
---|
19 | @date 2007/12/06
|
---|
20 | */
|
---|
21 | Class IOException
|
---|
22 | Inherits SystemException
|
---|
23 | Public
|
---|
24 | /*!
|
---|
25 | @biref コンストラクタ
|
---|
26 | */
|
---|
27 | Sub IOException()
|
---|
28 | SystemException(GetType().FullName)
|
---|
29 | HResult = ActiveBasic.AB_E_IO
|
---|
30 | End Sub
|
---|
31 | /*!
|
---|
32 | @biref コンストラクタ
|
---|
33 | @param[in] message エラーメッセージ
|
---|
34 | */
|
---|
35 | Sub IOException(message As String)
|
---|
36 | SystemException(message)
|
---|
37 | HResult = ActiveBasic.AB_E_IO
|
---|
38 | End Sub
|
---|
39 | /*!
|
---|
40 | @biref コンストラクタ
|
---|
41 | @param[in] message エラーメッセージ
|
---|
42 | @param[in] innerException 内部例外
|
---|
43 | */
|
---|
44 | Sub IOException(message As String, innerException As Exception)
|
---|
45 | SystemException(message, innerException)
|
---|
46 | HResult = ActiveBasic.AB_E_IO
|
---|
47 | End Sub
|
---|
48 | /*!
|
---|
49 | @biref コンストラクタ
|
---|
50 | @param[in] message エラーメッセージ
|
---|
51 | @param[in] hr HRESULT例外値
|
---|
52 | */
|
---|
53 | Sub IOException(message As String, hr As HRESULT)
|
---|
54 | SystemException(message)
|
---|
55 | HResult = hr
|
---|
56 | End Sub
|
---|
57 | End Class
|
---|
58 |
|
---|
59 | Namespace Detail
|
---|
60 | /*!
|
---|
61 | @brief Windowsエラー値を基にIOExceptionを投げる。
|
---|
62 | @param[in] message エラーメッセージ
|
---|
63 | @author Egtra
|
---|
64 | @date 2007/12/06
|
---|
65 | */
|
---|
66 | Sub ThrowWinIOException(msg As String, error As DWord)
|
---|
67 | Throw New IOException(msg, HRESULT_FROM_WIN32(error))
|
---|
68 | End Sub
|
---|
69 |
|
---|
70 | /*!
|
---|
71 | @brief GetLastError()の値を基にIOExceptionを投げる。
|
---|
72 | @param[in] message エラーメッセージ
|
---|
73 | @author Egtra
|
---|
74 | @date 2007/12/06
|
---|
75 | */
|
---|
76 | Sub ThrowWinLastErrorIOException(msg As String)
|
---|
77 | Throw New IOException(msg, HRESULT_FROM_WIN32(GetLastError()))
|
---|
78 | End Sub
|
---|
79 | End Namespace
|
---|
80 |
|
---|
81 |
|
---|
82 | /*!
|
---|
83 | @brief ディスク上に指定したファイル名が見つからない際の例外
|
---|
84 | @author NoWest
|
---|
85 | @date 2008/08/11
|
---|
86 | */
|
---|
87 | Class FileNotFoundException
|
---|
88 | Inherits SystemException
|
---|
89 | Public
|
---|
90 | /*!
|
---|
91 | @biref コンストラクタ
|
---|
92 | */
|
---|
93 | Sub FileNotFoundException()
|
---|
94 | SystemException(GetType().FullName)
|
---|
95 | HResult = ActiveBasic.AB_E_FILENOTFOUND
|
---|
96 | End Sub
|
---|
97 | /*!
|
---|
98 | @biref コンストラクタ
|
---|
99 | @param[in] message エラーメッセージ
|
---|
100 | */
|
---|
101 | Sub FileNotFoundException(message As String)
|
---|
102 | SystemException(message)
|
---|
103 | HResult = ActiveBasic.AB_E_FILENOTFOUND
|
---|
104 | End Sub
|
---|
105 | /*!
|
---|
106 | @biref コンストラクタ
|
---|
107 | @param[in] message エラーメッセージ
|
---|
108 | @param[in] innerException 内部例外
|
---|
109 | */
|
---|
110 | Sub FileNotFoundException(message As String, innerException As Exception)
|
---|
111 | SystemException(message, innerException)
|
---|
112 | HResult = ActiveBasic.AB_E_FILENOTFOUND
|
---|
113 | End Sub
|
---|
114 | End Class
|
---|
115 |
|
---|
116 | End Namespace 'IO
|
---|
117 | End Namespace 'System
|
---|