X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=include%2Fextensible.h;h=a9b3704056eb19c62c28bd94f1d5b2fe0b7631ef;hb=327bacd3687f307a5f8586856a94b16c9e4370bf;hp=0efb1db5f133ab7fe782db983da7f4a74c2cd396;hpb=703ba72071b970caaa7554b1e58a13def57694dc;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/include/extensible.h b/include/extensible.h index 0efb1db5f..a9b370405 100644 --- a/include/extensible.h +++ b/include/extensible.h @@ -1,6 +1,9 @@ /* * InspIRCd -- Internet Relay Chat Daemon * + * Copyright (C) 2013, 2017-2019 Sadie Powell + * Copyright (C) 2012, 2014-2015 Attila Molnar + * Copyright (C) 2012 Robby * Copyright (C) 2009 Daniel De Graaf * * This file is part of InspIRCd. InspIRCd is free software: you can @@ -133,7 +136,9 @@ class CoreExport ExtensionItem : public ServiceProvider, public usecountbase * a flags variable, and each module defining bits within the flag as 'theirs' as it is less prone to conflict and * supports arbitary data storage). */ -class CoreExport Extensible : public classbase +class CoreExport Extensible + : public classbase + , public Serializable { public: typedef insp::flat_map, void*> ExtensibleStore; @@ -165,6 +170,12 @@ class CoreExport Extensible : public classbase * Free all extension items attached to this Extensible */ void FreeAllExtItems(); + + /** @copydoc Serializable::Deserialize. */ + bool Deserialize(Data& data) CXX11_OVERRIDE; + + /** @copydoc Serializable::Deserialize. */ + bool Serialize(Serializable::Data& data) CXX11_OVERRIDE; }; class CoreExport ExtensionManager @@ -210,22 +221,19 @@ class SimpleExtItem : public ExtensionItem { T* ptr = new T(value); T* old = static_cast(set_raw(container, ptr)); - Del del; - del(old); + free(container, old); } inline void set(Extensible* container, T* value) { T* old = static_cast(set_raw(container, value)); - Del del; - del(old); + free(container, old); } inline void unset(Extensible* container) { T* old = static_cast(unset_raw(container)); - Del del; - del(old); + free(container, old); } void free(Extensible* container, void* item) CXX11_OVERRIDE