Changeset 58 for Include/Classes/System/Diagnostics
- Timestamp:
- Jan 12, 2007, 3:21:30 AM (18 years ago)
- Location:
- Include/Classes/System/Diagnostics
- Files:
-
- 2 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Include/Classes/System/Diagnostics/Trace.ab
r45 r58 1 1 2 ' リスナ3 Class TraceListener4 End Class5 2 6 3 ' リスナコレクション 7 4 Class TraceListenerCollection 5 ppListeners As **TraceListener 6 count As Long 8 7 Public 8 9 Sub TraceListenerCollection() 10 ppListeners = _System_malloc( 1 ) 11 End Sub 12 Sub ~TraceListenerCollection() 13 Dim i As Long 14 For i = 0 To ELM( count ) 15 Delete ppListeners[i] 16 Next 17 _System_free( ppListeners ) 18 End Sub 9 19 10 20 '---------------------------------------------------------------- … … 13 23 14 24 ' リスナを追加 15 Function Add( listener As TraceListener ) 16 ' TODO: 実装 17 End Function 25 Sub Add( listener As TraceListener ) As Long 26 ppListeners = _System_realloc( ppListeners, ( count + 1 ) * SizeOf( *TraceListener ) ) 27 ppListeners[count] = New TraceListener( listener ) 28 count++ 29 End Sub 18 30 19 31 ' 複数のリスナを追加 20 32 Sub AddRange( listeners As TraceListenerCollection ) 21 33 ' TODO: 実装 22 End Function34 End Sub 23 35 24 36 ' リストからすべてのリスナを削除 … … 50 62 '---------------------------------------------------------------- 51 63 64 ' インデクサ ( Getter ) 65 Function Operator[] ( index As Long ) As TraceListener 66 If index < 0 or count <= index Then 67 ' TODO: エラー処理 68 debug 69 End If 70 71 Dim tempListener As TraceListener( ByVal ppListeners[index] ) 72 Return tempListener 73 End Function 74 52 75 ' 保有するリスナの数を取得する 53 76 Function Count() As Long 54 ' TODO: 実装 55 End Function 56 57 ' リスナを取得する 58 Function Item( index As Long ) As TraceListener 59 ' TODO: 実装 77 Return count 60 78 End Function 61 79 End Class … … 65 83 Static indentSize = 4 As Long 66 84 67 Static Function GetIndentString() As String68 Dim i As Long69 85 70 Dim IndentStr = "" 71 For i = 0 To ELM( indentSize ) 72 IndentStr = IndentStr + " " 73 Next 74 75 Dim ResultStr = "" 76 For i = 0 To ELM( indentLevel ) 77 ResultStr = ResultStr + IndentStr 78 Next 79 80 Return ResultStr 81 End Function 86 ' リスナ管理 87 Static Listeners As TraceListenerCollection 82 88 83 89 Public … … 113 119 ' インデントレベルを上げる 114 120 Static Sub Indent() 115 indentLevel++121 IndentLevel = indentLevel + 1 116 122 End Sub 117 123 … … 122 128 Return 123 129 End If 124 indentLevel-- 130 IndentLevel = indentLevel - 1 131 End Sub 132 133 Static Sub Write( message As String ) 134 125 135 End Sub 126 136 127 137 ' 一行の文字列を出力 128 138 Static Sub WriteLine( message As String ) 129 Dim tempmsg = GetIndentString() + message + Ex"\n" 130 131 ' TODO: リスナへの出力を実装 139 Dim i As Long 140 For i = 0 To ELM( Listeners.Count ) 141 Dim temp As TraceListener 142 temp = Listeners[i] 143 temp.WriteLine( message ) 144 Next 132 145 End Sub 133 146 … … 141 154 Return indentLevel 142 155 End Function 143 Static Sub IndentLevel( level As Long ) 144 indentLevel = level 156 Static Sub IndentLevel( indentLevel As Long ) 157 This.indentLevel = indentLevel 158 159 Dim i As Long 160 For i = 0 To ELM( Listeners.Count ) 161 Dim temp As TraceListener 162 temp = Listeners[i] 163 temp.IndentLevel = indentLevel 164 Next 145 165 End Sub 146 166 … … 151 171 Static Sub IndentSize( size As Long ) 152 172 indentSize = size 153 End Sub154 173 155 ' Listenersプロパティ156 Static Function Listeners() As TraceListenerCollection157 Return listeners158 End Function159 Static Sub Listeners( listeners As TraceListenerCollection )160 This.listeners = listeners174 Dim i As Long 175 For i = 0 To ELM( Listeners.Count ) 176 Dim temp As TraceListener 177 temp = Listeners[i] 178 temp.IndentSize = indentSize 179 Next 161 180 End Sub 162 181
Note:
See TracChangeset
for help on using the changeset viewer.