From 1f6e81295b5190a0a67daf9e85b4206faafb725e Mon Sep 17 00:00:00 2001 From: Mike Fleetwood Date: Sat, 6 Nov 2021 16:55:01 +0000 Subject: [PATCH] Return constant reference from OperationDetail::get_description() (!94) All uses of get_description() copy construct to a local variable, not assign to a reference, so this doesn't save anything. It is just being done to be consistent with making other getters return a constant reference. Closes !94 - Make more getter methods use return-by-constant-reference --- include/OperationDetail.h | 2 +- src/OperationDetail.cc | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/include/OperationDetail.h b/include/OperationDetail.h index 4cdda715..bf898dff 100644 --- a/include/OperationDetail.h +++ b/include/OperationDetail.h @@ -58,7 +58,7 @@ public: OperationDetailStatus status = STATUS_EXECUTE, Font font = FONT_NORMAL ) ; void set_description( const Glib::ustring & description, Font font = FONT_NORMAL ) ; - Glib::ustring get_description() const ; + const Glib::ustring& get_description() const; void set_status( OperationDetailStatus status ) ; void set_success_and_capture_errors( bool success ); OperationDetailStatus get_status() const ; diff --git a/src/OperationDetail.cc b/src/OperationDetail.cc index 1e358650..89c15dc3 100644 --- a/src/OperationDetail.cc +++ b/src/OperationDetail.cc @@ -75,11 +75,13 @@ void OperationDetail::set_description( const Glib::ustring & description, Font f on_update( *this ) ; } -Glib::ustring OperationDetail::get_description() const + +const Glib::ustring& OperationDetail::get_description() const { return description ; } - + + void OperationDetail::set_status( OperationDetailStatus status ) { if ( this ->status != STATUS_ERROR )