kodi
EpgTagsCache.h
1 /*
2  * Copyright (C) 2012-2018 Team Kodi
3  * This file is part of Kodi - https://kodi.tv
4  *
5  * SPDX-License-Identifier: GPL-2.0-or-later
6  * See LICENSES/README.md for more information.
7  */
8 
9 #pragma once
10 
11 #include "XBDateTime.h"
12 
13 #include <map>
14 #include <memory>
15 
16 namespace PVR
17 {
18 class CPVREpgChannelData;
19 class CPVREpgDatabase;
20 class CPVREpgInfoTag;
21 
23 {
24 public:
25  CPVREpgTagsCache() = delete;
26  CPVREpgTagsCache(int iEpgID,
27  const std::shared_ptr<CPVREpgChannelData>& channelData,
28  const std::shared_ptr<CPVREpgDatabase>& database,
29  const std::map<CDateTime, std::shared_ptr<CPVREpgInfoTag>>& changedTags)
30  : m_iEpgID(iEpgID), m_channelData(channelData), m_database(database), m_changedTags(changedTags)
31  {
32  }
33 
34  void SetChannelData(const std::shared_ptr<CPVREpgChannelData>& data);
35 
36  void Reset();
37 
38  bool Refresh();
39 
40  std::shared_ptr<CPVREpgInfoTag> GetLastEndedTag();
41  std::shared_ptr<CPVREpgInfoTag> GetNowActiveTag();
42  std::shared_ptr<CPVREpgInfoTag> GetNextStartingTag();
43 
44 private:
45  void RefreshLastEndedTag(const CDateTime& activeTime);
46  void RefreshNextStartingTag(const CDateTime& activeTime);
47 
48  int m_iEpgID;
49  std::shared_ptr<CPVREpgChannelData> m_channelData;
50  std::shared_ptr<CPVREpgDatabase> m_database;
51  const std::map<CDateTime, std::shared_ptr<CPVREpgInfoTag>>& m_changedTags;
52 
53  std::shared_ptr<CPVREpgInfoTag> m_lastEndedTag;
54  std::shared_ptr<CPVREpgInfoTag> m_nowActiveTag;
55  std::shared_ptr<CPVREpgInfoTag> m_nextStartingTag;
56 
57  CDateTime m_nowActiveStart;
58  CDateTime m_nowActiveEnd;
59 };
60 
61 } // namespace PVR
Definition: ContextMenuManager.h:24
DateTime class, which uses FileTime as it&#39;s base.
Definition: XBDateTime.h:63
Definition: EpgTagsCache.h:22