Implement: XLineManager::RegisterFactory, UnregisterFactory, GetFactory

git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8437 e03df62e-2008-0410-955e-edbf42e46eb7
This commit is contained in:
brain 2007-10-31 19:15:12 +00:00
parent 3cf7620e91
commit dcd26f6b56

View File

@ -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;
}