Changeset 200 for Include/com/currency.ab
- Timestamp:
- Apr 2, 2007, 11:55:39 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Include/com/currency.ab
r192 r200 1 1 ' com/currency.ab 2 3 #require <com/variant.ab> 4 5 #ifndef _COM_CURRENCY_AB 6 #define _COM_CURRENCY_AB 2 7 3 8 Class Currency 4 9 Public 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 */ 5 23 Const Function Operator +() As Currency 6 24 Return New Currency(This) … … 68 86 VarCyRound(This.cy, c, Round.cy) 69 87 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 70 119 Private 71 120 cy As CY 72 121 End Class 122 123 #endif '_COM_CURRENCY_AB
Note:
See TracChangeset
for help on using the changeset viewer.