Changeset 272 for Include/com/bstring.ab
- Timestamp:
- Jun 12, 2007, 7:24:38 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Include/com/bstring.ab
r267 r272 8 8 9 9 Class 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 15 11 Public 16 12 Sub BString() … … 22 18 End Sub 23 19 24 Sub BString( ByRefs As BString)20 Sub BString(s As BString) 25 21 Init(s.bs, s.Length) 26 22 End Sub … … 44 40 End Sub 45 41 46 Sub BString( ByRefs As String)42 Sub BString(s As String) 47 43 Init(s.StrPtr, s.Length As DWord) 48 44 End Sub … … 52 48 End Sub 53 49 54 Sub Assign( ByRefbstr As BString)50 Sub Assign(bstr As BString) 55 51 Clear() 56 52 Init(bstr, bstr.Length) … … 70 66 BString.Copy(Copy, bs) 71 67 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 72 76 73 77 Sub Clear() … … 134 138 bs As BSTR 135 139 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 136 146 Static Sub Copy(ByRef dst As BSTR, ByVal src As BSTR) 137 147 dst = SysAllocStringLen(src, SysStringLen(src))
Note:
See TracChangeset
for help on using the changeset viewer.