fixes for powerpc, thanks to pieter
[enigma2.git] / lib / dvb / db.h
index 5a67870d1d92493ed48ecd39ff149448b7befffb..430a5af0b48b692dd837458a43c2373886f28ad1 100644 (file)
@@ -1,29 +1,22 @@
 #ifndef __db_h
 #define __db_h
 
+#ifndef SWIG
+#include <lib/base/eptrlist.h>
 #include <lib/dvb/idvb.h>
 #include <set>
-
-class eDVBService: public iObject
-{
-       DECLARE_REF;
-public:
-       eDVBService();
-       std::string m_service_name;
-       std::string m_provider_name;
-       
-       int m_flags;
-       std::set<int> m_ca;
-       std::map<int,int> m_cache;
-       virtual ~eDVBService();
-};
-
-class ServiceDescriptionTable;
+class ServiceDescriptionSection;
+#endif
 
 class eDVBDB: public iDVBChannelList
 {
-DECLARE_REF;
-private:
+       static eDVBDB *instance;
+DECLARE_REF(eDVBDB);
+       friend class eDVBDBQuery;
+       friend class eDVBDBBouquetQuery;
+       friend class eDVBDBSatellitesQuery;
+       friend class eDVBDBProvidersQuery;
+
        struct channel
        {
                ePtr<iDVBFrontendParameters> m_frontendParameters;
@@ -32,10 +25,23 @@ private:
        std::map<eDVBChannelID, channel> m_channels;
        
        std::map<eServiceReferenceDVB, ePtr<eDVBService> > m_services;
-public:
-       eDVBDB();
-       virtual ~eDVBDB();
        
+       std::map<std::string, eBouquet> m_bouquets;
+#ifdef SWIG
+       eDVBDB();
+       ~eDVBDB();
+#endif
+public:
+// iDVBChannelList
+       RESULT removeFlags(unsigned int flagmask, int dvb_namespace=-1, int tsid=-1, int onid=-1, unsigned int orb_pos=0xFFFFFFFF);
+       RESULT removeServices(int dvb_namespace=-1, int tsid=-1, int onid=-1, unsigned int orb_pos=0xFFFFFFFF);
+       RESULT removeService(const eServiceReference &service);
+       RESULT addFlag(const eServiceReference &service, unsigned int flagmask);
+       RESULT removeFlag(const eServiceReference &service, unsigned int flagmask);
+#ifndef SWIG
+       RESULT removeFlags(unsigned int flagmask, eDVBChannelID chid, unsigned int orb_pos);
+       RESULT removeServices(eDVBChannelID chid, unsigned int orb_pos);
+
        RESULT addChannelToList(const eDVBChannelID &id, iDVBFrontendParameters *feparm);
        RESULT removeChannel(const eDVBChannelID &id);
 
@@ -43,6 +49,75 @@ public:
        
        RESULT addService(const eServiceReferenceDVB &service, eDVBService *service);
        RESULT getService(const eServiceReferenceDVB &reference, ePtr<eDVBService> &service);
+       RESULT flush();
+
+       RESULT startQuery(ePtr<iDVBChannelListQuery> &query, eDVBChannelQuery *query, const eServiceReference &source);
+
+       RESULT getBouquet(const eServiceReference &ref, eBouquet* &bouquet);
+//////
+       void saveServicelist();
+       void loadBouquet(const char *path);
+       eServiceReference searchReference(int tsid, int onid, int sid);
+       eDVBDB();
+       virtual ~eDVBDB();
+#endif
+       static eDVBDB *getInstance() { return instance; }
+       void reloadServicelist();
+       void reloadBouquets();
+};
+
+#ifndef SWIG
+       // we have to add a possibility to invalidate here.
+class eDVBDBQueryBase: public iDVBChannelListQuery
+{
+DECLARE_REF(eDVBDBQueryBase);
+protected:
+       ePtr<eDVBDB> m_db;
+       ePtr<eDVBChannelQuery> m_query;
+       eServiceReference m_source;
+public:
+       eDVBDBQueryBase(eDVBDB *db, const eServiceReference &source, eDVBChannelQuery *query);
+       virtual int compareLessEqual(const eServiceReferenceDVB &a, const eServiceReferenceDVB &b);
+};
+
+class eDVBDBQuery: public eDVBDBQueryBase
+{
+       std::map<eServiceReferenceDVB, ePtr<eDVBService> >::iterator m_cursor;
+public:
+       eDVBDBQuery(eDVBDB *db, const eServiceReference &source, eDVBChannelQuery *query);
+       RESULT getNextResult(eServiceReferenceDVB &ref);
+};
+
+class eDVBDBBouquetQuery: public eDVBDBQueryBase
+{
+       std::list<eServiceReference>::iterator m_cursor;
+public:
+       eDVBDBBouquetQuery(eDVBDB *db, const eServiceReference &source, eDVBChannelQuery *query);
+       RESULT getNextResult(eServiceReferenceDVB &ref);
+};
+
+class eDVBDBListQuery: public eDVBDBQueryBase
+{
+protected:
+       std::list<eServiceReferenceDVB> m_list;
+       std::list<eServiceReferenceDVB>::iterator m_cursor;
+public:
+       eDVBDBListQuery(eDVBDB *db, const eServiceReference &source, eDVBChannelQuery *query);
+       RESULT getNextResult(eServiceReferenceDVB &ref);
+       int compareLessEqual(const eServiceReferenceDVB &a, const eServiceReferenceDVB &b);
+};
+
+class eDVBDBSatellitesQuery: public eDVBDBListQuery
+{
+public:
+       eDVBDBSatellitesQuery(eDVBDB *db, const eServiceReference &source, eDVBChannelQuery *query);
+};
+
+class eDVBDBProvidersQuery: public eDVBDBListQuery
+{
+public:
+       eDVBDBProvidersQuery(eDVBDB *db, const eServiceReference &source, eDVBChannelQuery *query);
 };
+#endif // SWIG
 
 #endif