summaryrefslogtreecommitdiff
path: root/Plugins/utils/mir_scope.h
diff options
context:
space:
mode:
authorpescuma <pescuma@c086bb3d-8645-0410-b8da-73a8550f86e7>2009-01-24 00:29:50 +0000
committerpescuma <pescuma@c086bb3d-8645-0410-b8da-73a8550f86e7>2009-01-24 00:29:50 +0000
commitbe94a568ef65120465b49f5c6db90cd4ec3c3eb2 (patch)
treefe7fc014fe1053e821860c53f78e4cabb95b9ac7 /Plugins/utils/mir_scope.h
parent52e0dac49837ca1123412fccd95fdb95873c8321 (diff)
utils: sync with BerliOS
git-svn-id: http://pescuma.googlecode.com/svn/trunk/Miranda@132 c086bb3d-8645-0410-b8da-73a8550f86e7
Diffstat (limited to 'Plugins/utils/mir_scope.h')
-rw-r--r--Plugins/utils/mir_scope.h12
1 files changed, 7 insertions, 5 deletions
diff --git a/Plugins/utils/mir_scope.h b/Plugins/utils/mir_scope.h
index a18bf55..31edde0 100644
--- a/Plugins/utils/mir_scope.h
+++ b/Plugins/utils/mir_scope.h
@@ -3,20 +3,22 @@
template<class T>
-class scope
+class mir_scope
{
public:
- scope(T t) : p(t) {}
- ~scope() { free(); }
+ mir_scope() : p(NULL) {}
+ mir_scope(T t) : p(t) {}
+ ~mir_scope() { release(); }
- void free()
+ void release()
{
if (p != NULL)
mir_free(p);
p = NULL;
}
-// T operator->() const { return p; }
+ T operator=(T t) { release(); p = t; return t; }
+ T operator->() const { return p; }
operator T() const { return p; }
T detach()