add iMutableServiceList
authorFelix Domke <tmbinc@elitedvb.net>
Sun, 13 Nov 2005 15:30:08 +0000 (15:30 +0000)
committerFelix Domke <tmbinc@elitedvb.net>
Sun, 13 Nov 2005 15:30:08 +0000 (15:30 +0000)
lib/service/iservice.h
lib/service/servicedvb.cpp
lib/service/servicedvb.h
lib/service/servicefs.cpp
lib/service/servicefs.h

index 15631fd..5f86189 100644 (file)
@@ -249,6 +249,20 @@ TEMPLATE_TYPEDEF(ePtr<iRecordableService>, iRecordableServicePtr);
 
 // TEMPLATE_TYPEDEF(std::list<eServiceReference>, eServiceReferenceList);
 
 
 // TEMPLATE_TYPEDEF(std::list<eServiceReference>, eServiceReferenceList);
 
+class iMutableServiceList: public iObject
+{
+public:
+               /* adds a service to a list */
+       virtual RESULT addService(eServiceReference &ref)=0;
+               /* removes a service from a list */
+       virtual RESULT removeService(eServiceReference &ref)=0;
+               /* moves a service in a list, only if list suppports a specific sort method. */
+               /* pos is the new, absolute position from 0..size-1 */
+       virtual RESULT moveService(eServiceReference &ref, int pos)=0;
+};
+
+TEMPLATE_TYPEDEF(ePtr<iMutableServiceList>, iMutableServiceListPtr);
+
 class iListableService: public iObject
 {
 public:
 class iListableService: public iObject
 {
 public:
@@ -264,6 +278,8 @@ public:
                   (as well as a future "active" extension) won't be possible.
                */
        virtual int compareLessEqual(const eServiceReference &, const eServiceReference &)=0;
                   (as well as a future "active" extension) won't be possible.
                */
        virtual int compareLessEqual(const eServiceReference &, const eServiceReference &)=0;
+       
+       virtual SWIG_VOID(RESULT) startEdit(ePtr<iMutableServiceList> &SWIG_OUTPUT)=0;
 };
 
 TEMPLATE_TYPEDEF(ePtr<iListableService>, iListableServicePtr);
 };
 
 TEMPLATE_TYPEDEF(ePtr<iListableService>, iListableServicePtr);
index 76b0089..94833f4 100644 (file)
@@ -270,6 +270,50 @@ int eDVBServiceList::compareLessEqual(const eServiceReference &a, const eService
        return m_query->compareLessEqual((const eServiceReferenceDVB&)a, (const eServiceReferenceDVB&)b);
 }
 
        return m_query->compareLessEqual((const eServiceReferenceDVB&)a, (const eServiceReferenceDVB&)b);
 }
 
+RESULT eDVBServiceList::startEdit(ePtr<iMutableServiceList> &res)
+{
+       if (m_parent.flags & eServiceReference::flagDirectory) // bouquet
+       {
+               ePtr<iDVBChannelList> db;
+               ePtr<eDVBResourceManager> resm;
+
+               if (eDVBResourceManager::getInstance(resm) || resm->getChannelList(db))
+                       return -1;
+
+                       // FIXME!
+               if (db->getBouquet(m_parent, (const eBouquet*&)m_bouquet) != 0)
+                       return -1;
+               
+               res = this;
+               
+               return 0;
+       }
+       res = 0;
+       return -1;
+}
+
+RESULT eDVBServiceList::addService(eServiceReference &ref)
+{
+       ASSERT(m_bouquet);
+//     return m_bouquet->addService(ref);
+       return -1;
+}
+
+RESULT eDVBServiceList::removeService(eServiceReference &ref)
+{
+       ASSERT(m_bouquet);
+//     return m_bouquet->removeService(ref);
+       return -1;
+}
+
+RESULT eDVBServiceList::moveService(eServiceReference &ref, int pos)
+{
+       ASSERT(m_bouquet);
+       
+//     return m_bouquet->moveService(ref, pos);
+       return -1;
+}
+
 RESULT eServiceFactoryDVB::play(const eServiceReference &ref, ePtr<iPlayableService> &ptr)
 {
        ePtr<eDVBService> service;
 RESULT eServiceFactoryDVB::play(const eServiceReference &ref, ePtr<iPlayableService> &ptr)
 {
        ePtr<eDVBService> service;
index 9ebd277..165703d 100644 (file)
@@ -25,7 +25,9 @@ private:
        RESULT lookupService(ePtr<eDVBService> &ptr, const eServiceReference &ref);
 };
 
        RESULT lookupService(ePtr<eDVBService> &ptr, const eServiceReference &ref);
 };
 
-class eDVBServiceList: public iListableService
+class eBouquet;
+
+class eDVBServiceList: public iListableService, public iMutableServiceList
 {
 DECLARE_REF(eDVBServiceList);
 public:
 {
 DECLARE_REF(eDVBServiceList);
 public:
@@ -33,12 +35,20 @@ public:
        RESULT getContent(std::list<eServiceReference> &list);
        RESULT getNext(eServiceReference &ptr);
        int compareLessEqual(const eServiceReference &a, const eServiceReference &b);
        RESULT getContent(std::list<eServiceReference> &list);
        RESULT getNext(eServiceReference &ptr);
        int compareLessEqual(const eServiceReference &a, const eServiceReference &b);
+       
+       RESULT startEdit(ePtr<iMutableServiceList> &);
+       RESULT addService(eServiceReference &ref);
+       RESULT removeService(eServiceReference &ref);
+       RESULT moveService(eServiceReference &ref, int pos);
 private:
        RESULT startQuery();
        eServiceReference m_parent;
        friend class eServiceFactoryDVB;
        eDVBServiceList(const eServiceReference &parent);
        ePtr<iDVBChannelListQuery> m_query;
 private:
        RESULT startQuery();
        eServiceReference m_parent;
        friend class eServiceFactoryDVB;
        eDVBServiceList(const eServiceReference &parent);
        ePtr<iDVBChannelListQuery> m_query;
+       
+               /* for editing purposes. WARNING: lifetime issue! */
+       eBouquet *m_bouquet;
 };
 
 class eDVBServicePlay: public iPlayableService, public iPauseableService, public iSeekableService, public Object, public iServiceInformation
 };
 
 class eDVBServicePlay: public iPlayableService, public iPauseableService, public iSeekableService, public Object, public iServiceInformation
index cf3f31f..1afdd16 100644 (file)
@@ -176,4 +176,10 @@ int eServiceFS::compareLessEqual(const eServiceReference &a, const eServiceRefer
                return a.path < b.path;
 }
 
                return a.path < b.path;
 }
 
+RESULT eServiceFS::startEdit(ePtr<iMutableServiceList> &res)
+{
+       res = 0;
+       return -1;
+}
+
 eAutoInitPtr<eServiceFactoryFS> init_eServiceFactoryFS(eAutoInitNumbers::service+1, "eServiceFactoryFS");
 eAutoInitPtr<eServiceFactoryFS> init_eServiceFactoryFS(eAutoInitNumbers::service+1, "eServiceFactoryFS");
index 3400fb8..46e8b89 100644 (file)
@@ -37,6 +37,7 @@ public:
        RESULT getContent(std::list<eServiceReference> &list);
        RESULT getNext(eServiceReference &ptr);
        int compareLessEqual(const eServiceReference &, const eServiceReference &);
        RESULT getContent(std::list<eServiceReference> &list);
        RESULT getNext(eServiceReference &ptr);
        int compareLessEqual(const eServiceReference &, const eServiceReference &);
+       RESULT startEdit(ePtr<iMutableServiceList> &);
 };
 
 #endif
 };
 
 #endif