From a89b0ed42d90f714e4fa01265f5cd4995686ba82 Mon Sep 17 00:00:00 2001 From: brain Date: Fri, 30 Apr 2004 12:26:20 +0000 Subject: Added Extensible classes git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@754 e03df62e-2008-0410-955e-edbf42e46eb7 --- include/base.h | 23 +++++++++++++++++++++++ src/InspIRCd.dev | 12 +++++++++++- src/InspIRCd.layout | 19 +++++++++++++------ src/Makefile | 2 +- 4 files changed, 48 insertions(+), 8 deletions(-) diff --git a/include/base.h b/include/base.h index dbe4588e9..e755fc951 100644 --- a/include/base.h +++ b/include/base.h @@ -40,6 +40,29 @@ class Extensible : public classbase /** Private data store */ std::map Extension_Items; + +public: + + /** Extend an Extensible class. + * You must provide a key to store the data as, and a void* to the data (typedef VoidPointer) + * The data will be inserted into the map. If the data already exists, you may not insert it + * twice, Extensible::Extend will return false in this case. + * On successful extension, Extend returns true. + */ + bool Extend(std::string key, VoidPointer p); + + /** Shrink an Extensible class. + * You must provide a key name. The given key name will be removed from the classes data. If + * you provide a nonexistent key (case is important) then the function will return false. + * Returns true on success. + */ + bool Shrink(std::string key); + + /** Get an extension item. + * You must provide a key name, which is case sensitive. If you provide a non-existent key name, + * the function returns NULL, otherwise a pointer to the item referenced by the key is returned. + */ + VoidPointer GetExt(std::string key); }; #endif diff --git a/src/InspIRCd.dev b/src/InspIRCd.dev index 11856196d..f553ce649 100644 --- a/src/InspIRCd.dev +++ b/src/InspIRCd.dev @@ -1,7 +1,7 @@ [Project] FileName=InspIRCd.dev Name=InspIRCd - The Inspire Internet Relay Chat Daemon -UnitCount=49 +UnitCount=50 Type=1 Ver=1 ObjFiles= @@ -535,3 +535,13 @@ Priority=1000 OverrideBuildCmd=0 BuildCmd= +[Unit50] +FileName=base.cpp +CompileCpp=1 +Folder=Source +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + diff --git a/src/InspIRCd.layout b/src/InspIRCd.layout index 1c609531c..2ba69f876 100644 --- a/src/InspIRCd.layout +++ b/src/InspIRCd.layout @@ -1,6 +1,6 @@ [Editors] Focused=-1 -Order=2,4,6,3,7,25,5,24,39,42,43,-1,1,46,0 +Order=2,4,6,3,7,25,5,24,39,42,43,-1,1,46,0,49 [Editor_0] Open=1 @@ -116,7 +116,7 @@ LeftChar=1 [Editor_14] Open=1 -Top=1 +Top=0 CursorCol=1 CursorRow=18 TopLine=1 @@ -188,10 +188,10 @@ LeftChar=1 [Editor_23] Open=1 -Top=0 -CursorCol=5 -CursorRow=41 -TopLine=1 +Top=1 +CursorCol=1 +CursorRow=69 +TopLine=14 LeftChar=1 [Editor_24] @@ -369,3 +369,10 @@ CursorCol=11 CursorRow=82 TopLine=53 LeftChar=1 +[Editor_49] +Open=1 +Top=0 +CursorCol=1 +CursorRow=32 +TopLine=1 +LeftChar=1 diff --git a/src/Makefile b/src/Makefile index 6a336dc9c..03c795c62 100644 --- a/src/Makefile +++ b/src/Makefile @@ -7,7 +7,7 @@ CC = im a cheezeball -SRC_1 = inspircd.cpp inspircd_util.cpp inspircd_io.cpp connection.cpp message.cpp commands.cpp +SRC_1 = base.cpp inspircd.cpp inspircd_util.cpp inspircd_io.cpp connection.cpp message.cpp commands.cpp SRC_2 = dynamic.cpp users.cpp modules.cpp wildcard.cpp servers.cpp channels.cpp mode.cpp xline.cpp SRC = $(SRC_1) $(SRC_2) -- cgit v1.2.3