qtmobility/src/contacts/qcontactactiondescriptor.cpp
changeset 4 90517678cc4f
parent 1 2b40d63a9c3d
--- a/qtmobility/src/contacts/qcontactactiondescriptor.cpp	Fri Apr 16 15:51:22 2010 +0300
+++ b/qtmobility/src/contacts/qcontactactiondescriptor.cpp	Mon May 03 13:18:40 2010 +0300
@@ -41,6 +41,7 @@
 
 #include "qcontactactiondescriptor.h"
 #include "qcontactactiondescriptor_p.h"
+#include <QHash>
 
 QTM_BEGIN_NAMESPACE
 
@@ -48,6 +49,7 @@
   \class QContactActionDescriptor
   \brief The QContactActionDescriptor class provides information that
   uniquely identifies a specific implementation of an action
+  \ingroup contacts-actions
 */
 
 /*!
@@ -166,4 +168,28 @@
     return !(*this == other);
 }
 
+/*!
+ * Returns true if the action descriptor is less than the \a other action descriptor.  The
+ * comparison is performed first on the vendor name, then the action name, then the implementation
+ * version.
+ */
+bool QContactActionDescriptor::operator<(const QContactActionDescriptor& other) const
+{
+    int comp = d->m_vendorName.compare(other.d->m_vendorName);
+    if (comp != 0)
+        return comp < 0;
+    comp = d->m_actionName.compare(other.d->m_actionName);
+    if (comp != 0)
+        return comp < 0;
+    return d->m_implementationVersion < other.d->m_implementationVersion;
+}
+
+/*! Returns the hash value for \a key. */
+uint qHash(const QContactActionDescriptor& key)
+{
+    return QT_PREPEND_NAMESPACE(qHash)(key.vendorName())
+            + QT_PREPEND_NAMESPACE(qHash)(key.actionName())
+            + QT_PREPEND_NAMESPACE(qHash)(key.implementationVersion());
+}
+
 QTM_END_NAMESPACE