Changeset 355 for trunk/Include/com
- Timestamp:
- Oct 13, 2007, 2:11:22 PM (17 years ago)
- Location:
- trunk/Include/com
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Include/com/currency.ab
r335 r355 56 56 Return ret 57 57 End Function 58 58 /* 59 59 Const Function Operator /(y As Variant) As Double 60 60 Dim vx = New Variant(This) 61 61 Dim ret = vx / y 62 Return ret.ValR 462 Return ret.ValR8 63 63 End Function 64 64 … … 67 67 Dim vy = New Variant(y) 68 68 Dim ret = vx / vy 69 Return ret.ValR 470 End Function 71 69 Return ret.ValR8 70 End Function 71 */ 72 72 Const Function Operator +(y As Currency) As Currency 73 73 Dim ret = New Currency -
trunk/Include/com/decimal.ab
r335 r355 15 15 Sub Decimal(d As Decimal) 16 16 ' dec = d なぜかコンパイルできない 17 memcpy(VarPtr(dec), VarPtr(d.dec), Len(dec)) 18 End Sub 19 20 Sub Decimal(ByRef d As DECIMAL) 17 21 memcpy(VarPtr(dec), VarPtr(d), Len(dec)) 18 22 End Sub … … 340 344 341 345 Const Function ToVariant() As Variant 342 Return New Variant( dec)346 Return New Variant(This) 343 347 End Function 344 348 -
trunk/Include/com/index.ab
r211 r355 3 3 #require <com/bstring.ab> 4 4 #require <com/variant.ab> 5 #require <com/vbobject.ab>5 '#require <com/vbobject.ab> 6 6 #require <com/currency.ab> 7 7 #require <com/decimal.ab> -
trunk/Include/com/variant.ab
r335 r355 6 6 '#require <oaidl.ab> 7 7 '#require <oleauto.ab> 8 #require <com/index.ab>8 '#require <com/index.ab> 9 9 10 10 Namespace ActiveBasic … … 109 109 110 110 Sub Variant(s As String) 111 Dim bs As BString(s) 112 Variant(bs) 111 ValStr = New BString(s) 113 112 End Sub 114 113 … … 118 117 End Sub 119 118 119 Sub Variant(n As Decimal) 120 Dim p = VarPtr(v) As *DECIMAL 121 p[0] = n.Dec 122 v.vt = VT_DECIMAL 123 End Sub 124 120 125 121 126 Sub ~Variant() … … 127 132 v.vt = VT_EMPTY 128 133 End Sub 129 /* 130 Sub Operator =(y As Variant) 131 Assign(y.v) 132 End Sub 133 134 Sub Operator =(y As VARIANT) 135 Assign(y) 136 End Sub 137 */ 134 138 135 Sub Assign(from As Variant) 139 136 Assign(from.v) … … 171 168 */ 172 169 'Operators 173 170 /* 174 171 Const Function Operator ^(y As Variant) As Variant 175 172 Dim ret = New Variant … … 265 262 Return ret 266 263 End Function 267 264 */ 268 265 Const Function Abs() As Variant 269 Dim ret = New Variant 270 VarAbs(This.v, ret.v) 271 Return ret 266 Abs = New Variant 267 VarAbs(This.v, Abs.v) 272 268 End Function 273 269 274 270 Const Function Fix() As Variant 275 Dim ret = New Variant 276 VarFix(This.v, ret.v) 277 Return ret 271 Fix = New Variant 272 VarFix(This.v, Fix.v) 278 273 End Function 279 274 280 275 Const Function Int() As Variant 281 Dim ret = New Variant 282 VarInt(This.v, ret.v) 283 Return ret 284 End Function 285 286 Const Function Round(cDecimals As Long) As Variant 287 Dim ret = New Variant 288 VarRound(This.v, cDecimals, ret) 289 Return ret 290 End Function 291 292 Const Function Round() As Variant 293 Return Round(0) 276 Int = New Variant 277 VarInt(This.v, Int.v) 278 End Function 279 280 Const Function Round(cDecimals = 0 As Long) As Variant 281 Round = New Variant 282 VarRound(This.v, cDecimals, Round.v) 294 283 End Function 295 284 … … 301 290 Return VarCmp(x.v, y.v, LOCALE_USER_DEFAULT, 0) 'VARCMP_NULL = 3を返す場合があるので注意 302 291 End Function 303 292 /* 304 293 Const Function Operator ==(y As Variant) As Boolean 305 294 Dim c = Compare(This, y) … … 338 327 End Function 339 328 */ 329 /* 340 330 Const Function Operator <=(y As Variant) As Boolean 341 331 Dim c = Compare(This, y) … … 355 345 End If 356 346 End Function 357 347 */ 358 348 Const Function ChangeType(vt As VARTYPE, flags As Word) As Variant 359 349 Dim ret = New Variant … … 435 425 Const Function ValI1() As SByte 436 426 Dim r = ChangeType(VT_I1) 437 Return GetByte(VarPtr(r.v al)) As SByte427 Return GetByte(VarPtr(r.v.val)) As SByte 438 428 End Function 439 429 … … 446 436 Const Function ValI2() As Integer 447 437 Dim r = ChangeType(VT_I2) 448 Return GetWord(VarPtr(r.v al)) As Integer438 Return GetWord(VarPtr(r.v.val)) As Integer 449 439 End Function 450 440 … … 457 447 Const Function ValI4() As Long 458 448 Dim r = ChangeType(VT_I4) 459 Return GetDWord(VarPtr(r.v al)) As Long449 Return GetDWord(VarPtr(r.v.val)) As Long 460 450 End Function 461 451 … … 468 458 Const Function ValI8() As Int64 469 459 Dim r = ChangeType(VT_I8) 470 Return GetQWord(VarPtr(r.v al)) As Int64460 Return GetQWord(VarPtr(r.v.val)) As Int64 471 461 End Function 472 462 … … 479 469 Const Function ValR4() As Single 480 470 Dim r = ChangeType(VT_R4) 481 Return GetSingle(VarPtr(r.v al))471 Return GetSingle(VarPtr(r.v.val)) 482 472 End Function 483 473 … … 490 480 Const Function ValR8() As Double 491 481 Dim r = ChangeType(VT_UI8) 492 Return GetDouble(VarPtr(r.v al))482 Return GetDouble(VarPtr(r.v.val)) 493 483 End Function 494 484 … … 512 502 Const Function ValError() As SCODE 513 503 Dim r = ChangeType(VT_ERROR) 514 Return GetDWord(VarPtr(r.v al))504 Return GetDWord(VarPtr(r.v.val)) 515 505 End Function 516 506 … … 524 514 Dim r = ChangeType(VT_CY) 525 515 ValCy = New Currency 526 ValCy.Cy = GetQWord(VarPtr(r.v al))516 ValCy.Cy = GetQWord(VarPtr(r.v.val)) 527 517 End Function 528 518 … … 561 551 v.vt = VT_UNKNOWN 562 552 End Sub 563 553 /* 564 554 Const Function ValObject() As VBObject 565 555 Dim r As VARIANT … … 576 566 v.vt = VT_DISPATH 577 567 End Sub 578 568 */ 579 569 'ValArray 580 570 581 571 Const Function ValDecimal() As Decimal 582 572 Dim p = VarPtr(v) As *Decimal 583 Return New Deciaml( p[0])573 Return New Deciaml(ByVal p) 584 574 End Function 585 575 586 576 Sub ValDecimal(x As Decimal) 587 577 Clear() 588 Dim p = VarPtr(v) As *D ecimal578 Dim p = VarPtr(v) As *DECIMAL 589 579 p[0] = x.Dec 590 580 v.vt = VT_DECIMAL '念の為 … … 599 589 ' If _System_VariantOptionalParam = Nothing Then 600 590 ' 'ToDo マルチスレッド対応 601 _System_VariantOptionalParam = New Variant602 _System_VariantOptionalParam.ValError = DISP_E_PARAMNOTFOUND591 VariantOptionalParam = New Variant 592 VariantOptionalParam.ValError = DISP_E_PARAMNOTFOUND 603 593 ' End If 604 Return _System_VariantOptionalParam594 Return VariantOptionalParam 605 595 End Function 606 596 Private … … 617 607 End Class 618 608 619 'Dim _System_VariantOptionalParam = Nothing As Variant609 Dim VariantOptionalParam = Nothing As Variant 620 610 621 611 /* -
trunk/Include/com/vbobject.ab
r335 r355 295 295 Return CallByName 296 296 End Function 297 297 /* 298 298 Function CreateObject(className As PCWSTR) As VBObject 299 299 Return New VBObject(className, 0, CLSCTX_ALL)
Note:
See TracChangeset
for help on using the changeset viewer.