Changeset 10919 for code/branches/cpp11_v2/src/libraries/core/commandline
- Timestamp:
- Dec 5, 2015, 10:47:51 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/cpp11_v2/src/libraries/core/commandline/CommandLineParser.cc
r10916 r10919 110 110 { 111 111 // first shove all the shortcuts in a map 112 for (std::map<std::string, CommandLineArgument*>::const_iterator it = cmdLineArgs_.begin(); 113 it != cmdLineArgs_.end(); ++it) 112 for (const auto& mapEntry : cmdLineArgs_) 114 113 { 115 OrxAssert(cmdLineArgsShortcut_.find( it->second->getShortcut()) == cmdLineArgsShortcut_.end(),114 OrxAssert(cmdLineArgsShortcut_.find(mapEntry.second->getShortcut()) == cmdLineArgsShortcut_.end(), 116 115 "Cannot have two command line shortcut with the same name."); 117 if (! it->second->getShortcut().empty())118 cmdLineArgsShortcut_[ it->second->getShortcut()] = it->second;116 if (!mapEntry.second->getShortcut().empty()) 117 cmdLineArgsShortcut_[mapEntry.second->getShortcut()] = mapEntry.second; 119 118 } 120 119 bFirstTimeParse_ = false; … … 257 256 // determine maximum name size 258 257 size_t maxNameSize = 0; 259 for (std::map<std::string, CommandLineArgument*>::const_iterator it = inst.cmdLineArgs_.begin(); 260 it != inst.cmdLineArgs_.end(); ++it) 261 { 262 maxNameSize = std::max(it->second->getName().size(), maxNameSize); 258 for (const auto& mapEntry : inst.cmdLineArgs_) 259 { 260 maxNameSize = std::max(mapEntry.second->getName().size(), maxNameSize); 263 261 } 264 262 … … 267 265 infoStr << "Available options:" << endl; 268 266 269 for (std::map<std::string, CommandLineArgument*>::const_iterator it = inst.cmdLineArgs_.begin(); 270 it != inst.cmdLineArgs_.end(); ++it) 271 { 272 if (!it->second->getShortcut().empty()) 273 infoStr << " [-" << it->second->getShortcut() << "] "; 267 for (const auto& mapEntry : inst.cmdLineArgs_) 268 { 269 if (!mapEntry.second->getShortcut().empty()) 270 infoStr << " [-" << mapEntry.second->getShortcut() << "] "; 274 271 else 275 272 infoStr << " "; 276 infoStr << "--" << it->second->getName() << ' ';277 if ( it->second->getValue().isType<bool>())273 infoStr << "--" << mapEntry.second->getName() << ' '; 274 if (mapEntry.second->getValue().isType<bool>()) 278 275 infoStr << " "; 279 276 else 280 277 infoStr << "ARG "; 281 278 // fill with the necessary amount of blanks 282 infoStr << std::string(maxNameSize - it->second->getName().size(), ' ');283 infoStr << ": " << it->second->getInformation();279 infoStr << std::string(maxNameSize - mapEntry.second->getName().size(), ' '); 280 infoStr << ": " << mapEntry.second->getInformation(); 284 281 infoStr << endl; 285 282 }
Note: See TracChangeset
for help on using the changeset viewer.