aboutsummaryrefslogtreecommitdiff
path: root/common/ptr.h
diff options
context:
space:
mode:
authorBastien Bouclet2018-01-13 17:22:17 +0100
committerGitHub2018-01-13 17:22:17 +0100
commit45f1fd0e8e4fac90a76ec18c891933eba803922a (patch)
tree6022fa29ca10784dd6dff2ec768caf1a8c00acbb /common/ptr.h
parent07f2b34d2682d0b0f64c2d2d2543769d9b263924 (diff)
parent3b8ffa0812184fda821ba3eeeec1bdc2b9d353bc (diff)
downloadscummvm-rg350-45f1fd0e8e4fac90a76ec18c891933eba803922a.tar.gz
scummvm-rg350-45f1fd0e8e4fac90a76ec18c891933eba803922a.tar.bz2
scummvm-rg350-45f1fd0e8e4fac90a76ec18c891933eba803922a.zip
Merge pull request #1097 from bgK/vkeybd-data-path
VKEYBD: Fallback to SearchMan when loading keyboard packs
Diffstat (limited to 'common/ptr.h')
-rw-r--r--common/ptr.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/common/ptr.h b/common/ptr.h
index f592beb005..f3b2f3cbfa 100644
--- a/common/ptr.h
+++ b/common/ptr.h
@@ -302,6 +302,22 @@ public:
bool operator_bool() const { return _pointer != nullptr; }
/**
+ * Resets the pointer with the new value. Old object will be destroyed
+ */
+ void reset(PointerType o, DisposeAfterUse::Flag dispose) {
+ if (_dispose) D()(_pointer);
+ _pointer = o;
+ _dispose = dispose;
+ }
+
+ /**
+ * Clears the pointer. Old object will be destroyed
+ */
+ void reset() {
+ reset(nullptr, DisposeAfterUse::NO);
+ }
+
+ /**
* Returns the plain pointer value.
*
* @return the pointer the DisposablePtr manages