The download UI application is added.
[apps/web/download-manager.git] / src / include / download-manager-event.h
1 /*
2  * Copyright 2012  Samsung Electronics Co., Ltd
3  *
4  * Licensed under the Flora License, Version 1.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *    http://www.tizenopensource.org/license
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 /**
18  * @file        download-manager-event.h
19  * @author      Jungki Kwak (jungki.kwak@samsung.com)
20  * @brief       Download event class
21  */
22 #ifndef DOWNLOAD_MANAGER_EVENT_H
23 #define DOWNLOAD_MANAGER_EVENT_H
24
25 #include <vector>
26 /* For debug */
27 #include <string>
28
29 using namespace std;
30
31 class Observer;
32 class Subject
33 {
34 public:
35         Subject(){}
36         ~Subject(){}
37
38         void attach(Observer *);
39         void detach(Observer *);
40         void notify(void);
41
42 private:
43         vector<Observer*> _observers;
44 };
45
46 typedef void (*updateFunction)(void *data);
47
48 class Observer
49 {
50 public:
51         /* For debug */
52         Observer(updateFunction uf, void *data, const char *name);
53         //Observer(updateFunction uf, void *data);
54         ~Observer(){}
55
56         void update(Subject *s);
57         void set(updateFunction uf, void *data);
58         void clear(void);
59         void *getUserData(void) { return m_userData; }
60         /* For debug */
61         string name(void) { return observerName; }
62
63 private:
64         void call(void);
65
66         updateFunction m_updateFunction;
67         void *m_userData;
68         /* For debug */
69         string observerName;
70 };
71
72 #endif /* DOWNLOAD_MANAGER_EVENT_H */