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.
| 5933 | // On success, stores the value of the flag in *value, and returns |
| 5934 | // true. On failure, returns false without changing *value. |
| 5935 | bool ParseStringFlag(const char* str, const char* flag, String* value) { |
| 5936 | // Gets the value of the flag as a string. |
| 5937 | const char* const value_str = ParseFlagValue(str, flag, false); |
| 5938 | |
| 5939 | // Aborts if the parsing failed. |
| 5940 | if (value_str == NULL) return false; |
| 5941 | |
| 5942 | // Sets *value to the value of the flag. |
| 5943 | *value = value_str; |
| 5944 | return true; |
| 5945 | } |
| 5946 | |
| 5947 | // Determines whether a string has a prefix that Google Test uses for its |
| 5948 | // flags, i.e., starts with GTEST_FLAG_PREFIX_ or GTEST_FLAG_PREFIX_DASH_. |
no test coverage detected