aboutsummaryrefslogtreecommitdiff
path: root/src/base
diff options
context:
space:
mode:
author0xd34df00d <0xd34df00d@gmail.com>2014-04-23 17:19:32 +0400
committer0xd34df00d <0xd34df00d@gmail.com>2014-04-23 17:19:32 +0400
commit721d34cf7955274d788a50ac1976b5f2577ef050 (patch)
tree512cab68ef8a193173e05d0e437c54e63c90a0c2 /src/base
parent02432b07d38f14f30a5992756294da4c3857bf24 (diff)
downloadqxmpp-721d34cf7955274d788a50ac1976b5f2577ef050.tar.gz
Equality ops for QXmppVCard{Email,Phone,Organization}.
Diffstat (limited to 'src/base')
-rw-r--r--src/base/QXmppVCardIq.cpp49
-rw-r--r--src/base/QXmppVCardIq.h9
2 files changed, 58 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
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<QXmppVCardEmailPrivate> 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<QXmppVCardPhonePrivate> 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<QXmppVCardOrganizationPrivate> 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.