diff options
| author | 0xd34df00d <0xd34df00d@gmail.com> | 2014-04-23 17:19:32 +0400 |
|---|---|---|
| committer | 0xd34df00d <0xd34df00d@gmail.com> | 2014-04-23 17:19:32 +0400 |
| commit | 721d34cf7955274d788a50ac1976b5f2577ef050 (patch) | |
| tree | 512cab68ef8a193173e05d0e437c54e63c90a0c2 /src/base/QXmppVCardIq.cpp | |
| parent | 02432b07d38f14f30a5992756294da4c3857bf24 (diff) | |
| download | qxmpp-721d34cf7955274d788a50ac1976b5f2577ef050.tar.gz | |
Equality ops for QXmppVCard{Email,Phone,Organization}.
Diffstat (limited to 'src/base/QXmppVCardIq.cpp')
| -rw-r--r-- | src/base/QXmppVCardIq.cpp | 49 |
1 files changed, 49 insertions, 0 deletions
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 |
