summaryrefslogtreecommitdiffstats
path: root/kresources/tvanytime/service.h
blob: 5c2fb1af73efc0f762bc85a98cebb935cce3604d (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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
/***************************************************************************
 *   Copyright (C) 2005 by Will Stephenson   *
 *   wstephenson@kde.org   *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   51 Franklin Street, Fifth Floor, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/

#ifndef SERVICE_H
#define SERVICE_H

#include <qdatetime.h>
#include <qdom.h>
#include <qmap.h>
#include <qregexp.h>
#include <qstring.h>
#include <qstringlist.h>
#include <kurl.h>


class ProgramInformation {
  public:
    ProgramInformation() {}
    ProgramInformation( const QString & title, const QString &synopsis );
    virtual ~ProgramInformation() {}

    QString id() const { return mId; }
    QString title() const { return mTitle; }
    QString synopsis() const { return mSynopsis; }
    QStringList genres() const { return mGenres; }

    void setId ( const QString & id ) { mId = id; }
    void setGenres( const QStringList & genres ) { mGenres = genres; }
    bool loadXML( const QDomElement & );
    bool loadAttribute( const QDomElement& element );

  private:
    QString mId;
    QString mTitle;
    QString mSynopsis;
    QStringList mGenres;
};

typedef QMap< QString, ProgramInformation > ProgramInformationMap;

class ScheduleEvent {
  public:
    ScheduleEvent() {}
    virtual ~ScheduleEvent() {}
    
    QString crid() const { return mCrid; }
    QDateTime startTime() const { return mStartTime; }
    uint duration() const { return mDuration; }
    QString programUrl() const { return mUrl; }

    bool loadXML( const QDomElement & );
    bool loadAttribute( const QDomElement& element );
    
  private:
    QString mCrid;
    QString mUrl;
    QDateTime mStartTime;
    uint mDuration;

    static QRegExp sRegExp;
};

class Service {
  public:
    Service();
    Service( bool active, const QString & name, const QString & owner, const KURL & serviceUrl, const KURL & logo, const QStringList & genres );
    virtual ~Service() {}
  
    void setId( const QString & id ) { mId = id; }
    void setActive( bool active );
    void setName( const QString& name );
    void setProgramInformation( const ProgramInformationMap & map );

    QString id() const { return mId; }
    bool active() const;
    QString name() const;
    ProgramInformationMap programmeInformation() const;

    bool loadXML( const QDomElement & );
    bool loadDescription( const QDomElement & );
    bool loadAttribute( const QDomElement& element );

  private:
    QString mId;
    bool mActive;
    QString mName;
    QString mOwner;
    KURL mServiceUrl;
    KURL mLogo;
    QStringList mGenres;
    ProgramInformationMap mProgInfo;
};

#endif