Merge branch 'bug_140_move_WirelessLan_and__NetworkWizard_to_Enigma2' into experimental
[enigma2.git] / lib / service / service.h
1 #ifndef __service_h
2 #define __service_h
3
4 #include <map>
5 #include <lib/base/object.h>
6 #include <lib/service/iservice.h>
7
8 class eServiceCenter;
9
10 #ifndef SWIG
11 typedef ePtr<eServiceCenter> eServiceCenterPtr;
12 #endif
13
14 class eServiceCenter: public iServiceHandler
15 {
16         DECLARE_REF(eServiceCenter);
17         std::map<int,ePtr<iServiceHandler> > handler;
18         std::map<int,std::list<std::string> > extensions;
19         static eServiceCenter *instance;
20 #ifdef SWIG
21         eServiceCenter();
22         ~eServiceCenter();
23 #endif
24 public:
25 #ifndef SWIG
26         eServiceCenter();
27         virtual ~eServiceCenter();
28
29         int getServiceTypeForExtension(const char *str);
30         int getServiceTypeForExtension(const std::string &str);
31
32                 // iServiceHandler
33         RESULT play(const eServiceReference &, ePtr<iPlayableService> &ptr);
34         RESULT record(const eServiceReference &, ePtr<iRecordableService> &ptr);
35         RESULT list(const eServiceReference &, ePtr<iListableService> &ptr);
36         RESULT info(const eServiceReference &, ePtr<iStaticServiceInformation> &ptr);
37         RESULT offlineOperations(const eServiceReference &, ePtr<iServiceOfflineOperations> &ptr);
38         
39                 // eServiceCenter
40         static RESULT getPrivInstance(ePtr<eServiceCenter> &ptr) { ptr = instance; return 0; }
41         RESULT addServiceFactory(int id, iServiceHandler *hnd, std::list<std::string> &extensions);
42         RESULT removeServiceFactory(int id);
43 #endif
44         static SWIG_VOID(RESULT) getInstance(ePtr<iServiceHandler> &SWIG_NAMED_OUTPUT(ptr)) { ptr = instance; return 0; }
45 };
46
47 #endif