// accumulate descriptor keywords in desckv
auto desckv = cmddesc_get_args(word);
// name the individual desc object based on the name key
- f->open_object_section(string(desckv["name"]).c_str());
+ f->open_object_section(desckv["name"]);
// Compatibility for pre-nautilus clients that don't know about CephBool
std::string val;
// dump all the keys including name into the array
for (auto [key, value] : desckv) {
- f->dump_string(string(key).c_str(), string(value));
+ f->dump_string(key, value);
}
f->close_section(); // attribute object for individual desc
}
const string& cmdsig,
const string& helptext)
{
- jf->open_object_section(secname.c_str());
+ jf->open_object_section(secname);
jf->open_array_section("sig");
dump_cmd_to_json(jf, features, cmdsig);
jf->close_section(); // sig array
- jf->dump_string("help", helptext.c_str());
+ jf->dump_string("help", helptext);
jf->close_section(); // cmd
}
const string& perm,
uint64_t flags)
{
- jf->open_object_section(secname.c_str());
+ jf->open_object_section(secname);
jf->open_array_section("sig");
dump_cmd_to_json(jf, features, cmdsig);
jf->close_section(); // sig array
- jf->dump_string("help", helptext.c_str());
- jf->dump_string("module", module.c_str());
- jf->dump_string("perm", perm.c_str());
+ jf->dump_string("help", helptext);
+ jf->dump_string("module", module);
+ jf->dump_string("perm", perm);
jf->dump_int("flags", flags);
jf->close_section(); // cmd
}
void operator()(const std::string &operand) const
{
- f->dump_string(key.c_str(), operand);
+ f->dump_string(key, operand);
}
void operator()(const bool &operand) const
{
- f->dump_bool(key.c_str(), operand);
+ f->dump_bool(key, operand);
}
void operator()(const int64_t &operand) const
{
- f->dump_int(key.c_str(), operand);
+ f->dump_int(key, operand);
}
void operator()(const double &operand) const
{
- f->dump_float(key.c_str(), operand);
+ f->dump_float(key, operand);
}
void operator()(const std::vector<std::string> &operand) const
{
- f->open_array_section(key.c_str());
- for (const auto i : operand) {
+ f->open_array_section(key);
+ for (const auto& i : operand) {
f->dump_string("item", i);
}
f->close_section();
void operator()(const std::vector<int64_t> &operand) const
{
- f->open_array_section(key.c_str());
+ f->open_array_section(key);
for (const auto i : operand) {
f->dump_int("item", i);
}
void operator()(const std::vector<double> &operand) const
{
- f->open_array_section(key.c_str());
+ f->open_array_section(key);
for (const auto i : operand) {
f->dump_float("item", i);
}