Changeset 192 for Include/com/variant.ab
- Timestamp:
- Mar 28, 2007, 10:29:58 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Include/com/variant.ab
r175 r192 20 20 End Sub 21 21 22 Sub Variant( vAs VARIANT)22 Sub Variant(ByRef y As VARIANT) 23 23 VariantInit(v) 24 24 VariantCopy(v, y) … … 132 132 End Sub 133 133 134 Sub Assign(from As VARIANT) 135 Clear() 134 Sub Assign(ByRef from As VARIANT) 136 135 Variant.Copy(v, from) 136 End Sub 137 138 Sub AssignInd(ByRef from As VARIANT) 139 VariantCopyInd(v, from) 137 140 End Sub 138 141 … … 141 144 End Sub 142 145 146 Const Function Copy() As VARIANT 147 Variant.Copy(Copy, v) 148 End Function 149 143 150 Function Detach() As VARIANT 144 151 Variant.Move(Detach, v) … … 153 160 End Function 154 161 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 156 167 Dim ret As Variant 157 168 VarNeg(This.v, ret.v) … … 219 230 End Function 220 231 221 Function Operator Not() As Variant232 Const Function Operator Not() As Variant 222 233 Dim ret As Variant 223 234 VarNot(This.v, ret.v) … … 237 248 End Function 238 249 239 Function Abs() As Variant250 Const Function Abs() As Variant 240 251 Dim ret As Variant 241 252 VarAbs(This.v, ret.v) … … 243 254 End Function 244 255 245 Function Fix() As Variant256 Const Function Fix() As Variant 246 257 Dim ret As Variant 247 258 VarFix(This.v, ret.v) … … 249 260 End Function 250 261 251 Function Int() As Variant262 Const Function Int() As Variant 252 263 Dim ret As Variant 253 264 VarInt(This.v, ret.v) … … 255 266 End Function 256 267 257 Function Round(cDecimals As Long) As Variant268 Const Function Round(cDecimals As Long) As Variant 258 269 Dim ret As Variant 259 270 VarRound(This.v, cDecimals, ret) … … 261 272 End Function 262 273 263 Function Round() As Variant274 Const Function Round() As Variant 264 275 Return Round(0) 265 276 End Function … … 274 285 275 286 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 277 293 End Function 278 294 279 295 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 281 302 End Function 282 303 283 304 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 */ 291 322 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 294 329 End Function 295 330 296 331 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 299 338 End Function 300 339 … … 469 508 'ValDate 470 509 471 Const Function Val BStr() As BString510 Const Function ValStr() As BString 472 511 Dim r As VARIANT 473 512 ChangeType(r, 0, VT_BSTR) … … 477 516 End Function 478 517 479 Sub Val BStr(x As BString)518 Sub ValStr(x As BString) 480 519 Clear() 481 520 v.vt = VT_BSTR … … 497 536 Const Function ValObject() As VBObject 498 537 Dim r As VARIANT 499 ChangeType(r, 0, VT_DISPAT H)500 Dim o As VBO Bject538 ChangeType(r, 0, VT_DISPATCH) 539 Dim o As VBObject 501 540 o.Attach(GetPointer(VarPtr(r.val)) As *IDispatch) 502 541 Return o … … 517 556 Return VarPtr(v) 518 557 End Function 558 519 559 Private 520 560 v As VARIANT … … 523 563 VariantCopy(dst, src) 524 564 End Sub 525 565 526 566 527 567 Static Sub Move(ByRef dst As VARIANT, ByRef src As VARIANT)
Note:
See TracChangeset
for help on using the changeset viewer.