coreid: add overload for ==(const char *)

Saves code on caller side and cycles for the hashing.

Change-Id: I9d0c739b44a4611a4d70d33cf2798e0b078a72b5
Reviewed-by: Eike Ziller <eike.ziller@nokia.com>
This commit is contained in:
hjk
2012-08-03 14:33:10 +02:00
committed by Eike Ziller
parent 69eeb94b7e
commit 7ca93f9b1e
2 changed files with 7 additions and 1 deletions

View File

@@ -129,7 +129,12 @@ QByteArray Id::name() const
QString Id::toString() const
{
return QString::fromUtf8(stringFromId[m_id]);
return QString::fromUtf8(stringFromId.at(m_id));
}
bool Id::operator==(const char *name) const
{
return strcmp(stringFromId.at(m_id).constData(), name) == 0;
}
// For debugging purposes

View File

@@ -50,6 +50,7 @@ public:
QString toString() const;
bool isValid() const { return m_id; }
bool operator==(Id id) const { return m_id == id.m_id; }
bool operator==(const char *name) const;
bool operator!=(Id id) const { return m_id != id.m_id; }
bool operator<(Id id) const { return m_id < id.m_id; }
bool operator>(Id id) const { return m_id > id.m_id; }