- Timestamp:
- Nov 21, 2015, 7:05:53 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/cpp11_v2/src/libraries/core/commandline/CommandLineParser.cc
r10768 r10821 124 124 std::string shortcut; 125 125 std::string value; 126 for ( unsigned int i = 0; i < arguments.size(); ++i)127 { 128 if (argument s[i].size() != 0)126 for (auto & argument : arguments) 127 { 128 if (argument.size() != 0) 129 129 { 130 130 // sure not "" 131 if (argument s[i][0] == '-')131 if (argument[0] == '-') 132 132 { 133 133 // start with "-" 134 if (argument s[i].size() == 1)134 if (argument.size() == 1) 135 135 { 136 136 // argument[i] is "-", probably a minus sign 137 137 value += "- "; 138 138 } 139 else if (argument s[i][1] <= 57 && arguments[i][1] >= 48)139 else if (argument[1] <= 57 && argument[1] >= 48) 140 140 { 141 141 // negative number as a value 142 value += argument s[i]+ ' ';142 value += argument + ' '; 143 143 } 144 144 else … … 161 161 } 162 162 163 if (argument s[i][1] == '-')163 if (argument[1] == '-') 164 164 { 165 165 // full name argument with "--name" 166 name = argument s[i].substr(2);166 name = argument.substr(2); 167 167 } 168 168 else 169 169 { 170 170 // shortcut with "-s" 171 shortcut = argument s[i].substr(1);171 shortcut = argument.substr(1); 172 172 } 173 173 … … 186 186 187 187 // Concatenate strings as long as there's no new argument by "-" or "--" 188 value += argument s[i]+ ' ';188 value += argument + ' '; 189 189 } 190 190 }
Note: See TracChangeset
for help on using the changeset viewer.