summaryrefslogtreecommitdiff
path: root/src/include/download-provider-event.h
diff options
context:
space:
mode:
authorKim Kibum <kb0929.kim@samsung.com>2012-06-08 14:53:59 +0900
committerKim Kibum <kb0929.kim@samsung.com>2012-06-08 14:53:59 +0900
commitbed963b6c4431be5d3ce04131683172cc43675ea (patch)
tree9c7c66c8eebfe59978e8295758a1cf38ecf659d1 /src/include/download-provider-event.h
parent6d4c001b680c399f750cd71eabc18d5bd39ae1ee (diff)
downloaddownload-provider-bed963b6c4431be5d3ce04131683172cc43675ea.tar.gz
download-provider-bed963b6c4431be5d3ce04131683172cc43675ea.tar.bz2
download-provider-bed963b6c4431be5d3ce04131683172cc43675ea.zip
apply FSL(Flora Software License)
Diffstat (limited to 'src/include/download-provider-event.h')
-rw-r--r--src/include/download-provider-event.h72
1 files changed, 72 insertions, 0 deletions
diff --git a/src/include/download-provider-event.h b/src/include/download-provider-event.h
new file mode 100644
index 0000000..e9378a6
--- /dev/null
+++ b/src/include/download-provider-event.h
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.tizenopensource.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file download-provider-event.h
+ * @author Jungki Kwak (jungki.kwak@samsung.com)
+ * @brief Download event class
+ */
+#ifndef DOWNLOAD_PROVIDER_EVENT_H
+#define DOWNLOAD_PROVIDER_EVENT_H
+
+#include <vector>
+/* For debug */
+#include <string>
+
+using namespace std;
+
+class Observer;
+class Subject
+{
+public:
+ Subject(){}
+ ~Subject(){}
+
+ void attach(Observer *);
+ void detach(Observer *);
+ void notify(void);
+
+private:
+ vector<Observer*> _observers;
+};
+
+typedef void (*updateFunction)(void *data);
+
+class Observer
+{
+public:
+ /* For debug */
+ Observer(updateFunction uf, void *data, const char *name);
+ //Observer(updateFunction uf, void *data);
+ ~Observer(){}
+
+ void update(Subject *s);
+ void set(updateFunction uf, void *data);
+ void clear(void);
+ void *getUserData(void) { return m_userData; }
+ /* For debug */
+ string name(void) { return observerName; }
+
+private:
+ void call(void);
+
+ updateFunction m_updateFunction;
+ void *m_userData;
+ /* For debug */
+ string observerName;
+};
+
+#endif /* DOWNLOAD_PROVIDER_EVENT_H */