summaryrefslogtreecommitdiff
path: root/plugins/Dropbox/src/singleton.h
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2014-02-19 19:07:45 +0000
committerAlexander Lantsev <aunsane@gmail.com>2014-02-19 19:07:45 +0000
commitfc46c19a61d26fb610d173bb8fc5420eea966caa (patch)
tree0d388af6d8a53eb4ef56dcdb96fe44d56bccb63d /plugins/Dropbox/src/singleton.h
parent3ced66e7eac9a8a0867073553db2b2bd74729b09 (diff)
Dropbox:
- global object replaced by singleton - added ability to upload folders git-svn-id: http://svn.miranda-ng.org/main/trunk@8183 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Dropbox/src/singleton.h')
-rw-r--r--plugins/Dropbox/src/singleton.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/plugins/Dropbox/src/singleton.h b/plugins/Dropbox/src/singleton.h
new file mode 100644
index 0000000000..432e2ed7f0
--- /dev/null
+++ b/plugins/Dropbox/src/singleton.h
@@ -0,0 +1,29 @@
+#ifndef _SINGLETON_H_
+#define _SINGLETON_H_
+
+template<typename T>
+class Singleton
+{
+public:
+ static T *GetInstance()
+ {
+ if (!instance)
+ instance = new T;
+ return instance;
+ }
+
+private:
+ static T* instance;
+
+ Singleton();
+ Singleton(Singleton const&);
+
+ ~Singleton();
+
+ Singleton &operator=(Singleton const&);
+};
+
+template <typename T> T *Singleton<T>::instance = 0;
+
+
+#endif //_SINGLETON_H_ \ No newline at end of file