Changeset 119 for Include/Classes
- Timestamp:
- Feb 23, 2007, 11:00:24 PM (18 years ago)
- 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> 1 3 2 4 Class Stream 3 Public 5 Public 'Protected 4 6 Sub Stream(): End Sub 5 7 Public 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 11 Public 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 17 39 18 40 Public … … 22 44 Virtual Function EndRead(ByRef asyncResult As IAsyncResult) As Long: End Function 23 45 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 31 48 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 32 66 Protected 33 67 Virtual Function CreateWaitHandle() As WaitHandle: End Function -
Include/Classes/System/String.ab
r49 r119 2 2 m_Length As Long 3 3 Public 4 Chars As LPSTR4 Chars As *Char 5 5 6 6 Sub String() … … 9 9 End Sub 10 10 11 Sub String(initStr As LPSTR)11 Sub String(initStr As *Char) 12 12 String() 13 13 Assign(initStr) … … 24 24 End Sub 25 25 */ 26 Sub String(initChar As Byte, length As Long)26 Sub String(initChar As Char, length As Long) 27 27 ReSize(length, initChar) 28 28 End Sub … … 40 40 End Function 41 41 42 Function Operator() As LPSTR42 Function Operator() As *Char 43 43 Return Chars 44 44 End Function … … 48 48 End Sub 49 49 50 Sub Operator = (text As LPSTR)50 Sub Operator = (text As *Char) 51 51 Assign(text) 52 52 End Sub 53 53 54 Function Operator[] (n As Long) As Byte54 Function Operator[] (n As Long) As Char 55 55 Return Chars[n] 56 56 End Function 57 57 58 Sub Operator[]= (n As Long, c As Byte)58 Sub Operator[]= (n As Long, c As Char) 59 59 Chars[n] = c 60 60 End Sub 61 61 62 Function Operator+ (lpszText As LPSTR) As String62 Function Operator+ (lpszText As *Char) As String 63 63 Return Concat(lpszText, lstrlen(lpszText)) 64 64 End Function … … 68 68 End Function 69 69 70 Function Operator& (lpszText As LPSTR) As String70 Function Operator& (lpszText As *Char) As String 71 71 Dim tempString As String 72 72 tempString=This+lpszText … … 88 88 End Function 89 89 90 Function Operator== (lpszText As LPSTR) As Long90 Function Operator== (lpszText As *Char) As Long 91 91 If lstrcmp(This, lpszText) = 0 Then 92 92 Return _System_TRUE … … 100 100 End Function 101 101 102 Function Operator<> (lpszText As LPSTR) As Long102 Function Operator<> (lpszText As *Char) As Long 103 103 Return lstrcmp(This, lpszText) 104 104 End Function … … 112 112 End Function 113 113 114 Function Operator< (lpszText As LPSTR) As Long114 Function Operator< (lpszText As *Char) As Long 115 115 If lstrcmp(This, lpszText) < 0 Then 116 116 Return _System_TRUE … … 128 128 End Function 129 129 130 Function Operator> (lpszText As LPSTR) As Long130 Function Operator> (lpszText As *Char) As Long 131 131 If lstrcmp(This, lpszText) > 0 Then 132 132 Return _System_TRUE … … 144 144 End Function 145 145 146 Function Operator<= (lpszText As LPSTR) As Long146 Function Operator<= (lpszText As *Char) As Long 147 147 If lstrcmp(This, lpszText) <= 0 Then 148 148 Return _System_TRUE … … 160 160 End Function 161 161 162 Function Operator>= (lpszText As LPSTR) As Long162 Function Operator>= (lpszText As *Char) As Long 163 163 If lstrcmp(This, lpszText) => 0 Then 164 164 Return _System_TRUE … … 168 168 End Function 169 169 170 Function StrPtr() As LPSTR170 Function StrPtr() As *Char 171 171 Return Chars 172 172 End Function … … 186 186 End Sub 187 187 188 Sub ReSize(allocLength As Long, c As Byte)188 Sub ReSize(allocLength As Long, c As Char) 189 189 If allocLength < 0 Then 190 190 Exit Sub … … 201 201 End Sub 202 202 203 Sub Assign(lpszText As LPSTR, textLength As Long)203 Sub Assign(lpszText As *Char, textLength As Long) 204 204 If lpszText = Chars Then Exit Sub 205 205 If AllocStringBuffer(textLength) <> 0 Then … … 213 213 End Sub 214 214 215 Sub Assign(lpszText As LPSTR)215 Sub Assign(lpszText As *Char) 216 216 If lpszText Then 217 217 Assign(lpszText, lstrlen(lpszText)) … … 223 223 End Sub 224 224 225 Sub Append(lpszText As LPSTR, textLength As Long)225 Sub Append(lpszText As *Char, textLength As Long) 226 226 Dim prevLen As Long 227 227 prevLen = m_Length … … 232 232 End Sub 233 233 234 Sub Append(text As LPSTR)234 Sub Append(text As *Char) 235 235 Append(text, lstrlen(text)) 236 236 End Sub … … 240 240 End Sub 241 241 242 Function Concat(lpszText As LPSTR, textLength As Long) As String242 Function Concat(lpszText As *Char, textLength As Long) As String 243 243 Dim tempString As String 244 244 With tempString … … 259 259 End Function 260 260 261 Function Contains(lpszText As LPSTR) As BOOL261 Function Contains(lpszText As *Char) As BOOL 262 262 If IndexOf(lpszText, 0, m_Length) >= 0 Then 263 263 Return _System_TRUE … … 267 267 End Function 268 268 269 Function IndexOf(lpszText As LPSTR) As Long269 Function IndexOf(lpszText As *Char) As Long 270 270 Return IndexOf(lpszText, 0, m_Length) 271 271 End Function 272 272 273 Function IndexOf(lpszText As LPSTR, startIndex As Long) As Long273 Function IndexOf(lpszText As *Char, startIndex As Long) As Long 274 274 Return IndexOf(lpszText, startIndex, m_Length - startIndex) 275 275 End Function 276 276 277 Function IndexOf(lpszText As LPSTR, startIndex As Long, count As Long) As Long277 Function IndexOf(lpszText As *Char, startIndex As Long, count As Long) As Long 278 278 Dim length As Long 279 279 length = lstrlen(lpszText) … … 298 298 End Function 299 299 300 Function LastIndexOf(lpszText As LPSTR) As Long300 Function LastIndexOf(lpszText As *Char) As Long 301 301 Return LastIndexOf(lpszText, m_Length - 1, m_Length) 302 302 End Function 303 303 304 Function LastIndexOf(lpszText As LPSTR, startIndex As Long) As Long305 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 Long304 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 309 309 Dim length As Long 310 310 length = lstrlen(lpszText) … … 329 329 End Function 330 330 331 Function StartsWith(lpszText As LPSTR) As BOOL331 Function StartsWith(lpszText As *Char) As BOOL 332 332 If IndexOf(lpszText) = 0 Then 333 333 Return _System_TRUE … … 337 337 End Function 338 338 339 Function EndsWith(lpszText As LPSTR) As BOOL339 Function EndsWith(lpszText As *Char) As BOOL 340 340 If LastIndexOf(lpszText) = m_Length - lstrlen(lpszText) Then 341 341 Return _System_TRUE … … 345 345 End Function 346 346 347 Function Insert(startIndex As Long, lpszText As LPSTR) As Long347 Function Insert(startIndex As Long, lpszText As *Char) As Long 348 348 Dim length As Long 349 349 length = lstrlen(lpszText) … … 351 351 If startIndex < 0 Or startIndex > m_Length Then Return -1 352 352 353 Dim newChars As LPSTR353 Dim newChars As *Char 354 354 newChars = _System_malloc(length + m_Length + 1) 355 355 If newChars = 0 Then Return -1 … … 391 391 If startIndex + count > m_Length Then Return -1 392 392 393 Dim newChars As LPSTR393 Dim newChars As *Char 394 394 newChars = _System_malloc(m_Length - count + 1) 395 395 If newChars = 0 Then Return -1 … … 413 413 End Function 414 414 415 Sub Replace(oldChar As Byte, newChar As Byte) 415 416 Sub Replace(oldChar As Char, newChar As Char) 416 417 Dim i As Long 417 418 For i = 0 To ELM(m_Length) … … 468 469 End Sub 469 470 471 Override Function ToString() As String 472 Return This 473 End Function 474 470 475 Private 471 476 ' メモリ確保に失敗すると元の文字列は失われない。(例外安全でいう強い保障) 472 Function AllocStringBuffer(textLength As Long) As LPSTR477 Function AllocStringBuffer(textLength As Long) As *Char 473 478 If textLength < 0 Then 474 479 Return 0 -
Include/Classes/System/Threading/WaitHandle.ab
r77 r119 21 21 22 22 Virtual Sub ~WaitHandle() 23 Close ()23 CloseHandle(h) 24 24 End Sub 25 25 … … 70 70 ExitThread(0) 71 71 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) 73 73 End Function 74 74
Note:
See TracChangeset
for help on using the changeset viewer.