summaryrefslogtreecommitdiffstats
path: root/xbmc/pvr/timers/PVRTimerRuleMatcher.h
blob: 9d502afa77f487c7152c148121f53522fa428c02 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/*
 *  Copyright (C) 2012-2018 Team Kodi
 *  This file is part of Kodi - https://kodi.tv
 *
 *  SPDX-License-Identifier: GPL-2.0-or-later
 *  See LICENSES/README.md for more information.
 */

#pragma once

#include "XBDateTime.h"

#include <memory>

class CRegExp;

namespace PVR
{
class CPVRChannel;
class CPVRTimerInfoTag;
class CPVREpgInfoTag;

class CPVRTimerRuleMatcher
{
public:
  CPVRTimerRuleMatcher(const std::shared_ptr<CPVRTimerInfoTag>& timerRule, const CDateTime& start);
  virtual ~CPVRTimerRuleMatcher();

  std::shared_ptr<CPVRTimerInfoTag> GetTimerRule() const { return m_timerRule; }

  std::shared_ptr<CPVRChannel> GetChannel() const;
  CDateTime GetNextTimerStart() const;
  bool Matches(const std::shared_ptr<CPVREpgInfoTag>& epgTag) const;

private:
  bool MatchSeriesLink(const std::shared_ptr<CPVREpgInfoTag>& epgTag) const;
  bool MatchChannel(const std::shared_ptr<CPVREpgInfoTag>& epgTag) const;
  bool MatchStart(const std::shared_ptr<CPVREpgInfoTag>& epgTag) const;
  bool MatchEnd(const std::shared_ptr<CPVREpgInfoTag>& epgTag) const;
  bool MatchDayOfWeek(const std::shared_ptr<CPVREpgInfoTag>& epgTag) const;
  bool MatchSearchText(const std::shared_ptr<CPVREpgInfoTag>& epgTag) const;

  const std::shared_ptr<CPVRTimerInfoTag> m_timerRule;
  CDateTime m_start;
  mutable std::unique_ptr<CRegExp> m_textSearch;
};
} // namespace PVR