Changeset 119 for Include/Classes/System


Ignore:
Timestamp:
Feb 23, 2007, 11:00:24 PM (18 years ago)
Author:
イグトランス (egtra)
Message:

Unicode (#50) 前準備
Byte→Char (#51) 型名は殆ど完了、ただし中身までは手を付けていないものが多い

Location:
Include/Classes/System
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • Include/Classes/System/IO/Stream.ab

    r115 r119  
     1
     2#require <Classes/System/misc.ab>
    13
    24Class Stream
    3 Public
     5Public 'Protected
    46    Sub Stream():   End Sub
    57Public
    6     Virtual Function CanRead() As Boolean:  End Function
    7     Virtual Function CanSeek() As Boolean:  End Function
    8     Virtual Function CanTimeout() As Boolean:   End Function
    9     Virtual Function CanWrite() As Boolean: End Function
    10     Virtual Function Length() As Int64: End Function
    11     Virtual Sub Position(value As Int64):   End Sub
    12     Virtual Function Position() As Int64:   End Function
    13     Virtual Sub ReadTimeout(value As Long): End Sub
    14     Virtual Function ReadTimeout() As Long: End Function
    15     Virtual Sub WriteTimeout(value As Long):    End Sub
    16     Virtual Function WriteTimeout() As Long:    End Function
     8    Virtual Sub ~Stream()
     9        Close()
     10    End Sub
     11Public
     12    Abstract Function CanRead() As Boolean
     13    Abstract Function CanSeek() As Boolean
     14
     15    Virtual Function CanTimeout() As Boolean
     16        Return True
     17    End Function
     18
     19    Abstract Function CanWrite() As Boolean
     20    Abstract Function Length() As Int64
     21    Abstract Sub Position(value As Int64)
     22    Abstract Function Position() As Int64
     23
     24    Virtual Sub ReadTimeout(value As Long)
     25        ' Throw InvalidOperationException
     26    End Sub
     27
     28    Virtual Function ReadTimeout() As Long
     29        ' Throw InvalidOperationException
     30    End Function
     31
     32    Virtual Sub WriteTimeout(value As Long)
     33        ' Throw InvalidOperationException
     34    End Sub
     35
     36    Virtual Function WriteTimeout() As Long
     37        ' Throw InvalidOperationException
     38    End Function
    1739
    1840Public
     
    2244    Virtual Function EndRead(ByRef asyncResult As IAsyncResult) As Long:    End Function
    2345    Virtual Sub EndWrite(ByRef asyncResult As IAsyncResult):    End Sub
    24     Virtual Sub Flush():    End Sub
    25     Virtual Function Read(ByRef buffer[] As Byte, offset As Long, count As Long) As Long:   End Function
    26     Virtual Function ReadByte() As Long:    End Function
    27     Virtual Function Seek(offset As Int64, origin As SeekOrigin) As Long:   End Function
    28     Virtual Sub SetLength(value As Int64):  End Sub
    29     Virtual Sub Write (ByRef buffer[] As Byte, offset As Long, count As Long):  End Sub
    30     Virtual Sub WriteByte(value As Byte):   End Sub
     46    Abstract Sub Flush()
     47    Abstract Function Read(ByRef buffer[] As Byte, offset As Long, count As Long) As Long
    3148
     49    Virtual Function ReadByte() As Long
     50        Dim b As Byte
     51        Dim ret = Read(VarPtr(b), 0, 1)
     52        If ret <> 0 Then
     53            Return b
     54        Else
     55            Return -1
     56        End If
     57    End Function
     58
     59    Abstract Function Seek(offset As Int64, origin As SeekOrigin) As Long
     60    Abstract Sub SetLength(value As Int64): End Sub
     61    Abstract Sub Write(ByRef buffer[] As Byte, offset As Long, count As Long)
     62
     63    Virtual Sub WriteByte(b As Byte)
     64        Write(VarPtr(b), 0, 1)
     65    End Sub
    3266Protected
    3367    Virtual Function CreateWaitHandle() As WaitHandle:  End Function
  • Include/Classes/System/String.ab

    r49 r119  
    22    m_Length As Long
    33Public
    4     Chars As LPSTR
     4    Chars As *Char
    55
    66    Sub String()
     
    99    End Sub
    1010
    11     Sub String(initStr As LPSTR)
     11    Sub String(initStr As *Char)
    1212        String()
    1313        Assign(initStr)
     
    2424    End Sub
    2525*/
    26     Sub String(initChar As Byte, length As Long)
     26    Sub String(initChar As Char, length As Long)
    2727        ReSize(length, initChar)
    2828    End Sub
     
    4040    End Function
    4141
    42     Function Operator() As LPSTR
     42    Function Operator() As *Char
    4343        Return Chars
    4444    End Function
     
    4848    End Sub
    4949
    50     Sub Operator = (text As LPSTR)
     50    Sub Operator = (text As *Char)
    5151        Assign(text)
    5252    End Sub
    5353
    54     Function Operator[] (n As Long) As Byte
     54    Function Operator[] (n As Long) As Char
    5555        Return Chars[n]
    5656    End Function
    5757
    58     Sub Operator[]= (n As Long, c As Byte)
     58    Sub Operator[]= (n As Long, c As Char)
    5959        Chars[n] = c
    6060    End Sub
    6161
    62     Function Operator+ (lpszText As LPSTR) As String
     62    Function Operator+ (lpszText As *Char) As String
    6363        Return Concat(lpszText, lstrlen(lpszText))
    6464    End Function
     
    6868    End Function
    6969
    70     Function Operator& (lpszText As LPSTR) As String
     70    Function Operator& (lpszText As *Char) As String
    7171        Dim tempString As String
    7272        tempString=This+lpszText
     
    8888    End Function
    8989
    90     Function Operator== (lpszText As LPSTR) As Long
     90    Function Operator== (lpszText As *Char) As Long
    9191        If lstrcmp(This, lpszText) = 0 Then
    9292            Return _System_TRUE
     
    100100    End Function
    101101
    102     Function Operator<> (lpszText As LPSTR) As Long
     102    Function Operator<> (lpszText As *Char) As Long
    103103        Return lstrcmp(This, lpszText)
    104104    End Function
     
    112112    End Function
    113113
    114     Function Operator< (lpszText As LPSTR) As Long
     114    Function Operator< (lpszText As *Char) As Long
    115115        If lstrcmp(This, lpszText) < 0 Then
    116116            Return _System_TRUE
     
    128128    End Function
    129129
    130     Function Operator> (lpszText As LPSTR) As Long
     130    Function Operator> (lpszText As *Char) As Long
    131131        If lstrcmp(This, lpszText) > 0 Then
    132132            Return _System_TRUE
     
    144144    End Function
    145145
    146     Function Operator<= (lpszText As LPSTR) As Long
     146    Function Operator<= (lpszText As *Char) As Long
    147147        If lstrcmp(This, lpszText) <= 0 Then
    148148            Return _System_TRUE
     
    160160    End Function
    161161
    162     Function Operator>= (lpszText As LPSTR) As Long
     162    Function Operator>= (lpszText As *Char) As Long
    163163        If lstrcmp(This, lpszText) => 0 Then
    164164            Return _System_TRUE
     
    168168    End Function
    169169
    170     Function StrPtr() As LPSTR
     170    Function StrPtr() As *Char
    171171        Return Chars
    172172    End Function
     
    186186    End Sub
    187187
    188     Sub ReSize(allocLength As Long, c As Byte)
     188    Sub ReSize(allocLength As Long, c As Char)
    189189        If allocLength < 0 Then
    190190            Exit Sub
     
    201201    End Sub
    202202
    203     Sub Assign(lpszText As LPSTR, textLength As Long)
     203    Sub Assign(lpszText As *Char, textLength As Long)
    204204        If lpszText = Chars Then Exit Sub
    205205        If AllocStringBuffer(textLength) <> 0 Then
     
    213213    End Sub
    214214
    215     Sub Assign(lpszText As LPSTR)
     215    Sub Assign(lpszText As *Char)
    216216        If lpszText Then
    217217            Assign(lpszText, lstrlen(lpszText))
     
    223223    End Sub
    224224
    225     Sub Append(lpszText As LPSTR, textLength As Long)
     225    Sub Append(lpszText As *Char, textLength As Long)
    226226        Dim prevLen As Long
    227227        prevLen = m_Length
     
    232232    End Sub
    233233
    234     Sub Append(text As LPSTR)
     234    Sub Append(text As *Char)
    235235        Append(text, lstrlen(text))
    236236    End Sub
     
    240240    End Sub
    241241
    242     Function Concat(lpszText As LPSTR, textLength As Long) As String
     242    Function Concat(lpszText As *Char, textLength As Long) As String
    243243        Dim tempString As String
    244244        With tempString
     
    259259    End Function
    260260
    261     Function Contains(lpszText As LPSTR) As BOOL
     261    Function Contains(lpszText As *Char) As BOOL
    262262        If IndexOf(lpszText, 0, m_Length) >= 0 Then
    263263            Return _System_TRUE
     
    267267    End Function
    268268
    269     Function IndexOf(lpszText As LPSTR) As Long
     269    Function IndexOf(lpszText As *Char) As Long
    270270        Return IndexOf(lpszText, 0, m_Length)
    271271    End Function
    272272
    273     Function IndexOf(lpszText As LPSTR, startIndex As Long) As Long
     273    Function IndexOf(lpszText As *Char, startIndex As Long) As Long
    274274        Return IndexOf(lpszText, startIndex, m_Length - startIndex)
    275275    End Function
    276276
    277     Function IndexOf(lpszText As LPSTR, startIndex As Long, count As Long) As Long
     277    Function IndexOf(lpszText As *Char, startIndex As Long, count As Long) As Long
    278278        Dim length As Long
    279279        length = lstrlen(lpszText)
     
    298298    End Function
    299299
    300     Function LastIndexOf(lpszText As LPSTR) As Long
     300    Function LastIndexOf(lpszText As *Char) As Long
    301301        Return LastIndexOf(lpszText, m_Length - 1, m_Length)
    302302    End Function
    303303
    304     Function LastIndexOf(lpszText As LPSTR, startIndex As Long) As Long
    305         Return LastIndexOf(lpszText As LPSTR, startIndex, startIndex + 1)
    306     End Function
    307 
    308     Function LastIndexOf(lpszText As LPSTR, startIndex As Long, count As Long) As Long
     304    Function LastIndexOf(lpszText As *Char, startIndex As Long) As Long
     305        Return LastIndexOf(lpszText As *Char, startIndex, startIndex + 1)
     306    End Function
     307
     308    Function LastIndexOf(lpszText As *Char, startIndex As Long, count As Long) As Long
    309309        Dim length As Long
    310310        length = lstrlen(lpszText)
     
    329329    End Function
    330330
    331     Function StartsWith(lpszText As LPSTR) As BOOL
     331    Function StartsWith(lpszText As *Char) As BOOL
    332332        If IndexOf(lpszText) = 0 Then
    333333            Return _System_TRUE
     
    337337    End Function
    338338
    339     Function EndsWith(lpszText As LPSTR) As BOOL
     339    Function EndsWith(lpszText As *Char) As BOOL
    340340        If LastIndexOf(lpszText) = m_Length - lstrlen(lpszText) Then
    341341            Return _System_TRUE
     
    345345    End Function
    346346
    347     Function Insert(startIndex As Long, lpszText As LPSTR) As Long
     347    Function Insert(startIndex As Long, lpszText As *Char) As Long
    348348        Dim length As Long
    349349        length = lstrlen(lpszText)
     
    351351        If startIndex < 0 Or startIndex > m_Length Then Return -1
    352352
    353         Dim newChars As LPSTR
     353        Dim newChars As *Char
    354354        newChars = _System_malloc(length + m_Length + 1)
    355355        If newChars = 0 Then Return -1
     
    391391        If startIndex + count > m_Length Then Return -1
    392392
    393         Dim newChars As LPSTR
     393        Dim newChars As *Char
    394394        newChars = _System_malloc(m_Length - count + 1)
    395395        If newChars = 0 Then Return -1
     
    413413    End Function
    414414
    415     Sub Replace(oldChar As Byte, newChar As Byte)
     415
     416    Sub Replace(oldChar As Char, newChar As Char)
    416417        Dim i As Long
    417418        For i = 0 To ELM(m_Length)
     
    468469    End Sub
    469470
     471    Override Function ToString() As String
     472        Return This
     473    End Function
     474
    470475Private
    471476    ' メモリ確保に失敗すると元の文字列は失われない。(例外安全でいう強い保障)
    472     Function AllocStringBuffer(textLength As Long) As LPSTR
     477    Function AllocStringBuffer(textLength As Long) As *Char
    473478        If textLength < 0 Then
    474479            Return 0
  • Include/Classes/System/Threading/WaitHandle.ab

    r77 r119  
    2121
    2222    Virtual Sub ~WaitHandle()
    23         Close()
     23        CloseHandle(h)
    2424    End Sub
    2525
     
    7070            ExitThread(0)
    7171        End If
    72         Return AfterWait(pSignalAndWait(toSignal.Handle, toWaitOn.Handle, millisecondsTimeout As DWord), 1)
     72        Return WaitHandle.AfterWait(pSignalAndWait(toSignal.Handle, toWaitOn.Handle, millisecondsTimeout As DWord), 1)
    7373    End Function
    7474
Note: See TracChangeset for help on using the changeset viewer.