You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ValidateCommandLineOption API to test a flag value. On success we can then set it using SetCommandLineOption.
bool
FlagRegistry::ValidateValueLocked(CommandLineFlag* flag, const char* value,
string* err_msg) const {
FlagValue* dummy_value = flag->current_->New();
bool result = TryParseLocked(flag, dummy_value, value, err_msg);
delete dummy_value;
if (result) {
// On success clear the message which says '<flag> set to <value>'.
*err_msg = "";
}
return result;
}
// --------------------------------------------------------------------
// ValidateCommandLineOption()
// Check if we can set a flag to a particular value. If this check
// passes then the flag can be successfuly set to this value using
// SetCommandLineOption.
// --------------------------------------------------------------------
bool ValidateCommandLineOption(const char* flagname, const char* value, string* err_msg) {
FlagRegistry* const registry = FlagRegistry::GlobalRegistry();
FlagRegistryLock frl(registry);
CommandLineFlag* flag = registry->FindFlagLocked(flagname);
if (!flag) {
*err_msg = StringPrintf("Unknown command line flag '%s'", flagname);
return false;
}
return registry->ValidateValueLocked(flag, value, err_msg);
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
ValidateCommandLineOption
API to test a flag value. On success we can then set it usingSetCommandLineOption
.Beta Was this translation helpful? Give feedback.
All reactions