Ignore:
Timestamp:
Mar 6, 2008, 9:49:43 PM (16 years ago)
Author:
イグトランス (egtra)
Message:

(SPrintF.ab) FormatIntegerExにStringBuilderを引数に取る版を追加。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Include/Classes/System/IO/TextReader.ab

    r432 r457  
    3636        ElseIf count < 0 Then
    3737        End If
     38        Read = ReadImpl(buffer, index, count)
    3839    End Function
    3940
     
    8081    End Function
    8182    /*
     83    @brief 現在位置からストリームの終わりまで読み込む。
    8284    @date 2008/02/26
    8385    @auther Egtra
     
    9395            sb.Append(ch As StrChar)
    9496        Loop
     97    End Function
     98
     99    Static Function Synchronized(reader As TextReader) As TextReader
    95100    End Function
    96101
     
    118123End Class
    119124
     125Namespace Detail
     126
     127Class SynchronizedTextReader
     128    Inherits TextReader
     129Public
     130    Sub SynchronizedTextReader(reader As TextReader)
     131        cs = New ActiveBasic.Windows.CriticalSection
     132        base = reader
     133    End Sub
     134
     135    Override Function Peek() As Long
     136'       Using lock = cs.Lock
     137            Peek = base.Peek
     138'       End Using
     139    End Function
     140
     141    Override Function Read() As Long
     142'       Using lock = cs.Lock
     143            Read = base.Read
     144'       End Using
     145    End Function
     146
     147    Override Function ReadLine() As String
     148'       Using lock = cs.Lock
     149            ReadLine = base.ReadLine
     150'       End Using
     151    End Function
     152
     153    Override Function ReadToEnd() As String
     154'       Using lock = cs.Lock
     155            ReadToEnd = base.ReadToEnd
     156'       End Using
     157    End Function
     158
     159Protected
     160    Override Sub Dispose(disposing As Boolean)
     161        Dim s = Nothing As Stream
     162        SetPointer(VarPtr(s) As *VoidPtr, InterlockedExchangePointer(ByVal VarPtr(base) As *VoidPtr, 0))
     163        If disposing Then
     164            If Not ActiveBasic.IsNothing(s) Then
     165                s.Dispose()
     166            End If
     167            cs.Dispose()
     168        End If
     169    End Sub
     170
     171    Override Function ReadImpl(buffer As *StrChar, index As Long, count As Long) As Long
     172'       Using lock = cs.Lock
     173            ReadImpl = base.ReadImpl(buffer, index, count)
     174'       End Using
     175    End Function
     176Private
     177    cs As ActiveBasic.Windows.CriticalSection
     178    base As TextReader
     179End Class
     180
     181End Namespace
     182
    120183End NameSpace
    121184End NameSpace
Note: See TracChangeset for help on using the changeset viewer.