source: Include/Classes/System/Diagnostics/Trace.ab@ 66

Last change on this file since 66 was 66, checked in by dai, 17 years ago
File size: 2.4 KB
RevLine 
[45]1
[43]2Class Trace
[45]3 Static indentLevel = 0 As Long
4 Static indentSize = 4 As Long
[44]5
[45]6
[58]7 ' リスナ管理
8 Static Listeners As TraceListenerCollection
[45]9
[43]10Public
[44]11
[45]12 '----------------------------------------------------------------
13 ' パブリック メソッド
14 '----------------------------------------------------------------
[44]15
[45]16 ' アサート(コールスタックを表示)
[44]17 Static Sub Assert( condition As Boolean )
18 If condition == False then
19 'TODO: コールスタックを表示
20 End If
21 End Sub
[45]22
23 ' アサート(メッセージ文字列を表示)
[44]24 Static Sub Assert( condition As Boolean, message As String )
25 If condition == False then
[45]26 ' TODO: メッセージボックス形式での表示に対応
[44]27 WriteLine( message )
28 End If
29 End Sub
30
[45]31 ' アサート(メッセージ文字列と詳細文字列を表示)
32 Static Sub Assert( condition As Boolean, message As String, detailMessage As String )
33 If condition == False then
34 ' TODO: メッセージボックス形式での表示に対応
35 WriteLine( message )
36 End If
37 End Sub
38
39
[44]40 ' インデントレベルを上げる
41 Static Sub Indent()
[58]42 IndentLevel = indentLevel + 1
[44]43 End Sub
44
45 ' インデントレベルを下げる
46 Static Sub Unindent()
[45]47 If indentLevel <= 0 Then
48 indentLevel = 0
[44]49 Return
50 End If
[58]51 IndentLevel = indentLevel - 1
[44]52 End Sub
53
[58]54 Static Sub Write( message As String )
55
56 End Sub
57
[44]58 ' 一行の文字列を出力
[43]59 Static Sub WriteLine( message As String )
[58]60 Dim i As Long
61 For i = 0 To ELM( Listeners.Count )
62 Dim temp As TraceListener
63 temp = Listeners[i]
64 temp.WriteLine( message )
65 Next
[43]66 End Sub
[45]67
68
69 '----------------------------------------------------------------
70 ' パブリック プロパティ
71 '----------------------------------------------------------------
72
73 ' IndentLevelプロパティ
74 Static Function IndentLevel() As Long
75 Return indentLevel
76 End Function
[58]77 Static Sub IndentLevel( indentLevel As Long )
78 This.indentLevel = indentLevel
79
80 Dim i As Long
81 For i = 0 To ELM( Listeners.Count )
82 Dim temp As TraceListener
83 temp = Listeners[i]
84 temp.IndentLevel = indentLevel
85 Next
[45]86 End Sub
87
88 ' IndentSizeプロパティ
89 Static Function IndentSize() As Long
90 Return indentSize
91 End Function
92 Static Sub IndentSize( size As Long )
93 indentSize = size
94
[58]95 Dim i As Long
96 For i = 0 To ELM( Listeners.Count )
97 Dim temp As TraceListener
98 temp = Listeners[i]
99 temp.IndentSize = indentSize
100 Next
[45]101 End Sub
102
[43]103End Class
[66]104
105Dim _System_defaultTraceListener As DefaultTraceListener
106Trace.Listeners.Add( _System_defaultTraceListener )
Note: See TracBrowser for help on using the repository browser.