summaryrefslogtreecommitdiffstats
path: root/tderesources/tvanytime/service.h
blob: 78570fe1f4dacedf599fe491d020b77a5d213bc0 (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   *
 *   [email protected]   *
 *                                                                         *
 *   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  02110-1301, USA.             *
 ***************************************************************************/

#ifndef SERVICE_H
#define SERVICE_H

#include <tqdatetime.h>
#include <tqdom.h>
#include <tqmap.h>
#include <tqregexp.h>
#include <tqstring.h>
#include <tqstringlist.h>
#include <kurl.h>


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

    TQString id() const { return mId; }
    TQString title() const { return mTitle; }
    TQString synopsis() const { return mSynopsis; }
    TQStringList genres() const { return mGenres; }

    void setId ( const TQString & id ) { mId = id; }
    void setGenres( const TQStringList & genres ) { mGenres = genres; }
    bool loadXML( const TQDomElement & );
    bool loadAttribute( const TQDomElement& element );

  private:
    TQString mId;
    TQString mTitle;
    TQString mSynopsis;
    TQStringList mGenres;
};

typedef TQMap< TQString, ProgramInformation > ProgramInformationMap;

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

    bool loadXML( const TQDomElement & );
    bool loadAttribute( const TQDomElement& element );
    
  private:
    TQString mCrid;
    TQString mUrl;
    TQDateTime mStartTime;
    uint mDuration;

    static TQRegExp sRegExp;
};

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

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

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

  private:
    TQString mId;
    bool mActive;
    TQString mName;
    TQString mOwner;
    KURL mServiceUrl;
    KURL mLogo;
    TQStringList mGenres;
    ProgramInformationMap mProgInfo;
};

#endif