Parses a string for an Int32 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.
| 6646 | // On success, stores the value of the flag in *value, and returns |
| 6647 | // true. On failure, returns false without changing *value. |
| 6648 | bool ParseInt32Flag(const char* str, const char* flag, Int32* value) { |
| 6649 | // Gets the value of the flag as a string. |
| 6650 | const char* const value_str = ParseFlagValue(str, flag, false); |
| 6651 | |
| 6652 | // Aborts if the parsing failed. |
| 6653 | if (value_str == NULL) return false; |
| 6654 | |
| 6655 | // Sets *value to the value of the flag. |
| 6656 | return ParseInt32(Message() << "The value of flag --" << flag, |
| 6657 | value_str, value); |
| 6658 | } |
| 6659 | |
| 6660 | // Parses a string for a string flag, in the form of |
| 6661 | // "--flag=value". |
no test coverage detected