本文整理汇总了C++中Param::name方法的典型用法代码示例。如果您正苦于以下问题:C++ Param::name方法的具体用法?C++ Param::name怎么用?C++ Param::name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Param
的用法示例。
在下文中一共展示了Param::name方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
RobotInterface::ParamList RobotInterface::XMLReader::Private::readParamListTag(TiXmlElement* paramListElem)
{
if (paramListElem->ValueStr().compare("paramlist") != 0) {
SYNTAX_ERROR(paramListElem->Row()) << "Expected \"paramlist\". Found" << paramListElem->ValueStr();
}
ParamList params;
Param mainparam;
if (paramListElem->QueryStringAttribute("name", &mainparam.name()) != TIXML_SUCCESS) {
SYNTAX_ERROR(paramListElem->Row()) << "\"paramlist\" element should contain the \"name\" attribute";
}
params.push_back(mainparam);
// yDebug() << "Found paramlist [" << params.at(0).name() << "]";
for (TiXmlElement* childElem = paramListElem->FirstChildElement(); childElem != 0; childElem = childElem->NextSiblingElement()) {
if (childElem->ValueStr().compare("elem") != 0) {
SYNTAX_ERROR(childElem->Row()) << "Expected \"elem\". Found" << childElem->ValueStr();
}
Param childParam;
if (childElem->QueryStringAttribute("name", &childParam.name()) != TIXML_SUCCESS) {
SYNTAX_ERROR(childElem->Row()) << "\"elem\" element should contain the \"name\" attribute";
}
const char *valueText = childElem->GetText();
if (!valueText) {
SYNTAX_ERROR(childElem->Row()) << "\"elem\" element should have a value [ \"name\" = " << childParam.name() << "]";
}
childParam.value() = valueText;
params.push_back(childParam);
}
if (params.empty()) {
SYNTAX_ERROR(paramListElem->Row()) << "\"paramlist\" cannot be empty";
}
// +1 skips the first element, that is the main param
for (ParamList::iterator it = params.begin() + 1; it != params.end(); ++it) {
Param ¶m = *it;
params.at(0).value() += (params.at(0).value().empty() ? "(" : " ") + param.name();
}
params.at(0).value() += ")";
// yDebug() << params;
return params;
}
示例2: readParams
RobotInterface::ParamList RobotInterface::XMLReader::Private::readSubDeviceTag(TiXmlElement *subDeviceElem)
{
if (subDeviceElem->ValueStr().compare("subdevice") != 0) {
SYNTAX_ERROR(subDeviceElem->Row()) << "Expected \"subdevice\". Found" << subDeviceElem->ValueStr();
}
ParamList params;
//FIXME Param featIdParam;
Param subDeviceParam;
//FIXME featIdParam.name() = "FeatId";
subDeviceParam.name() = "subdevice";
//FIXME if (subDeviceElem->QueryStringAttribute("name", &featIdParam.value()) != TIXML_SUCCESS) {
// SYNTAX_ERROR(subDeviceElem->Row()) << "\"subdevice\" element should contain the \"name\" attribute";
// }
if (subDeviceElem->QueryStringAttribute("type", &subDeviceParam.value()) != TIXML_SUCCESS) {
SYNTAX_ERROR(subDeviceElem->Row()) << "\"subdevice\" element should contain the \"type\" attribute";
}
//FIXME params.push_back(featIdParam);
params.push_back(subDeviceParam);
// yDebug() << "Found subdevice [" << params.at(0).value() << "]";
for (TiXmlElement* childElem = subDeviceElem->FirstChildElement(); childElem != 0; childElem = childElem->NextSiblingElement()) {
ParamList childParams = readParams(childElem);
for (ParamList::const_iterator it = childParams.begin(); it != childParams.end(); ++it) {
params.push_back(Param(it->name(), it->value()));
}
}
// yDebug() << params;
return params;
}
示例3:
/*! Writes the name and value of the given \a param to \a dbg. */
QDebug operator<<(QDebug dbg, const Param ¶m)
{
dbg.nospace() << "Param(Name: " << param.name() << ", Value:" << param.value() << ")";
return dbg.space();
}