Merge branch 'bug_411_timeshift_disable_without_live'
[vuplus_dvbapp] / lib / service / event.h
1 #ifndef __lib_service_event_h
2 #define __lib_service_event_h
3
4 #ifndef SWIG
5 #include <time.h>
6 #include <list>
7 #include <string>
8 class Event;
9 #endif
10
11 #include <lib/base/object.h>
12 #include <lib/service/iservice.h>
13
14 SWIG_IGNORE(eComponentData);
15 struct eComponentData
16 {
17         friend class eServiceEvent;
18         DECLARE_REF(eComponentData);
19         uint8_t m_streamContent;
20         uint8_t m_componentType;
21         uint8_t m_componentTag;
22         std::string m_iso639LanguageCode;
23         std::string m_text;
24 public:
25         eComponentData(const eComponentData& d) { *this = d; } 
26         eComponentData() { m_streamContent = m_componentType = m_componentTag = 0; }
27         int getStreamContent(void) const { return m_streamContent; }
28         int getComponentType(void) const { return m_componentType; }
29         int getComponentTag(void) const { return m_componentTag; }
30         std::string getIso639LanguageCode(void) const { return m_iso639LanguageCode; }
31         std::string getText(void) const { return m_text; }
32 };
33 SWIG_TEMPLATE_TYPEDEF(ePtr<eComponentData>, eComponentDataPtr);
34
35 SWIG_ALLOW_OUTPUT_SIMPLE(eServiceReference);  // needed for SWIG_OUTPUT in eServiceEvent::getLinkageService
36
37 SWIG_IGNORE(eServiceEvent);
38 class eServiceEvent: public iObject
39 {
40         DECLARE_REF(eServiceEvent);
41         bool loadLanguage(Event *event, std::string lang, int tsidonid);
42         std::list<eComponentData> m_component_data;
43         std::list<eServiceReference> m_linkage_services;
44         time_t m_begin;
45         int m_duration;
46         int m_event_id;
47         std::string m_event_name, m_short_description, m_extended_description;
48         static std::string m_language;
49         // .. additional info
50 public:
51 #ifndef SWIG
52         RESULT parseFrom(Event *evt, int tsidonid=0);
53         RESULT parseFrom(const std::string filename, int tsidonid=0);
54         static void setEPGLanguage( const std::string language );
55 #endif
56         time_t getBeginTime() const { return m_begin; }
57         int getDuration() const { return m_duration; }
58         int getEventId() const { return m_event_id; }
59         std::string getEventName() const { return m_event_name; }
60         std::string getShortDescription() const { return m_short_description; }
61         std::string getExtendedDescription() const { return m_extended_description; }
62         std::string getBeginTimeString() const;
63         SWIG_VOID(RESULT) getComponentData(ePtr<eComponentData> &SWIG_OUTPUT, int tagnum) const;
64         PyObject *getComponentData() const;
65         int getNumOfLinkageServices() const { return m_linkage_services.size(); }
66         SWIG_VOID(RESULT) getLinkageService(eServiceReference &SWIG_OUTPUT, eServiceReference &parent, int num) const;
67 };
68 SWIG_TEMPLATE_TYPEDEF(ePtr<eServiceEvent>, eServiceEvent);
69 SWIG_EXTEND(ePtr<eServiceEvent>,
70         static void setEPGLanguage( const std::string language )
71         {
72                 extern void setServiceEventLanguage(const std::string language);
73                 setServiceEventLanguage(language);
74         }
75 );
76
77 #ifndef SWIG
78 SWIG_IGNORE(eDebugClass);
79 class eDebugClass: public iObject
80 {
81         DECLARE_REF(eDebugClass);
82 public:
83         int x;
84         static void getDebug(ePtr<eDebugClass> &ptr, int x) { ptr = new eDebugClass(x); }
85         eDebugClass(int i) { printf("build debug class %d\n", i); x = i; }
86         ~eDebugClass() { printf("remove debug class %d\n", x); }
87 };
88 SWIG_TEMPLATE_TYPEDEF(ePtr<eDebugClass>, eDebugClassPtr);
89 #endif
90
91 #endif