Commit 7ca93f9b authored by hjk's avatar hjk Committed by Eike Ziller
Browse files

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



Saves code on caller side and cycles for the hashing.

Change-Id: I9d0c739b44a4611a4d70d33cf2798e0b078a72b5
Reviewed-by: default avatarEike Ziller <eike.ziller@nokia.com>
parent 69eeb94b
......@@ -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
......
......@@ -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; }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment