Ignore:
Timestamp:
Dec 12, 2006, 8:41:48 PM (17 years ago)
Author:
OverTaker
Message:

Charsをpublicに戻しました。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Include/Classes/System/String.ab

    r30 r31  
    11Class String
    2     m_Chars As LPSTR
    32    m_Length As Long
    43Public
     4    Chars As LPSTR
    55
    66    Sub String()
    7         m_Chars = _System_calloc(1)
     7        Chars = _System_calloc(1)
    88        m_Length = 0
    99    End Sub
     
    2929
    3030    Sub ~String()
    31         _System_free(m_Chars)
    32         m_Chars = 0
     31        _System_free(Chars)
     32        Chars = 0
    3333#ifdef _DEBUG
    3434        m_Length = 0
     
    3636    End Sub
    3737
    38     Function Chars() As LPSTR
    39         Return m_Chars
    40     End Function
    41 
    4238    Function Length() As Long
    4339        Return m_Length
     
    4541
    4642    Function Operator() As LPSTR
    47         Return m_Chars
     43        Return Chars
    4844    End Function
    4945
    5046    Sub Operator = (ByRef objString As String)
    51         Assign(objString.m_Chars, objString.m_Length)
     47        Assign(objString.Chars, objString.m_Length)
    5248    End Sub
    5349
     
    5753
    5854    Function Operator[] (n As Long) As Byte
    59         Return m_Chars[n]
     55        Return Chars[n]
    6056    End Function
    6157
    6258    Sub Operator[]= (n As Long, c As Byte)
    63         m_Chars[n] = c
     59        Chars[n] = c
    6460    End Sub
    6561
     
    173169
    174170    Function StrPtr() As LPSTR
    175         Return m_Chars
     171        Return Chars
    176172    End Function
    177173
     
    182178            oldLength = m_Length
    183179            If AllocStringBuffer(allocLength) <> 0 Then
    184                 ZeroMemory(m_Chars + oldLength, m_Length - oldLength + 1)
     180                ZeroMemory(Chars + oldLength, m_Length - oldLength + 1)
    185181            End If
    186182        Else
    187183            m_Length = allocLength
    188             m_Chars[m_Length] = 0
     184            Chars[m_Length] = 0
    189185        End If
    190186    End Sub
     
    197193            oldLength = m_Length
    198194            If AllocStringBuffer(allocLength) <> 0 Then
    199                 FillMemory(m_Chars + oldLength, m_Length - oldLength, c)
     195                FillMemory(Chars + oldLength, m_Length - oldLength, c)
    200196            End If
    201197        Else
    202198            m_Length = allocLength
    203199        End If
    204         m_Chars[m_Length] = 0
     200        Chars[m_Length] = 0
    205201    End Sub
    206202
    207203    Sub Assign(lpszText As LPSTR, textLength As Long)
    208         If lpszText = m_Chars Then Exit Sub
     204        If lpszText = Chars Then Exit Sub
    209205        If AllocStringBuffer(textLength) <> 0 Then
    210             memcpy(m_Chars, lpszText, textLength)
    211             m_Chars[m_Length] = 0
     206            memcpy(Chars, lpszText, textLength)
     207            Chars[m_Length] = 0
    212208        End If     
    213209    End Sub
    214210
    215211    Sub Assign(ByRef objString As String)
    216         Assign(objString.m_Chars, objString.m_Length)
     212        Assign(objString.Chars, objString.m_Length)
    217213    End Sub
    218214
     
    221217            Assign(lpszText, lstrlen(lpszText))
    222218        Else
    223             'm_Chars=_System_realloc(m_Chars,1)
    224             m_Chars[0] = 0
     219            'Chars=_System_realloc(Chars,1)
     220            Chars[0] = 0
    225221            m_Length = 0
    226222        End If
     
    231227        prevLen = m_Length
    232228        If AllocStringBuffer(m_Length + textLength) <> 0 Then
    233             memcpy(m_Chars + prevLen, lpszText, textLength)
    234             m_Chars[m_Length] = 0
     229            memcpy(Chars + prevLen, lpszText, textLength)
     230            Chars[m_Length] = 0
    235231        End If
    236232    End Sub
     
    241237
    242238    Sub Append(ByRef str As String)
    243         Append(str.m_Chars, str.m_Length)
     239        Append(str.Chars, str.m_Length)
    244240    End Sub
    245241
     
    248244        With tempString
    249245            .AllocStringBuffer(This.m_Length + textLength)
    250             memcpy(.m_Chars, This.m_Chars, This.m_Length)
    251             memcpy(.m_Chars + This.m_Length, lpszText, textLength)
    252             .m_Chars[.m_Length] = 0
     246            memcpy(.Chars, This.Chars, This.m_Length)
     247            memcpy(.Chars + This.m_Length, lpszText, textLength)
     248            .Chars[.m_Length] = 0
    253249        End With
    254250        Return tempString
     
    292288        For i = startIndex To startIndex + count - 1
    293289            For j = 0 To length - 1
    294                 If m_Chars[i + j] = lpszText[j] Then
     290                If Chars[i + j] = lpszText[j] Then
    295291                    If j = length - 1 Then Return i
    296292                Else
     
    323319        For i = startIndex To  startIndex - count + 1 Step -1
    324320            For j = length - 1 To 0 Step -1
    325                 If m_Chars[i + j] = lpszText[j] Then
     321                If Chars[i + j] = lpszText[j] Then
    326322                    If j = 0 Then Return i
    327323                Else
     
    359355        If newChars = 0 Then Return -1
    360356
    361         memcpy(newChars, m_Chars, startIndex)
     357        memcpy(newChars, Chars, startIndex)
    362358        memcpy(newChars + startIndex, lpszText, length)
    363         memcpy(newChars + startIndex + length, m_Chars + startIndex, m_Length - startIndex + 1)
    364 
    365         _System_free(m_Chars)
    366         m_Chars = newChars
     359        memcpy(newChars + startIndex + length, Chars + startIndex, m_Length - startIndex + 1)
     360
     361        _System_free(Chars)
     362        Chars = newChars
    367363        m_Length = length + m_Length
    368364        Return m_Length
     
    379375        Dim temp As String
    380376        temp.AllocStringBuffer(length)
    381         memcpy(temp.m_Chars, VarPtr(m_Chars[startIndex]), length)
    382         m_Chars[m_Length] = 0
     377        memcpy(temp.Chars, VarPtr(Chars[startIndex]), length)
     378        Chars[m_Length] = 0
    383379        Return temp
    384380    End Function
     
    386382    Function Remove(startIndex As Long) As Long
    387383        If startIndex < 0 Or startIndex > m_Length Then Return -1
    388         m_Chars[startIndex] = 0
     384        Chars[startIndex] = 0
    389385        m_Length = startIndex
    390386        Return m_Length
     
    399395        If newChars = 0 Then Return -1
    400396
    401         memcpy(newChars, m_Chars, startIndex)
    402         memcpy(newChars + startIndex, m_Chars + startIndex + count, m_Length - startIndex - count)
     397        memcpy(newChars, Chars, startIndex)
     398        memcpy(newChars + startIndex, Chars + startIndex + count, m_Length - startIndex - count)
    403399        newChars[m_Length - count] = 0
    404400
    405         _System_free(m_Chars)
    406         m_Chars = newChars
     401        _System_free(Chars)
     402        Chars = newChars
    407403        m_Length = m_Length - count
    408404        Return m_Length
     
    420416        Dim i As Long
    421417        For i = 0 To ELM(m_Length)
    422             If m_Chars[i] = oldChar Then
    423                 m_Chars[i] = newChar
     418            If Chars[i] = oldChar Then
     419                Chars[i] = newChar
    424420            End If
    425421        Next
     
    444440                    Exit Do
    445441                End If
    446                 .Append(m_Chars + current, pos - current)
     442                .Append(Chars + current, pos - current)
    447443                .Append(newStr, newLen)
    448444                current = pos + oldLen
    449445            Loop
    450             .Append(m_Chars + current, m_Length - current)
     446            .Append(Chars + current, m_Length - current)
    451447        End With
    452448        Swap(tempString)
     
    454450
    455451    Sub ToLower()
    456         CharLower(m_Chars)
     452        CharLower(Chars)
    457453    End Sub
    458454
    459455    Sub ToUpper()
    460         CharUpper(m_Chars)
     456        CharUpper(Chars)
    461457    End Sub
    462458
     
    465461        Dim tempChars As PSTR
    466462        tempLen = x.m_Length
    467         tempChars = x.m_Chars
     463        tempChars = x.Chars
    468464        x.m_Length = This.m_Length
    469         x.m_Chars = This.m_Chars
     465        x.Chars = This.Chars
    470466        This.m_Length = tempLen
    471         This.m_Chars = tempChars
     467        This.Chars = tempChars
    472468    End Sub
    473469
     
    478474            Return 0
    479475        ElseIf textLength > m_Length Then
    480             AllocStringBuffer = _System_realloc(m_Chars, textLength + 1)
     476            AllocStringBuffer = _System_realloc(Chars, textLength + 1)
    481477            If AllocStringBuffer <> 0 Then
    482478                m_Length = textLength
    483                 m_Chars = AllocStringBuffer
     479                Chars = AllocStringBuffer
    484480            End If
    485481        Else
    486482            m_Length = textLength
    487             AllocStringBuffer = m_Chars
     483            AllocStringBuffer = Chars
    488484        End If
    489485    End Function
Note: See TracChangeset for help on using the changeset viewer.