Changeset 142 for Include/Classes/System


Ignore:
Timestamp:
Mar 9, 2007, 10:15:34 PM (18 years ago)
Author:
イグトランス (egtra)
Message:

Environment, OperatingSystem, Versionの追加、Unicode対応修正ほか

Location:
Include/Classes/System
Files:
3 added
7 edited

Legend:

Unmodified
Added
Removed
  • Include/Classes/System/Drawing/Font.ab

    r137 r142  
    131131        /*IN const*/ ByRef fontCollection As FontCollection)
    132132#ifdef __STRING_IS_NOT_UNICODE
    133         Dim name = _System_MultiByteToWideChar(familyName)
     133        Dim oldAlloc = _System_AllocForConvertedString
     134        _System_AllocForConvertedString = AddressOf (_System_malloc)
     135        Dim name = ToWCStr(familyName)
    134136        Font(name, emSize, style, unit, fontCollection)
    135137        _System_free(name)
     138        _System_AllocForConvertedString = oldAlloc
    136139#else
    137140        Font(familyName.Chars, emSize, style, unit, fontCollection)
     
    285288            ((lf.fdwUnderline <> FALSE) And FontStyle.Underline)) As FontStyle
    286289    End Function
    287        
     290
    288291    'Const Function SystemFontName() As String
    289292
  • Include/Classes/System/IO/DirectoryInfo.ab

    r129 r142  
    1818
    1919    Function Root() As DirectoryInfo
    20         Dim dirInfo as DirectoryInfo(Path.GetPathRoot(FullPath))
     20        Dim dirInfo As DirectoryInfo(Path.GetPathRoot(FullPath))
    2121        Return dirInfo
    2222    End Function
     
    2424    'Public Method
    2525    Sub Create()
    26         CreateDirectory(FullPath, NULL)
     26        CreateDirectory(ToTCStr(FullPath), NULL)
    2727    End Sub
    2828
     
    3131
    3232    Override Sub Delete()
    33         RemoveDirectory(FullPath)
     33        RemoveDirectory(ToTCStr(FullPath))
    3434    End Sub
    3535
     
    5454/*  Function GetFiles() As Array
    5555    End Function*/
    56    
     56
    5757/*  Function GetFiles(searchPattern As String) As Array
    5858    End Function*/
    59    
     59
    6060/*  Function GetFiles(searchPattern As String, searchOption As SearchOption) As Array
    6161    End Function*/
     
    6868
    6969    Sub MoveTo(destDirName As String)
    70         If MoveFile(FullPath, destDirName) = False Then
     70        If MoveFile(ToTCStr(FullPath), ToTCStr(destDirName)) = FALSE Then
    7171            'Exception
    7272        End If
  • Include/Classes/System/IO/DriveInfo.ab

    r64 r142  
    3535
    3636    Function DriveFormat() As String
    37         Dim systemName As String
    38         systemName.ReSize(15)
    39         If GetVolumeInformation(m_DriveName, NULL, NULL, NULL, NULL, NULL, systemName, 16) Then
     37        Dim systemName[15] As TCHAR
     38        If GetVolumeInformation(m_DriveName, NULL, NULL, NULL, NULL, NULL, systemName, Len (systemName)) Then
    4039            Return systemName
    4140        Else
     
    4847    End Function
    4948
    50     Function IsReady() As BOOL
     49    Function IsReady() As Boolean
    5150        If GetVolumeInformation(m_DriveName, NULL, NULL, NULL, NULL, NULL, NULL, NULL) Then
    52             Return _System_TRUE
     51            Return True
    5352        Else
    54             Return _System_FALSE
     53            Return False
    5554        End If
    5655    End Function
     
    8281
    8382    Function VolumeLabel() As String
    84         Dim volumeName As String
    85         volumeName.ReSize(63)
     83        Dim volumeName[63] As TCAHR
    8684        If GetVolumeInformation(m_DriveName, volumeName, 64, NULL, NULL, NULL, NULL, NULL) Then
    8785            Return volumeName
  • Include/Classes/System/IO/FileSystemInfo.ab

    r130 r142  
    167167    Virtual Sub Refresh()
    168168        Dim data As WIN32_FIND_DATA
    169         Dim hFind As HANDLE
    170         hFind = FindFirstFile(FullPath, data)
     169        Dim hFind = FindFirstFile(ToTCStr(FullPath), data)
    171170        FindClose(hFind)
    172171
     
    179178Private
    180179    Function setFileTime() As Boolean
    181         Dim hFile As HANDLE
    182         hFile = CreateFile(FullPath, GENERIC_WRITE, FILE_SHARE_READ Or FILE_SHARE_WRITE, ByVal 0, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0)
     180        Dim hFile = CreateFile(ToTCStr(FullPath), GENERIC_WRITE, FILE_SHARE_READ Or FILE_SHARE_WRITE, ByVal 0, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0)
    183181        If hFile = INVALID_HANDLE_VALUE Then
    184182            setFileTime = False
  • Include/Classes/System/IO/Path.ab

    r136 r142  
     1' System/IO/Path.ab
     2
     3#require <Classes/System/Environment.ab>
     4
    15Class Path
    26Public
     
    3640        Return path.Remove(0, extPos)
    3741    End Function
    38    
     42
    3943    Static Function ChangeExtension(path As String, extension As String) As String
    4044        Dim extPos As Long
     
    4953    Static Function HasExtension(ByRef path As String) As Boolean
    5054        If GetExtension(path) <> "" Then
    51             Return _System_TRUE
     55            Return True
    5256        Else
    53             Return _System_FALSE
     57            Return False
    5458        End If
    5559    End Function
     
    7478
    7579    Static Function GetTempPath() As String
    76         GetTempPath.ReSize(__GetTempPath(0, 0) - 1)
    77         __GetTempPath(GetTempPath.Length + 1, GetTempPath)
     80        Dim size = GetTempPath(0, 0
     81        Dim tempPath = _System_malloc(size))
     82        __GetTempPath(size, tempPath)
     83        GetTempPath = tempPath
     84        _System_free(tempPath)
    7885    End Function
    7986
    8087    Static Function GetFullPath(path As String) As String
    81         Dim cd As String
    82         Dim dirSepChar As String(Chr$(DirectorySeparatorChar))
    83         If IsPathRooted(path) Then Return path
    84 
    85         cd.ReSize = GetCurrentDirectory(0, 0) - 1
    86         GetCurrentDirectory(cd.Length + 1, cd)
    87         Return cd + dirSepChar + path
     88        If IsPathRooted(path) Then
     89            Return path
     90        Else
     91            Return Environment.CurrentDirectory + Chr$(DirectorySeparatorChar) + path
     92        End If
    8893    End Function
    8994
     
    108113    End Function
    109114
    110     Static Function IsPathRooted(path As String) As BOOL
     115    Static Function IsPathRooted(path As String) As Boolean
    111116        Dim volSepChar As String(Chr$(VolumeSeparatorChar))
    112117        If path.IndexOf(volSepChar, 1, 1) = 1 Then
    113             Return _System_TRUE
     118            Return True
    114119        Else
    115             Return _System_FALSE
     120            Return False
    116121        End If
    117122    End Function
  • Include/Classes/System/String.ab

    r139 r142  
    1010#else
    1111TypeDef StrChar = WCHAR
     12#ifndef UNICODE
     13#define __STRING_UNICODE_WINDOWS_ANSI
     14#endif
    1215#endif
    1316
     
    494497            Dim i As Long
    495498            For i = 0 To ELM(.m_Length)
    496                 If .Chars[i] = .oldChar Then
    497                     .Chars[i] = .newChar
     499                If .Chars[i] = oldChar Then
     500                    .Chars[i] = newChar
    498501                End If
    499502            Next
     
    558561
    559562    Static Function Copy(s As String) As String
    560         Copy.Resize(s.m_Length)
     563        Copy.ReSize(s.m_Length)
    561564        memcpy(Copy.Chars, This.Chars, SizeOf (StrChar) * m_Length)
    562565    End Function
  • Include/Classes/System/index.ab

    r106 r142  
    44#require "String.ab"
    55#require "TimeSpan.ab"
     6#require "OperatingSystem.ab"
     7#require "Version.ab"
     8#require "Environment.ab"
Note: See TracChangeset for help on using the changeset viewer.