From 197309468247c893bdaa37ef47a98db695b2ea78 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Thu, 30 Jan 2014 13:44:12 -0600 Subject: following on the review comment covered in the last commit, use shared_ptr instead of shared_ptr where possible. --- include/datetime/clock.h | 2 +- include/datetime/formatter.h | 8 ++++---- include/datetime/locations-settings.h | 8 ++++---- include/datetime/menu.h | 4 ++-- include/datetime/timezones-live.h | 4 ++-- src/clock-live.cpp | 6 +++--- src/formatter-desktop.cpp | 4 ++-- src/formatter.cpp | 6 +++--- src/locations-settings.cpp | 4 ++-- src/menu.cpp | 24 ++++++++++++------------ src/timezones-live.cpp | 3 ++- 11 files changed, 37 insertions(+), 36 deletions(-) diff --git a/include/datetime/clock.h b/include/datetime/clock.h index b3e3538..4a9db8f 100644 --- a/include/datetime/clock.h +++ b/include/datetime/clock.h @@ -79,7 +79,7 @@ class Timezones; class LiveClock: public Clock { public: - LiveClock (const std::shared_ptr& zones); + LiveClock (const std::shared_ptr& zones); virtual ~LiveClock(); virtual DateTime localtime() const; diff --git a/include/datetime/formatter.h b/include/datetime/formatter.h index 3de109e..f323858 100644 --- a/include/datetime/formatter.h +++ b/include/datetime/formatter.h @@ -86,7 +86,7 @@ public: std::string getRelativeFormat(GDateTime* then, GDateTime* then_end=nullptr) const; protected: - Formatter(const std::shared_ptr&); + Formatter(const std::shared_ptr&); virtual ~Formatter(); static const char* getDefaultHeaderTimeFormat(bool twelvehour, bool show_seconds); @@ -107,10 +107,10 @@ private: class DesktopFormatter: public Formatter { public: - DesktopFormatter(const std::shared_ptr&, const std::shared_ptr&); + DesktopFormatter(const std::shared_ptr&, const std::shared_ptr&); private: - std::shared_ptr m_settings; + std::shared_ptr m_settings; void rebuildHeaderFormat(); const gchar* getFullTimeFormatString() const; @@ -126,7 +126,7 @@ private: class PhoneFormatter: public Formatter { public: - PhoneFormatter(const std::shared_ptr& clock): Formatter(clock) { + PhoneFormatter(const std::shared_ptr& clock): Formatter(clock) { headerFormat.set(getDefaultHeaderTimeFormat(is_locale_12h(), false)); } }; diff --git a/include/datetime/locations-settings.h b/include/datetime/locations-settings.h index d01cbb5..8757f43 100644 --- a/include/datetime/locations-settings.h +++ b/include/datetime/locations-settings.h @@ -39,12 +39,12 @@ public: * @param[in] settings the #Settings whose locations property is to be used * @param[in] timezones the #Timezones to always show first in the list */ - SettingsLocations (const std::shared_ptr& settings, - const std::shared_ptr& timezones); + SettingsLocations (const std::shared_ptr& settings, + const std::shared_ptr& timezones); private: - std::shared_ptr m_settings; - std::shared_ptr m_timezones; + std::shared_ptr m_settings; + std::shared_ptr m_timezones; void reload(); }; diff --git a/include/datetime/menu.h b/include/datetime/menu.h index a95be10..7b351c3 100644 --- a/include/datetime/menu.h +++ b/include/datetime/menu.h @@ -70,12 +70,12 @@ private: class MenuFactory { public: - MenuFactory (const std::shared_ptr& actions, const std::shared_ptr& state); + MenuFactory (const std::shared_ptr& actions, const std::shared_ptr& state); std::shared_ptr buildMenu(Menu::Profile profile); private: std::shared_ptr m_actions; - std::shared_ptr m_state; + std::shared_ptr m_state; }; } // namespace datetime diff --git a/include/datetime/timezones-live.h b/include/datetime/timezones-live.h index 286c967..ca4ef31 100644 --- a/include/datetime/timezones-live.h +++ b/include/datetime/timezones-live.h @@ -38,14 +38,14 @@ namespace datetime { class LiveTimezones: public Timezones { public: - LiveTimezones(std::shared_ptr& settings, const std::string& filename); + LiveTimezones(const std::shared_ptr& settings, const std::string& filename); private: void update_geolocation(); void update_timezones(); FileTimezone m_file; - std::shared_ptr m_settings; + std::shared_ptr m_settings; std::shared_ptr m_geo; }; diff --git a/src/clock-live.cpp b/src/clock-live.cpp index 69ebda7..7c9db40 100644 --- a/src/clock-live.cpp +++ b/src/clock-live.cpp @@ -59,7 +59,7 @@ class LiveClock::Impl { public: - Impl(LiveClock& owner, const std::shared_ptr& tzd): + Impl(LiveClock& owner, const std::shared_ptr& tzd): m_owner(owner), m_timezones(tzd) { @@ -135,13 +135,13 @@ protected: LiveClock& m_owner; GTimeZone* m_timezone = nullptr; - std::shared_ptr m_timezones; + std::shared_ptr m_timezones; DateTime m_prev_datetime; unsigned int m_timer = 0; }; -LiveClock::LiveClock(const std::shared_ptr& tzd): +LiveClock::LiveClock(const std::shared_ptr& tzd): p(new Impl(*this, tzd)) { } diff --git a/src/formatter-desktop.cpp b/src/formatter-desktop.cpp index d542ec4..9a098c6 100644 --- a/src/formatter-desktop.cpp +++ b/src/formatter-desktop.cpp @@ -64,8 +64,8 @@ std::string joinDateAndTimeFormatStrings(const char* date_string, **** ***/ -DesktopFormatter::DesktopFormatter(const std::shared_ptr& clock_in, - const std::shared_ptr& settings_in): +DesktopFormatter::DesktopFormatter(const std::shared_ptr& clock_in, + const std::shared_ptr& settings_in): Formatter(clock_in), m_settings(settings_in) { diff --git a/src/formatter.cpp b/src/formatter.cpp index a15c7f8..638eac4 100644 --- a/src/formatter.cpp +++ b/src/formatter.cpp @@ -118,7 +118,7 @@ class Formatter::Impl { public: - Impl(Formatter* owner, const std::shared_ptr& clock): + Impl(Formatter* owner, const std::shared_ptr& clock): m_owner(owner), m_clock(clock) { @@ -208,14 +208,14 @@ private: guint m_relative_timer = 0; public: - std::shared_ptr m_clock; + std::shared_ptr m_clock; }; /*** **** ***/ -Formatter::Formatter(const std::shared_ptr& clock): +Formatter::Formatter(const std::shared_ptr& clock): p(new Formatter::Impl(this, clock)) { } diff --git a/src/locations-settings.cpp b/src/locations-settings.cpp index 9b90bc0..ef3085f 100644 --- a/src/locations-settings.cpp +++ b/src/locations-settings.cpp @@ -29,8 +29,8 @@ namespace unity { namespace indicator { namespace datetime { -SettingsLocations::SettingsLocations(const std::shared_ptr& settings, - const std::shared_ptr& timezones): +SettingsLocations::SettingsLocations(const std::shared_ptr& settings, + const std::shared_ptr& timezones): m_settings(settings), m_timezones(timezones) { diff --git a/src/menu.cpp b/src/menu.cpp index 42265c9..e92d398 100644 --- a/src/menu.cpp +++ b/src/menu.cpp @@ -70,9 +70,9 @@ class MenuImpl: public Menu protected: MenuImpl(const Menu::Profile profile_in, const std::string& name_in, - std::shared_ptr& state, + std::shared_ptr& state, std::shared_ptr& actions, - std::shared_ptr formatter): + std::shared_ptr formatter): Menu(profile_in, name_in), m_state(state), m_actions(actions), @@ -136,9 +136,9 @@ protected: g_action_group_change_action_state(action_group, action_name.c_str(), state); } - std::shared_ptr m_state; + std::shared_ptr m_state; std::shared_ptr m_actions; - std::shared_ptr m_formatter; + std::shared_ptr m_formatter; GMenu* m_submenu = nullptr; GVariant* get_serialized_alarm_icon() { return m_serialized_alarm_icon; } @@ -450,10 +450,10 @@ class DesktopBaseMenu: public MenuImpl protected: DesktopBaseMenu(Menu::Profile profile_, const std::string& name_, - std::shared_ptr& state_, + std::shared_ptr& state_, std::shared_ptr& actions_): MenuImpl(profile_, name_, state_, actions_, - std::shared_ptr(new DesktopFormatter(state_->clock, state_->settings))) + std::shared_ptr(new DesktopFormatter(state_->clock, state_->settings))) { update_header(); } @@ -477,14 +477,14 @@ protected: class DesktopMenu: public DesktopBaseMenu { public: - DesktopMenu(std::shared_ptr& state_, std::shared_ptr& actions_): + DesktopMenu(std::shared_ptr& state_, std::shared_ptr& actions_): DesktopBaseMenu(Desktop,"desktop", state_, actions_) {} }; class DesktopGreeterMenu: public DesktopBaseMenu { public: - DesktopGreeterMenu(std::shared_ptr& state_, std::shared_ptr& actions_): + DesktopGreeterMenu(std::shared_ptr& state_, std::shared_ptr& actions_): DesktopBaseMenu(DesktopGreeter,"desktop_greeter", state_, actions_) {} }; @@ -493,7 +493,7 @@ class PhoneBaseMenu: public MenuImpl protected: PhoneBaseMenu(Menu::Profile profile_, const std::string& name_, - std::shared_ptr& state_, + std::shared_ptr& state_, std::shared_ptr& actions_): MenuImpl(profile_, name_, state_, actions_, std::shared_ptr(new PhoneFormatter(state_->clock))) @@ -534,7 +534,7 @@ protected: class PhoneMenu: public PhoneBaseMenu { public: - PhoneMenu(std::shared_ptr& state_, + PhoneMenu(std::shared_ptr& state_, std::shared_ptr& actions_): PhoneBaseMenu(Phone, "phone", state_, actions_) {} }; @@ -542,7 +542,7 @@ public: class PhoneGreeterMenu: public PhoneBaseMenu { public: - PhoneGreeterMenu(std::shared_ptr& state_, + PhoneGreeterMenu(std::shared_ptr& state_, std::shared_ptr& actions_): PhoneBaseMenu(PhoneGreeter, "phone_greeter", state_, actions_) {} }; @@ -552,7 +552,7 @@ public: ****/ MenuFactory::MenuFactory(const std::shared_ptr& actions_, - const std::shared_ptr& state_): + const std::shared_ptr& state_): m_actions(actions_), m_state(state_) { diff --git a/src/timezones-live.cpp b/src/timezones-live.cpp index baac05d..4902b76 100644 --- a/src/timezones-live.cpp +++ b/src/timezones-live.cpp @@ -25,7 +25,8 @@ namespace unity { namespace indicator { namespace datetime { -LiveTimezones::LiveTimezones(std::shared_ptr& settings, const std::string& filename): +LiveTimezones::LiveTimezones(const std::shared_ptr& settings, + const std::string& filename): m_file(filename), m_settings(settings) { -- cgit v1.2.3