Ignore:
Timestamp:
Dec 7, 2007, 12:21:58 AM (17 years ago)
Author:
イグトランス (egtra)
Message:

FileStream非同期読み書きの修正、例外処理の追加。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Include/Classes/System/Exception.ab

    r385 r391  
    33#require <Classes/ActiveBasic/misc.ab>
    44
     5Namespace ActiveBasic
    56'右のコメントは対応するCOR_E_ナントカのコード
    67Const AB_E_EXCEPTION = &h80041500 '80131500
     
    1213Const AB_E_NOTSUPPORTED = &h80041515 '80131515
    1314Const AB_E_PLATFORMNOTSUPPORTED = &h80041539 '80131539
     15
     16End Namespace
    1417
    1518/*
     
    5760    Sub Exception()
    5861        init(GetType().FullName, Nothing)
    59         hr = AB_E_EXCEPTION
     62        hr = ActiveBasic.AB_E_EXCEPTION
    6063    End Sub
    6164    /*!
     
    6568    Sub Exception(message As String)
    6669        init(message, Nothing)
    67         hr = AB_E_EXCEPTION
     70        hr = ActiveBasic.AB_E_EXCEPTION
    6871    End Sub
    6972    /*!
     
    7477    Sub Exception(message As String, innerException As Exception)
    7578        init(message, innerException)
    76         hr = AB_E_EXCEPTION
     79        hr = ActiveBasic.AB_E_EXCEPTION
    7780    End Sub
    7881
     
    190193    Sub SystemException()
    191194        Exception(GetType().FullName, Nothing)
    192         HResult = AB_E_SYSTEM
     195        HResult = ActiveBasic.AB_E_SYSTEM
    193196    End Sub
    194197    /*!
     
    198201    Sub SystemException(message As String)
    199202        Exception(message, Nothing)
    200         HResult = AB_E_SYSTEM
     203        HResult = ActiveBasic.AB_E_SYSTEM
    201204    End Sub
    202205    /*!
     
    207210    Sub SystemException(message As String, innerException As Exception)
    208211        Exception(message, innerException)
    209         HResult = AB_E_SYSTEM
     212        HResult = ActiveBasic.AB_E_SYSTEM
    210213    End Sub
    211214End Class
     
    224227    Sub ArgumentException()
    225228        SystemException("One or more arguments have invalid value.", Nothing)
    226         HResult = AB_E_ARGUMENT
     229        HResult = ActiveBasic.AB_E_ARGUMENT
    227230    End Sub
    228231    /*!
     
    232235    Sub ArgumentException(message As String)
    233236        SystemException(message, Nothing)
    234         HResult = AB_E_ARGUMENT
     237        HResult = ActiveBasic.AB_E_ARGUMENT
    235238    End Sub
    236239    /*!
     
    241244    Sub ArgumentException(message As String, innerException As Exception)
    242245        SystemException(message, innerException)
    243         HResult = AB_E_ARGUMENT
     246        HResult = ActiveBasic.AB_E_ARGUMENT
    244247    End Sub
    245248    /*!
     
    251254        SystemException(message, Nothing)
    252255        param = paramName
    253         HResult = AB_E_ARGUMENT
     256        HResult = ActiveBasic.AB_E_ARGUMENT
    254257    End Sub
    255258    /*!
     
    262265        SystemException(message, innerException)
    263266        param = paramName
    264         HResult = AB_E_ARGUMENT
     267        HResult = ActiveBasic.AB_E_ARGUMENT
    265268    End Sub
    266269
     
    337340    Sub ArgumentOutOfRangeException()
    338341        ArgumentException("One or more arguments ware out of range value.", "", Nothing)
    339         HResult = AB_E_ARGUMENTOUTOFRANGE
     342        HResult = ActiveBasic.AB_E_ARGUMENTOUTOFRANGE
    340343    End Sub
    341344    /*!
     
    345348    Sub ArgumentOutOfRangeException(message As String)
    346349        ArgumentException(message, "", Nothing)
    347         HResult = AB_E_ARGUMENTOUTOFRANGE
     350        HResult = ActiveBasic.AB_E_ARGUMENTOUTOFRANGE
    348351    End Sub
    349352    /*!
     
    354357    Sub ArgumentOutOfRangeException(message As String, innerException As Exception)
    355358        ArgumentException(message, "", innerException)
    356         HResult = AB_E_ARGUMENTOUTOFRANGE
     359        HResult = ActiveBasic.AB_E_ARGUMENTOUTOFRANGE
    357360    End Sub
    358361    /*!
     
    363366    Sub ArgumentOutOfRangeException(message As String, paramName As String)
    364367        ArgumentException(message, paramName, Nothing)
    365         HResult = AB_E_ARGUMENTOUTOFRANGE
     368        HResult = ActiveBasic.AB_E_ARGUMENTOUTOFRANGE
    366369    End Sub
    367370    /*!
     
    374377        ArgumentException(message, paramName, Nothing)
    375378        actualValueObject = actualValue
    376         HResult = AB_E_ARGUMENTOUTOFRANGE
     379        HResult = ActiveBasic.AB_E_ARGUMENTOUTOFRANGE
    377380    End Sub
    378381
     
    411414    Sub IndexOutOfRangeException()
    412415        SystemException("The index was out of range value.", Nothing)
    413         HResult = AB_E_INDEXOUTOFRANGE
     416        HResult = ActiveBasic.AB_E_INDEXOUTOFRANGE
    414417    End Sub
    415418    /*!
     
    419422    Sub IndexOutOfRangeException(message As String)
    420423        SystemException(message, Nothing)
    421         HResult = AB_E_INDEXOUTOFRANGE
     424        HResult = ActiveBasic.AB_E_INDEXOUTOFRANGE
    422425    End Sub
    423426    /*!
     
    428431    Sub IndexOutOfRangeException(message As String, innerException As Exception)
    429432        SystemException(message, innerException)
    430         HResult = AB_E_INDEXOUTOFRANGE
     433        HResult = ActiveBasic.AB_E_INDEXOUTOFRANGE
    431434    End Sub
    432435End Class
     
    445448    Sub InvalidOperationException()
    446449        SystemException("The operation is invalid.", Nothing)
    447         HResult = AB_E_INVALIDOPERATION
     450        HResult = ActiveBasic.AB_E_INVALIDOPERATION
    448451    End Sub
    449452    /*!
     
    453456    Sub InvalidOperationException(message As String)
    454457        SystemException(message, Nothing)
    455         HResult = AB_E_INVALIDOPERATION
     458        HResult = ActiveBasic.AB_E_INVALIDOPERATION
    456459    End Sub
    457460    /*!
     
    462465    Sub InvalidOperationException(message As String, innerException As Exception)
    463466        SystemException(message, innerException)
    464         HResult = AB_E_INVALIDOPERATION
    465     End Sub
     467        HResult = ActiveBasic.AB_E_INVALIDOPERATION
     468    End Sub
     469End Class
     470
     471/*!
     472@brief  博されたオブジェクトを操作しようとしたことを表す例外
     473@author Egtra
     474@date   2007/12/06
     475*/
     476Class ObjectDisposedException
     477    Inherits InvalidOperationException
     478Public
     479    /*!
     480    @biref  コンストラクタ
     481    */
     482    Sub ObjectDisposedException()
     483        InvalidOperationException("The object has been disposed.", Nothing)
     484        HResult = ActiveBasic.AB_E_INVALIDOPERATION
     485    End Sub
     486    /*!
     487    @biref  コンストラクタ
     488    @param[in] message  エラーメッセージ
     489    */
     490    Sub ObjectDisposedException(message As String)
     491        InvalidOperationException(message, Nothing)
     492        HResult = ActiveBasic.AB_E_INVALIDOPERATION
     493    End Sub
     494    /*!
     495    @biref  コンストラクタ
     496    @param[in] message  エラーメッセージ
     497    @param[in] innerException   内部例外
     498    */
     499    Sub ObjectDisposedException(message As String, innerException As Exception)
     500        InvalidOperationException(message, innerException)
     501        HResult = ActiveBasic.AB_E_INVALIDOPERATION
     502    End Sub
     503    /*!
     504    @biref  コンストラクタ
     505    @param[in] objectName   操作しようとしたオブジェクトの名前
     506    @param[in] message  エラーメッセージ
     507    */
     508    Sub ObjectDisposedException(objectName As String, message As String)
     509        InvalidOperationException(message, Nothing)
     510        HResult = ActiveBasic.AB_E_INVALIDOPERATION
     511        objName = " object: " + objectName
     512    End Sub
     513    /*!
     514    @brief  この例外が発生したとき、操作しようとしていたオブジェクトの名前を返す。
     515    */
     516    Function ObjectName() As String
     517        Return objName
     518    End Function
     519
     520    Override Function ToString() As String
     521        ToString = Super.ToString()
     522        If Not ActiveBasic.IsNothing(objName) Then
     523            ToString += objName
     524        End If
     525    End Function
     526Private
     527    objName As String
    466528End Class
    467529
     
    513575    Sub NotSupportedException()
    514576        SystemException("This operation is not supported,", Nothing)
    515         HResult = AB_E_NOTSUPPORTED
     577        HResult = ActiveBasic.AB_E_NOTSUPPORTED
    516578    End Sub
    517579    /*!
     
    521583    Sub NotSupportedException(message As String)
    522584        SystemException(message, Nothing)
    523         HResult = AB_E_NOTSUPPORTED
     585        HResult = ActiveBasic.AB_E_NOTSUPPORTED
    524586    End Sub
    525587    /*!
     
    530592    Sub NotSupportedException(message As String, innerException As Exception)
    531593        SystemException(message, innerException)
    532         HResult = AB_E_NOTSUPPORTED
     594        HResult = ActiveBasic.AB_E_NOTSUPPORTED
    533595    End Sub
    534596End Class
     
    547609    Sub PlatformNotSupportedException()
    548610        NotSupportedException("This operation is not supported in this platform.", Nothing)
    549         HResult = AB_E_PLATFORMNOTSUPPORTED
     611        HResult = ActiveBasic.AB_E_PLATFORMNOTSUPPORTED
    550612    End Sub
    551613    /*!
     
    555617    Sub PlatformNotSupportedException(message As String)
    556618        NotSupportedException(message, Nothing)
    557         HResult = AB_E_PLATFORMNOTSUPPORTED
     619        HResult = ActiveBasic.AB_E_PLATFORMNOTSUPPORTED
    558620    End Sub
    559621    /*!
     
    564626    Sub PlatformNotSupportedException(message As String, innerException As Exception)
    565627        NotSupportedException(message, innerException)
    566         HResult = AB_E_PLATFORMNOTSUPPORTED
     628        HResult = ActiveBasic.AB_E_PLATFORMNOTSUPPORTED
    567629    End Sub
    568630End Class
Note: See TracChangeset for help on using the changeset viewer.