source: mythtv/mythtv/libs/libmythtv/recordinginfo.h

Last change on this file was c03b8b919, checked in by David Hampton <mythtv@…>, 5 years ago

tidy: Fix reserved identifier messages in header inclusion. (libs)

The new clang-tidy-11 "reserved identifier" checker looks for code
that violates the C/C+ standards for identifier naming. The C++
standard reserves 1) all names that start with an underscore followed
by an uppercase letter, and 2) any name that contains a double
underscore. Use of these names results in undefined behavior.

Replace all illegal names in the #ifndef/#define/#endif sequence that
is normally used to protect a header file from being included multiple
times.

https://clang.llvm.org/extra/clang-tidy/checks/bugprone-reserved-identifier.html

  • Property mode set to 100644
File size: 10.0 KB
Line 
1#ifndef RECORDING_INFO_H
2#define RECORDING_INFO_H
3
4#include <QDateTime>
5#include <QString>
6
7#include "mythtvexp.h"
8#include "programinfo.h"
9#include "recordingfile.h"
10#include "enums/recStatus.h"
11
12class RecordingRule;
13
14/** \class RecordingInfo
15 *  \brief Holds information on a %TV Program one might wish to record.
16 *
17 *  This class exxtends ProgramInfo with additional information about
18 *  scheduled recordings and contains helper methods to aid in the
19 *  scheduling of recordings.
20 */
21
22// Note: methods marked with "//pi" could be moved to ProgramInfo without
23// breaking linkage or adding new classes to libmyth. For some of them
24// RecordingRule::signalChange would need to be moved to remoteutil.{cpp,h},
25// but that is a static method which is fairly easy to move.
26// These methods are in RecordingInfo because it currently makes sense
27// for them to be in this class in terms of related functions being here.
28
29class RecordingInfo;
30class RecordingRule;
31
32using RecordingList = AutoDeleteDeque<RecordingInfo*>;
33
34class MTV_PUBLIC RecordingInfo : public ProgramInfo
35{
36  public:
37    RecordingInfo(void) { LoadRecordingFile(); }
38    RecordingInfo(const RecordingInfo &other) :
39        ProgramInfo(other),
40        m_oldrecstatus(other.m_oldrecstatus),
41        m_savedrecstatus(other.m_savedrecstatus),
42        m_future(other.m_future),
43        m_schedOrder(other.m_schedOrder),
44        m_mplexId(other.m_mplexId),
45        m_sgroupId(other.m_sgroupId),
46        m_desiredRecStartTs(other.m_desiredRecStartTs),
47        m_desiredRecEndTs(other.m_desiredRecEndTs)  { LoadRecordingFile(); }
48    explicit RecordingInfo(const ProgramInfo &other) :
49        ProgramInfo(other),
50        m_desiredRecStartTs(m_startTs),
51        m_desiredRecEndTs(m_endTs)  { LoadRecordingFile(); }
52    explicit RecordingInfo(uint _recordedid) :
53        ProgramInfo(_recordedid),
54        m_desiredRecStartTs(m_startTs),
55        m_desiredRecEndTs(m_endTs)  { LoadRecordingFile(); }
56    RecordingInfo(uint _chanid, const QDateTime &_recstartts) : /// DEPRECATED
57        ProgramInfo(_chanid, _recstartts),
58        m_desiredRecStartTs(m_startTs),
59        m_desiredRecEndTs(m_endTs)  { LoadRecordingFile(); }
60    RecordingInfo(QStringList::const_iterator &it,
61                  const QStringList::const_iterator&  end) :
62        ProgramInfo(it, end),
63        m_desiredRecStartTs(m_startTs),
64        m_desiredRecEndTs(m_endTs)  { LoadRecordingFile(); }
65    /// Create RecordingInfo from 'program'+'record'+'channel' tables,
66    /// used in scheduler.cpp @ ~ 3296
67    RecordingInfo(
68        const QString &title,
69        const QString &sortTitle,
70        const QString &subtitle,
71        const QString &sortSubtitle,
72        const QString &description,
73        uint season,
74        uint episode,
75        uint totalepisodes,
76        const QString &syndicatedepisode,
77        const QString &category,
78
79        uint chanid,
80        const QString &chanstr,
81        const QString &chansign,
82        const QString &channame,
83
84        const QString &recgroup,
85        const QString &playgroup,
86
87        const QString &hostname,
88        const QString &storagegroup,
89
90        uint year,
91        uint partnumber,
92        uint parttotal,
93
94        const QString &seriesid,
95        const QString &programid,
96        const QString &inetref,
97        CategoryType catType,
98
99        int recpriority,
100
101        const QDateTime &startts,
102        const QDateTime &endts,
103        const QDateTime &recstartts,
104        const QDateTime &recendts,
105
106        float stars,
107        const QDate &originalAirDate,
108
109        bool repeat,
110
111        RecStatus::Type oldrecstatus,
112        bool reactivate,
113
114        uint recordid,
115        uint parentid,
116        RecordingType rectype,
117        RecordingDupInType dupin,
118        RecordingDupMethodType dupmethod,
119
120        uint sourceid,
121        uint inputid,
122
123        uint findid,
124
125        bool commfree,
126        uint subtitleType,
127        uint videoproperties,
128        uint audioproperties,
129        bool future,
130        int schedorder,
131        uint mplexid,
132        uint sgroupid,
133        const QString &inputname);
134
135    /// Create RecordingInfo from 'record'+'channel' tables,
136    /// user in scheduler.cpp  @ ~ 3566 & ~ 3643
137    RecordingInfo(
138        const QString &title,
139        const QString &sortTitle,
140        const QString &subtitle,
141        const QString &sortSubtitle,
142        const QString &description,
143        uint season,
144        uint episode,
145        const QString &category,
146
147        uint chanid,
148        const QString &chanstr,
149        const QString &chansign,
150        const QString &channame,
151
152        const QString &recgroup,
153        const QString &playgroup,
154
155        const QString &seriesid,
156        const QString &programid,
157        const QString &inetref,
158
159        int recpriority,
160
161        const QDateTime &startts,
162        const QDateTime &endts,
163        const QDateTime &recstartts,
164        const QDateTime &recendts,
165
166        RecStatus::Type recstatus,
167
168        uint recordid,
169        RecordingType rectype,
170        RecordingDupInType dupin,
171        RecordingDupMethodType dupmethod,
172
173        uint findid,
174
175        bool commfree);
176
177    // Create ProgramInfo that overlaps the desired time on the
178    // specified channel id.
179    enum LoadStatus {
180        kNoProgram           = 0,
181        kFoundProgram        = 1,
182        kFakedLiveTVProgram  = 2,
183        kFakedZeroMinProgram = 3,
184    };
185    RecordingInfo(uint _chanid, const QDateTime &desiredts,
186                  bool genUnknown, uint maxHours = 0,
187                  LoadStatus *status = nullptr);
188
189    enum SpecialRecordingGroups {
190        kDefaultRecGroup     = 1, // Auto-increment columns start at one
191        kLiveTVRecGroup      = 2,
192        kDeletedRecGroup     = 3,
193    };
194
195  public:
196    RecordingInfo &operator=(const RecordingInfo &other)
197        { if (this==&other) return *this; RecordingInfo::clone(other); return *this; }
198    RecordingInfo &operator=(const ProgramInfo &other)
199        { if (this==&other) return *this; RecordingInfo::clone(other); return *this; }
200    virtual void clone(const RecordingInfo &other,
201                       bool ignore_non_serialized_data = false);
202    void clone(const ProgramInfo &other,
203               bool ignore_non_serialized_data = false) override; // ProgramInfo
204
205    void clear(void) override; // ProgramInfo
206
207    // Destructor
208    ~RecordingInfo() override;
209
210    // Serializers
211    void SubstituteMatches(QString &str) override; // ProgramInfo
212
213    void SetRecordingID(uint _recordedid) override // ProgramInfo
214        {  m_recordedId = _recordedid;
215            m_recordingFile->m_recordingId = _recordedid; }
216
217    // Quick gets
218    /// Creates a unique string that can be used to identify a
219    /// scheduled recording.
220    QString MakeUniqueSchedulerKey(void) const
221        { return MakeUniqueKey(m_chanId, m_startTs); }
222
223    // Used to query and set RecordingRule info
224    RecordingRule *GetRecordingRule(void);
225    int getRecordID(void);
226    static bool QueryRecordedIdForKey(int & recordedid,
227                                      uint chanid, const QDateTime& recstartts);
228    int GetAutoRunJobs(void) const;
229    RecordingType GetProgramRecordingStatus(void);
230    QString GetProgramRecordingProfile(void) const;
231    void ApplyRecordStateChange(RecordingType newstate, bool save = true);
232    void ApplyRecordRecPriorityChange(int newrecpriority);
233    void QuickRecord(void);
234
235    // Used in determining start and end for RecordingQuality determination
236    void SetDesiredStartTime(const QDateTime &dt) { m_desiredRecStartTs = dt; }
237    void SetDesiredEndTime(const QDateTime &dt) { m_desiredRecEndTs = dt; }
238    QDateTime GetDesiredStartTime(void) const { return m_desiredRecStartTs; }
239    QDateTime GetDesiredEndTime(void) const { return m_desiredRecEndTs; }
240
241    // these five can be moved to programinfo
242    void AddHistory(bool resched = true, bool forcedup = false,
243                    bool future = false);//pi
244    void DeleteHistory(void);//pi
245    void ForgetHistory(void);//pi
246    void SetDupHistory(void);//pi
247
248    // Used to update database with recording info
249    void StartedRecording(const QString& ext);
250    void FinishedRecording(bool allowReRecord);
251    void UpdateRecordingEnd(void);//pi
252    void ReactivateRecording(void);//pi
253    void ApplyRecordRecID(void);//pi
254    void ApplyRecordRecGroupChange(const QString &newrecgroup);
255    void ApplyRecordRecGroupChange(int newrecgroupid);
256    void ApplyRecordPlayGroupChange(const QString &newplaygroup);
257    void ApplyStorageGroupChange(const QString &newstoragegroup);
258    void ApplyRecordRecTitleChange(const QString &newTitle,
259                                   const QString &newSubtitle,
260                                   const QString &newDescription);
261    void ApplyTranscoderProfileChange(const QString &profile) const;//pi
262    void ApplyTranscoderProfileChangeById(int id);
263    void ApplyNeverRecord(void);
264
265    // Temporary while we transition from string to integer
266    static QString GetRecgroupString(uint recGroupID);
267    static uint GetRecgroupID(const QString &recGroup);
268
269    // File specific metdata
270    void LoadRecordingFile();
271    RecordingFile *GetRecordingFile() const { return m_recordingFile; }
272    void SaveFilesize(uint64_t fsize) override; // ProgramInfo
273    void SetFilesize( uint64_t fsize ) override; // ProgramInfo
274    uint64_t GetFilesize(void) const override; // ProgramInfo
275
276    RecStatus::Type m_oldrecstatus      {RecStatus::Unknown};
277    RecStatus::Type m_savedrecstatus    {RecStatus::Unknown};
278    bool            m_future            {false};
279    int             m_schedOrder        {0};
280    uint            m_mplexId           {0}; // Only valid within the scheduler
281    uint            m_sgroupId          {0}; // Only valid within the scheduler
282    QDateTime       m_desiredRecStartTs;
283    QDateTime       m_desiredRecEndTs;
284
285  private:
286    mutable class RecordingRule *m_record        {nullptr};
287    RecordingFile               *m_recordingFile {nullptr};
288
289  protected:
290    static bool InsertProgram(RecordingInfo *pg,
291                              const RecordingRule *rule);
292
293    static QString s_unknownTitle;
294};
295
296Q_DECLARE_METATYPE(RecordingInfo*)
297Q_DECLARE_METATYPE(RecordingInfo)
298
299#endif // RECORDING_INFO_H
300
301/* vim: set expandtab tabstop=4 shiftwidth=4: */
Note: See TracBrowser for help on using the repository browser.