qtmobility/src/contacts/qcontactactiondescriptor.cpp
changeset 4 90517678cc4f
parent 1 2b40d63a9c3d
equal deleted inserted replaced
1:2b40d63a9c3d 4:90517678cc4f
    39 **
    39 **
    40 ****************************************************************************/
    40 ****************************************************************************/
    41 
    41 
    42 #include "qcontactactiondescriptor.h"
    42 #include "qcontactactiondescriptor.h"
    43 #include "qcontactactiondescriptor_p.h"
    43 #include "qcontactactiondescriptor_p.h"
       
    44 #include <QHash>
    44 
    45 
    45 QTM_BEGIN_NAMESPACE
    46 QTM_BEGIN_NAMESPACE
    46 
    47 
    47 /*!
    48 /*!
    48   \class QContactActionDescriptor
    49   \class QContactActionDescriptor
    49   \brief The QContactActionDescriptor class provides information that
    50   \brief The QContactActionDescriptor class provides information that
    50   uniquely identifies a specific implementation of an action
    51   uniquely identifies a specific implementation of an action
       
    52   \ingroup contacts-actions
    51 */
    53 */
    52 
    54 
    53 /*!
    55 /*!
    54  * Constructs a new action descriptor for the implementation of the action identified by the given \a actionName
    56  * Constructs a new action descriptor for the implementation of the action identified by the given \a actionName
    55  * of the given implementation \a vendorVersion, as implemented by the vendor identified by the given \a vendorName
    57  * of the given implementation \a vendorVersion, as implemented by the vendor identified by the given \a vendorName
   164 bool QContactActionDescriptor::operator!=(const QContactActionDescriptor& other) const
   166 bool QContactActionDescriptor::operator!=(const QContactActionDescriptor& other) const
   165 {
   167 {
   166     return !(*this == other);
   168     return !(*this == other);
   167 }
   169 }
   168 
   170 
       
   171 /*!
       
   172  * Returns true if the action descriptor is less than the \a other action descriptor.  The
       
   173  * comparison is performed first on the vendor name, then the action name, then the implementation
       
   174  * version.
       
   175  */
       
   176 bool QContactActionDescriptor::operator<(const QContactActionDescriptor& other) const
       
   177 {
       
   178     int comp = d->m_vendorName.compare(other.d->m_vendorName);
       
   179     if (comp != 0)
       
   180         return comp < 0;
       
   181     comp = d->m_actionName.compare(other.d->m_actionName);
       
   182     if (comp != 0)
       
   183         return comp < 0;
       
   184     return d->m_implementationVersion < other.d->m_implementationVersion;
       
   185 }
       
   186 
       
   187 /*! Returns the hash value for \a key. */
       
   188 uint qHash(const QContactActionDescriptor& key)
       
   189 {
       
   190     return QT_PREPEND_NAMESPACE(qHash)(key.vendorName())
       
   191             + QT_PREPEND_NAMESPACE(qHash)(key.actionName())
       
   192             + QT_PREPEND_NAMESPACE(qHash)(key.implementationVersion());
       
   193 }
       
   194 
   169 QTM_END_NAMESPACE
   195 QTM_END_NAMESPACE