Changeset 192 for Include/com/variant.ab


Ignore:
Timestamp:
Mar 28, 2007, 10:29:58 AM (18 years ago)
Author:
イグトランス (egtra)
Message:

Currencyを追加、その他修正

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Include/com/variant.ab

    r175 r192  
    2020    End Sub
    2121
    22     Sub Variant(v As VARIANT)
     22    Sub Variant(ByRef y As VARIANT)
    2323        VariantInit(v)
    2424        VariantCopy(v, y)
     
    132132    End Sub
    133133
    134     Sub Assign(from As VARIANT)
    135         Clear()
     134    Sub Assign(ByRef from As VARIANT)
    136135        Variant.Copy(v, from)
     136    End Sub
     137
     138    Sub AssignInd(ByRef from As VARIANT)
     139        VariantCopyInd(v, from)
    137140    End Sub
    138141
     
    141144    End Sub
    142145
     146    Const Function Copy() As VARIANT
     147        Variant.Copy(Copy, v)
     148    End Function
     149
    143150    Function Detach() As VARIANT
    144151        Variant.Move(Detach, v)
     
    153160    End Function
    154161
    155     Function Operator -() As Variant
     162    Const Function Operator +() As Variant
     163        Return New Variant(This)
     164    End Function
     165
     166    Const Function Operator -() As Variant
    156167        Dim ret As Variant
    157168        VarNeg(This.v, ret.v)
     
    219230    End Function
    220231
    221     Function Operator Not() As Variant
     232    Const Function Operator Not() As Variant
    222233        Dim ret As Variant
    223234        VarNot(This.v, ret.v)
     
    237248    End Function
    238249
    239     Function Abs() As Variant
     250    Const Function Abs() As Variant
    240251        Dim ret As Variant
    241252        VarAbs(This.v, ret.v)
     
    243254    End Function
    244255
    245     Function Fix() As Variant
     256    Const Function Fix() As Variant
    246257        Dim ret As Variant
    247258        VarFix(This.v, ret.v)
     
    249260    End Function
    250261
    251     Function Int() As Variant
     262    Const Function Int() As Variant
    252263        Dim ret As Variant
    253264        VarInt(This.v, ret.v)
     
    255266    End Function
    256267
    257     Function Round(cDecimals As Long) As Variant
     268    Const Function Round(cDecimals As Long) As Variant
    258269        Dim ret As Variant
    259270        VarRound(This.v, cDecimals, ret)
     
    261272    End Function
    262273
    263     Function Round() As Variant
     274    Const Function Round() As Variant
    264275        Return Round(0)
    265276    End Function
     
    274285
    275286    Const Function Operator ==(y As Variant) As Boolean
    276         Return Compare(This, y) = VARCMP_EQ
     287        Dim c = Compare(This, y)
     288        If c = VARCMP_EQ Then
     289            Return True
     290        Else
     291            Return False
     292        End If
    277293    End Function
    278294
    279295    Const Function Operator <>(y As Variant) As Boolean
    280         Return Compare(This, y) <> VARCMP_EQ
     296        Dim c = Compare(This, y)
     297        If c <> VARCMP_EQ Then
     298            Return True
     299        Else
     300            Return False
     301        End If
    281302    End Function
    282303
    283304    Const Function Operator <(y As Variant) As Boolean
    284         Return Compare(This, y) = VARCMP_LT
    285     End Function
    286 
    287 '   Const Function Operator >(y As Variant) As Boolean
    288 '       Return Compare(This, y) = VARCMP_GT
    289 '   End Function
    290 
     305        Dim c = Compare(This, y)
     306        If c = VARCMP_LT Then
     307            Return True
     308        Else
     309            Return False
     310        End If
     311    End Function
     312/*
     313    Const Function Operator >(y As Variant) As Boolean
     314        Dim c = Compare(This, y)
     315        If c = VARCMP_GT Then
     316            Return True
     317        Else
     318            Return False
     319        End If
     320    End Function
     321*/
    291322    Const Function Operator <=(y As Variant) As Boolean
    292         Dim result = Compare(This, y)
    293         Return result = VARCMP_LT Or result = VARCMP_EQ
     323        Dim c = Compare(This, y)
     324        If result = VARCMP_LT Or result = VARCMP_EQ Then
     325            Return True
     326        Else
     327            Return False
     328        End If
    294329    End Function
    295330
    296331    Const Function Operator >=(y As Variant) As Boolean
    297         Dim result = Compare(This, y)
    298         Return result = VARCMP_GT Or result = VARCMP_EQ
     332        Dim c = Compare(This, y)
     333        If result = VARCMP_GT Or result = VARCMP_EQ Then
     334            Return True
     335        Else
     336            Return False
     337        End If
    299338    End Function
    300339
     
    469508    'ValDate
    470509
    471     Const Function ValBStr() As BString
     510    Const Function ValStr() As BString
    472511        Dim r As VARIANT
    473512        ChangeType(r, 0, VT_BSTR)
     
    477516    End Function
    478517
    479     Sub ValBStr(x As BString)
     518    Sub ValStr(x As BString)
    480519        Clear()
    481520        v.vt = VT_BSTR
     
    497536    Const Function ValObject() As VBObject
    498537        Dim r As VARIANT
    499         ChangeType(r, 0, VT_DISPATH)
    500         Dim o As VBOBject
     538        ChangeType(r, 0, VT_DISPATCH)
     539        Dim o As VBObject
    501540        o.Attach(GetPointer(VarPtr(r.val)) As *IDispatch)
    502541        Return o
     
    517556        Return VarPtr(v)
    518557    End Function
     558
    519559Private
    520560    v As VARIANT
     
    523563        VariantCopy(dst, src)
    524564    End Sub
    525        
     565
    526566
    527567    Static Sub Move(ByRef dst As VARIANT, ByRef src As VARIANT)
Note: See TracChangeset for help on using the changeset viewer.