[391] | 1 | /*!
|
---|
| 2 | @file
|
---|
| 3 | @brief System.IOに属す例外クラスの定義
|
---|
| 4 | */
|
---|
| 5 |
|
---|
| 6 | Namespace ActiveBasic
|
---|
| 7 |
|
---|
| 8 | Const AB_E_IO = &h80041620 '80131620
|
---|
[584] | 9 | Const AB_E_FILENOTFOUND = STG_E_FILENOTFOUND '0x80070002
|
---|
[391] | 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()
|
---|
[560] | 28 | SystemException(GetType().FullName)
|
---|
[391] | 29 | HResult = ActiveBasic.AB_E_IO
|
---|
| 30 | End Sub
|
---|
| 31 | /*!
|
---|
| 32 | @biref コンストラクタ
|
---|
| 33 | @param[in] message エラーメッセージ
|
---|
| 34 | */
|
---|
| 35 | Sub IOException(message As String)
|
---|
[560] | 36 | SystemException(message)
|
---|
[391] | 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)
|
---|
[560] | 45 | SystemException(message, innerException)
|
---|
[391] | 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)
|
---|
[560] | 54 | SystemException(message)
|
---|
[391] | 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)
|
---|
[435] | 67 | Throw New IOException(msg, HRESULT_FROM_WIN32(error))
|
---|
[391] | 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)
|
---|
[435] | 77 | Throw New IOException(msg, HRESULT_FROM_WIN32(GetLastError()))
|
---|
[391] | 78 | End Sub
|
---|
| 79 | End Namespace
|
---|
| 80 |
|
---|
[584] | 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 |
|
---|
[391] | 116 | End Namespace 'IO
|
---|
| 117 | End Namespace 'System
|
---|