Changeset 497 for trunk/Include/Classes/System/String.ab
- Timestamp:
- Mar 28, 2008, 5:43:34 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Include/Classes/System/String.ab
r478 r497 1 1 ' Classes/System/String.ab 2 3 #require <basic/function.sbp>4 #require <Classes/System/Text/StringBuilder.ab>5 #require <Classes/ActiveBasic/Strings/Strings.ab>6 7 TypeDef StrChar = Char8 9 #ifdef UNICODE10 #define __STRING_IS_UNICODE11 #else12 #define __STRING_IS_NOT_UNICODE13 #endif14 2 15 3 Namespace System … … 270 258 271 259 Sub Assign(text As PCSTR, textLengthA As Long) 272 #ifdef __STRING_IS_NOT_UNICODE 273 AssignFromCharPtr(text, textLengthA) 274 #else 260 #ifdef UNICODE 275 261 Dim textLengthW = MultiByteToWideChar(CP_THREAD_ACP, 0, text, textLengthA, 0, 0) 276 262 If AllocStringBuffer(textLengthW) <> 0 Then … … 278 264 Chars[textLengthW] = 0 279 265 End If 266 #else 267 AssignFromCharPtr(text, textLengthA) 280 268 #endif 281 269 End Sub 282 270 283 271 Sub Assign(text As PCWSTR, textLengthW As Long) 284 #ifdef __STRING_IS_NOT_UNICODE 272 #ifdef UNICODE 273 AssignFromCharPtr(text, textLengthW) 274 #else 285 275 Dim textLengthA = WideCharToMultiByte(CP_THREAD_ACP, 0, text, textLengthW, 0, 0, 0, 0) 286 276 If AllocStringBuffer(textLengthA) <> 0 Then … … 288 278 Chars[textLengthA] = 0 289 279 End If 290 #else291 AssignFromCharPtr(text, textLengthW)292 280 #endif 293 281 End Sub … … 305 293 Public 306 294 Const Function Concat(text As PCSTR, len As Long) As String 307 #ifdef __STRING_IS_NOT_UNICODE 308 Return ConcatChar(This.Chars, m_Length, text, len) 309 #else 295 #ifdef UNICODE 310 296 With Concat 311 297 Dim lenW = MultiByteToWideChar(CP_THREAD_ACP, 0, text, len, 0, 0) … … 316 302 .Chars[m_Length + lenW] = 0 317 303 End With 304 #else 305 Return ConcatChar(This.Chars, m_Length, text, len) 318 306 #endif 319 307 End Function 320 308 321 309 Const Function Concat(text As PCWSTR, len As Long) As String 322 #ifdef __STRING_IS_NOT_UNICODE 310 #ifdef UNICODE 311 Return ConcatChar(This.Chars, m_Length, text, len) 312 #else 323 313 With Concat 324 314 Concat = New String … … 329 319 .Chars[m_Length + lenA] = 0 330 320 End With 331 #else332 Return ConcatChar(This.Chars, m_Length, text, len)333 321 #endif 334 322 End Function … … 600 588 601 589 Override Function GetHashCode() As Long 602 #ifdef __STRING_IS_NOT_UNICODE 590 #ifdef UNICODE 591 Dim size = m_Length 592 #else 603 593 Dim size = (m_Length + 1) >> 1 604 #else605 Dim size = m_Length606 594 #endif 607 595 Return _System_GetHashFromWordArray(Chars As *Word, size) Xor m_Length
Note:
See TracChangeset
for help on using the changeset viewer.