Changeset 175 for Include/Classes


Ignore:
Timestamp:
Mar 21, 2007, 7:06:34 PM (18 years ago)
Author:
イグトランス (egtra)
Message:

Variant, VBObjectの追加

Location:
Include/Classes/System
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • Include/Classes/System/OperatingSystem.ab

    r173 r175  
    11' System/OperatingSystem.ab
     2
     3#ifndef _SYSYTEM_OPERATINGSYSTEM_AB_
     4#define _SYSYTEM_OPERATINGSYSTEM_AB_
    25
    36#require <Classes/System/Version.ab>
     
    7982    Unix = 4
    8083End Enum
     84
     85#endif '_SYSYTEM_OPERATINGSYSTEM_AB_
  • Include/Classes/System/String.ab

    r143 r175  
    233233    End Sub
    234234
    235     Sub AssignFromStrChar(text As *StrChar, textLength As Long)
    236         If text = Chars Then Exit Sub
    237         If AllocStringBuffer(textLength) <> 0 Then
    238             memcpy(Chars, text, SizeOf (StrChar) * textLength)
    239             Chars[m_Length] = 0
    240         End If
    241     End Sub
    242 #ifdef __STRCHAR_IS_NOT_UNICODE
    243     Sub AssignFromWideChar(text As PCWSTR, textLengthW As Long)
     235    Sub Assign(text As PCSTR, textLengthA As Long)
     236#ifdef __STRING_IS_NOT_UNICODE
     237        AssignFromStrChar(text, textLengthA)
     238#else
     239        Dim textLengthW = MultiByteToWideChar(CP_THREAD_ACP, 0, text, textLengthA, 0, 0)
     240        If AllocStringBuffer(textLengthW) <> 0 Then
     241            MultiByteToWideChar(CP_THREAD_ACP, 0, text, textLengthA, Chars, textLengthW)
     242        End If
     243#endif
     244    End Sub
     245
     246    Sub Assign(text As PCWSTR, textLengthW As Long)
     247#ifdef __STRING_IS_NOT_UNICODE
    244248        Dim textLengthA = WideCharToMultiByte(CP_THREAD_ACP, 0, text, textLengthW, 0, 0, 0, 0)
    245249        If AllocStringBuffer(textLengthA) <> 0 Then
    246250            WideCharToMultiByte(CP_THREAD_ACP, 0, text, textLengthW, Chars, textLengthA, 0, 0)
    247251        End If
    248     End Sub
    249252#else
    250     Sub AssignFromMultiByte(text As PCSTR, textLengthA As Long)
    251         Dim textLengthW = MultiByteToWideChar(CP_THREAD_ACP, 0, text, textLengthA, 0, 0)
    252         If AllocStringBuffer(textLengthW) <> 0 Then
    253             MultiByteToWideChar(CP_THREAD_ACP, 0, text, textLengthA, Chars, textLengthW)
    254         End If
    255     End Sub
    256 #endif
    257     Sub Assign(text As PCSTR, textLength As Long)
    258 #ifdef __STRING_IS_NOT_UNICODE
    259         AssignFromStrChar(text, textLength)
    260 #else
    261         AssignFromMultiByte(text, textLength)
    262 #endif
    263     End Sub
    264 
    265     Sub Assign(text As PCWSTR, textLength As Long)
    266 #ifdef __STRING_IS_NOT_UNICODE
    267         AssignFromWideChar(text, textLength)
    268 #else
    269         AssignFromStrChar(text, textLength)
     253        AssignFromStrChar(text, textLengthW)
    270254#endif
    271255    End Sub
     
    571555        Dim size = m_Length
    572556#endif
    573         Dim hash = 0 As DWord
    574         Dim p = Chars As *Word
    575         Dim i As Long
    576         For i = 0 To ELM(size)
    577             hash = ((hash << 16) + p[i]) Mod &h7fffffff
    578         Next
    579         Return hash As Long
     557        Return _System_GetHashFromWordArray(Chars As *Word, size)
    580558    End Function
    581559Private
     
    617595    End Function
    618596
     597    Sub AssignFromStrChar(text As *StrChar, textLength As Long)
     598        If text = Chars Then Exit Sub
     599        If AllocStringBuffer(textLength) <> 0 Then
     600            memcpy(Chars, text, SizeOf (StrChar) * textLength)
     601            Chars[m_Length] = 0
     602        End If
     603    End Sub
    619604End Class
  • Include/Classes/System/Version.ab

    r161 r175  
    11' System/Version.ab
     2
     3#ifndef __SYSTEM_VERSION_AB__
     4#define __SYSTEM_VERSION_AB__
     5
     6#require <api_winsock2.sbp>
    27
    38Class Version
     
    7580
    7681    Override Function GetHashCode() As Long
    77         Return htonl(major) Xor minor Xor build Xor htonl(rivision)
     82        Return _System_BSwap(major As DWord) Xor minor Xor build Xor _System_BSwap(rivision As DWord)
    7883    End Function
    7984
     
    143148    rivision As Long
    144149End Class
     150
     151#endif '__SYSTEM_VERSION_AB__
  • Include/Classes/System/index.ab

    r142 r175  
    1 #require "DateTime.ab"
    2 #require "Math.ab"
    3 #require "Object.ab"
    4 #require "String.ab"
    5 #require "TimeSpan.ab"
    6 #require "OperatingSystem.ab"
    7 #require "Version.ab"
    8 #require "Environment.ab"
     1#require <Classes/System/DateTime.ab>
     2#require <Classes/System/Math.ab>
     3#require <Classes/System/Object.ab>
     4#require <Classes/System/String.ab.
     5#require <Classes/System/TimeSpan.ab>
     6#require <Classes/System/OperatingSystem.ab>
     7#require <Classes/System/Version.ab>
     8#require <Classes/System/Environment.ab>
Note: See TracChangeset for help on using the changeset viewer.