summaryrefslogtreecommitdiff
path: root/plugins/Dropbox/src/singleton.h
diff options
context:
space:
mode:
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