Changeset 208 for Include/com/variant.ab


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

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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/*
Note: See TracChangeset for help on using the changeset viewer.