Changeset 6021 for code/trunk/src/libraries/core/CommandLineParser.cc
- Timestamp:
- Nov 4, 2009, 12:28:59 PM (14 years ago)
- File:
-
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/libraries/core/CommandLineParser.cc
r6014 r6021 27 27 */ 28 28 29 #include "CommandLine .h"29 #include "CommandLineParser.h" 30 30 31 31 #include <algorithm> … … 88 88 Destructor destroys all CommandLineArguments with it. 89 89 */ 90 CommandLine ::~CommandLine()91 { 92 CommandLine ::destroyAllArguments();90 CommandLineParser::~CommandLineParser() 91 { 92 CommandLineParser::destroyAllArguments(); 93 93 } 94 94 … … 97 97 Returns a unique instance (Meyers Singleton). 98 98 */ 99 CommandLine & CommandLine::_getInstance()100 { 101 static CommandLine instance;99 CommandLineParser& CommandLineParser::_getInstance() 100 { 101 static CommandLineParser instance; 102 102 return instance; 103 103 } … … 108 108 of main. Do not use before that. 109 109 */ 110 void CommandLine ::destroyAllArguments()110 void CommandLineParser::destroyAllArguments() 111 111 { 112 112 for (std::map<std::string, CommandLineArgument*>::const_iterator it = _getInstance().cmdLineArgs_.begin(); … … 127 127 Vector of space separated strings. 128 128 */ 129 void CommandLine ::_parse(const std::vector<std::string>& arguments, bool bParsingFile)129 void CommandLineParser::_parse(const std::vector<std::string>& arguments, bool bParsingFile) 130 130 { 131 131 try … … 232 232 { 233 233 COUT(0) << "Could not parse command line (including additional files): " << ex.what() << std::endl; 234 COUT(0) << CommandLine ::getUsageInformation() << std::endl;234 COUT(0) << CommandLineParser::getUsageInformation() << std::endl; 235 235 throw GeneralException(""); 236 236 } … … 245 245 String containing the value 246 246 */ 247 void CommandLine ::checkFullArgument(const std::string& name, const std::string& value, bool bParsingFile)247 void CommandLineParser::checkFullArgument(const std::string& name, const std::string& value, bool bParsingFile) 248 248 { 249 249 std::map<std::string, CommandLineArgument*>::const_iterator it = cmdLineArgs_.find(name); … … 262 262 String containing the value 263 263 */ 264 void CommandLine ::checkShortcut(const std::string& shortcut, const std::string& value, bool bParsingFile)264 void CommandLineParser::checkShortcut(const std::string& shortcut, const std::string& value, bool bParsingFile) 265 265 { 266 266 std::map<std::string, CommandLineArgument*>::const_iterator it = cmdLineArgsShortcut_.find(shortcut); … … 271 271 } 272 272 273 std::string CommandLine ::getUsageInformation()274 { 275 CommandLine & inst = _getInstance();273 std::string CommandLineParser::getUsageInformation() 274 { 275 CommandLineParser& inst = _getInstance(); 276 276 std::ostringstream infoStr; 277 277 … … 315 315 You shold of course not call this method before the command line has been parsed. 316 316 */ 317 const CommandLineArgument* CommandLine ::getArgument(const std::string& name)317 const CommandLineArgument* CommandLineParser::getArgument(const std::string& name) 318 318 { 319 319 std::map<std::string, CommandLineArgument*>::const_iterator it = _getInstance().cmdLineArgs_.find(name); … … 332 332 Parses only the command line for CommandLineArguments. 333 333 */ 334 void CommandLine ::_parseCommandLine(const std::string& cmdLine)334 void CommandLineParser::_parseCommandLine(const std::string& cmdLine) 335 335 { 336 336 std::vector<std::string> args; … … 345 345 Parses start.ini (or the file specified with --optionsFile) for CommandLineArguments. 346 346 */ 347 void CommandLine ::_parseFile()348 { 349 std::string filename = CommandLine ::getValue("optionsFile").getString();347 void CommandLineParser::_parseFile() 348 { 349 std::string filename = CommandLineParser::getValue("optionsFile").getString(); 350 350 351 351 // look for additional arguments in given file or start.ini as default
Note: See TracChangeset
for help on using the changeset viewer.