Parses a string for an int32_t flag, in the form of "--flag=value". On success, stores the value of the flag in *value, and returns true. On failure, returns false without changing *value.
| 6318 | // On success, stores the value of the flag in *value, and returns |
| 6319 | // true. On failure, returns false without changing *value. |
| 6320 | bool ParseInt32Flag(const char* str, const char* flag, int32_t* value) { |
| 6321 | // Gets the value of the flag as a string. |
| 6322 | const char* const value_str = ParseFlagValue(str, flag, false); |
| 6323 | |
| 6324 | // Aborts if the parsing failed. |
| 6325 | if (value_str == nullptr) return false; |
| 6326 | |
| 6327 | // Sets *value to the value of the flag. |
| 6328 | return ParseInt32(Message() << "The value of flag --" << flag, |
| 6329 | value_str, value); |
| 6330 | } |
| 6331 | |
| 6332 | // Parses a string for a string flag, in the form of "--flag=value". |
| 6333 | // |
no test coverage detected