diff options
author | Tomaz Canabrava <tomaz.canabrava@intel.com> | 2014-05-10 22:07:02 -0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-05-11 01:57:28 -0700 |
commit | 4b8a66f4899cb337899ec1d35058ab7fc1b1bc86 (patch) | |
tree | 4fc3bc3059c58003e6a9ad917dfc33b86c7ef667 /qthelper.cpp | |
parent | 4eaceb98614e28ab8c20baa1513733e0e662c7df (diff) | |
download | subsurface-4b8a66f4899cb337899ec1d35058ab7fc1b1bc86.tar.gz |
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>
Diffstat (limited to 'qthelper.cpp')
-rw-r--r-- | qthelper.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/qthelper.cpp b/qthelper.cpp index c51e13628..894601c80 100644 --- a/qthelper.cpp +++ b/qthelper.cpp @@ -48,7 +48,7 @@ bool DiveComputerNode::changesValues(const DiveComputerNode &b) const (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) if (it->deviceId == d) @@ -56,7 +56,7 @@ const DiveComputerNode *DiveComputerList::getExact(QString m, uint32_t d) return NULL; } -const DiveComputerNode *DiveComputerList::get(QString m) +const DiveComputerNode *DiveComputerList::get(const QString& m) { QMap<QString, DiveComputerNode>::iterator it = dcMap.find(m); if (it != dcMap.end()) @@ -64,7 +64,7 @@ const DiveComputerNode *DiveComputerList::get(QString m) 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) return; @@ -86,7 +86,7 @@ void DiveComputerList::addDC(QString m, uint32_t d, QString n, QString s, QStrin 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); dcMap.remove(m, *existNode); |