Changeset 208 for Include/com


Ignore:
Timestamp:
Apr 7, 2007, 10:20:40 PM (18 years ago)
Author:
イグトランス (egtra)
Message:

[207]参照型変数のNothing初期化に対応する修正

Location:
Include/com
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • Include/com/bstring.ab

    r192 r208  
    3131
    3232    Sub BString(s As PCSTR, len As DWord)
    33         Dim lenBS = MultiByteToWideChar(CP_THREAD_ACP, 0, s, len, 0, 0)
     33        Dim lenBS = MultiByteToWideChar(CP_THREAD_ACP, 0, s, len As Long, 0, 0)
    3434        bs = SysAllocStringLen(0, lenBS)
    35         MultiByteToWideChar(CP_THREAD_ACP, 0, s, len, bs, lenBS)
     35        MultiByteToWideChar(CP_THREAD_ACP, 0, s, len As Long, bs, lenBS)
    3636    End Sub
    3737
     
    9292        BStr = bs
    9393    End Function
     94/*
     95    Static Function Assgin(bs As BSTR) As BString
     96        Assgin = New BString
     97        Assgin.Assgin(bs)
     98    End Function
    9499
     100    Static Function Attach(bs As BSTR) As BString
     101        Attach = New BString
     102        Attach.Attach(bs)
     103    End Function
     104*/
    95105    Const Function Length() As DWord
    96106        Length = SysStringLen(bs)
     
    116126
    117127    Override Function ToString() As String
    118         Dim s As String(bs As PCWSTR, Length As Long)
    119         Return s
     128        Return New String(bs As PCWSTR, Length As Long)
    120129    End Function
    121130
  • Include/com/currency.ab

    r200 r208  
    7171    End Function
    7272
     73    Static Function Compare(x As Currency, y As Currency) As HRESULT
     74        Return VarCyCmp(x, y)
     75    End Function
     76
     77    Static Function Compare(x As Currency, y As Double) As HRESULT
     78        Return VarCyCmpR8(x, y)
     79    End Function
     80
     81    Static Function Compare(x As Double, y As Currency) As HRESULT
     82        Dim ret = VarCyCmpR8(y, x)
     83        Select Case ret
     84            Case VARCMP_LT
     85                Return VARCMP_GT
     86            Case VARCMP_GT
     87                Return VARCMP_LT
     88            Case Else
     89                Return ret
     90        End Select
     91    End Function
     92
     93    Const Function Operator ==(y As Currency) As Boolean
     94        Dim c = Compare(This, y)
     95        Return c = VARCMP_EQ
     96    End Function
     97
     98    Const Function Operator ==(y As Double) As Boolean
     99        Dim c = Compare(This, y)
     100        Return c = VARCMP_EQ
     101    End Function
     102
     103    Const Function Operator <>(y As Currency) As Boolean
     104        Dim c = Compare(This, y)
     105        Return c <> VARCMP_EQ
     106    End Function
     107
     108    Const Function Operator <>(y As Double) As Boolean
     109        Dim c = Compare(This, y)
     110        Return c <> VARCMP_EQ
     111    End Function
     112
     113    Const Function Operator <(y As Currency) As Boolean
     114        Dim c = Compare(This, y)
     115        Return c = VARCMP_LT
     116    End Function
     117
     118    Const Function Operator <(y As Double) As Boolean
     119        Dim c = Compare(This, y)
     120        Return c = VARCMP_LT
     121    End Function
     122/*
     123    Const Function Operator >(y As Currency) As Boolean
     124        Dim c = Compare(This, y)
     125        Return c = VARCMP_GT
     126    End Function
     127
     128    Const Function Operator >(y As Double) As Boolean
     129        Dim c = Compare(This, y)
     130        Return c = VARCMP_GT
     131    End Function
     132*/
     133    Const Function Operator <=(y As Currency) As Boolean
     134        Dim c = Compare(This, y)
     135        Return result = VARCMP_LT Or result = VARCMP_EQ
     136    End Function
     137
     138    Const Function Operator <=(y As Double) As Boolean
     139        Dim c = Compare(This, y)
     140        Return result = VARCMP_LT Or result = VARCMP_EQ
     141    End Function
     142
     143    Const Function Operator >=(y As Currency) As Boolean
     144        Dim c = Compare(This, y)
     145        Return result = VARCMP_GT Or result = VARCMP_EQ
     146    End Function
     147
     148    Const Function Operator >=(y As Double) As Boolean
     149        Dim c = Compare(This, y)
     150        Return result = VARCMP_GT Or result = VARCMP_EQ
     151    End Function
     152
    73153    Const Function Abs() As Currency
     154        Abs = New Currency
    74155        VarCyAbs(This.cy, Abs.cy)
    75156    End Function
    76157
    77158    Const Function Fix() As Currency
     159        Fix = New Currency
    78160        VarCyFix(This.cy, Fix.cy)
    79161    End Function
    80162
    81163    Const Function Int() As Currency
     164        Int = New Currency
    82165        VarCyInt(This.cy, Int.cy)
    83166    End Function
    84167
    85168    Const Function Round(c = 0 As Long) As Currency
     169        Round = New Currency
    86170        VarCyRound(This.cy, c, Round.cy)
    87171    End Function
  • Include/com/variant.ab

    r200 r208  
    156156        Variant.Move(Detach, v)
    157157    End Function
    158 
     158/*
     159    Static Function Assgin(ByRef from As VARIANT) As Variant
     160        Assign = New Variant
     161        Assgin.Assign(from)
     162    End Function
     163
     164    Static Function Attach(ByRef from As VARIANT) As Variant
     165        Attach = New Variant
     166        Attach.Attach(from)
     167    End Function
     168*/
    159169    'Operators
    160170
    161171    Const Function Operator ^(y As Variant) As Variant
    162         Dim ret As Variant
     172        Dim ret = New Variant
    163173        VarPow(This.v, y.v, ret.v)
    164174        Return ret
     
    170180
    171181    Const Function Operator -() As Variant
    172         Dim ret As Variant
     182        Dim ret = New Variant
    173183        VarNeg(This.v, ret.v)
    174184        Return ret
     
    176186
    177187    Const Function Operator *(y As Variant) As Variant
    178         Dim ret As Variant
     188        Dim ret = New Variant
    179189        VarMul(This.v, y.v, ret.v)
    180190        Return ret
     
    182192
    183193    Const Function Operator /(y As Variant) As Variant
    184         Dim ret As Variant
     194        Dim ret = New Variant
    185195        VarDiv(This.v, y.v, ret.v)
    186196        Return ret
     
    188198
    189199    Const Function Operator \(y As Variant) As Variant
    190         Dim ret As Variant
     200        Dim ret = New Variant
    191201        VarIDiv(This.v, y.v, ret.v)
    192202        Return ret
     
    194204
    195205    Const Function Operator Mod(y As Variant) As Variant
    196         Dim ret As Variant
     206        Dim ret = New Variant
    197207        VarMod(This.v, y.v, ret.v)
    198208        Return ret
     
    200210
    201211    Const Function Operator +(y As Variant) As Variant
    202         Dim ret As Variant
     212        Dim ret = New Variant
    203213        VarAdd(This.v, y.v, ret.v)
    204214        Return ret
     
    206216
    207217    Const Function Operator -(y As Variant) As Variant
    208         Dim ret As Variant
     218        Dim ret = New Variant
    209219        VarSub(This.v, y.v, ret.v)
    210220        Return ret
     
    212222
    213223    Const Function Operator &(y As Variant) As Variant
    214         Dim ret As Variant
     224        Dim ret = New Variant
    215225        VarCat(This.v, y.v, ret.v)
    216226        Return ret
     
    218228
    219229    Const Function Operator And(y As Variant) As Variant
    220         Dim ret As Variant
     230        Dim ret = New Variant
    221231        VarAnd(This.v, y.v, ret.v)
    222232        Return ret
     
    224234
    225235    Const Function Operator Or(y As Variant) As Variant
    226         Dim ret As Variant
     236        Dim ret = New Variant
    227237        VarOr(This.v, y.v, ret.v)
    228238        Return ret
     
    230240
    231241    Const Function Operator Xor(y As Variant) As Variant
    232         Dim ret As Variant
     242        Dim ret = New Variant
    233243        VarXor(This.v, y.v, ret.v)
    234244        Return ret
     
    236246
    237247    Const Function Operator Not() As Variant
    238         Dim ret As Variant
     248        Dim ret = New Variant
    239249        VarNot(This.v, ret.v)
    240250        Return ret
     
    242252
    243253    Static Function Imp(x As Variant, y As Variant) As Variant
    244         Dim ret As Variant
     254        Dim ret = New Variant
    245255        VarImp(x.v, y.v, ret.v)
    246256        Return ret
     
    248258
    249259    Static Function Eqv(x As Variant, y As Variant) As Variant
    250         Dim ret As Variant
     260        Dim ret = New Variant
    251261        VarEqv(x.v, y.v, ret.v)
    252262        Return ret
     
    254264
    255265    Const Function Abs() As Variant
    256         Dim ret As Variant
     266        Dim ret = New Variant
    257267        VarAbs(This.v, ret.v)
    258268        Return ret
     
    260270
    261271    Const Function Fix() As Variant
    262         Dim ret As Variant
     272        Dim ret = New Variant
    263273        VarFix(This.v, ret.v)
    264274        Return ret
     
    266276
    267277    Const Function Int() As Variant
    268         Dim ret As Variant
     278        Dim ret = New Variant
    269279        VarInt(This.v, ret.v)
    270280        Return ret
     
    272282
    273283    Const Function Round(cDecimals As Long) As Variant
    274         Dim ret As Variant
     284        Dim ret = New Variant
    275285        VarRound(This.v, cDecimals, ret)
    276286        Return ret
     
    286296
    287297    Static Function Compare(x As Variant, y As Variant) As HRESULT
    288         Return VarCmp(x.v, y.v, GetUserDefaultLCID(), 0) 'VARCMP_NULL = 3を返す場合があるので注意
     298        Return VarCmp(x.v, y.v, LOCALE_USER_DEFAULT, 0) 'VARCMP_NULL = 3を返す場合があるので注意
    289299    End Function
    290300
     
    344354
    345355    Const Function ChangeType(vt As VARTYPE, flags As Word) As Variant
    346         Dim ret As Variant
     356        Dim ret = New Variant
    347357        ChangeType(ret, flags, vt)
    348358        Return ret
     
    368378        Dim tmp = ChangeType(VT_BSTR)
    369379        Dim bs = ((tmp.v.val As ULONG_PTR) As BSTR)
    370         Dim s As String(bs As PCWSTR, SysStringLen(bs) As Long)
    371         Return s
     380        Return New String(bs As PCWSTR, SysStringLen(bs) As Long)
    372381    End Function
    373382
     
    520529        Dim r As VARIANT
    521530        ChangeType(r, 0, VT_BSTR)
    522         Dim bs As BString
     531        Dim bs = New BString
    523532        bs.Attach(GetPointer(VarPtr(r.val)) As BSTR)
    524533        Return bs
     
    528537        Clear()
    529538        v.vt = VT_BSTR
     539        SetPointer(VarPtr(v.val), x.Copy())
    530540    End Sub
    531541
     
    588598End Class
    589599
    590 Dim _System_VariantOptionalParam = Nothing As Variant
     600'Dim _System_VariantOptionalParam = Nothing As Variant
    591601
    592602/*
  • Include/com/vbobject.ab

    r200 r208  
    157157        Dim hr = pdisp->Invoke(dispid, GUID_NULL, LOCALE_USER_DEFAULT, DISPATCH_PROPERTYGET, dispParams, ret, 0, 0)
    158158        Dispose()
    159         Dim v = New Variant
     159        Prop = New Variant
    160160        v.Attach(ret)
    161161        Return v
     
    288288    Dim ret As VARIANT
    289289    hr = obj->Invoke(dispid, GUID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, dispParams, ret, ByVal 0, 0)
     290    CallByName = New Variant
    290291    CallByName.Attach(ret)
    291292    Return CallByName
Note: See TracChangeset for help on using the changeset viewer.