MCPcopy Create free account
hub / github.com/ceph/ceph / arg_in_range

Function arg_in_range

src/common/cmdparse.cc:532–548  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

530
531template<typename T>
532bool arg_in_range(T value, const arg_desc_t& desc, std::ostream& os) {
533 auto range = desc.find("range");
534 if (range == desc.end()) {
535 return true;
536 }
537 auto min_max = get_str_list(string(range->second), "|");
538 auto min = str_to_num<T>(min_max.front());
539 auto max = std::numeric_limits<T>::max();
540 if (min_max.size() > 1) {
541 max = str_to_num<T>(min_max.back());
542 }
543 if (value < min || value > max) {
544 os << "'" << value << "' out of range: " << min_max;
545 return false;
546 }
547 return true;
548}
549
550bool validate_str_arg(std::string_view value,
551 std::string_view type,

Callers 1

validate_argFunction · 0.85

Calls 6

get_str_listFunction · 0.70
findMethod · 0.45
endMethod · 0.45
frontMethod · 0.45
sizeMethod · 0.45
backMethod · 0.45

Tested by

no test coverage detected