/********************************************************************* ** METHOD : ** PURPOSE : ** INPUT : ** OUTPUT : ** RETURN : ** REMARKS : *********************************************************************/ void HierarchyParserVisitor::visitOptionsParser (OptionsParser& object, size_t depth) { for (std::list<IOptionsParser*>::const_iterator it = object.getParsers().begin(); it != object.getParsers().end(); ++it) { (*it)->accept (*this, depth+1); } }
/********************************************************************* ** METHOD : ** PURPOSE : ** INPUT : ** OUTPUT : ** RETURN : ** REMARKS : *********************************************************************/ void VisibilityOptionsVisitor::visitOptionsParser (OptionsParser& object, size_t depth) { if (_names.find(object.getName()) != _names.end()) { object.setVisible(_visibility); } for (std::list<IOptionsParser*>::const_iterator it = object.getParsers().begin(); it != object.getParsers().end(); ++it) { (*it)->accept (*this, depth+1); } }
/********************************************************************* ** METHOD : ** PURPOSE : ** INPUT : ** OUTPUT : ** RETURN : ** REMARKS : *********************************************************************/ void OptionsHelpVisitor::visitOptionsParser (OptionsParser& object, size_t depth) { if (object.isVisible() == true) { /** We first look for the longest option name. */ nameMaxLen=0; for (list<IOptionsParser*>::const_iterator it = object.getParsers().begin(); it != object.getParsers().end(); ++it) { if (!(*it)->getName().empty()) { nameMaxLen = std::max (nameMaxLen, (*it)->getName().size()); } } os << endl; indent(os,depth) << "[" << object.getName() << " options]" << endl; /** We loop over each known parser. */ for (list<IOptionsParser*>::const_iterator it = object.getParsers().begin(); it != object.getParsers().end(); ++it) { if ((*it)->isVisible()) { (*it)->accept (*this, depth+1); } } } }