Changeset 272 for Include/com


Ignore:
Timestamp:
Jun 12, 2007, 7:24:38 PM (17 years ago)
Author:
イグトランス (egtra)
Message:

StringBuilderを追加。String不変へ。共通の文字列操作関数をActiveBasic.Strings内に配置(設計に検討の余地あり)。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Include/com/bstring.ab

    r267 r272  
    88
    99Class BString
    10     Sub Init(s As PCSTR, len As DWord)
    11         Dim lenBS = MultiByteToWideChar(CP_THREAD_ACP, 0, s, len As Long, 0, 0)
    12         bs = SysAllocStringLen(0, lenBS)
    13         MultiByteToWideChar(CP_THREAD_ACP, 0, s, len As Long, bs, lenBS)
    14     End Sub
     10    'Inherits System.IDisposable, System.ICloneable
    1511Public
    1612    Sub BString()
     
    2218    End Sub
    2319
    24     Sub BString(ByRef s As BString)
     20    Sub BString(s As BString)
    2521        Init(s.bs, s.Length)
    2622    End Sub
     
    4440    End Sub
    4541
    46     Sub BString(ByRef s As String)
     42    Sub BString(s As String)
    4743        Init(s.StrPtr, s.Length As DWord)
    4844    End Sub
     
    5248    End Sub
    5349
    54     Sub Assign(ByRef bstr As BString)
     50    Sub Assign(bstr As BString)
    5551        Clear()
    5652        Init(bstr, bstr.Length)
     
    7066        BString.Copy(Copy, bs)
    7167    End Function
     68
     69    /*Override*/ Function Clone() As BString
     70        Return New BString(This)
     71    End Function
     72
     73    /*Override*/ Sub Dispose()
     74        Clear()
     75    End Sub
    7276
    7377    Sub Clear()
     
    134138    bs As BSTR
    135139
     140    Sub Init(s As PCSTR, len As DWord)
     141        Dim lenBS = MultiByteToWideChar(CP_THREAD_ACP, 0, s, len As Long, 0, 0)
     142        bs = SysAllocStringLen(0, lenBS)
     143        MultiByteToWideChar(CP_THREAD_ACP, 0, s, len As Long, bs, lenBS)
     144    End Sub
     145
    136146    Static Sub Copy(ByRef dst As BSTR, ByVal src As BSTR)
    137147        dst = SysAllocStringLen(src, SysStringLen(src))
Note: See TracChangeset for help on using the changeset viewer.