- Timestamp:
- Dec 22, 2009, 2:07:44 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation2/src/libraries/core/CommandLineParser.cc
r6021 r6394 63 63 this->value_ = temp; 64 64 } 65 else if (value == "")65 else if (value.empty()) 66 66 { 67 67 this->bHasDefaultValue_ = false; … … 140 140 OrxAssert(cmdLineArgsShortcut_.find(it->second->getShortcut()) == cmdLineArgsShortcut_.end(), 141 141 "Cannot have two command line shortcut with the same name."); 142 if ( it->second->getShortcut() != "")142 if (!it->second->getShortcut().empty()) 143 143 cmdLineArgsShortcut_[it->second->getShortcut()] = it->second; 144 144 } … … 165 165 { 166 166 // negative number as a value 167 value += arguments[i] + " ";167 value += arguments[i] + ' '; 168 168 } 169 169 else … … 173 173 // save old data first 174 174 value = removeTrailingWhitespaces(value); 175 if ( name != "")175 if (!name.empty()) 176 176 { 177 177 checkFullArgument(name, value, bParsingFile); 178 name = "";179 assert(shortcut == "");178 name.clear(); 179 assert(shortcut.empty()); 180 180 } 181 else if ( shortcut != "")181 else if (!shortcut.empty()) 182 182 { 183 183 checkShortcut(shortcut, value, bParsingFile); 184 shortcut = "";185 assert(name == "");184 shortcut.clear(); 185 assert(name.empty()); 186 186 } 187 187 … … 198 198 199 199 // reset value string 200 value = "";200 value.clear(); 201 201 } 202 202 } … … 205 205 // value string 206 206 207 if (name == "" && shortcut == "")207 if (name.empty() && shortcut.empty()) 208 208 { 209 209 ThrowException(Argument, "Expected \"-\" or \"-\" in command line arguments.\n"); … … 218 218 // parse last argument 219 219 value = removeTrailingWhitespaces(value); 220 if ( name != "")220 if (!name.empty()) 221 221 { 222 222 checkFullArgument(name, value, bParsingFile); 223 assert(shortcut == "");224 } 225 else if ( shortcut != "")223 assert(shortcut.empty()); 224 } 225 else if (!shortcut.empty()) 226 226 { 227 227 checkShortcut(shortcut, value, bParsingFile); 228 assert(name == "");228 assert(name.empty()); 229 229 } 230 230 } … … 291 291 it != inst.cmdLineArgs_.end(); ++it) 292 292 { 293 if ( it->second->getShortcut() != "")293 if (!it->second->getShortcut().empty()) 294 294 infoStr << " [-" << it->second->getShortcut() << "] "; 295 295 else 296 296 infoStr << " "; 297 infoStr << "--" << it->second->getName() << " ";297 infoStr << "--" << it->second->getName() << ' '; 298 298 if (it->second->getValue().getType() != MT_Type::Bool) 299 299 infoStr << "ARG "; … … 347 347 void CommandLineParser::_parseFile() 348 348 { 349 std::stringfilename = CommandLineParser::getValue("optionsFile").getString();349 const 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.