Changeset 208 for Include/com
- Timestamp:
- Apr 7, 2007, 10:20:40 PM (18 years ago)
- Location:
- Include/com
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
Include/com/bstring.ab
r192 r208 31 31 32 32 Sub BString(s As PCSTR, len As DWord) 33 Dim lenBS = MultiByteToWideChar(CP_THREAD_ACP, 0, s, len , 0, 0)33 Dim lenBS = MultiByteToWideChar(CP_THREAD_ACP, 0, s, len As Long, 0, 0) 34 34 bs = SysAllocStringLen(0, lenBS) 35 MultiByteToWideChar(CP_THREAD_ACP, 0, s, len , bs, lenBS)35 MultiByteToWideChar(CP_THREAD_ACP, 0, s, len As Long, bs, lenBS) 36 36 End Sub 37 37 … … 92 92 BStr = bs 93 93 End Function 94 /* 95 Static Function Assgin(bs As BSTR) As BString 96 Assgin = New BString 97 Assgin.Assgin(bs) 98 End Function 94 99 100 Static Function Attach(bs As BSTR) As BString 101 Attach = New BString 102 Attach.Attach(bs) 103 End Function 104 */ 95 105 Const Function Length() As DWord 96 106 Length = SysStringLen(bs) … … 116 126 117 127 Override Function ToString() As String 118 Dim s As String(bs As PCWSTR, Length As Long) 119 Return s 128 Return New String(bs As PCWSTR, Length As Long) 120 129 End Function 121 130 -
Include/com/currency.ab
r200 r208 71 71 End Function 72 72 73 Static Function Compare(x As Currency, y As Currency) As HRESULT 74 Return VarCyCmp(x, y) 75 End Function 76 77 Static Function Compare(x As Currency, y As Double) As HRESULT 78 Return VarCyCmpR8(x, y) 79 End Function 80 81 Static Function Compare(x As Double, y As Currency) As HRESULT 82 Dim ret = VarCyCmpR8(y, x) 83 Select Case ret 84 Case VARCMP_LT 85 Return VARCMP_GT 86 Case VARCMP_GT 87 Return VARCMP_LT 88 Case Else 89 Return ret 90 End Select 91 End Function 92 93 Const Function Operator ==(y As Currency) As Boolean 94 Dim c = Compare(This, y) 95 Return c = VARCMP_EQ 96 End Function 97 98 Const Function Operator ==(y As Double) As Boolean 99 Dim c = Compare(This, y) 100 Return c = VARCMP_EQ 101 End Function 102 103 Const Function Operator <>(y As Currency) As Boolean 104 Dim c = Compare(This, y) 105 Return c <> VARCMP_EQ 106 End Function 107 108 Const Function Operator <>(y As Double) As Boolean 109 Dim c = Compare(This, y) 110 Return c <> VARCMP_EQ 111 End Function 112 113 Const Function Operator <(y As Currency) As Boolean 114 Dim c = Compare(This, y) 115 Return c = VARCMP_LT 116 End Function 117 118 Const Function Operator <(y As Double) As Boolean 119 Dim c = Compare(This, y) 120 Return c = VARCMP_LT 121 End Function 122 /* 123 Const Function Operator >(y As Currency) As Boolean 124 Dim c = Compare(This, y) 125 Return c = VARCMP_GT 126 End Function 127 128 Const Function Operator >(y As Double) As Boolean 129 Dim c = Compare(This, y) 130 Return c = VARCMP_GT 131 End Function 132 */ 133 Const Function Operator <=(y As Currency) As Boolean 134 Dim c = Compare(This, y) 135 Return result = VARCMP_LT Or result = VARCMP_EQ 136 End Function 137 138 Const Function Operator <=(y As Double) As Boolean 139 Dim c = Compare(This, y) 140 Return result = VARCMP_LT Or result = VARCMP_EQ 141 End Function 142 143 Const Function Operator >=(y As Currency) As Boolean 144 Dim c = Compare(This, y) 145 Return result = VARCMP_GT Or result = VARCMP_EQ 146 End Function 147 148 Const Function Operator >=(y As Double) As Boolean 149 Dim c = Compare(This, y) 150 Return result = VARCMP_GT Or result = VARCMP_EQ 151 End Function 152 73 153 Const Function Abs() As Currency 154 Abs = New Currency 74 155 VarCyAbs(This.cy, Abs.cy) 75 156 End Function 76 157 77 158 Const Function Fix() As Currency 159 Fix = New Currency 78 160 VarCyFix(This.cy, Fix.cy) 79 161 End Function 80 162 81 163 Const Function Int() As Currency 164 Int = New Currency 82 165 VarCyInt(This.cy, Int.cy) 83 166 End Function 84 167 85 168 Const Function Round(c = 0 As Long) As Currency 169 Round = New Currency 86 170 VarCyRound(This.cy, c, Round.cy) 87 171 End Function -
Include/com/variant.ab
r200 r208 156 156 Variant.Move(Detach, v) 157 157 End Function 158 158 /* 159 Static Function Assgin(ByRef from As VARIANT) As Variant 160 Assign = New Variant 161 Assgin.Assign(from) 162 End Function 163 164 Static Function Attach(ByRef from As VARIANT) As Variant 165 Attach = New Variant 166 Attach.Attach(from) 167 End Function 168 */ 159 169 'Operators 160 170 161 171 Const Function Operator ^(y As Variant) As Variant 162 Dim ret AsVariant172 Dim ret = New Variant 163 173 VarPow(This.v, y.v, ret.v) 164 174 Return ret … … 170 180 171 181 Const Function Operator -() As Variant 172 Dim ret AsVariant182 Dim ret = New Variant 173 183 VarNeg(This.v, ret.v) 174 184 Return ret … … 176 186 177 187 Const Function Operator *(y As Variant) As Variant 178 Dim ret AsVariant188 Dim ret = New Variant 179 189 VarMul(This.v, y.v, ret.v) 180 190 Return ret … … 182 192 183 193 Const Function Operator /(y As Variant) As Variant 184 Dim ret AsVariant194 Dim ret = New Variant 185 195 VarDiv(This.v, y.v, ret.v) 186 196 Return ret … … 188 198 189 199 Const Function Operator \(y As Variant) As Variant 190 Dim ret AsVariant200 Dim ret = New Variant 191 201 VarIDiv(This.v, y.v, ret.v) 192 202 Return ret … … 194 204 195 205 Const Function Operator Mod(y As Variant) As Variant 196 Dim ret AsVariant206 Dim ret = New Variant 197 207 VarMod(This.v, y.v, ret.v) 198 208 Return ret … … 200 210 201 211 Const Function Operator +(y As Variant) As Variant 202 Dim ret AsVariant212 Dim ret = New Variant 203 213 VarAdd(This.v, y.v, ret.v) 204 214 Return ret … … 206 216 207 217 Const Function Operator -(y As Variant) As Variant 208 Dim ret AsVariant218 Dim ret = New Variant 209 219 VarSub(This.v, y.v, ret.v) 210 220 Return ret … … 212 222 213 223 Const Function Operator &(y As Variant) As Variant 214 Dim ret AsVariant224 Dim ret = New Variant 215 225 VarCat(This.v, y.v, ret.v) 216 226 Return ret … … 218 228 219 229 Const Function Operator And(y As Variant) As Variant 220 Dim ret AsVariant230 Dim ret = New Variant 221 231 VarAnd(This.v, y.v, ret.v) 222 232 Return ret … … 224 234 225 235 Const Function Operator Or(y As Variant) As Variant 226 Dim ret AsVariant236 Dim ret = New Variant 227 237 VarOr(This.v, y.v, ret.v) 228 238 Return ret … … 230 240 231 241 Const Function Operator Xor(y As Variant) As Variant 232 Dim ret AsVariant242 Dim ret = New Variant 233 243 VarXor(This.v, y.v, ret.v) 234 244 Return ret … … 236 246 237 247 Const Function Operator Not() As Variant 238 Dim ret AsVariant248 Dim ret = New Variant 239 249 VarNot(This.v, ret.v) 240 250 Return ret … … 242 252 243 253 Static Function Imp(x As Variant, y As Variant) As Variant 244 Dim ret AsVariant254 Dim ret = New Variant 245 255 VarImp(x.v, y.v, ret.v) 246 256 Return ret … … 248 258 249 259 Static Function Eqv(x As Variant, y As Variant) As Variant 250 Dim ret AsVariant260 Dim ret = New Variant 251 261 VarEqv(x.v, y.v, ret.v) 252 262 Return ret … … 254 264 255 265 Const Function Abs() As Variant 256 Dim ret AsVariant266 Dim ret = New Variant 257 267 VarAbs(This.v, ret.v) 258 268 Return ret … … 260 270 261 271 Const Function Fix() As Variant 262 Dim ret AsVariant272 Dim ret = New Variant 263 273 VarFix(This.v, ret.v) 264 274 Return ret … … 266 276 267 277 Const Function Int() As Variant 268 Dim ret AsVariant278 Dim ret = New Variant 269 279 VarInt(This.v, ret.v) 270 280 Return ret … … 272 282 273 283 Const Function Round(cDecimals As Long) As Variant 274 Dim ret AsVariant284 Dim ret = New Variant 275 285 VarRound(This.v, cDecimals, ret) 276 286 Return ret … … 286 296 287 297 Static Function Compare(x As Variant, y As Variant) As HRESULT 288 Return VarCmp(x.v, y.v, GetUserDefaultLCID(), 0) 'VARCMP_NULL = 3を返す場合があるので注意298 Return VarCmp(x.v, y.v, LOCALE_USER_DEFAULT, 0) 'VARCMP_NULL = 3を返す場合があるので注意 289 299 End Function 290 300 … … 344 354 345 355 Const Function ChangeType(vt As VARTYPE, flags As Word) As Variant 346 Dim ret AsVariant356 Dim ret = New Variant 347 357 ChangeType(ret, flags, vt) 348 358 Return ret … … 368 378 Dim tmp = ChangeType(VT_BSTR) 369 379 Dim bs = ((tmp.v.val As ULONG_PTR) As BSTR) 370 Dim s As String(bs As PCWSTR, SysStringLen(bs) As Long) 371 Return s 380 Return New String(bs As PCWSTR, SysStringLen(bs) As Long) 372 381 End Function 373 382 … … 520 529 Dim r As VARIANT 521 530 ChangeType(r, 0, VT_BSTR) 522 Dim bs AsBString531 Dim bs = New BString 523 532 bs.Attach(GetPointer(VarPtr(r.val)) As BSTR) 524 533 Return bs … … 528 537 Clear() 529 538 v.vt = VT_BSTR 539 SetPointer(VarPtr(v.val), x.Copy()) 530 540 End Sub 531 541 … … 588 598 End Class 589 599 590 Dim _System_VariantOptionalParam = Nothing As Variant600 'Dim _System_VariantOptionalParam = Nothing As Variant 591 601 592 602 /* -
Include/com/vbobject.ab
r200 r208 157 157 Dim hr = pdisp->Invoke(dispid, GUID_NULL, LOCALE_USER_DEFAULT, DISPATCH_PROPERTYGET, dispParams, ret, 0, 0) 158 158 Dispose() 159 Dim v= New Variant159 Prop = New Variant 160 160 v.Attach(ret) 161 161 Return v … … 288 288 Dim ret As VARIANT 289 289 hr = obj->Invoke(dispid, GUID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, dispParams, ret, ByVal 0, 0) 290 CallByName = New Variant 290 291 CallByName.Attach(ret) 291 292 Return CallByName
Note:
See TracChangeset
for help on using the changeset viewer.