Changeset 200 for Include/com


Ignore:
Timestamp:
Apr 2, 2007, 11:55:39 PM (18 years ago)
Author:
イグトランス (egtra)
Message:

Currencyにメンバを追加

Location:
Include/com
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • Include/com/currency.ab

    r192 r200  
    11' com/currency.ab
     2
     3#require <com/variant.ab>
     4
     5#ifndef _COM_CURRENCY_AB
     6#define _COM_CURRENCY_AB
    27
    38Class Currency
    49Public
     10/*
     11    Sub Currency(x As CY)
     12        cy = x
     13    End Sub
     14*/
     15    Sub Currency(x As Double)
     16        VarCyFromR8(x, cy)
     17    End Sub
     18/*
     19    Sub Currency(x As Int64)
     20        VarCyFromI8(x, cy)
     21    End Sub
     22*/
    523    Const Function Operator +() As Currency
    624        Return New Currency(This)
     
    6886        VarCyRound(This.cy, c, Round.cy)
    6987    End Function
     88
     89    Const Function Cy() As CY
     90        Return cy
     91    End Function
     92
     93    Sub Cy(c As CY)
     94        cy = c
     95    End Sub
     96
     97    Const Function ToDouble() As Double
     98        VarR8FromCy(cy, ToDouble)
     99    End Function
     100
     101    Const Function ToInt64() As Int64
     102        VarI8FromCy(cy, ToInt64)
     103    End Function
     104
     105    Const Function ToVariant() As Variant
     106        Return New Variant(This)
     107    End Function
     108
     109    Override Function ToString() As String
     110        Dim bs As BSTR
     111        VarBstrFromCy(cy, LOCALE_USER_DEFAULT, LOCALE_USE_NLS, bs)
     112        ToString = New String(bs As PCWSTR, SysStringLen(bs) As Long)
     113        SysFreeString(bs)
     114    End Function
     115
     116    Override Function GetHashCode() As Long
     117        Return HIDWORD(cy) Xor LODWORD(cy)
     118    End Function
    70119Private
    71120    cy As CY
    72121End Class
     122
     123#endif '_COM_CURRENCY_AB
  • Include/com/index.ab

    r192 r200  
    33#require <com/bstring.ab>
    44#require <com/variant.ab>
    5 #require <com/vbojbect.ab>
     5#require <com/vbobject.ab>
    66#require <com/currency.ab>
  • Include/com/variant.ab

    r192 r200  
    66#require <oaidl.ab>
    77#require <oleauto.ab>
    8 #require <com/bstring.ab>
    9 #include <com/vbobject.ab>
     8#require <com/index.ab>
    109
    1110Class Variant
     
    111110    End Sub
    112111
     112    Sub Variant(n As Currency)
     113        v.vt = VT_CY
     114        SetQWord(VarPtr(v.val), n.Cy As QWord)
     115    End Sub
     116
     117
    113118    Sub ~Variant()
    114119        Clear()
     
    504509    End Sub
    505510
    506     'ValCy
    507 
     511    Const Function ValCy() As Currency
     512    End Function
     513
     514    Sub ValCy(x As Currency)
     515    End Sub
     516   
    508517    'ValDate
    509518
     
    557566    End Function
    558567
     568    Static Function OptionalParam() As Variant
     569'       If _System_VariantOptionalParam = Nothing Then
     570'           'ToDo マルチスレッド対応
     571            _System_VariantOptionalParam = New Variant
     572            _System_VariantOptionalParam.ValError = DISP_E_PARAMNOTFOUND
     573'       End If
     574        Return _System_VariantOptionalParam
     575    End Function
    559576Private
    560577    v As VARIANT
     
    570587    End Sub
    571588End Class
     589
     590Dim _System_VariantOptionalParam = Nothing As Variant
     591
    572592/*
    573593Function Abs(v As Variant) As Variant
  • Include/com/vbobject.ab

    r192 r200  
    3434        pdisp = obj.pdisp
    3535        pdisp->AddRef()
    36     End Sub
    37 
    38     Sub Operator =(ByRef obj As VBObject)
    39         ~VBObject()
    40         VBObject(obj)
    4136    End Sub
    4237
     
    206201    End Function
    207202
    208     Function Call(arg1 As Variant) As Variant
    209         Return Call(1, arg1.PtrToVariant)
    210     End Function
    211 
    212     Function Call(ByRef arg1 As Variant, ByRef arg2 As Variant) As Variant
    213         Dim arg[1] As VARIANT
    214 
    215         Return Call(2, VarPtr(arg1) As *VARIANT)
    216     End Function
    217 
     203    Function Call(arg0 As Variant) As Variant
     204        Return Call(1, arg0.PtrToVariant)
     205    End Function
     206
     207    Function Call(arg0 As Variant, arg1 As Variant) As Variant
     208        Dim arg[ELM(2)] As VARIANT
     209        arg[0] = arg0.Copy()
     210        arg[1] = arg1.Copy()
     211        Return Call(2, arg)
     212    End Function
     213
     214    Function Call(arg0 As Variant, arg1 As Variant, arg2 As Variant) As Variant
     215        Dim arg[ELM(3)] As VARIANT
     216        arg[0] = arg0.Copy()
     217        arg[1] = arg1.Copy()
     218        arg[2] = arg2.Copy()
     219        Return Call(3, arg)
     220    End Function
     221
     222    Function Call(arg0 As Variant, arg1 As Variant, arg2 As Variant, arg3 As Variant) As Variant
     223        Dim arg[ELM(4)] As VARIANT
     224        arg[0] = arg0.Copy()
     225        arg[1] = arg1.Copy()
     226        arg[2] = arg2.Copy()
     227        arg[3] = arg3.Copy()
     228        Return Call(4, arg)
     229    End Function
     230
     231/*
     232    Function Call(arg0 = Variant.OptionalParam As Variant, arg1 = Variant.OptionalParam As Variant,
     233        arg2 = Variant.OptionalParam As Variant, arg3 = Variant.OptionalParam As Variant,
     234        arg4 = Variant.OptionalParam As Variant, arg5 = Variant.OptionalParam As Variant,
     235        arg6 = Variant.OptionalParam As Variant, arg7 = Variant.OptionalParam As Variant,
     236        arg8 = Variant.OptionalParam As Variant, arg9 = Variant.OptionalParam As Variant) As Variant
     237        Dim arg[ELM(10)] As VARIANT
     238        arg[0] = arg0.Copy()
     239        arg[1] = arg1.Copy()
     240        arg[2] = arg2.Copy()
     241        arg[3] = arg3.Copy()
     242        arg[4] = arg3.Copy()
     243        arg[5] = arg4.Copy()
     244        arg[6] = arg5.Copy()
     245        arg[7] = arg6.Copy()
     246        arg[8] = arg7.Copy()
     247        arg[9] = arg8.Copy()
     248        Return Call(10, arg)
     249    End Function
     250*/
    218251Private
    219252    Sub setProp(ByRef arg As VARIANT, callType As Word)
Note: See TracChangeset for help on using the changeset viewer.