summaryrefslogtreecommitdiff
path: root/include/base.h
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-10-19 20:12:22 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-10-19 20:12:22 +0000
commitbe10eab6ce68d4f06cc7b14bc2fca35e005ce6b5 (patch)
treec22583006f80a8cb86bb15489c196832476cd28a /include/base.h
parentaa7cc18468f4b16bf79cd1788cad0cbf0d926817 (diff)
Maintain refcount of Module objects to complain about leaked pointers
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11925 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'include/base.h')
-rw-r--r--include/base.h29
1 files changed, 19 insertions, 10 deletions
diff --git a/include/base.h b/include/base.h
index 13efdd2dd..0de37e781 100644
--- a/include/base.h
+++ b/include/base.h
@@ -179,21 +179,30 @@ class CoreExport CoreException : public std::exception
}
};
+class Module;
+
class CoreExport ModuleException : public CoreException
{
public:
- /** Default constructor, just uses the error mesage 'Module threw an exception'.
- */
- ModuleException() : CoreException("Module threw an exception", "A Module") {}
-
/** This constructor can be used to specify an error message before throwing.
*/
- ModuleException(const std::string &message) : CoreException(message, "A Module") {}
- /** This destructor solves world hunger, cancels the world debt, and causes the world to end.
- * Actually no, it does nothing. Never mind.
- * @throws Nothing!
- */
- virtual ~ModuleException() throw() {};
+ ModuleException(const std::string &message, Module* me = NULL);
+};
+
+class CoreExport ModuleRef : public reference_base
+{
+ Module* const value;
+ public:
+ ModuleRef(Module* v);
+ ~ModuleRef();
+ inline operator Module*() const { return value; }
+ inline Module* operator->() const { return value; }
+ inline Module& operator*() const { return *value; }
+ private:
+ ModuleRef(const ModuleRef&);
+ void operator=(const ModuleRef&);
+ void* operator new(size_t);
+ void operator delete(void*);
};
#endif