mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
When creating methods that pass QString, use const QString&
This removes unecessary creation and destruction of the object making the code shine a bit more and be more fluffy. :) Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
4eaceb9861
commit
4b8a66f489
2 changed files with 10 additions and 10 deletions
|
@ -48,7 +48,7 @@ bool DiveComputerNode::changesValues(const DiveComputerNode &b) const
|
||||||
(nickName != b.nickName);
|
(nickName != b.nickName);
|
||||||
}
|
}
|
||||||
|
|
||||||
const DiveComputerNode *DiveComputerList::getExact(QString m, uint32_t d)
|
const DiveComputerNode *DiveComputerList::getExact(const QString& m, uint32_t d)
|
||||||
{
|
{
|
||||||
for (QMap<QString, DiveComputerNode>::iterator it = dcMap.find(m); it != dcMap.end() && it.key() == m; ++it)
|
for (QMap<QString, DiveComputerNode>::iterator it = dcMap.find(m); it != dcMap.end() && it.key() == m; ++it)
|
||||||
if (it->deviceId == d)
|
if (it->deviceId == d)
|
||||||
|
@ -56,7 +56,7 @@ const DiveComputerNode *DiveComputerList::getExact(QString m, uint32_t d)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
const DiveComputerNode *DiveComputerList::get(QString m)
|
const DiveComputerNode *DiveComputerList::get(const QString& m)
|
||||||
{
|
{
|
||||||
QMap<QString, DiveComputerNode>::iterator it = dcMap.find(m);
|
QMap<QString, DiveComputerNode>::iterator it = dcMap.find(m);
|
||||||
if (it != dcMap.end())
|
if (it != dcMap.end())
|
||||||
|
@ -64,7 +64,7 @@ const DiveComputerNode *DiveComputerList::get(QString m)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DiveComputerList::addDC(QString m, uint32_t d, QString n, QString s, QString f)
|
void DiveComputerList::addDC(const QString& m, uint32_t d, const QString& n, const QString& s,const QString& f)
|
||||||
{
|
{
|
||||||
if (m.isEmpty() || d == 0)
|
if (m.isEmpty() || d == 0)
|
||||||
return;
|
return;
|
||||||
|
@ -86,7 +86,7 @@ void DiveComputerList::addDC(QString m, uint32_t d, QString n, QString s, QStrin
|
||||||
dcMap.insert(m, newNode);
|
dcMap.insert(m, newNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DiveComputerList::rmDC(QString m, uint32_t d)
|
void DiveComputerList::rmDC(const QString& m, uint32_t d)
|
||||||
{
|
{
|
||||||
const DiveComputerNode *existNode = this->getExact(m, d);
|
const DiveComputerNode *existNode = this->getExact(m, d);
|
||||||
dcMap.remove(m, *existNode);
|
dcMap.remove(m, *existNode);
|
||||||
|
|
12
qthelper.h
12
qthelper.h
|
@ -29,12 +29,12 @@ class DiveComputerList {
|
||||||
public:
|
public:
|
||||||
DiveComputerList();
|
DiveComputerList();
|
||||||
~DiveComputerList();
|
~DiveComputerList();
|
||||||
const DiveComputerNode *getExact(QString m, uint32_t d);
|
const DiveComputerNode *getExact(const QString& m, uint32_t d);
|
||||||
const DiveComputerNode *get(QString m);
|
const DiveComputerNode *get(const QString& m);
|
||||||
void addDC(QString m, uint32_t d, QString n = "", QString s = "", QString f = "");
|
void addDC(const QString& m, uint32_t d,const QString& n = QString(),const QString& s = QString(), const QString& f = QString());
|
||||||
void rmDC(QString m, uint32_t d);
|
void rmDC(const QString& m, uint32_t d);
|
||||||
DiveComputerNode matchDC(QString m, uint32_t d);
|
DiveComputerNode matchDC(const QString& m, uint32_t d);
|
||||||
DiveComputerNode matchModel(QString m);
|
DiveComputerNode matchModel(const QString& m);
|
||||||
QMultiMap<QString, DiveComputerNode> dcMap;
|
QMultiMap<QString, DiveComputerNode> dcMap;
|
||||||
QMultiMap<QString, DiveComputerNode> dcWorkingMap;
|
QMultiMap<QString, DiveComputerNode> dcWorkingMap;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue