Lines Matching defs:value

51 // to the actual flag, default value, comment, etc.  This is designed to be POD
70 const void* defptr_; // Pointer to the default value.
72 bool owns_ptr_; // Does the flag own its string value?
89 void set_bool_variable(bool value, SetBy set_by) {
91 bool change_flag = *reinterpret_cast<bool*>(valptr_) != value;
93 if (change_flag) *reinterpret_cast<bool*>(valptr_) = value;
101 void set_maybe_bool_variable(MaybeBoolFlag value, SetBy set_by) {
103 bool change_flag = *reinterpret_cast<MaybeBoolFlag*>(valptr_) != value;
105 if (change_flag) *reinterpret_cast<MaybeBoolFlag*>(valptr_) = value;
113 void set_int_variable(int value, SetBy set_by) {
115 bool change_flag = *reinterpret_cast<int*>(valptr_) != value;
117 if (change_flag) *reinterpret_cast<int*>(valptr_) = value;
125 void set_uint_variable(unsigned int value, SetBy set_by) {
127 bool change_flag = *reinterpret_cast<unsigned int*>(valptr_) != value;
129 if (change_flag) *reinterpret_cast<unsigned int*>(valptr_) = value;
137 void set_uint64_variable(uint64_t value, SetBy set_by) {
139 bool change_flag = *reinterpret_cast<uint64_t*>(valptr_) != value;
141 if (change_flag) *reinterpret_cast<uint64_t*>(valptr_) = value;
149 void set_float_variable(double value, SetBy set_by) {
151 bool change_flag = *reinterpret_cast<double*>(valptr_) != value;
153 if (change_flag) *reinterpret_cast<double*>(valptr_) = value;
161 void set_size_t_variable(size_t value, SetBy set_by) {
163 bool change_flag = *reinterpret_cast<size_t*>(valptr_) != value;
165 if (change_flag) *reinterpret_cast<size_t*>(valptr_) = value;
173 void set_string_value(const char* value, bool owns_ptr, SetBy set_by) {
176 bool change_flag = (*ptr == nullptr) != (value == nullptr) ||
177 (*ptr && value && std::strcmp(*ptr, value) != 0);
181 *ptr = value;
184 if (owns_ptr && value != nullptr) DeleteArray(value);
234 // {change_flag} indicates if we're going to change the flag value.
235 // Returns an updated value for {change_flag}, which is changed to false if a
245 // For bool flags, we only check for a conflict if the value actually
246 // changes. So specifying the same flag with the same value multiple times
249 // presence of an implication even if the value is the same.
252 // value.
282 "Flag --%s: value implied by --%s conflicts with explicit "
317 // Compare this flag's current value against the default.
345 // Set a flag back to it's default value.
460 ? (flag.maybe_bool_variable().value ? "true" : "false")
525 // a flag name and flag value (or nullptr if they are missing). negated is set
529 const char** name, const char** value,
532 *value = nullptr;
552 // get the value if any
560 // get the value
561 *value = arg + 1;
567 bool TryParseUnsigned(Flag* flag, const char* arg, const char* value,
574 int64_t val = static_cast<int64_t>(strtoll(value, endp, 10));
598 const char* value;
600 SplitArgument(arg, buffer, sizeof buffer, &name, &value, &negated);
619 // if we still need a flag value, use the next argument if available
621 flag->type() != Flag::TYPE_MAYBE_BOOL && value == nullptr) {
623 value = argv[i++];
625 if (!value) {
626 PrintF(stderr, "Error: missing value for flag %s of type %s\n", arg,
644 flag->set_int_variable(static_cast<int>(strtol(value, &endp, 10)),
649 if (TryParseUnsigned(flag, arg, value, &endp, &parsed_value)) {
658 if (TryParseUnsigned(flag, arg, value, &endp, &parsed_value)) {
666 flag->set_float_variable(strtod(value, &endp),
671 if (TryParseUnsigned(flag, arg, value, &endp, &parsed_value)) {
679 flag->set_string_value(value ? StrDup(value) : nullptr, true,
687 if ((is_bool_type && value != nullptr) || (!is_bool_type && negated) ||
691 PrintF(stderr, "Error: illegal value for flag %s of type %s\n", arg,
701 // remove the flag & value from the command
802 " --flag=value (non-bool flags only, no spaces around '=')\n"
803 " --flag value (non-bool flags only)\n"
826 A* conclusion_pointer, B value, bool weak_implication) {
828 bool change_flag = *conclusion_pointer != implicit_cast<A>(value);
834 if (change_flag) *conclusion_pointer = value;