From dcd26f6b564ade8fa51f1adb972c4e1fb5f234c7 Mon Sep 17 00:00:00 2001 From: brain Date: Wed, 31 Oct 2007 19:15:12 +0000 Subject: Implement: XLineManager::RegisterFactory, UnregisterFactory, GetFactory git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8437 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/xline.cpp | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) 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::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::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::iterator n = line_factory.find(type); + + if (n != line_factory.end()) + return NULL; + + return n->second; +} + -- cgit v1.2.3