From cddae2ffadf1bfcaf66c9ee0da3e9c6fbff64f6b Mon Sep 17 00:00:00 2001 From: IgorekLoschinin <igor.loschinin2014@yandex.ru> Date: Mon, 19 Apr 2021 22:44:12 +0300 Subject: [PATCH 1/2] ref #38 Fixing: add const reference into getOwnerName. --- src/CopyrighFixer/CopyrighFixer/owner.cpp | 2 +- src/CopyrighFixer/CopyrighFixer/owner.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/CopyrighFixer/CopyrighFixer/owner.cpp b/src/CopyrighFixer/CopyrighFixer/owner.cpp index 37d549f..feeef3c 100644 --- a/src/CopyrighFixer/CopyrighFixer/owner.cpp +++ b/src/CopyrighFixer/CopyrighFixer/owner.cpp @@ -16,7 +16,7 @@ void Owner::setName(const QString &ownerName) { Owner::name = ownerName; } -QString Owner::getOwnerName() { +const QString &Owner::getOwnerName() const { return Owner::name; } diff --git a/src/CopyrighFixer/CopyrighFixer/owner.h b/src/CopyrighFixer/CopyrighFixer/owner.h index 73fbf3d..22a2061 100644 --- a/src/CopyrighFixer/CopyrighFixer/owner.h +++ b/src/CopyrighFixer/CopyrighFixer/owner.h @@ -30,7 +30,7 @@ public: * @brief getOwnerName The method allows you to get information about the owner. * @return the owner name. */ - QString getOwnerName(); + const QString& getOwnerName() const; /** * @brief setTimeRange A method that allows you to set the time interval for using a file. From 7eca87abc2fcadd5d0ad45e09f2a3e4803853c30 Mon Sep 17 00:00:00 2001 From: IgorekLoschinin <igor.loschinin2014@yandex.ru> Date: Mon, 19 Apr 2021 22:59:34 +0300 Subject: [PATCH 2/2] ref #38 Fixing_2: added const references --- src/CopyrighFixer/CopyrighFixer/owner.cpp | 8 ++++---- src/CopyrighFixer/CopyrighFixer/owner.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/CopyrighFixer/CopyrighFixer/owner.cpp b/src/CopyrighFixer/CopyrighFixer/owner.cpp index feeef3c..921b6e7 100644 --- a/src/CopyrighFixer/CopyrighFixer/owner.cpp +++ b/src/CopyrighFixer/CopyrighFixer/owner.cpp @@ -13,19 +13,19 @@ Owner::Owner() { } void Owner::setName(const QString &ownerName) { - Owner::name = ownerName; + name = ownerName; } const QString &Owner::getOwnerName() const { - return Owner::name; + return name; } void Owner::setTimeRange(const QString &interval) { timeRange = interval; } -QString Owner::getTimeRange() { - return Owner::timeRange; +const QString &Owner::getTimeRange() const { + return timeRange; } }; diff --git a/src/CopyrighFixer/CopyrighFixer/owner.h b/src/CopyrighFixer/CopyrighFixer/owner.h index 22a2061..81dbc74 100644 --- a/src/CopyrighFixer/CopyrighFixer/owner.h +++ b/src/CopyrighFixer/CopyrighFixer/owner.h @@ -42,7 +42,7 @@ public: * @brief getTimeRange The method changes the timestamp of the usage. * @return the time interval when the file was modified */ - QString getTimeRange(); + const QString& getTimeRange() const; private: QString name; QString timeRange;