Changeset 45


Ignore:
Timestamp:
Jan 6, 2007, 10:46:56 PM (17 years ago)
Author:
dai
Message:

リスナとの関係を作った。ほとんどのメソッドがTODOになっているので、実装が必要。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Include/Classes/System/Diagnostics/Trace.ab

    r44 r45  
     1
     2' リスナ
     3Class TraceListener
     4End Class
     5
     6' リスナコレクション
     7Class TraceListenerCollection
     8Public
     9
     10    '----------------------------------------------------------------
     11    ' パブリック メソッド
     12    '----------------------------------------------------------------
     13
     14    ' リスナを追加
     15    Function Add( listener As TraceListener )
     16        ' TODO: 実装
     17    End Function
     18
     19    ' 複数のリスナを追加
     20    Sub AddRange( listeners As TraceListenerCollection )
     21        ' TODO: 実装
     22    End Function
     23
     24    ' リストからすべてのリスナを削除
     25    Sub Clear()
     26        ' TODO: 実装
     27    End Sub
     28
     29    ' 指定したリスナのインデックスを取得
     30    Function IndexOf( listener As TraceListener )
     31        ' TODO: 実装
     32    End Function
     33
     34    ' リスナを挿入
     35    Sub Insert( index As Long, listener As TraceListener )
     36        ' TODO: 実装
     37    End Sub
     38
     39    ' リスナを削除
     40    Function Remove( name As String )
     41        ' TODO: 実装
     42    End Function
     43    Function Remove( listener As TraceListener )
     44        ' TODO: 実装
     45    End Function
     46
     47
     48    '----------------------------------------------------------------
     49    ' パブリック プロパティ
     50    '----------------------------------------------------------------
     51
     52    ' 保有するリスナの数を取得する
     53    Function Count() As Long
     54        ' TODO: 実装
     55    End Function
     56
     57    ' リスナを取得する
     58    Function Item( index As Long ) As TraceListener
     59        ' TODO: 実装
     60    End Function
     61End Class
     62
    163Class Trace
    2     Static IndentNum = 0 As Long
     64    Static indentLevel = 0 As Long
     65    Static indentSize = 4 As Long
    366
    467    Static Function GetIndentString() As String
    568        Dim i As Long
     69
     70        Dim IndentStr = ""
     71        For i = 0 To ELM( indentSize )
     72            IndentStr = IndentStr + " "
     73        Next
     74
    675        Dim ResultStr = ""
    7         For i = 0 To ELM( IndentNum )
    8             ResultStr = ResultStr + Ex"\t"
     76        For i = 0 To ELM( indentLevel )
     77            ResultStr = ResultStr + IndentStr
    978        Next
     79
    1080        Return ResultStr
    1181    End Function
     82
    1283Public
    1384
    14 /*
    15     TODO: 実装
     85    '----------------------------------------------------------------
     86    ' パブリック メソッド
     87    '----------------------------------------------------------------
    1688
    17     ' アサート表示
     89    ' アサート(コールスタックを表示)
    1890    Static Sub Assert( condition As Boolean )
    1991        If condition == False then
     
    2193        End If
    2294    End Sub
     95
     96    ' アサート(メッセージ文字列を表示)
    2397    Static Sub Assert( condition As Boolean, message As String )
    2498        If condition == False then
     99            ' TODO: メッセージボックス形式での表示に対応
    25100            WriteLine( message )
    26101        End If
    27102    End Sub
    28 */
     103
     104    ' アサート(メッセージ文字列と詳細文字列を表示)
     105    Static Sub Assert( condition As Boolean, message As String, detailMessage As String )
     106        If condition == False then
     107            ' TODO: メッセージボックス形式での表示に対応
     108            WriteLine( message )
     109        End If
     110    End Sub
     111
    29112
    30113    ' インデントレベルを上げる
    31114    Static Sub Indent()
    32         IndentNum++
     115        indentLevel++
    33116    End Sub
    34117
    35118    ' インデントレベルを下げる
    36119    Static Sub Unindent()
    37         If IndentNum <= 0 Then
    38             IndentNum = 0
     120        If indentLevel <= 0 Then
     121            indentLevel = 0
    39122            Return
    40123        End If
    41         IndentNum--
     124        indentLevel--
    42125    End Sub
    43126
     
    45128    Static Sub WriteLine( message As String )
    46129        Dim tempmsg = GetIndentString() + message + Ex"\n"
    47         OutputDebugString( tempmsg )
     130
     131        ' TODO: リスナへの出力を実装
    48132    End Sub
     133
     134
     135    '----------------------------------------------------------------
     136    ' パブリック プロパティ
     137    '----------------------------------------------------------------
     138
     139    ' IndentLevelプロパティ
     140    Static Function IndentLevel() As Long
     141        Return indentLevel
     142    End Function
     143    Static Sub IndentLevel( level As Long )
     144        indentLevel = level
     145    End Sub
     146
     147    ' IndentSizeプロパティ
     148    Static Function IndentSize() As Long
     149        Return indentSize
     150    End Function
     151    Static Sub IndentSize( size As Long )
     152        indentSize = size
     153    End Sub
     154
     155    ' Listenersプロパティ
     156    Static Function Listeners() As TraceListenerCollection
     157        Return listeners
     158    End Function
     159    Static Sub Listeners( listeners As TraceListenerCollection )
     160        This.listeners = listeners
     161    End Sub
     162
    49163End Class
Note: See TracChangeset for help on using the changeset viewer.