diff options
author | Adam <Adam@anope.org> | 2012-11-22 00:50:33 -0500 |
---|---|---|
committer | Adam <Adam@anope.org> | 2012-11-22 00:50:33 -0500 |
commit | d33a0f75a5c0c584fbb7cc0076da36d494f39494 (patch) | |
tree | 7b2274cc833c793c0f5595660cbd4d715de52ffd /include/extensible.h | |
parent | 368d469631763e9c8bf399980d0ac7c5b5664d39 (diff) |
Pretty large coding style cleanup, in source doc
cleanup, and allow protocol mods to depend on each
other
Diffstat (limited to 'include/extensible.h')
-rw-r--r-- | include/extensible.h | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/include/extensible.h b/include/extensible.h index 6db4cf112..493dc20cf 100644 --- a/include/extensible.h +++ b/include/extensible.h @@ -1,7 +1,10 @@ /* - * Copyright (C) 2008-2012 Anope Team <team@anope.org> + * + * (C) 2003-2012 Anope Team + * Contact us at team@anope.org * * Please read COPYING and README for further details. + * */ #ifndef EXTENSIBLE_H @@ -9,19 +12,28 @@ #include "anope.h" +/* All items added to Extensible must inherit from this. + */ class CoreExport ExtensibleItem { public: - ExtensibleItem(); - virtual ~ExtensibleItem(); - virtual void OnDelete(); + virtual ~ExtensibleItem() { } + + /* Called when this ExtensibleItem is being deleted. This should + * clean up things (eg, delete this;) if necessary. + */ + virtual void OnDelete() { delete this; } }; +/** Common class used to Extensible::Extend non-pointers from, as it doesn't delete + * itself when removed. Eg, obj->Extend(key, new ExtensibleItemClass<Anope::string>(value)); + */ template<typename T> struct CoreExport ExtensibleItemClass : T, ExtensibleItem { ExtensibleItemClass(const T& t) : T(t) { } }; +/* Used to attach arbitrary objects to this object using unique keys */ class CoreExport Extensible { private: @@ -33,7 +45,7 @@ class CoreExport Extensible */ Extensible() { } - /** Default destructor, deletes all of the extensible items in this object + /** Destructor, deletes all of the extensible items in this object * then clears the map */ virtual ~Extensible() |