本文整理汇总了C++中PolyDriver::getOptions方法的典型用法代码示例。如果您正苦于以下问题:C++ PolyDriver::getOptions方法的具体用法?C++ PolyDriver::getOptions怎么用?C++ PolyDriver::getOptions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PolyDriver
的用法示例。
在下文中一共展示了PolyDriver::getOptions方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: toDox
// helper method for "yarpdev" body
static void toDox(PolyDriver& dd, FILE *os) {
fprintf(os,"===============================================================\n");
fprintf(os,"== Options checked by device:\n== \n");
Bottle order = dd.getOptions();
for (size_t i=0; i<order.size(); i++) {
std::string name = order.get(i).toString();
if (name=="wrapped"||(name.find(".wrapped")!=std::string::npos)) {
continue;
}
std::string desc = dd.getComment(name.c_str());
Value def = dd.getDefaultValue(name.c_str());
Value actual = dd.getValue(name.c_str());
std::string out = "";
out += name;
if (!actual.isNull()) {
if (actual.toString()!="") {
out += "=";
if (actual.toString().length()<40) {
out += actual.toString().c_str();
} else {
out += "(value too long)";
}
}
}
if (!def.isNull()) {
if (def.toString()!="") {
out += " [";
if (def.toString().length()<40) {
out += def.toString().c_str();
} else {
out += "(value too long)";
}
out += "]";
}
}
if (desc!="") {
out += "\n ";
out += desc.c_str();
}
fprintf(os,"%s\n", out.c_str());
}
fprintf(os,"==\n");
fprintf(os,"===============================================================\n");
}
示例2: toDox
static void toDox(PolyDriver& dd, FILE *os) {
fprintf(os, "<table>\n");
fprintf(os, "<tr><td>PROPERTY</td><td>DESCRIPTION</td><td>DEFAULT</td></tr>\n");
Bottle order = dd.getOptions();
for (int i=0; i<order.size(); i++) {
String name = order.get(i).toString().c_str();
if (name=="wrapped"||name.substr(0,10)=="subdevice.") {
continue;
}
ConstString desc = dd.getComment(name.c_str());
ConstString def = dd.getDefaultValue(name.c_str()).toString();
String out = "";
out += "<tr><td>";
out += name.c_str();
out += "</td><td>";
out += desc.c_str();
out += "</td><td>";
out += def.c_str();
out += "</td></tr>";
fprintf(os,"%s\n",out.c_str());
}
fprintf(os, "</table>\n");
}