diff options
author | George Hazan <george.hazan@gmail.com> | 2012-05-17 15:50:17 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-05-17 15:50:17 +0000 |
commit | a338e594273bda039eec784ecb461395f23bd56e (patch) | |
tree | 672ca0530c45df8af7289d6d3d7e287342a77376 /plugins/utils/mir_scope.h | |
parent | 11771cfdeade7fbb283a208138c6561ba779779c (diff) |
- missing plugins added
- fixes for the status plugins' projects
- other VS2010 projects cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@13 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/utils/mir_scope.h')
-rw-r--r-- | plugins/utils/mir_scope.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/plugins/utils/mir_scope.h b/plugins/utils/mir_scope.h new file mode 100644 index 0000000000..2f54044d83 --- /dev/null +++ b/plugins/utils/mir_scope.h @@ -0,0 +1,35 @@ +#ifndef __PTR_H__
+# define __PTR_H__
+
+
+template<class T>
+class scope
+{
+public:
+ scope(T t) : p(t) {}
+ ~scope() { mir_free(); }
+
+ void free()
+ {
+ if (p != NULL)
+ mir_free(p);
+ p = NULL;
+ }
+
+// T operator->() const { return p; }
+ operator T() const { return p; }
+
+ T detach()
+ {
+ T ret = p;
+ p = NULL;
+ return ret;
+ }
+
+private:
+ T p;
+};
+
+
+
+#endif // __PTR_H__
|