forked from qt-creator/qt-creator
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:
@@ -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; }
|
||||
|
||||
Reference in New Issue
Block a user