dvbd / recording.h @ bfdb7446
History | View | Annotate | Download (2.18 KB)
1 |
// -*- c++ -*-
|
---|---|
2 |
/*
|
3 |
Copyright 2003 John Knottenbelt
|
4 |
|
5 |
This program is free software; you can redistribute it and/or modify
|
6 |
it under the terms of the GNU General Public License as published by
|
7 |
the Free Software Foundation; either version 2 of the License, or
|
8 |
(at your option) any later version.
|
9 |
|
10 |
This program is distributed in the hope that it will be useful,
|
11 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
GNU General Public License for more details.
|
14 |
|
15 |
You should have received a copy of the GNU General Public License
|
16 |
along with this program; if not, write to the Free Software
|
17 |
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
|
18 |
*/
|
19 |
|
20 |
#if !defined __RECORDING_H
|
21 |
|
22 |
#include "stringrep.h" |
23 |
#include <string> |
24 |
#include <ctime> |
25 |
#include <iostream> |
26 |
|
27 |
/** Represents a scheduled recording */
|
28 |
|
29 |
class Recording : public StringRep { |
30 |
public:
|
31 |
Recording() |
32 |
: job(-1), priority(-1), duration(0), uid(0) |
33 |
{ |
34 |
} |
35 |
|
36 |
Recording(const std::string &type,
|
37 |
const std::string &channel,
|
38 |
int priority,
|
39 |
time_t startTime, |
40 |
unsigned duration,
|
41 |
const std::string &path,
|
42 |
uid_t uid) |
43 |
: job(-1),
|
44 |
type(type), channel(channel), |
45 |
priority(priority), startTime(startTime), |
46 |
duration(duration), path(path), |
47 |
uid(uid) |
48 |
{ |
49 |
} |
50 |
|
51 |
~Recording(); |
52 |
|
53 |
void setJob(int job) { |
54 |
this->job = job; |
55 |
} |
56 |
|
57 |
int getJob() const { |
58 |
return job;
|
59 |
} |
60 |
|
61 |
std::string getType() const {
|
62 |
return type;
|
63 |
} |
64 |
|
65 |
std::string getChannel() const {
|
66 |
return channel;
|
67 |
} |
68 |
|
69 |
int getPriority() const { |
70 |
return priority;
|
71 |
} |
72 |
|
73 |
time_t getStartTime() const {
|
74 |
return startTime;
|
75 |
} |
76 |
|
77 |
unsigned getDuration() const { |
78 |
return duration;
|
79 |
} |
80 |
|
81 |
time_t getStopTime() const {
|
82 |
return startTime + duration;
|
83 |
} |
84 |
|
85 |
std::string getPath() const {
|
86 |
return path;
|
87 |
} |
88 |
|
89 |
uid_t getUid() const {
|
90 |
return uid;
|
91 |
} |
92 |
|
93 |
friend std::istream &operator >> (std::istream &i, Recording &r); |
94 |
|
95 |
protected:
|
96 |
|
97 |
virtual std::ostream& printOn(std::ostream &) const;
|
98 |
|
99 |
private:
|
100 |
int job;
|
101 |
std::string type, channel; |
102 |
int priority;
|
103 |
time_t startTime; |
104 |
unsigned duration;
|
105 |
std::string path; |
106 |
int uid;
|
107 |
}; |
108 |
|
109 |
#endif // __RECORDING_H |