Changeset 69 for Include/Classes/System


Ignore:
Timestamp:
Jan 19, 2007, 3:34:12 AM (18 years ago)
Author:
dai
Message:

Trace/Debugクラスを実装(リスナ系にちょっとTODOが残っている…)。

Location:
Include/Classes/System
Files:
1 added
8 edited

Legend:

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

    r43 r69  
    22
    33Class Debug
     4    Static base As _System_TraceBase()
     5
    46Public
     7
     8    '----------------------------------------------------------------
     9    ' パブリック メソッド
     10    '----------------------------------------------------------------
     11
     12    ' アサート(コールスタックを表示)
     13    Static Sub Assert( condition As Boolean )
     14        base.Assert( condition )
     15    End Sub
     16
     17    ' アサート(メッセージ文字列を表示)
     18    Static Sub Assert( condition As Boolean, message As String )
     19        base.Assert( condition, message )
     20    End Sub
     21
     22    ' アサート(メッセージ文字列と詳細文字列を表示)
     23    Static Sub Assert( condition As Boolean, message As String, detailMessage As String )
     24        base.Assert( condition, message, detailMessage )
     25    End Sub
     26
     27
     28    ' インデントレベルを上げる
     29    Static Sub Indent()
     30        base.Indent()
     31    End Sub
     32
     33    ' インデントレベルを下げる
     34    Static Sub Unindent()
     35        base.Unindent()
     36    End Sub
     37
     38    ' 文字列を出力
     39    Static Sub Write( value As Object )
     40        base.Write( value )
     41    End Sub
     42    Static Sub Write( message As String )
     43        base.Write( message )
     44    End Sub
     45    Static Sub Write( value As Object, category As String )
     46        base.Write( value, category )
     47    End Sub
     48    Static Sub Write( message As String, category As String )
     49        base.Write( message, category )
     50    End Sub
     51
     52    ' 一行の文字列を出力
     53    Static Sub WriteLine( value As Object )
     54        base.WriteLine( value )
     55    End Sub
    556    Static Sub WriteLine( message As String )
    6         Trace.WriteLine( message )
    7     End Sub
     57        base.WriteLine( message )
     58    End Sub
     59    Static Sub WriteLine( value As Object, category As String )
     60        base.WriteLine( value, category )
     61    End Sub
     62    Static Sub WriteLine( message As String, category As String )
     63        base.WriteLine( message, category )
     64    End Sub
     65
     66    ' 条件をもとに文字列を出力
     67    Static Sub WriteIf( condition As Boolean, value As Object )
     68        base.WriteIf( condition, value )
     69    End Sub
     70    Static Sub WriteIf( condition As Boolean, message As String )
     71        base.WriteIf( condition, message )
     72    End Sub
     73    Static Sub WriteIf( condition As Boolean, value As Object, category As String )
     74        base.WriteIf( condition, value, category )
     75    End Sub
     76    Static Sub WriteIf( condition As Boolean, message As String, category As String )
     77        base.WriteIf( condition, message, category )
     78    End Sub
     79
     80    ' 条件をもとに一行の文字列を出力
     81    Static Sub WriteLineIf( condition As Boolean, message As String )
     82        base.WriteLineIf( condition, message )
     83    End Sub
     84    Static Sub WriteLineIf( condition As Boolean, value As Object )
     85        base.WriteLineIf( condition, value )
     86    End Sub
     87    Static Sub WriteLineIf( condition As Boolean, value As Object, category As String )
     88        base.WriteLineIf( condition, value, category )
     89    End Sub
     90    Static Sub WriteLineIf( condition As Boolean, message As String, category As String )
     91        base.WriteLineIf( condition, message, category )
     92    End Sub
     93
     94
     95    '----------------------------------------------------------------
     96    ' パブリック プロパティ
     97    '----------------------------------------------------------------
     98
     99    ' IndentLevelプロパティ
     100    Static Function IndentLevel() As Long
     101        Return base.IndentLevel
     102    End Function
     103    Static Sub IndentLevel( indentLevel As Long )
     104        base.IndentLevel = indentLevel
     105    End Sub
     106
     107    ' IndentSizeプロパティ
     108    Static Function IndentSize() As Long
     109        Return base.IndentSize
     110    End Function
     111    Static Sub IndentSize( size As Long )
     112        base.IndentSize = size
     113    End Sub
     114
     115    ' Listenersプロパティ
     116    Static Function Listeners() As TraceListenerCollection
     117        Return base.Listeners
     118    End Function
    8119End Class
    9120
     
    11122
    12123Class Debug
     124    Static base As _System_TraceBase()
     125
    13126Public
     127
     128    '----------------------------------------------------------------
     129    ' パブリック メソッド
     130    '----------------------------------------------------------------
     131
     132    ' アサート(コールスタックを表示)
     133    Static Sub Assert( condition As Boolean )
     134        'base.Assert( condition )
     135    End Sub
     136
     137    ' アサート(メッセージ文字列を表示)
     138    Static Sub Assert( condition As Boolean, message As String )
     139        'base.Assert( condition, message )
     140    End Sub
     141
     142    ' アサート(メッセージ文字列と詳細文字列を表示)
     143    Static Sub Assert( condition As Boolean, message As String, detailMessage As String )
     144        'base.Assert( condition, message, detailMessage )
     145    End Sub
     146
     147
     148    ' インデントレベルを上げる
     149    Static Sub Indent()
     150        base.Indent()
     151    End Sub
     152
     153    ' インデントレベルを下げる
     154    Static Sub Unindent()
     155        base.Unindent()
     156    End Sub
     157
     158    ' 文字列を出力
     159    Static Sub Write( value As Object )
     160        'base.Write( value )
     161    End Sub
     162    Static Sub Write( message As String )
     163        'base.Write( message )
     164    End Sub
     165    Static Sub Write( value As Object, category As String )
     166        'base.Write( value, category )
     167    End Sub
     168    Static Sub Write( message As String, category As String )
     169        'base.Write( message, category )
     170    End Sub
     171
     172    ' 一行の文字列を出力
     173    Static Sub WriteLine( value As Object )
     174        'base.WriteLine( value )
     175    End Sub
    14176    Static Sub WriteLine( message As String )
    15     End Sub
     177        'base.WriteLine( message )
     178    End Sub
     179    Static Sub WriteLine( value As Object, category As String )
     180        'base.WriteLine( value, category )
     181    End Sub
     182    Static Sub WriteLine( message As String, category As String )
     183        'base.WriteLine( message, category )
     184    End Sub
     185
     186    ' 条件をもとに文字列を出力
     187    Static Sub WriteIf( condition As Boolean, value As Object )
     188        'base.WriteIf( condition, value )
     189    End Sub
     190    Static Sub WriteIf( condition As Boolean, message As String )
     191        'base.WriteIf( condition, message )
     192    End Sub
     193    Static Sub WriteIf( condition As Boolean, value As Object, category As String )
     194        'base.WriteIf( condition, value, category )
     195    End Sub
     196    Static Sub WriteIf( condition As Boolean, message As String, category As String )
     197        'base.WriteIf( condition, message, category )
     198    End Sub
     199
     200    ' 条件をもとに一行の文字列を出力
     201    Static Sub WriteLineIf( condition As Boolean, message As String )
     202        'base.WriteLineIf( condition, message )
     203    End Sub
     204    Static Sub WriteLineIf( condition As Boolean, value As Object )
     205        'base.WriteLineIf( condition, value )
     206    End Sub
     207    Static Sub WriteLineIf( condition As Boolean, value As Object, category As String )
     208        'base.WriteLineIf( condition, value, category )
     209    End Sub
     210    Static Sub WriteLineIf( condition As Boolean, message As String, category As String )
     211        'base.WriteLineIf( condition, message, category )
     212    End Sub
     213
     214
     215    '----------------------------------------------------------------
     216    ' パブリック プロパティ
     217    '----------------------------------------------------------------
     218
     219    ' IndentLevelプロパティ
     220    Static Function IndentLevel() As Long
     221        Return base.IndentLevel
     222    End Function
     223    Static Sub IndentLevel( indentLevel As Long )
     224        base.IndentLevel = indentLevel
     225    End Sub
     226
     227    ' IndentSizeプロパティ
     228    Static Function IndentSize() As Long
     229        Return base.IndentSize
     230    End Function
     231    Static Sub IndentSize( size As Long )
     232        base.IndentSize = size
     233    End Sub
     234
     235    ' Listenersプロパティ
     236    Static Function Listeners() As TraceListenerCollection
     237        Return base.Listeners
     238    End Function
    16239End Class
    17240
  • Include/Classes/System/Diagnostics/Trace.ab

    r66 r69  
    11
    22Class Trace
    3     Static indentLevel = 0 As Long
    4     Static indentSize = 4 As Long
    5 
    6 
    7     ' リスナ管理
    8     Static Listeners As TraceListenerCollection
     3    Static base As _System_TraceBase()
    94
    105Public
     
    1611    ' アサート(コールスタックを表示)
    1712    Static Sub Assert( condition As Boolean )
    18         If condition == False then
    19             'TODO: コールスタックを表示
    20         End If
     13        base.Assert( condition )
    2114    End Sub
    2215
    2316    ' アサート(メッセージ文字列を表示)
    2417    Static Sub Assert( condition As Boolean, message As String )
    25         If condition == False then
    26             ' TODO: メッセージボックス形式での表示に対応
    27             WriteLine( message )
    28         End If
     18        base.Assert( condition, message )
    2919    End Sub
    3020
    3121    ' アサート(メッセージ文字列と詳細文字列を表示)
    3222    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
     23        base.Assert( condition, message, detailMessage )
    3724    End Sub
    3825
     
    4027    ' インデントレベルを上げる
    4128    Static Sub Indent()
    42         IndentLevel = indentLevel + 1
     29        base.Indent()
    4330    End Sub
    4431
    4532    ' インデントレベルを下げる
    4633    Static Sub Unindent()
    47         If indentLevel <= 0 Then
    48             indentLevel = 0
    49             Return
    50         End If
    51         IndentLevel = indentLevel - 1
     34        base.Unindent()
    5235    End Sub
    5336
     37    ' 文字列を出力
     38    Static Sub Write( value As Object )
     39        base.Write( value )
     40    End Sub
    5441    Static Sub Write( message As String )
    55        
     42        base.Write( message )
     43    End Sub
     44    Static Sub Write( value As Object, category As String )
     45        base.Write( value, category )
     46    End Sub
     47    Static Sub Write( message As String, category As String )
     48        base.Write( message, category )
    5649    End Sub
    5750
    5851    ' 一行の文字列を出力
     52    Static Sub WriteLine( value As Object )
     53        base.WriteLine( value )
     54    End Sub
    5955    Static Sub WriteLine( message As String )
    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
     56        base.WriteLine( message )
     57    End Sub
     58    Static Sub WriteLine( value As Object, category As String )
     59        base.WriteLine( value, category )
     60    End Sub
     61    Static Sub WriteLine( message As String, category As String )
     62        base.WriteLine( message, category )
     63    End Sub
     64
     65    ' 条件をもとに文字列を出力
     66    Static Sub WriteIf( condition As Boolean, value As Object )
     67        base.WriteIf( condition, value )
     68    End Sub
     69    Static Sub WriteIf( condition As Boolean, message As String )
     70        base.WriteIf( condition, message )
     71    End Sub
     72    Static Sub WriteIf( condition As Boolean, value As Object, category As String )
     73        base.WriteIf( condition, value, category )
     74    End Sub
     75    Static Sub WriteIf( condition As Boolean, message As String, category As String )
     76        base.WriteIf( condition, message, category )
     77    End Sub
     78
     79    ' 条件をもとに一行の文字列を出力
     80    Static Sub WriteLineIf( condition As Boolean, message As String )
     81        base.WriteLineIf( condition, message )
     82    End Sub
     83    Static Sub WriteLineIf( condition As Boolean, value As Object )
     84        base.WriteLineIf( condition, value )
     85    End Sub
     86    Static Sub WriteLineIf( condition As Boolean, value As Object, category As String )
     87        base.WriteLineIf( condition, value, category )
     88    End Sub
     89    Static Sub WriteLineIf( condition As Boolean, message As String, category As String )
     90        base.WriteLineIf( condition, message, category )
    6691    End Sub
    6792
     
    7398    ' IndentLevelプロパティ
    7499    Static Function IndentLevel() As Long
    75         Return indentLevel
     100        Return base.IndentLevel
    76101    End Function
    77102    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
     103        base.IndentLevel = indentLevel
    86104    End Sub
    87105
    88106    ' IndentSizeプロパティ
    89107    Static Function IndentSize() As Long
    90         Return indentSize
     108        Return base.IndentSize
    91109    End Function
    92110    Static Sub IndentSize( size As Long )
    93         indentSize = size
    94 
    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
     111        base.IndentSize = size
    101112    End Sub
    102113
     114    ' Listenersプロパティ
     115    Static Function Listeners() As TraceListenerCollection
     116        Return base.Listeners
     117    End Function
     118
    103119End Class
    104 
    105 Dim _System_defaultTraceListener As DefaultTraceListener
    106 Trace.Listeners.Add( _System_defaultTraceListener )
  • Include/Classes/System/Diagnostics/TraceListener.ab

    r58 r69  
    4141        '派生クラスで実装 (基底では何もしない)
    4242    End Sub
    43     Virtual Sub Write( o As Object )
    44         Write( o.ToString() )
     43    Virtual Sub Write( value As Object )
     44        Write( value.ToString() )
    4545    End Sub
    46     Virtual Sub Write( o As Object, category As String )
    47         Write( category + ": " + o.ToString() )
     46    Virtual Sub Write( value As Object, category As String )
     47        Write( category + ": " + value.ToString() )
    4848    End Sub
    4949    Virtual Sub Write( message As String, category As String )
     
    5454        '派生クラスで実装 (基底では何もしない)
    5555    End Sub
    56     Virtual Sub WriteLine( o As Object )
    57         WriteLine( o.ToString() )
     56    Virtual Sub WriteLine( value As Object )
     57        WriteLine( value.ToString() )
    5858    End Sub
    59     Virtual Sub WriteLine( o As Object, category As String )
    60         WriteLine( category + ": " + o.ToString() )
     59    Virtual Sub WriteLine( value As Object, category As String )
     60        WriteLine( category + ": " + value.ToString() )
    6161    End Sub
    6262    Virtual Sub WriteLine( message As String, category As String )
  • Include/Classes/System/Diagnostics/index.ab

    r66 r69  
     1#require "base.ab"
     2
    13#require "Debug.ab"
    24#require "Trace.ab"
  • Include/Classes/System/IO/FileStream.ab

    r59 r69  
     1' TODO: 実装
  • Include/Classes/System/IO/Stream.ab

    r59 r69  
     1' TODO: 実装
  • Include/Classes/System/IO/StreamReader.ab

    r59 r69  
     1' TODO: 実装
  • Include/Classes/System/IO/StreamWriter.ab

    r59 r69  
     1' TODO: 実装
Note: See TracChangeset for help on using the changeset viewer.