Ignore:
Timestamp:
May 12, 2007, 6:31:13 PM (17 years ago)
Author:
dai
Message:

Objectクラス、Stringクラスの定義をSystem名前空間に入れると共に、コンパイラ側で両者のクラスをSystem名前空間に依存しない特殊型として扱うようにした。
System.Diagnostics名前空間を導入した。
Namespaceステートメントのコード補間機能に対応。

File:
1 edited

Legend:

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

    r147 r246  
     1Namespace System
     2    Namespace Diagnostics
    13
    2 ' リスナ
    3 Class TraceListener
    4     indentLevel As Long
    5     indentSize As Long
     4        ' リスナ
     5        Class TraceListener
     6            indentLevel As Long
     7            indentSize As Long
    68
    7 Protected
    8     Function GetIndentString() As String
    9         Dim i As Long
     9        Protected
     10            Function GetIndentString() As String
     11                Dim i As Long
    1012
    11         Dim IndentStr = ""
    12         For i = 0 To ELM( indentSize )
    13             IndentStr = IndentStr + " "
    14         Next
     13                Dim IndentStr = ""
     14                For i = 0 To ELM( indentSize )
     15                    IndentStr = IndentStr + " "
     16                Next
    1517
    16         Dim ResultStr = ""
    17         For i = 0 To ELM( indentLevel )
    18             ResultStr = ResultStr + IndentStr
    19         Next
     18                Dim ResultStr = ""
     19                For i = 0 To ELM( indentLevel )
     20                    ResultStr = ResultStr + IndentStr
     21                Next
    2022
    21         Return ResultStr
    22     End Function
     23                Return ResultStr
     24            End Function
    2325
    24 Public
    25     Sub TraceListener()
    26         indentLevel = 0
    27         indentSize = 4
    28     End Sub
     26        Public
     27            Sub TraceListener()
     28                indentLevel = 0
     29                indentSize = 4
     30            End Sub
    2931
    30     ' コピーコンストラクタ
    31     Sub TraceListener( ByRef listener As TraceListener )
    32         indentLevel = listener.indentLevel
    33         indentSize = listener.indentSize
    34     End Sub
     32            ' コピーコンストラクタ
     33            Sub TraceListener( ByRef listener As TraceListener )
     34                indentLevel = listener.indentLevel
     35                indentSize = listener.indentSize
     36            End Sub
    3537
    3638
    37     '----------------------------------------------------------------
    38     ' パブリック コンストラクタ
    39     '----------------------------------------------------------------
     39            '----------------------------------------------------------------
     40            ' パブリック コンストラクタ
     41            '----------------------------------------------------------------
    4042
    41     Virtual Sub Write( message As String )
    42         '派生クラスで実装 (基底では何もしない)
    43     End Sub
    44     Virtual Sub Write( value As Object )
    45         Write( value.ToString() )
    46     End Sub
    47     Virtual Sub Write( value As Object, category As String )
    48         Write( category + ": " + value.ToString() )
    49     End Sub
    50     Virtual Sub Write( message As String, category As String )
    51         Write( category + ": " + message )
    52     End Sub
     43            Virtual Sub Write( message As String )
     44                '派生クラスで実装 (基底では何もしない)
     45            End Sub
     46            Virtual Sub Write( value As Object )
     47                Write( value.ToString() )
     48            End Sub
     49            Virtual Sub Write( value As Object, category As String )
     50                Write( category + ": " + value.ToString() )
     51            End Sub
     52            Virtual Sub Write( message As String, category As String )
     53                Write( category + ": " + message )
     54            End Sub
    5355
    54     Virtual Sub WriteLine( message As String )
    55         '派生クラスで実装 (基底では何もしない)
    56     End Sub
    57     Virtual Sub WriteLine( value As Object )
    58         WriteLine( value.ToString() )
    59     End Sub
    60     Virtual Sub WriteLine( value As Object, category As String )
    61         WriteLine( category + ": " + value.ToString() )
    62     End Sub
    63     Virtual Sub WriteLine( message As String, category As String )
    64         WriteLine( category + ": " + message )
    65     End Sub
     56            Virtual Sub WriteLine( message As String )
     57                '派生クラスで実装 (基底では何もしない)
     58            End Sub
     59            Virtual Sub WriteLine( value As Object )
     60                WriteLine( value.ToString() )
     61            End Sub
     62            Virtual Sub WriteLine( value As Object, category As String )
     63                WriteLine( category + ": " + value.ToString() )
     64            End Sub
     65            Virtual Sub WriteLine( message As String, category As String )
     66                WriteLine( category + ": " + message )
     67            End Sub
    6668
    6769
    68     '----------------------------------------------------------------
    69     ' パブリック プロパティ
    70     '----------------------------------------------------------------
     70            '----------------------------------------------------------------
     71            ' パブリック プロパティ
     72            '----------------------------------------------------------------
    7173
    72     ' IndentLevelプロパティ
    73     Function IndentLevel() As Long
    74         Return indentLevel
    75     End Function
    76     Sub IndentLevel( indentLevel As Long )
    77         This.indentLevel = indentLevel
    78     End Sub
     74            ' IndentLevelプロパティ
     75            Function IndentLevel() As Long
     76                Return indentLevel
     77            End Function
     78            Sub IndentLevel( indentLevel As Long )
     79                This.indentLevel = indentLevel
     80            End Sub
    7981
    80     ' IndentSizeプロパティ
    81     Function IndentSize() As Long
    82         Return indentSize
    83     End Function
    84     Sub IndentSize( size As Long )
    85         indentSize = size
    86     End Sub
    87 End Class
     82            ' IndentSizeプロパティ
     83            Function IndentSize() As Long
     84                Return indentSize
     85            End Function
     86            Sub IndentSize( size As Long )
     87                indentSize = size
     88            End Sub
     89        End Class
    8890
    89 ' デフォルトリスナ(デバッガビューへの出力)
    90 Class DefaultTraceListener
    91     Inherits TraceListener
    92 Public
     91        ' デフォルトリスナ(デバッガビューへの出力)
     92        Class DefaultTraceListener
     93            Inherits TraceListener
     94        Public
    9395
    94     Override Sub Write( message As String )
    95         ' デバッグビューへ出力
    96         Dim tempStr = GetIndentString() + message
    97         OutputDebugString( tempStr )
     96            Override Sub Write( message As String )
     97                ' デバッグビューへ出力
     98                Dim tempStr = GetIndentString() + message
     99                OutputDebugString( tempStr )
    98100
    99         ' デバッグログへ書き込む
    100         ' TODO: 実装
    101     End Sub
     101                ' デバッグログへ書き込む
     102                ' TODO: 実装
     103            End Sub
    102104
    103     Override Sub WriteLine( message As String )
    104         Write( GetIndentString() + message + Ex"\r\n" )
    105     End Sub
    106 End Class
     105            Override Sub WriteLine( message As String )
     106                Write( GetIndentString() + message + Ex"\r\n" )
     107            End Sub
     108        End Class
     109
     110    End Namespace
     111End Namespace
Note: See TracChangeset for help on using the changeset viewer.