AREXPORT bool ArFileParser::remHandler(
	ArRetFunctor3<bool, ArArgumentBuilder *, char *, size_t> *functor)
{
  std::map<std::string, HandlerCBType *, ArStrCaseCmpOp>::iterator it;
  HandlerCBType *handler;

  if (myRemainderHandler != NULL && myRemainderHandler->haveFunctor(functor))
  {
    delete myRemainderHandler;
    myRemainderHandler = NULL;
    ArLog::log(ArLog::Verbose, "Functor for remainder handler removed");
    return true;
  }

  for (it = myMap.begin(); it != myMap.end(); it++)
  {
    if ((*it).second->haveFunctor(functor))
    {
      if (!myIsQuiet) {
        ArLog::log(ArLog::Verbose, "Functor for keyword '%s' removed.", 
		                     (*it).first.c_str());
      }
      handler = (*it).second;
      myMap.erase(it);
      delete handler;
      remHandler(functor);
      return true;
    }
  }
  return false;

}
Example #2
0
AREXPORT bool ArFileParser::remHandler(const char *keyword,
				       bool logIfCannotFind)
{
  std::map<std::string, HandlerCBType *, ArStrCaseCmpOp>::iterator it;
  HandlerCBType *handler;

  if (myRemainderHandler != NULL && keyword == NULL)
  {
    delete myRemainderHandler;
    myRemainderHandler = NULL;
    ArLog::log(ArLog::Verbose, "Functor for remainder handler removed");
    return true;
  }

  if ((it = myMap.find(keyword)) == myMap.end())
  {
    if (logIfCannotFind)
      ArLog::log(ArLog::Normal, "There is no keyword '%s' to remove.",
		 keyword);
    return false;
  }
  ArLog::log(ArLog::Verbose, "keyword '%s' removed", keyword);
  handler = (*it).second;
  myMap.erase(it);
  delete handler;
  remHandler(keyword, false);
  return true;

}