Ignore:
Timestamp:
Mar 28, 2008, 5:43:34 PM (17 years ago)
Author:
イグトランス (egtra)
Message:

インクルードガードとその他不要な前処理定義などの削除

File:
1 edited

Legend:

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

    r478 r497  
    11' 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 = Char
    8 
    9 #ifdef UNICODE
    10 #define __STRING_IS_UNICODE
    11 #else
    12 #define __STRING_IS_NOT_UNICODE
    13 #endif
    142
    153Namespace System
     
    270258
    271259        Sub Assign(text As PCSTR, textLengthA As Long)
    272 #ifdef __STRING_IS_NOT_UNICODE
    273             AssignFromCharPtr(text, textLengthA)
    274 #else
     260#ifdef UNICODE
    275261            Dim textLengthW = MultiByteToWideChar(CP_THREAD_ACP, 0, text, textLengthA, 0, 0)
    276262            If AllocStringBuffer(textLengthW) <> 0 Then
     
    278264                Chars[textLengthW] = 0
    279265            End If
     266#else
     267            AssignFromCharPtr(text, textLengthA)
    280268#endif
    281269        End Sub
    282270
    283271        Sub Assign(text As PCWSTR, textLengthW As Long)
    284 #ifdef __STRING_IS_NOT_UNICODE
     272#ifdef UNICODE
     273            AssignFromCharPtr(text, textLengthW)
     274#else
    285275            Dim textLengthA = WideCharToMultiByte(CP_THREAD_ACP, 0, text, textLengthW, 0, 0, 0, 0)
    286276            If AllocStringBuffer(textLengthA) <> 0 Then
     
    288278                Chars[textLengthA] = 0
    289279            End If
    290 #else
    291             AssignFromCharPtr(text, textLengthW)
    292280#endif
    293281        End Sub
     
    305293    Public
    306294        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
    310296            With Concat
    311297                Dim lenW = MultiByteToWideChar(CP_THREAD_ACP, 0, text, len, 0, 0)
     
    316302                .Chars[m_Length + lenW] = 0
    317303            End With
     304#else
     305            Return ConcatChar(This.Chars, m_Length, text, len)
    318306#endif
    319307        End Function
    320308
    321309        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
    323313            With Concat
    324314                Concat = New String
     
    329319                .Chars[m_Length + lenA] = 0
    330320            End With
    331 #else
    332             Return ConcatChar(This.Chars, m_Length, text, len)
    333321#endif
    334322        End Function
     
    600588
    601589        Override Function GetHashCode() As Long
    602 #ifdef __STRING_IS_NOT_UNICODE
     590#ifdef UNICODE
     591            Dim size = m_Length
     592#else
    603593            Dim size = (m_Length + 1) >> 1
    604 #else
    605             Dim size = m_Length
    606594#endif
    607595            Return _System_GetHashFromWordArray(Chars As *Word, size) Xor m_Length
Note: See TracChangeset for help on using the changeset viewer.