bool AbstractCompositeHelpTopic::writeSubTopicList(const HelpWriterContext &context, const std::string &title) const { if (context.outputFormat() != eHelpOutputFormat_Console) { Impl::SubTopicList::const_iterator topic; for (topic = impl_->subTopics_.begin(); topic != impl_->subTopics_.end(); ++topic) { const char *const title = (*topic)->title(); if (!isNullOrEmpty(title)) { context.outputFile().writeLine(); HelpWriterContext subContext(context); subContext.enterSubSection(title); (*topic)->writeHelp(subContext); } } return true; } int maxNameLength = 0; Impl::SubTopicMap::const_iterator topic; for (topic = impl_->subTopicMap_.begin(); topic != impl_->subTopicMap_.end(); ++topic) { const char *const title = topic->second->title(); if (!isNullOrEmpty(title)) { int nameLength = static_cast<int>(topic->first.length()); if (nameLength > maxNameLength) { maxNameLength = nameLength; } } } if (maxNameLength == 0) { return false; } TextWriter &file = context.outputFile(); TextTableFormatter formatter; formatter.addColumn(NULL, maxNameLength + 1, false); formatter.addColumn(NULL, 72 - maxNameLength, true); formatter.setFirstColumnIndent(4); file.writeLine(title); for (topic = impl_->subTopicMap_.begin(); topic != impl_->subTopicMap_.end(); ++topic) { const char *const name = topic->first.c_str(); const char *const title = topic->second->title(); if (!isNullOrEmpty(title)) { formatter.clear(); formatter.addColumnLine(0, name); formatter.addColumnLine(1, title); file.writeString(formatter.formatRow()); } } return true; }
void CommandLineHelpWriter::Impl::formatBugs(const HelpWriterContext &context) { if (bugs_.empty()) { return; } context.writeTitle("Known Issues"); ConstArrayRef<const char *>::const_iterator i; for (i = bugs_.begin(); i != bugs_.end(); ++i) { const char *const bug = *i; TextLineWrapperSettings settings; settings.setIndent(2); settings.setFirstLineIndent(0); settings.setLineLength(78); context.outputFile().writeLine( context.substituteMarkupAndWrapToString( settings, formatString("* %s", bug))); } }