From 4f3f3245b957bd384b5df6d87230c44ad3d4bc98 Mon Sep 17 00:00:00 2001 From: xhaggi Date: Thu, 19 Feb 2015 12:10:46 +0100 Subject: [PATCH] [epg] removes some unecessary setters in CEpgInfoTag --- xbmc/epg/EpgInfoTag.cpp | 137 ++++++---------------------------------- xbmc/epg/EpgInfoTag.h | 114 +++------------------------------ 2 files changed, 27 insertions(+), 224 deletions(-) diff --git a/xbmc/epg/EpgInfoTag.cpp b/xbmc/epg/EpgInfoTag.cpp index 1aa55222ffe1b..6e9c75aa0ced1 100644 --- a/xbmc/epg/EpgInfoTag.cpp +++ b/xbmc/epg/EpgInfoTag.cpp @@ -89,30 +89,33 @@ CEpgInfoTag::CEpgInfoTag(const EPG_TAG &data) : m_iUniqueBroadcastID(-1), m_epg(NULL) { - SetStartFromUTC(data.startTime + g_advancedSettings.m_iPVRTimeCorrection); - SetEndFromUTC(data.endTime + g_advancedSettings.m_iPVRTimeCorrection); + m_startTime = (data.startTime + g_advancedSettings.m_iPVRTimeCorrection); + m_endTime = (data.endTime + g_advancedSettings.m_iPVRTimeCorrection); + m_iParentalRating = data.iParentalRating; + m_iUniqueBroadcastID = data.iUniqueBroadcastId; + m_bNotify = data.bNotify; + m_firstAired = (data.firstAired + g_advancedSettings.m_iPVRTimeCorrection); + m_iEpisodeNumber = data.iEpisodeNumber; + m_iEpisodePart = data.iEpisodePartNumber; + m_iStarRating = data.iStarRating; + SetGenre(data.iGenreType, data.iGenreSubType, data.strGenreDescription); - SetParentalRating(data.iParentalRating); - SetUniqueBroadcastID(data.iUniqueBroadcastId); - SetNotify(data.bNotify); - SetFirstAiredFromUTC(data.firstAired + g_advancedSettings.m_iPVRTimeCorrection); - SetEpisodeNumber(data.iEpisodeNumber); - SetEpisodePart(data.iEpisodePartNumber); - SetStarRating(data.iStarRating); // explicit NULL check, because there is no implicit NULL constructor for std::string if (data.strTitle) - SetTitle(data.strTitle); + m_strTitle = data.strTitle; if (data.strPlotOutline) - SetPlotOutline(data.strPlotOutline); + m_strPlotOutline = data.strPlotOutline; if (data.strPlot) - SetPlot(data.strPlot); + m_strPlot = data.strPlot; if (data.strEpisodeName) - SetEpisodeName(data.strEpisodeName); + m_strEpisodeName = data.strEpisodeName; if (data.strIconPath) - SetIcon(data.strIconPath); + m_strIconPath = data.strIconPath; if (data.strRecordingId) - SetRecordingId(data.strRecordingId); + m_strRecordingId = data.strRecordingId; + + UpdatePath(); } CEpgInfoTag::~CEpgInfoTag() @@ -268,11 +271,6 @@ int CEpgInfoTag::UniqueBroadcastID(void) const return m_iUniqueBroadcastID; } -void CEpgInfoTag::SetBroadcastId(int iBroadcastID) -{ - m_iBroadcastId = iBroadcastID; -} - int CEpgInfoTag::BroadcastId(void) const { return m_iBroadcastId; @@ -290,21 +288,6 @@ CDateTime CEpgInfoTag::StartAsLocalTime(void) const return retVal; } -void CEpgInfoTag::SetStartFromUTC(const CDateTime &start) -{ - if (m_startTime != start) - { - m_startTime = start; - UpdatePath(); - } -} - -void CEpgInfoTag::SetStartFromLocalTime(const CDateTime &start) -{ - CDateTime tmp = start.GetAsUTCDateTime(); - SetStartFromUTC(tmp); -} - CDateTime CEpgInfoTag::EndAsUTC(void) const { return m_endTime; @@ -322,12 +305,6 @@ void CEpgInfoTag::SetEndFromUTC(const CDateTime &end) m_endTime = end; } -void CEpgInfoTag::SetEndFromLocalTime(const CDateTime &end) -{ - CDateTime tmp = end.GetAsUTCDateTime(); - SetEndFromUTC(tmp); -} - int CEpgInfoTag::GetDuration(void) const { time_t start, end; @@ -336,11 +313,6 @@ int CEpgInfoTag::GetDuration(void) const return end - start > 0 ? end - start : 3600; } -void CEpgInfoTag::SetTitle(const std::string &strTitle) -{ - m_strTitle = strTitle; -} - std::string CEpgInfoTag::Title(bool bOverrideParental /* = false */) const { std::string strTitle; @@ -359,11 +331,6 @@ std::string CEpgInfoTag::Title(bool bOverrideParental /* = false */) const return strTitle; } -void CEpgInfoTag::SetPlotOutline(const std::string &strPlotOutline) -{ - m_strPlotOutline = strPlotOutline; -} - std::string CEpgInfoTag::PlotOutline(bool bOverrideParental /* = false */) const { std::string retVal; @@ -373,11 +340,6 @@ std::string CEpgInfoTag::PlotOutline(bool bOverrideParental /* = false */) const return retVal; } -void CEpgInfoTag::SetPlot(const std::string &strPlot) -{ - m_strPlot = strPlot; -} - std::string CEpgInfoTag::Plot(bool bOverrideParental /* = false */) const { std::string retVal; @@ -434,112 +396,51 @@ CDateTime CEpgInfoTag::FirstAiredAsLocalTime(void) const return retVal; } -void CEpgInfoTag::SetFirstAiredFromUTC(const CDateTime &firstAired) -{ - m_firstAired = firstAired; -} - -void CEpgInfoTag::SetFirstAiredFromLocalTime(const CDateTime &firstAired) -{ - CDateTime tmp = firstAired.GetAsUTCDateTime(); - SetFirstAiredFromUTC(tmp); -} - -void CEpgInfoTag::SetParentalRating(int iParentalRating) -{ - m_iParentalRating = iParentalRating; -} - int CEpgInfoTag::ParentalRating(void) const { return m_iParentalRating; } -void CEpgInfoTag::SetStarRating(int iStarRating) -{ - m_iStarRating = iStarRating; -} - int CEpgInfoTag::StarRating(void) const { return m_iStarRating; } -void CEpgInfoTag::SetNotify(bool bNotify) -{ - m_bNotify = bNotify; -} - bool CEpgInfoTag::Notify(void) const { return m_bNotify; } -void CEpgInfoTag::SetSeriesNumber(int iSeriesNumber) -{ - m_iSeriesNumber = iSeriesNumber; -} - int CEpgInfoTag::SeriesNumber(void) const { return m_iSeriesNumber; } -void CEpgInfoTag::SetEpisodeNumber(int iEpisodeNumber) -{ - m_iEpisodeNumber = iEpisodeNumber; -} - int CEpgInfoTag::EpisodeNumber(void) const { return m_iEpisodeNumber; } -void CEpgInfoTag::SetEpisodePart(int iEpisodePart) -{ - m_iEpisodePart = iEpisodePart; -} - int CEpgInfoTag::EpisodePart(void) const { return m_iEpisodePart; } -void CEpgInfoTag::SetEpisodeName(const std::string &strEpisodeName) -{ - m_strEpisodeName = strEpisodeName; -} - std::string CEpgInfoTag::EpisodeName(void) const { return m_strEpisodeName; } -void CEpgInfoTag::SetIcon(const std::string &strIconPath) -{ - m_strIconPath = strIconPath; -} - std::string CEpgInfoTag::Icon(void) const { return m_strIconPath; } -void CEpgInfoTag::SetPath(const std::string &strFileNameAndPath) -{ - m_strFileNameAndPath = strFileNameAndPath; -} - std::string CEpgInfoTag::Path(void) const { return m_strFileNameAndPath; } -void CEpgInfoTag::SetRecordingId(const std::string &strRecordingId) -{ - m_strRecordingId = strRecordingId; -} - const std::string& CEpgInfoTag::RecordingId(void) const { return m_strRecordingId; @@ -690,7 +591,7 @@ bool CEpgInfoTag::Persist(bool bSingleUpdate /* = true */) void CEpgInfoTag::UpdatePath(void) { - SetPath(StringUtils::Format("pvr://guide/%04i/%s.epg", EpgID(), m_startTime.GetAsDBDateTime().c_str())); + m_strFileNameAndPath = StringUtils::Format("pvr://guide/%04i/%s.epg", EpgID(), m_startTime.GetAsDBDateTime().c_str()); } const CEpg *CEpgInfoTag::GetTable() const diff --git a/xbmc/epg/EpgInfoTag.h b/xbmc/epg/EpgInfoTag.h index bb6d4037b8260..d3c20d2fc7543 100644 --- a/xbmc/epg/EpgInfoTag.h +++ b/xbmc/epg/EpgInfoTag.h @@ -152,12 +152,6 @@ namespace EPG */ int UniqueBroadcastID(void) const; - /*! - * @brief Change the event's database ID. - * @param iBroadcastID The new database ID. - */ - void SetBroadcastId(int iBroadcastID); - /*! * @brief Get the event's database ID. * @return The database ID. @@ -171,13 +165,6 @@ namespace EPG CDateTime StartAsUTC(void) const; CDateTime StartAsLocalTime(void) const; - /*! - * @brief Change the event's start time. - * @param start The new start time. - */ - void SetStartFromUTC(const CDateTime &start); - void SetStartFromLocalTime(const CDateTime &start); - /*! * @brief Get the event's end time. * @return The new start time. @@ -190,7 +177,6 @@ namespace EPG * @param end The new end time. */ void SetEndFromUTC(const CDateTime &end); - void SetEndFromLocalTime(const CDateTime &end); /*! * @brief Get the duration of this event in seconds. @@ -198,12 +184,6 @@ namespace EPG */ int GetDuration(void) const; - /*! - * @brief Change the title of this event. - * @param strTitle The new title. - */ - void SetTitle(const std::string &strTitle); - /*! * @brief Get the title of this event. * @param bOverrideParental True to override parental control, false check it. @@ -211,12 +191,6 @@ namespace EPG */ std::string Title(bool bOverrideParental = false) const; - /*! - * @brief Change the plot outline of this event. - * @param strPlotOutline The new plot outline. - */ - void SetPlotOutline(const std::string &strPlotOutline); - /*! * @brief Get the plot outline of this event. * @param bOverrideParental True to override parental control, false check it. @@ -224,12 +198,6 @@ namespace EPG */ std::string PlotOutline(bool bOverrideParental = false) const; - /*! - * @brief Change the plot of this event. - * @param strPlot The new plot. - */ - void SetPlot(const std::string &strPlot); - /*! * @brief Get the plot of this event. * @param bOverrideParental True to override parental control, false check it. @@ -237,13 +205,6 @@ namespace EPG */ std::string Plot(bool bOverrideParental = false) const; - /*! - * @brief Change the genre of this event. - * @param iGenreType The genre type ID. - * @param iGenreSubType The genre subtype ID. - */ - void SetGenre(int iGenreType, int iGenreSubType, const char* strGenre); - /*! * @brief Get the genre type ID of this event. * @return The genre type ID. @@ -262,13 +223,6 @@ namespace EPG */ const std::vector Genre(void) const; - /*! - * @brief Change the first air date of this event. - * @param firstAired The new first air date. - */ - void SetFirstAiredFromUTC(const CDateTime &firstAired); - void SetFirstAiredFromLocalTime(const CDateTime &firstAired); - /*! * @brief Get the first air date of this event. * @return The first air date. @@ -276,120 +230,60 @@ namespace EPG CDateTime FirstAiredAsUTC(void) const; CDateTime FirstAiredAsLocalTime(void) const; - /*! - * @brief Change the parental rating of this event. - * @param iParentalRating The new parental rating. - */ - void SetParentalRating(int iParentalRating); - /*! * @brief Get the parental rating of this event. * @return The parental rating. */ int ParentalRating(void) const; - /*! - * @brief Change the star rating of this event. - * @param iStarRating The new star rating. - */ - void SetStarRating(int iStarRating); - /*! * @brief Get the star rating of this event. * @return The star rating. */ int StarRating(void) const; - /*! - * @brief Change the value of notify on start. - * @param bNotify The new value. - */ - void SetNotify(bool bNotify); - /*! * @brief Notify on start if true. * @return Notify on start. */ bool Notify(void) const; - /*! - * @brief Change the series number of this event. - * @param iSeriesNumber The new series number. - */ - void SetSeriesNumber(int iSeriesNumber); - /*! * @brief The series number of this event. * @return The series number. */ int SeriesNumber(void) const; - /*! - * @brief Change the episode number of this event. - * @param iEpisodeNum The new episode number. - */ - void SetEpisodeNumber(int iEpisodeNumber); - /*! * @brief The episode number of this event. * @return The episode number. */ int EpisodeNumber(void) const; - /*! - * @brief Change the episode part number of this event. - * @param iEpisodePart The new episode part number. - */ - void SetEpisodePart(int iEpisodePart); - /*! * @brief The episode part number of this event. * @return The episode part number. */ int EpisodePart(void) const; - /*! - * @brief Change the episode name of this event. - * @param strEpisodeName The new episode name. - */ - void SetEpisodeName(const std::string &strEpisodeName); - /*! * @brief The episode name of this event. * @return The episode name. */ std::string EpisodeName(void) const; - /*! - * @brief Change the path to the icon for this event. - * @param strIconPath The new path. - */ - void SetIcon(const std::string &strIconPath); - /*! * @brief Get the path to the icon for this event. * @return The path to the icon */ std::string Icon(void) const; - /*! - * @brief Change the path to this event. - * @param strFileNameAndPath The new path. - */ - void SetPath(const std::string &strFileNameAndPath); - /*! * @brief The path to this event. * @return The path. */ std::string Path(void) const; - /*! - * @brief Change the recording ID to this event. - * @param strRecordingId The new recording ID. - */ - void SetRecordingId(const std::string &strRecordingId); - /*! * @brief The recording ID to this event. * @return The recording ID. @@ -481,6 +375,14 @@ namespace EPG bool Update(const CEpgInfoTag &tag, bool bUpdateBroadcastId = true); private: + + /*! + * @brief Change the genre of this event. + * @param iGenreType The genre type ID. + * @param iGenreSubType The genre subtype ID. + */ + void SetGenre(int iGenreType, int iGenreSubType, const char* strGenre); + /*! * @brief Hook that is called when the start date changed. */