113 bool QContactId::operator!=(const QContactId& other) const |
115 bool QContactId::operator!=(const QContactId& other) const |
114 { |
116 { |
115 return !(*this == other); |
117 return !(*this == other); |
116 } |
118 } |
117 |
119 |
|
120 /*! Returns true if this id is less than the \a other id. |
|
121 This id will be considered less than the \a other id if the |
|
122 manager URI of this id is alphabetically less than the manager |
|
123 URI of the \a other id. If both ids have the same manager URI, |
|
124 this id will be considered less than the \a other id if the |
|
125 local id of this id is less than the local id of the \a other id. |
|
126 |
|
127 The invalid, empty id consists of an empty manager URI and the |
|
128 invalid, zero local id, and hence will be less than any non-invalid |
|
129 id. |
|
130 |
|
131 This operator is provided primarily to allow use of a QContactId |
|
132 as a key in a QMap. |
|
133 */ |
|
134 bool QContactId::operator<(const QContactId& other) const |
|
135 { |
|
136 const int comp = this->managerUri().compare(other.managerUri()); |
|
137 if (comp != 0) |
|
138 return comp < 0; |
|
139 |
|
140 return this->localId() < other.localId(); |
|
141 } |
|
142 |
|
143 /*! |
|
144 * Returns the hash value for \a key. |
|
145 */ |
|
146 uint qHash(const QContactId &key) |
|
147 { |
|
148 return QT_PREPEND_NAMESPACE(qHash)(key.managerUri()) |
|
149 + QT_PREPEND_NAMESPACE(qHash)(key.localId()); |
|
150 } |
|
151 |
|
152 #ifndef QT_NO_DEBUG_STREAM |
|
153 QDebug operator<<(QDebug dbg, const QContactId& id) |
|
154 { |
|
155 dbg.nospace() << "QContactId(" << id.managerUri() << ", " << id.localId() << ")"; |
|
156 return dbg.maybeSpace(); |
|
157 } |
|
158 #endif |
|
159 |
118 /*! |
160 /*! |
119 * Returns the URI of the manager which contains the contact identified by this id |
161 * Returns the URI of the manager which contains the contact identified by this id |
120 */ |
162 */ |
121 QString QContactId::managerUri() const |
163 QString QContactId::managerUri() const |
122 { |
164 { |