 |
Changeset 2893
- Timestamp:
- 11/19/07 16:31:46
(10 months ago)
- Author:
- sean
- Message:
Changed opEqusls to return a bool instead of an int.
!!! THIS CHANGE MAKE BREAK OVERRIDDEN OPERATORS IN USER CODE !!!
closes #761
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r2465 |
r2893 |
|
| 111 | 111 | * Returns !=0 if this object does have the same contents as obj. |
|---|
| 112 | 112 | */ |
|---|
| 113 | | int opEquals(Object o) |
|---|
| | 113 | bool opEquals(Object o) |
|---|
| 114 | 114 | { |
|---|
| 115 | 115 | return cast(int)(this is o); |
|---|
| … | … | |
| 229 | 229 | } |
|---|
| 230 | 230 | |
|---|
| 231 | | int opEquals(Object o) |
|---|
| | 231 | bool opEquals(Object o) |
|---|
| 232 | 232 | { |
|---|
| 233 | 233 | /* TypeInfo instances are singletons, but duplicates can exist |
|---|
| … | … | |
| 284 | 284 | char[] toUtf8() { return name; } |
|---|
| 285 | 285 | |
|---|
| 286 | | int opEquals(Object o) |
|---|
| | 286 | bool opEquals(Object o) |
|---|
| 287 | 287 | { TypeInfo_Typedef c; |
|---|
| 288 | 288 | |
|---|
| … | … | |
| 317 | 317 | char[] toUtf8() { return m_next.toUtf8() ~ "*"; } |
|---|
| 318 | 318 | |
|---|
| 319 | | int opEquals(Object o) |
|---|
| | 319 | bool opEquals(Object o) |
|---|
| 320 | 320 | { TypeInfo_Pointer c; |
|---|
| 321 | 321 | |
|---|
| … | … | |
| 367 | 367 | char[] toUtf8() { return value.toUtf8() ~ "[]"; } |
|---|
| 368 | 368 | |
|---|
| 369 | | int opEquals(Object o) |
|---|
| | 369 | bool opEquals(Object o) |
|---|
| 370 | 370 | { TypeInfo_Array c; |
|---|
| 371 | 371 | |
|---|
| … | … | |
| 448 | 448 | } |
|---|
| 449 | 449 | |
|---|
| 450 | | int opEquals(Object o) |
|---|
| | 450 | bool opEquals(Object o) |
|---|
| 451 | 451 | { TypeInfo_StaticArray c; |
|---|
| 452 | 452 | |
|---|
| … | … | |
| 532 | 532 | } |
|---|
| 533 | 533 | |
|---|
| 534 | | int opEquals(Object o) |
|---|
| | 534 | bool opEquals(Object o) |
|---|
| 535 | 535 | { TypeInfo_AssociativeArray c; |
|---|
| 536 | 536 | |
|---|
| … | … | |
| 562 | 562 | } |
|---|
| 563 | 563 | |
|---|
| 564 | | int opEquals(Object o) |
|---|
| | 564 | bool opEquals(Object o) |
|---|
| 565 | 565 | { TypeInfo_Function c; |
|---|
| 566 | 566 | |
|---|
| … | … | |
| 587 | 587 | } |
|---|
| 588 | 588 | |
|---|
| 589 | | int opEquals(Object o) |
|---|
| | 589 | bool opEquals(Object o) |
|---|
| 590 | 590 | { TypeInfo_Delegate c; |
|---|
| 591 | 591 | |
|---|
| … | … | |
| 611 | 611 | char[] toUtf8() { return info.name; } |
|---|
| 612 | 612 | |
|---|
| 613 | | int opEquals(Object o) |
|---|
| | 613 | bool opEquals(Object o) |
|---|
| 614 | 614 | { TypeInfo_Class c; |
|---|
| 615 | 615 | |
|---|
| … | … | |
| 674 | 674 | char[] toUtf8() { return info.name; } |
|---|
| 675 | 675 | |
|---|
| 676 | | int opEquals(Object o) |
|---|
| | 676 | bool opEquals(Object o) |
|---|
| 677 | 677 | { TypeInfo_Interface c; |
|---|
| 678 | 678 | |
|---|
| … | … | |
| 737 | 737 | char[] toUtf8() { return name; } |
|---|
| 738 | 738 | |
|---|
| 739 | | int opEquals(Object o) |
|---|
| | 739 | bool opEquals(Object o) |
|---|
| 740 | 740 | { TypeInfo_Struct s; |
|---|
| 741 | 741 | |
|---|
| … | … | |
| 843 | 843 | } |
|---|
| 844 | 844 | |
|---|
| 845 | | int opEquals(Object o) |
|---|
| | 845 | bool opEquals(Object o) |
|---|
| 846 | 846 | { |
|---|
| 847 | 847 | if (this is o) |
|---|
| r2515 |
r2893 |
|
| 111 | 111 | * Returns !=0 if this object does have the same contents as obj. |
|---|
| 112 | 112 | */ |
|---|
| 113 | | int opEquals(Object o) |
|---|
| | 113 | bool opEquals(Object o) |
|---|
| 114 | 114 | { |
|---|
| 115 | 115 | return cast(int)(this is o); |
|---|
| … | … | |
| 229 | 229 | } |
|---|
| 230 | 230 | |
|---|
| 231 | | int opEquals(Object o) |
|---|
| | 231 | bool opEquals(Object o) |
|---|
| 232 | 232 | { |
|---|
| 233 | 233 | /* TypeInfo instances are singletons, but duplicates can exist |
|---|
| … | … | |
| 284 | 284 | char[] toUtf8() { return name; } |
|---|
| 285 | 285 | |
|---|
| 286 | | int opEquals(Object o) |
|---|
| | 286 | bool opEquals(Object o) |
|---|
| 287 | 287 | { TypeInfo_Typedef c; |
|---|
| 288 | 288 | |
|---|
| … | … | |
| 317 | 317 | char[] toUtf8() { return m_next.toUtf8() ~ "*"; } |
|---|
| 318 | 318 | |
|---|
| 319 | | int opEquals(Object o) |
|---|
| | 319 | bool opEquals(Object o) |
|---|
| 320 | 320 | { TypeInfo_Pointer c; |
|---|
| 321 | 321 | |
|---|
| … | … | |
| 367 | 367 | char[] toUtf8() { return value.toUtf8() ~ "[]"; } |
|---|
| 368 | 368 | |
|---|
| 369 | | int opEquals(Object o) |
|---|
| | 369 | bool opEquals(Object o) |
|---|
| 370 | 370 | { TypeInfo_Array c; |
|---|
| 371 | 371 | |
|---|
| … | … | |
| 448 | 448 | } |
|---|
| 449 | 449 | |
|---|
| 450 | | int opEquals(Object o) |
|---|
| | 450 | bool opEquals(Object o) |
|---|
| 451 | 451 | { TypeInfo_StaticArray c; |
|---|
| 452 | 452 | |
|---|
| … | … | |
| 532 | 532 | } |
|---|
| 533 | 533 | |
|---|
| 534 | | int opEquals(Object o) |
|---|
| | 534 | bool opEquals(Object o) |
|---|
| 535 | 535 | { TypeInfo_AssociativeArray c; |
|---|
| 536 | 536 | |
|---|
| … | … | |
| 562 | 562 | } |
|---|
| 563 | 563 | |
|---|
| 564 | | int opEquals(Object o) |
|---|
| | 564 | bool opEquals(Object o) |
|---|
| 565 | 565 | { TypeInfo_Function c; |
|---|
| 566 | 566 | |
|---|
| … | … | |
| 587 | 587 | } |
|---|
| 588 | 588 | |
|---|
| 589 | | int opEquals(Object o) |
|---|
| | 589 | bool opEquals(Object o) |
|---|
| 590 | 590 | { TypeInfo_Delegate c; |
|---|
| 591 | 591 | |
|---|
| … | … | |
| 611 | 611 | char[] toUtf8() { return info.name; } |
|---|
| 612 | 612 | |
|---|
| 613 | | int opEquals(Object o) |
|---|
| | 613 | bool opEquals(Object o) |
|---|
| 614 | 614 | { TypeInfo_Class c; |
|---|
| 615 | 615 | |
|---|
| … | … | |
| 674 | 674 | char[] toUtf8() { return info.name; } |
|---|
| 675 | 675 | |
|---|
| 676 | | int opEquals(Object o) |
|---|
| | 676 | bool opEquals(Object o) |
|---|
| 677 | 677 | { TypeInfo_Interface c; |
|---|
| 678 | 678 | |
|---|
| … | … | |
| 737 | 737 | char[] toUtf8() { return name; } |
|---|
| 738 | 738 | |
|---|
| 739 | | int opEquals(Object o) |
|---|
| | 739 | bool opEquals(Object o) |
|---|
| 740 | 740 | { TypeInfo_Struct s; |
|---|
| 741 | 741 | |
|---|
| … | … | |
| 855 | 855 | } |
|---|
| 856 | 856 | |
|---|
| 857 | | int opEquals(Object o) |
|---|
| | 857 | bool opEquals(Object o) |
|---|
| 858 | 858 | { |
|---|
| 859 | 859 | if (this is o) |
|---|
| r2557 |
r2893 |
|
| 11 | 11 | hash_t toHash(); |
|---|
| 12 | 12 | int opCmp(Object o); |
|---|
| 13 | | int opEquals(Object o); |
|---|
| | 13 | bool opEquals(Object o); |
|---|
| 14 | 14 | |
|---|
| 15 | 15 | version( PhobosCompatibility ) |
|---|
| r2883 |
r2893 |
|
| 31 | 31 | bool opCall( T p1, T p2 ) |
|---|
| 32 | 32 | { |
|---|
| 33 | | // TODO: Fix this if/when opEquals is changed to return a bool. |
|---|
| 34 | | static if( is( T == class ) || is( T == struct ) ) |
|---|
| 35 | | return (p1 == p2) != 0; |
|---|
| 36 | | else |
|---|
| 37 | | return p1 == p2; |
|---|
| | 33 | return p1 == p2; |
|---|
| 38 | 34 | } |
|---|
| 39 | 35 | } |
|---|
| r2356 |
r2893 |
|
| 356 | 356 | * Support for operators == and != for bit arrays. |
|---|
| 357 | 357 | */ |
|---|
| 358 | | int opEquals(BitArray a2) |
|---|
| | 358 | bool opEquals(BitArray a2) |
|---|
| 359 | 359 | { |
|---|
| 360 | 360 | int i; |
|---|
| r2809 |
r2893 |
|
| 478 | 478 | |
|---|
| 479 | 479 | |
|---|
| 480 | | final int opEquals(T)( T rhs ) |
|---|
| | 480 | final bool opEquals(T)( T rhs ) |
|---|
| 481 | 481 | { |
|---|
| 482 | 482 | static if( is( T == Variant ) ) |
|---|
| r2890 |
r2893 |
|
| 322 | 322 | ***********************************************************************/ |
|---|
| 323 | 323 | |
|---|
| 324 | | final override int opEquals (Object o) |
|---|
| | 324 | final override bool opEquals (Object o) |
|---|
| 325 | 325 | { |
|---|
| 326 | 326 | return (this is o) || (o && toUtf8 == o.toUtf8); |
|---|
| … | … | |
| 333 | 333 | ***********************************************************************/ |
|---|
| 334 | 334 | |
|---|
| 335 | | final override int opEquals (char[] s) |
|---|
| | 335 | final override bool opEquals (char[] s) |
|---|
| 336 | 336 | { |
|---|
| 337 | 337 | return toUtf8() == s; |
|---|
| r2730 |
r2893 |
|
| 153 | 153 | int compare (T[] text); |
|---|
| 154 | 154 | int compare (StringView other); |
|---|
| 155 | | int opEquals (Object other); |
|---|
| | 155 | bool opEquals (Object other); |
|---|
| 156 | 156 | int opCmp (Object other); |
|---|
| 157 | 157 | |
|---|
| … | … | |
| 1037 | 1037 | ***********************************************************************/ |
|---|
| 1038 | 1038 | |
|---|
| 1039 | | override int opEquals (Object o) |
|---|
| | 1039 | override bool opEquals (Object o) |
|---|
| 1040 | 1040 | { |
|---|
| 1041 | 1041 | auto other = cast (StringViewT) o; |
|---|
| … | … | |
| 1050 | 1050 | |
|---|
| 1051 | 1051 | /// ditto |
|---|
| 1052 | | final int opEquals (T[] s) |
|---|
| | 1052 | final bool opEquals (T[] s) |
|---|
| 1053 | 1053 | { |
|---|
| 1054 | 1054 | return slice == s; |
|---|
| … | … | |
| 1287 | 1287 | ***********************************************************************/ |
|---|
| 1288 | 1288 | |
|---|
| 1289 | | abstract int opEquals (Object other); |
|---|
| | 1289 | abstract bool opEquals (Object other); |
|---|
| 1290 | 1290 | |
|---|
| 1291 | 1291 | /*********************************************************************** |
|---|
| … | … | |
| 1295 | 1295 | ***********************************************************************/ |
|---|
| 1296 | 1296 | |
|---|
| 1297 | | abstract int opEquals (T[] other); |
|---|
| | 1297 | abstract bool opEquals (T[] other); |
|---|
| 1298 | 1298 | |
|---|
| 1299 | 1299 | /*********************************************************************** |
|---|
| r2809 |
r2893 |
|
| 153 | 153 | int compare (T[] text); |
|---|
| 154 | 154 | int compare (TextView other); |
|---|
| 155 | | int opEquals (Object other); |
|---|
| | 155 | bool opEquals (Object other); |
|---|
| 156 | 156 | int opCmp (Object other); |
|---|
| 157 | 157 | |
|---|
| … | … | |
| 1031 | 1031 | ***********************************************************************/ |
|---|
| 1032 | 1032 | |
|---|
| 1033 | | override int opEquals (Object o) |
|---|
| | 1033 | override bool opEquals (Object o) |
|---|
| 1034 | 1034 | { |
|---|
| 1035 | 1035 | auto other = cast (TextViewT) o; |
|---|
| … | … | |
| 1044 | 1044 | |
|---|
| 1045 | 1045 | /// ditto |
|---|
| 1046 | | final int opEquals (T[] s) |
|---|
| | 1046 | final bool opEquals (T[] s) |
|---|
| 1047 | 1047 | { |
|---|
| 1048 | 1048 | return slice == s; |
|---|
| … | … | |
| 1281 | 1281 | ***********************************************************************/ |
|---|
| 1282 | 1282 | |
|---|
| 1283 | | abstract int opEquals (Object other); |
|---|
| | 1283 | abstract bool opEquals (Object other); |
|---|
| 1284 | 1284 | |
|---|
| 1285 | 1285 | /*********************************************************************** |
|---|
| … | … | |
| 1289 | 1289 | ***********************************************************************/ |
|---|
| 1290 | 1290 | |
|---|
| 1291 | | abstract int opEquals (T[] other); |
|---|
| | 1291 | abstract bool opEquals (T[] other); |
|---|
| 1292 | 1292 | |
|---|
| 1293 | 1293 | /*********************************************************************** |
|---|
| r2878 |
r2893 |
|
| 406 | 406 | } |
|---|
| 407 | 407 | |
|---|
| 408 | | public override int opEquals(Object obj) { |
|---|
| | 408 | public override bool opEquals(Object obj) { |
|---|
| 409 | 409 | if (obj is this) |
|---|
| 410 | 410 | return true; |
|---|
Download in other formats:
|
 |
 |
|
 |
Copyright © 2006-2008 Tango. All Rights Reserved. | Page Width:
Static or
Dynamic