Parses a string for a string 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.
| 6663 | // On success, stores the value of the flag in *value, and returns |
| 6664 | // true. On failure, returns false without changing *value. |
| 6665 | bool ParseStringFlag(const char* str, const char* flag, std::string* value) { |
| 6666 | // Gets the value of the flag as a string. |
| 6667 | const char* const value_str = ParseFlagValue(str, flag, false); |
| 6668 | |
| 6669 | // Aborts if the parsing failed. |
| 6670 | if (value_str == NULL) return false; |
| 6671 | |
| 6672 | // Sets *value to the value of the flag. |
| 6673 | *value = value_str; |
| 6674 | return true; |
| 6675 | } |
| 6676 | |
| 6677 | // Determines whether a string has a prefix that Google Test uses for its |
| 6678 | // flags, i.e., starts with GTEST_FLAG_PREFIX_ or GTEST_FLAG_PREFIX_DASH_. |
no test coverage detected