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.
| 5916 | // On success, stores the value of the flag in *value, and returns |
| 5917 | // true. On failure, returns false without changing *value. |
| 5918 | bool ParseInt32Flag(const char* str, const char* flag, Int32* value) { |
| 5919 | // Gets the value of the flag as a string. |
| 5920 | const char* const value_str = ParseFlagValue(str, flag, false); |
| 5921 | |
| 5922 | // Aborts if the parsing failed. |
| 5923 | if (value_str == NULL) return false; |
| 5924 | |
| 5925 | // Sets *value to the value of the flag. |
| 5926 | return ParseInt32(Message() << "The value of flag --" << flag, |
| 5927 | value_str, value); |
| 5928 | } |
| 5929 | |
| 5930 | // Parses a string for a string flag, in the form of |
| 5931 | // "--flag=value". |
no test coverage detected