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

Function validate_bool

src/common/cmdparse.cc:581–602  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

579}
580
581bool validate_bool(const cmdmap_t& cmdmap,
582 const arg_desc_t& desc,
583 const std::string_view name,
584 const std::string_view type,
585 std::ostream& os)
586{
587 bool v;
588 try {
589 if (!cmd_getval(cmdmap, name, v)) {
590 if (auto req = desc.find("req");
591 req != end(desc) && req->second == "false") {
592 return true;
593 } else {
594 os << "missing required parameter: '" << name << "'";
595 return false;
596 }
597 }
598 return true;
599 } catch (const bad_cmd_get& e) {
600 return false;
601 }
602}
603
604template<bool is_vector,
605 typename T,

Callers 1

validate_cmdFunction · 0.85

Calls 3

cmd_getvalFunction · 0.70
endFunction · 0.50
findMethod · 0.45

Tested by

no test coverage detected