MCPcopy Create free account
hub / github.com/KhronosGroup/KTX-Software / ParseInt32Flag

Function ParseInt32Flag

tests/gtest/src/gtest.cc:6320–6330  ·  view source on GitHub ↗

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.

Source from the content-addressed store, hash-verified

6318// On success, stores the value of the flag in *value, and returns
6319// true. On failure, returns false without changing *value.
6320bool 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//

Callers 1

ParseGoogleTestFlagFunction · 0.70

Calls 3

ParseFlagValueFunction · 0.70
ParseInt32Function · 0.70
MessageFunction · 0.50

Tested by

no test coverage detected