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

Currencyにメンバを追加

File:
1 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
Note: See TracChangeset for help on using the changeset viewer.