Changeset View
Changeset View
Standalone View
Standalone View
src/core/udsentry.cpp
Show First 20 Lines • Show All 457 Lines • ▼ Show 20 Line(s) | 456 | { | |||
---|---|---|---|---|---|
458 | return s; | 458 | return s; | ||
459 | } | 459 | } | ||
460 | 460 | | |||
461 | KIOCORE_EXPORT QDataStream &operator>>(QDataStream &s, KIO::UDSEntry &a) | 461 | KIOCORE_EXPORT QDataStream &operator>>(QDataStream &s, KIO::UDSEntry &a) | ||
462 | { | 462 | { | ||
463 | a.d->load(s); | 463 | a.d->load(s); | ||
464 | return s; | 464 | return s; | ||
465 | } | 465 | } | ||
466 | | ||||
467 | KIOCORE_EXPORT bool operator==(const KIO::UDSEntry &entry, const KIO::UDSEntry &other) | ||||
468 | { | ||||
469 | if (entry.count() != other.count()) { | ||||
470 | return false; | ||||
471 | } | ||||
472 | | ||||
473 | const QVector<uint> fields = entry.fields(); | ||||
474 | for (uint field : fields) { | ||||
475 | if (!other.contains(field)) { | ||||
476 | return false; | ||||
477 | } | ||||
478 | | ||||
479 | if (field & UDSEntry::UDS_STRING) { | ||||
480 | if (entry.stringValue(field) != other.stringValue(field)) { | ||||
481 | return false; | ||||
482 | } | ||||
483 | } else { | ||||
484 | if (entry.numberValue(field) != other.numberValue(field)) { | ||||
485 | return false; | ||||
486 | } | ||||
487 | } | ||||
488 | } | ||||
489 | | ||||
490 | return true; | ||||
491 | } | ||||
492 | | ||||
493 | KIOCORE_EXPORT bool operator!=(const KIO::UDSEntry &entry, const KIO::UDSEntry &other) | ||||
494 | { | ||||
495 | return !(entry == other); | ||||
496 | } |