From 4e2ae6954c20b0b7e3a9845d2331e68695153726 Mon Sep 17 00:00:00 2001 From: 0xd34df00d <0xd34df00d@gmail.com> Date: Wed, 23 Apr 2014 16:48:18 +0400 Subject: Added operator== and != for QXmppVCardAddress. --- src/base/QXmppVCardIq.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/base/QXmppVCardIq.cpp') diff --git a/src/base/QXmppVCardIq.cpp b/src/base/QXmppVCardIq.cpp index 6d9f1fdb..7701b60a 100644 --- a/src/base/QXmppVCardIq.cpp +++ b/src/base/QXmppVCardIq.cpp @@ -86,6 +86,23 @@ QXmppVCardAddress& QXmppVCardAddress::operator=(const QXmppVCardAddress &other) return *this; } +/// \brief Checks if two address objects represent the same address. + +bool operator==(const QXmppVCardAddress &left, const QXmppVCardAddress &right) +{ + return left.type() == right.type() && + left.country() == right.country() && + left.locality() == right.locality() && + left.postcode() == right.postcode() && + left.region() == right.region() && + left.street() == right.street(); +} + +bool operator!=(const QXmppVCardAddress &left, const QXmppVCardAddress &right) +{ + return !(left == right); +} + /// Returns the country. QString QXmppVCardAddress::country() const -- cgit v1.2.3 From 721d34cf7955274d788a50ac1976b5f2577ef050 Mon Sep 17 00:00:00 2001 From: 0xd34df00d <0xd34df00d@gmail.com> Date: Wed, 23 Apr 2014 17:19:32 +0400 Subject: Equality ops for QXmppVCard{Email,Phone,Organization}. --- src/base/QXmppVCardIq.cpp | 49 +++++++++++++++++++++++++++++++++++++++++++++++ src/base/QXmppVCardIq.h | 9 +++++++++ 2 files changed, 58 insertions(+) (limited to 'src/base/QXmppVCardIq.cpp') diff --git a/src/base/QXmppVCardIq.cpp b/src/base/QXmppVCardIq.cpp index 7701b60a..8733256b 100644 --- a/src/base/QXmppVCardIq.cpp +++ b/src/base/QXmppVCardIq.cpp @@ -98,6 +98,8 @@ bool operator==(const QXmppVCardAddress &left, const QXmppVCardAddress &right) left.street() == right.street(); } +/// \brief Checks if two address objects represent different addresses. + bool operator!=(const QXmppVCardAddress &left, const QXmppVCardAddress &right) { return !(left == right); @@ -267,6 +269,21 @@ QXmppVCardEmail& QXmppVCardEmail::operator=(const QXmppVCardEmail &other) return *this; } +/// \brief Checks if two email objects represent the same email address. + +bool operator==(const QXmppVCardEmail &left, const QXmppVCardEmail &right) +{ + return left.type() == right.type() && + left.address() == right.address(); +} + +/// \brief Checks if two email objects represent different email addresses. + +bool operator!=(const QXmppVCardEmail &left, const QXmppVCardEmail &right) +{ + return !(left == right); +} + /// Returns the e-mail address. QString QXmppVCardEmail::address() const @@ -370,6 +387,21 @@ QString QXmppVCardPhone::number() const return d->number; } +/// \brief Checks if two phone objects represent the same phone number. + +bool operator==(const QXmppVCardPhone &left, const QXmppVCardPhone &right) +{ + return left.type() == right.type() && + left.number() == right.number(); +} + +/// \brief Checks if two phone objects represent different phone numbers. + +bool operator!=(const QXmppVCardPhone &left, const QXmppVCardPhone &right) +{ + return !(left == right); +} + /// Sets the phone \a number. void QXmppVCardPhone::setNumber(const QString &number) @@ -492,6 +524,23 @@ QXmppVCardOrganization& QXmppVCardOrganization::operator=(const QXmppVCardOrgani return *this; } +/// \brief Checks if two organization objects represent the same organization. + +bool operator==(const QXmppVCardOrganization &left, const QXmppVCardOrganization &right) +{ + return left.organization() == right.organization() && + left.unit() == right.unit() && + left.title() == right.title() && + left.role() == right.role(); +} + +/// \brief Checks if two organization objects represent different organizations. + +bool operator!=(const QXmppVCardOrganization &left, const QXmppVCardOrganization &right) +{ + return !(left == right); +} + /// Returns the name of the organization. QString QXmppVCardOrganization::organization() const diff --git a/src/base/QXmppVCardIq.h b/src/base/QXmppVCardIq.h index ae0e7efc..dc3a1f78 100644 --- a/src/base/QXmppVCardIq.h +++ b/src/base/QXmppVCardIq.h @@ -124,6 +124,9 @@ private: QSharedDataPointer d; }; +QXMPP_EXPORT bool operator==(const QXmppVCardEmail&, const QXmppVCardEmail&); +QXMPP_EXPORT bool operator!=(const QXmppVCardEmail&, const QXmppVCardEmail&); + /// \brief Represents a vCard phone number. class QXMPP_EXPORT QXmppVCardPhone @@ -169,6 +172,9 @@ private: QSharedDataPointer d; }; +QXMPP_EXPORT bool operator==(const QXmppVCardPhone&, const QXmppVCardPhone&); +QXMPP_EXPORT bool operator!=(const QXmppVCardPhone&, const QXmppVCardPhone&); + /// \brief Represents organization information in XMPP vCards. /// /// This contains both information about organization itself and @@ -204,6 +210,9 @@ private: QSharedDataPointer d; }; +QXMPP_EXPORT bool operator==(const QXmppVCardOrganization&, const QXmppVCardOrganization&); +QXMPP_EXPORT bool operator!=(const QXmppVCardOrganization&, const QXmppVCardOrganization&); + /// \brief Represents the XMPP vCard. /// /// The functions names are self explanatory. -- cgit v1.2.3 From 1db9e5ebf34895c610d97f9f61718781f7b69923 Mon Sep 17 00:00:00 2001 From: 0xd34df00d <0xd34df00d@gmail.com> Date: Wed, 23 Apr 2014 17:29:21 +0400 Subject: Added equality ops for QXmppVCardIq. --- src/base/QXmppVCardIq.cpp | 28 ++++++++++++++++++++++++++++ src/base/QXmppVCardIq.h | 3 +++ 2 files changed, 31 insertions(+) (limited to 'src/base/QXmppVCardIq.cpp') diff --git a/src/base/QXmppVCardIq.cpp b/src/base/QXmppVCardIq.cpp index 8733256b..4a237200 100644 --- a/src/base/QXmppVCardIq.cpp +++ b/src/base/QXmppVCardIq.cpp @@ -678,6 +678,34 @@ QXmppVCardIq& QXmppVCardIq::operator=(const QXmppVCardIq &other) return *this; } +/// \brief Checks if two VCard objects represent the same VCard. + +bool operator==(const QXmppVCardIq &left, const QXmppVCardIq &right) +{ + return left.birthday() == right.birthday() && + left.description() == right.description() && + left.email() == right.email() && + left.firstName() == right.firstName() && + left.fullName() == right.fullName() && + left.lastName() == right.lastName() && + left.middleName() == right.middleName() && + left.nickName() == right.nickName() && + left.photo() == right.photo() && + left.photoType() == right.photoType() && + left.url() == right.url() && + left.addresses() == right.addresses() && + left.emails() == right.emails() && + left.phones() == right.phones() && + left.organization() == right.organization(); +} + +/// \brief Checks if two VCard objects represent different VCards. + +bool operator!=(const QXmppVCardIq &left, const QXmppVCardIq &right) +{ + return !(left == right); +} + /// Returns the date of birth of the individual associated with the vCard. /// diff --git a/src/base/QXmppVCardIq.h b/src/base/QXmppVCardIq.h index dc3a1f78..966ff632 100644 --- a/src/base/QXmppVCardIq.h +++ b/src/base/QXmppVCardIq.h @@ -291,4 +291,7 @@ private: QSharedDataPointer d; }; +QXMPP_EXPORT bool operator==(const QXmppVCardIq&, const QXmppVCardIq&); +QXMPP_EXPORT bool operator!=(const QXmppVCardIq&, const QXmppVCardIq&); + #endif // QXMPPVCARDIQ_H -- cgit v1.2.3