summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-10-31 19:15:12 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-10-31 19:15:12 +0000
commitdcd26f6b564ade8fa51f1adb972c4e1fb5f234c7 (patch)
treec9a1ba3d07e58bfa92520c76f7f908198361f321
parent3cf7620e916d1dc943151117eb508ea459fe4fc8 (diff)
Implement: XLineManager::RegisterFactory, UnregisterFactory, GetFactory
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8437 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--src/xline.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/xline.cpp b/src/xline.cpp
index 75f689265..b970ad9e7 100644
--- a/src/xline.cpp
+++ b/src/xline.cpp
@@ -650,3 +650,37 @@ const char* QLine::Displayable()
return nick;
}
+bool XLineManager::RegisterFactory(XLineFactory* xlf)
+{
+ std::map<char, XLineFactory*>::iterator n = line_factory.find(xlf->GetType());
+
+ if (n != line_factory.end())
+ return false;
+
+ line_factory[xlf->GetType()] = xlf;
+
+ return true;
+}
+
+bool XLineManager::UnregisterFactory(XLineFactory* xlf)
+{
+ std::map<char, XLineFactory*>::iterator n = line_factory.find(xlf->GetType());
+
+ if (n == line_factory.end())
+ return false;
+
+ line_factory.erase(n);
+
+ return true;
+}
+
+XLineFactory* XLineManager::GetFactory(const char type)
+{
+ std::map<char, XLineFactory*>::iterator n = line_factory.find(type);
+
+ if (n != line_factory.end())
+ return NULL;
+
+ return n->second;
+}
+