Lines Matching defs:value
32 // the result to *value and returns true; otherwise leaves *value
34 bool ParseInt32(const std::string& src_text, const char* str, int32_t* value) {
43 << "but actually has value \"" << str << "\".\n";
47 // Is the parsed value in the range of an Int32?
51 // The parsed value overflows as a long. (strtol() returns
54 // The parsed value overflows as an Int32.
57 << "but actually has value \"" << str << "\", "
62 *value = result;
66 // Parses 'str' for a double. If successful, writes the result to *value and
67 // returns true; otherwise leaves *value unchanged and returns false.
68 bool ParseDouble(const std::string& src_text, const char* str, double* value) {
77 << "but actually has value \"" << str << "\".\n";
81 *value = double_value;
85 // Parses 'str' into KV pairs. If successful, writes the result to *value and
86 // returns true; otherwise leaves *value unchanged and returns false.
88 std::map<std::string, std::string>* value) {
94 << "<key>=<value> strings, but actually has value \"" << str
105 *value = kvs;
135 int32_t value = default_val;
138 &value)) {
141 return value;
148 double value = default_val;
151 &value)) {
154 return value;
160 const char* const value = getenv(env_var.c_str());
161 return value == nullptr ? default_val : value;
172 std::map<std::string, std::string> value;
173 if (!ParseKvPairs("Environment variable " + env_var, value_str, &value)) {
176 return value;
180 // the format "--flag=value". When def_optional is true, the "=value"
183 // Returns the value of the flag, or nullptr if the parsing failed.
197 // When def_optional is true, it's OK to not have a "=value" part.
210 bool ParseBoolFlag(const char* str, const char* flag, bool* value) {
211 // Gets the value of the flag as a string.
217 // Converts the string value to a bool.
218 *value = IsTruthyFlagValue(value_str);
223 bool ParseInt32Flag(const char* str, const char* flag, int32_t* value) {
224 // Gets the value of the flag as a string.
230 // Sets *value to the value of the flag.
231 return ParseInt32(std::string("The value of flag --") + flag, value_str,
232 value);
236 bool ParseDoubleFlag(const char* str, const char* flag, double* value) {
237 // Gets the value of the flag as a string.
243 // Sets *value to the value of the flag.
244 return ParseDouble(std::string("The value of flag --") + flag, value_str,
245 value);
249 bool ParseStringFlag(const char* str, const char* flag, std::string* value) {
250 // Gets the value of the flag as a string.
256 *value = value_str;
262 std::map<std::string, std::string>* value) {
270 value->emplace(kv[0], kv[1]);
282 bool IsTruthyFlagValue(const std::string& value) {
283 if (value.size() == 1) {
284 char v = value[0];
288 if (!value.empty()) {
289 std::string value_lower(value);