Ignore:
Timestamp:
Oct 13, 2007, 2:11:22 PM (17 years ago)
Author:
イグトランス (egtra)
Message:

FormatIntegerDを実装。
UnitTestの失敗時の表示を目立つようにした。
ArrayListを名前空間System.Collectionsに入れた。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Include/com/variant.ab

    r335 r355  
    66'#require <oaidl.ab>
    77'#require <oleauto.ab>
    8 #require <com/index.ab>
     8'#require <com/index.ab>
    99
    1010Namespace ActiveBasic
     
    109109
    110110    Sub Variant(s As String)
    111         Dim bs As BString(s)
    112         Variant(bs)
     111        ValStr = New BString(s)
    113112    End Sub
    114113
     
    118117    End Sub
    119118
     119    Sub Variant(n As Decimal)
     120        Dim p = VarPtr(v) As *DECIMAL
     121        p[0] = n.Dec
     122        v.vt = VT_DECIMAL
     123    End Sub
     124
    120125
    121126    Sub ~Variant()
     
    127132        v.vt = VT_EMPTY
    128133    End Sub
    129 /*
    130     Sub Operator =(y As Variant)
    131         Assign(y.v)
    132     End Sub
    133 
    134     Sub Operator =(y As VARIANT)
    135         Assign(y)
    136     End Sub
    137 */
     134
    138135    Sub Assign(from As Variant)
    139136        Assign(from.v)
     
    171168*/
    172169    'Operators
    173 
     170/*
    174171    Const Function Operator ^(y As Variant) As Variant
    175172        Dim ret = New Variant
     
    265262        Return ret
    266263    End Function
    267 
     264*/
    268265    Const Function Abs() As Variant
    269         Dim ret = New Variant
    270         VarAbs(This.v, ret.v)
    271         Return ret
     266        Abs = New Variant
     267        VarAbs(This.v, Abs.v)
    272268    End Function
    273269
    274270    Const Function Fix() As Variant
    275         Dim ret = New Variant
    276         VarFix(This.v, ret.v)
    277         Return ret
     271        Fix = New Variant
     272        VarFix(This.v, Fix.v)
    278273    End Function
    279274
    280275    Const Function Int() As Variant
    281         Dim ret = New Variant
    282         VarInt(This.v, ret.v)
    283         Return ret
    284     End Function
    285 
    286     Const Function Round(cDecimals As Long) As Variant
    287         Dim ret = New Variant
    288         VarRound(This.v, cDecimals, ret)
    289         Return ret
    290     End Function
    291 
    292     Const Function Round() As Variant
    293         Return Round(0)
     276        Int = New Variant
     277        VarInt(This.v, Int.v)
     278    End Function
     279
     280    Const Function Round(cDecimals = 0 As Long) As Variant
     281        Round = New Variant
     282        VarRound(This.v, cDecimals, Round.v)
    294283    End Function
    295284
     
    301290        Return VarCmp(x.v, y.v, LOCALE_USER_DEFAULT, 0) 'VARCMP_NULL = 3を返す場合があるので注意
    302291    End Function
    303 
     292/*
    304293    Const Function Operator ==(y As Variant) As Boolean
    305294        Dim c = Compare(This, y)
     
    338327    End Function
    339328*/
     329/*
    340330    Const Function Operator <=(y As Variant) As Boolean
    341331        Dim c = Compare(This, y)
     
    355345        End If
    356346    End Function
    357 
     347*/
    358348    Const Function ChangeType(vt As VARTYPE, flags As Word) As Variant
    359349        Dim ret = New Variant
     
    435425    Const Function ValI1() As SByte
    436426        Dim r = ChangeType(VT_I1)
    437         Return GetByte(VarPtr(r.val)) As SByte
     427        Return GetByte(VarPtr(r.v.val)) As SByte
    438428    End Function
    439429
     
    446436    Const Function ValI2() As Integer
    447437        Dim r = ChangeType(VT_I2)
    448         Return GetWord(VarPtr(r.val)) As Integer
     438        Return GetWord(VarPtr(r.v.val)) As Integer
    449439    End Function
    450440
     
    457447    Const Function ValI4() As Long
    458448        Dim r = ChangeType(VT_I4)
    459         Return GetDWord(VarPtr(r.val)) As Long
     449        Return GetDWord(VarPtr(r.v.val)) As Long
    460450    End Function
    461451
     
    468458    Const Function ValI8() As Int64
    469459        Dim r = ChangeType(VT_I8)
    470         Return GetQWord(VarPtr(r.val)) As Int64
     460        Return GetQWord(VarPtr(r.v.val)) As Int64
    471461    End Function
    472462
     
    479469    Const Function ValR4() As Single
    480470        Dim r = ChangeType(VT_R4)
    481         Return GetSingle(VarPtr(r.val))
     471        Return GetSingle(VarPtr(r.v.val))
    482472    End Function
    483473
     
    490480    Const Function ValR8() As Double
    491481        Dim r = ChangeType(VT_UI8)
    492         Return GetDouble(VarPtr(r.val))
     482        Return GetDouble(VarPtr(r.v.val))
    493483    End Function
    494484
     
    512502    Const Function ValError() As SCODE
    513503        Dim r = ChangeType(VT_ERROR)
    514         Return GetDWord(VarPtr(r.val))
     504        Return GetDWord(VarPtr(r.v.val))
    515505    End Function
    516506
     
    524514        Dim r = ChangeType(VT_CY)
    525515        ValCy = New Currency
    526         ValCy.Cy = GetQWord(VarPtr(r.val))
     516        ValCy.Cy = GetQWord(VarPtr(r.v.val))
    527517    End Function
    528518
     
    561551        v.vt = VT_UNKNOWN
    562552    End Sub
    563 
     553/*
    564554    Const Function ValObject() As VBObject
    565555        Dim r As VARIANT
     
    576566        v.vt = VT_DISPATH
    577567    End Sub
    578 
     568*/
    579569    'ValArray
    580570
    581571    Const Function ValDecimal() As Decimal
    582572        Dim p = VarPtr(v) As *Decimal
    583         Return New Deciaml(p[0])
     573        Return New Deciaml(ByVal p)
    584574    End Function
    585575
    586576    Sub ValDecimal(x As Decimal)
    587577        Clear()
    588         Dim p = VarPtr(v) As *Decimal
     578        Dim p = VarPtr(v) As *DECIMAL
    589579        p[0] = x.Dec
    590580        v.vt = VT_DECIMAL '念の為
     
    599589'       If _System_VariantOptionalParam = Nothing Then
    600590'           'ToDo マルチスレッド対応
    601             _System_VariantOptionalParam = New Variant
    602             _System_VariantOptionalParam.ValError = DISP_E_PARAMNOTFOUND
     591            VariantOptionalParam = New Variant
     592            VariantOptionalParam.ValError = DISP_E_PARAMNOTFOUND
    603593'       End If
    604         Return _System_VariantOptionalParam
     594        Return VariantOptionalParam
    605595    End Function
    606596Private
     
    617607End Class
    618608
    619 'Dim _System_VariantOptionalParam = Nothing As Variant
     609Dim VariantOptionalParam = Nothing As Variant
    620610
    621611/*
Note: See TracChangeset for help on using the changeset viewer.