[PATCH 06/13] Use ref instead of copy for function const arguments.
Vincent Ordy
vincent at ordy.net
Thu Jun 17 18:22:45 CEST 2010
---
kmymoney/mymoney/mymoneycategory.cpp | 10 +++++-----
kmymoney/mymoney/mymoneycategory.h | 12 ++++++------
kmymoney/mymoney/mymoneyforecast.cpp | 2 +-
kmymoney/mymoney/mymoneyforecast.h | 2 +-
kmymoney/mymoney/mymoneytransaction.cpp | 2 +-
kmymoney/mymoney/mymoneytransaction.h | 2 +-
kmymoney/reports/querytable.h | 6 +++---
libkdchart/src/KDChartDataValueAttributes.cpp | 6 +++---
libkdchart/src/KDChartDataValueAttributes.h | 6 +++---
9 files changed, 24 insertions(+), 24 deletions(-)
diff --git a/kmymoney/mymoney/mymoneycategory.cpp b/kmymoney/mymoney/mymoneycategory.cpp
index 1755130..d1d6c8f 100644
--- a/kmymoney/mymoney/mymoneycategory.cpp
+++ b/kmymoney/mymoney/mymoneycategory.cpp
@@ -21,13 +21,13 @@ MyMoneyCategory::MyMoneyCategory()
m_income = true;
}
-MyMoneyCategory::MyMoneyCategory(const bool income, const QString name)
+MyMoneyCategory::MyMoneyCategory(const bool income, const QString& name)
{
m_income = income;
m_name = name;
}
-MyMoneyCategory::MyMoneyCategory(const bool income, const QString name, QStringList minors)
+MyMoneyCategory::MyMoneyCategory(const bool income, const QString& name, QStringList minors)
{
m_income = income;
m_name = name;
@@ -39,7 +39,7 @@ MyMoneyCategory::~MyMoneyCategory()
}
// Functions use the find method to search the list
-bool MyMoneyCategory::addMinorCategory(const QString val)
+bool MyMoneyCategory::addMinorCategory(const QString& val)
{
if (val.isEmpty() || val.isNull())
return false;
@@ -52,7 +52,7 @@ bool MyMoneyCategory::addMinorCategory(const QString val)
return false;
}
-bool MyMoneyCategory::removeMinorCategory(const QString val)
+bool MyMoneyCategory::removeMinorCategory(const QString& val)
{
if (val.isEmpty() || val.isNull())
return false;
@@ -65,7 +65,7 @@ bool MyMoneyCategory::removeMinorCategory(const QString val)
return false;
}
-bool MyMoneyCategory::renameMinorCategory(const QString oldVal, const QString newVal)
+bool MyMoneyCategory::renameMinorCategory(const QString& oldVal, const QString& newVal)
{
if (oldVal.isEmpty() || oldVal.isNull() || newVal.isEmpty() || newVal.isNull())
return false;
diff --git a/kmymoney/mymoney/mymoneycategory.h b/kmymoney/mymoney/mymoneycategory.h
index 15b91c9..1fda08d 100644
--- a/kmymoney/mymoney/mymoneycategory.h
+++ b/kmymoney/mymoney/mymoneycategory.h
@@ -38,8 +38,8 @@ class MyMoneyCategory
public:
MyMoneyCategory();
- MyMoneyCategory(const bool income, const QString name);
- MyMoneyCategory(const bool income, const QString name, QStringList minors);
+ MyMoneyCategory(const bool income, const QString& name);
+ MyMoneyCategory(const bool income, const QString& name, QStringList minors);
~MyMoneyCategory();
// Simple get operations
@@ -57,14 +57,14 @@ public:
void setIncome(const bool val) {
m_income = val;
}
- void setName(const QString val) {
+ void setName(const QString& val) {
m_name = val;
}
bool setMinorCategories(QStringList values);
- bool addMinorCategory(const QString val);
- bool removeMinorCategory(const QString val);
- bool renameMinorCategory(const QString oldVal, const QString newVal);
+ bool addMinorCategory(const QString& val);
+ bool removeMinorCategory(const QString& val);
+ bool renameMinorCategory(const QString& oldVal, const QString& newVal);
bool addMinorCategory(QStringList values);
bool removeAllMinors(void);
QString firstMinor(void);
diff --git a/kmymoney/mymoney/mymoneyforecast.cpp b/kmymoney/mymoney/mymoneyforecast.cpp
index b1126ae..e935407 100644
--- a/kmymoney/mymoney/mymoneyforecast.cpp
+++ b/kmymoney/mymoney/mymoneyforecast.cpp
@@ -402,7 +402,7 @@ MyMoneyMoney MyMoneyForecast::accountWeightedMovingAverage(const MyMoneyAccount
return (balanceVariation / MyMoneyMoney(totalWeight, 1)).convert(10000);
}
-MyMoneyMoney MyMoneyForecast::accountLinearRegression(const MyMoneyAccount &acc, const int trendDay, const int actualTerms, const MyMoneyMoney meanTerms)
+MyMoneyMoney MyMoneyForecast::accountLinearRegression(const MyMoneyAccount &acc, const int trendDay, const int actualTerms, const MyMoneyMoney& meanTerms)
{
MyMoneyMoney meanBalance, totalBalance, totalTerms;
totalTerms = MyMoneyMoney(actualTerms, 1);
diff --git a/kmymoney/mymoney/mymoneyforecast.h b/kmymoney/mymoney/mymoneyforecast.h
index e960f14..c4bd975 100644
--- a/kmymoney/mymoney/mymoneyforecast.h
+++ b/kmymoney/mymoney/mymoneyforecast.h
@@ -331,7 +331,7 @@ private:
/**
* Returns the linear regression for a given @p trendDay
*/
- MyMoneyMoney accountLinearRegression(const MyMoneyAccount &acc, const int trendDay, const int totalWeight, const MyMoneyMoney meanTerms);
+ MyMoneyMoney accountLinearRegression(const MyMoneyAccount &acc, const int trendDay, const int totalWeight, const MyMoneyMoney& meanTerms);
/**
* calculate daily forecast trend based on historic transactions
diff --git a/kmymoney/mymoney/mymoneytransaction.cpp b/kmymoney/mymoney/mymoneytransaction.cpp
index 43ceb72..074cdb7 100644
--- a/kmymoney/mymoney/mymoneytransaction.cpp
+++ b/kmymoney/mymoney/mymoneytransaction.cpp
@@ -32,7 +32,7 @@ MyMoneyTransaction::MyMoneyTransaction() :
m_postDate = QDate();
}
-MyMoneyTransaction::MyMoneyTransaction(const QString id, const MyMoneyTransaction& transaction) :
+MyMoneyTransaction::MyMoneyTransaction(const QString& id, const MyMoneyTransaction& transaction) :
MyMoneyObject(id)
{
*this = transaction;
diff --git a/kmymoney/mymoney/mymoneytransaction.h b/kmymoney/mymoney/mymoneytransaction.h
index f2849f1..1744798 100644
--- a/kmymoney/mymoney/mymoneytransaction.h
+++ b/kmymoney/mymoney/mymoneytransaction.h
@@ -51,7 +51,7 @@ class KMM_MYMONEY_EXPORT MyMoneyTransaction : public MyMoneyObject, public MyMon
{
public:
MyMoneyTransaction();
- MyMoneyTransaction(const QString id,
+ MyMoneyTransaction(const QString& id,
const MyMoneyTransaction& transaction);
/**
* @param node reference to QDomNode
diff --git a/kmymoney/reports/querytable.h b/kmymoney/reports/querytable.h
index e0d9b1a..9125f70 100644
--- a/kmymoney/reports/querytable.h
+++ b/kmymoney/reports/querytable.h
@@ -81,13 +81,13 @@ class CashFlowListItem
public:
CashFlowListItem(void) {}
CashFlowListItem(const QDate& _date, const MyMoneyMoney& _value): m_date(_date), m_value(_value) {}
- bool operator<(const CashFlowListItem _second) const {
+ bool operator<(const CashFlowListItem& _second) const {
return m_date < _second.m_date;
}
- bool operator<=(const CashFlowListItem _second) const {
+ bool operator<=(const CashFlowListItem& _second) const {
return m_date <= _second.m_date;
}
- bool operator>(const CashFlowListItem _second) const {
+ bool operator>(const CashFlowListItem& _second) const {
return m_date > _second.m_date;
}
const QDate& date(void) const {
diff --git a/libkdchart/src/KDChartDataValueAttributes.cpp b/libkdchart/src/KDChartDataValueAttributes.cpp
index b7f4921..3a54e02 100644
--- a/libkdchart/src/KDChartDataValueAttributes.cpp
+++ b/libkdchart/src/KDChartDataValueAttributes.cpp
@@ -256,7 +256,7 @@ int DataValueAttributes::decimalDigits() const
return d->decimalDigits;
}
-void DataValueAttributes::setPrefix( const QString prefixString )
+void DataValueAttributes::setPrefix( const QString& prefixString )
{
d->prefix = prefixString;
}
@@ -266,7 +266,7 @@ QString DataValueAttributes::prefix() const
return d->prefix;
}
-void DataValueAttributes::setSuffix( const QString suffixString )
+void DataValueAttributes::setSuffix( const QString& suffixString )
{
d->suffix = suffixString;
}
@@ -276,7 +276,7 @@ QString DataValueAttributes::suffix() const
return d->suffix;
}
-void DataValueAttributes::setDataLabel( const QString label )
+void DataValueAttributes::setDataLabel( const QString& label )
{
d->dataLabel = label;
}
diff --git a/libkdchart/src/KDChartDataValueAttributes.h b/libkdchart/src/KDChartDataValueAttributes.h
index 8a0f625..7e9d51c 100644
--- a/libkdchart/src/KDChartDataValueAttributes.h
+++ b/libkdchart/src/KDChartDataValueAttributes.h
@@ -165,7 +165,7 @@ public:
* \brief Prepend a prefix string to the data value label
* \sa prefix
*/
- void setPrefix( const QString prefix );
+ void setPrefix( const QString& prefix );
/**
* \brief Returns the string used as a prefix to the data value text.
@@ -177,7 +177,7 @@ public:
* \brief Append a suffix string to the data value label
* \sa suffix
*/
- void setSuffix( const QString suffix );
+ void setSuffix( const QString& suffix );
/**
* \brief Returns the string used as a suffix to the data value text.
@@ -190,7 +190,7 @@ public:
* Supports HTML code.
* \sa dataLabel
*/
- void setDataLabel( const QString label );
+ void setDataLabel( const QString& label );
/**
* \brief Returns the string displayed instead of the data value label
--
1.7.1
--------------060703030708080806090607
Content-Type: text/x-diff;
name="0007-Remove-useless-variable-5.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="0007-Remove-useless-variable-5.patch"
More information about the KMyMoney-devel
mailing list