本文整理汇总了C++中XmlNode::getChildren方法的典型用法代码示例。如果您正苦于以下问题:C++ XmlNode::getChildren方法的具体用法?C++ XmlNode::getChildren怎么用?C++ XmlNode::getChildren使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XmlNode
的用法示例。
在下文中一共展示了XmlNode::getChildren方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
map<string, CanVariable> CanIdTranslator::translateData(int commandId, string moduleName, string dataHex)
{
vector<XmlNode> commandNodes = xmlNode.findChild("commands").getChildren();
for (int n = 0; n < commandNodes.size(); n++)
{
map<string, string> attributes = commandNodes[n].getAttributes();
bool correct = false;
if (commandId >= 128)
{
if (stoi(attributes["id"]) == commandId && attributes["module"] == moduleName)
{
correct = true;
}
}
else if (stoi(attributes["id"]) == commandId)
{
correct = true;
}
if (correct)
{
XmlNode varablesNode = commandNodes[n].findChild("variables");
return translateData(varablesNode.getChildren(), dataHex);
}
}
map<string, CanVariable> variables;
return variables;
}
示例2: resolveCommandId
int CanIdTranslator::resolveCommandId(string commandName, string moduleName)
{
XmlNode commandsNode = xmlNode.findChild("commands");
vector<XmlNode> commandNodes = commandsNode.getChildren();
for (int n = 0; n < commandNodes.size(); n++)
{
map<string, string> attributes = commandNodes[n].getAttributes();
if (attributes["name"].compare(commandName) == 0)
{
int commandId = stoi(attributes["id"]);
if (commandId >= 128)
{
if (attributes["module"] == moduleName)
{
return commandId;
}
}
else
{
return commandId;
}
}
}
return -1;
}
示例3: resolveClassId
int CanIdTranslator::resolveClassId(string className)
{
XmlNode classesNode = xmlNode.findChild("classes");
vector<XmlNode> classNodes = classesNode.getChildren();
for (int n = 0; n < classNodes.size(); n++)
{
map<string, string> attributes = classNodes[n].getAttributes();
if (attributes["name"].compare(className) == 0)
{
return stoi(attributes["id"]);
}
}
return -1;
}
示例4: lookupClassName
string CanIdTranslator::lookupClassName(int classId)
{
XmlNode classesNode = xmlNode.findChild("classes");
vector<XmlNode> classNodes = classesNode.getChildren();
for (int n = 0; n < classNodes.size(); n++)
{
map<string, string> attributes = classNodes[n].getAttributes();
if (stoi(attributes["id"]) == classId)
{
return attributes["name"];
}
}
return "";
}
示例5: resolveModuleId
int CanIdTranslator::resolveModuleId(string moduleName)
{
XmlNode modulesNode = xmlNode.findChild("modules");
vector<XmlNode> moduleNodes = modulesNode.getChildren();
for (int n = 0; n < moduleNodes.size(); n++)
{
map<string, string> attributes = moduleNodes[n].getAttributes();
if (attributes["name"].compare(moduleName) == 0)
{
return stoi(attributes["id"]);
}
}
return -1;
}
示例6: lookupModuleName
string CanIdTranslator::lookupModuleName(int moduleId)
{
XmlNode modulesNode = xmlNode.findChild("modules");
vector<XmlNode> moduleNodes = modulesNode.getChildren();
for (int n = 0; n < moduleNodes.size(); n++)
{
map<string, string> attributes = moduleNodes[n].getAttributes();
if (stoi(attributes["id"]) == moduleId)
{
return attributes["name"];
}
}
return "";
}
示例7: resolveDirectionFlag
int CanIdTranslator::resolveDirectionFlag(string directionName)
{
XmlNode definesNode = xmlNode.findChild("defines");
vector<XmlNode> defineNodes = definesNode.getChildren();
for (int n = 0; n < defineNodes.size(); n++)
{
map<string, string> attributes = defineNodes[n].getAttributes();
if (attributes["group"].compare("DirectionFlag") == 0 && attributes["name"].compare(directionName) == 0)
{
return stoi(attributes["id"]);
}
}
return -1;
}
示例8: lookupDirectionFlag
string CanIdTranslator::lookupDirectionFlag(int directionFlag)
{
XmlNode definesNode = xmlNode.findChild("defines");
vector<XmlNode> defineNodes = definesNode.getChildren();
for (int n = 0; n < defineNodes.size(); n++)
{
map<string, string> attributes = defineNodes[n].getAttributes();
if (attributes["group"].compare("DirectionFlag") == 0 && stoi(attributes["id"]) == directionFlag)
{
return attributes["name"];
}
}
return "";
}
示例9: getDefineId
string CanIdTranslator::getDefineId(string name, string group)
{
XmlNode definesNode = xmlNode.findChild("defines");
vector<XmlNode> defineNodes = definesNode.getChildren();
for (int n = 0; n < defineNodes.size(); n++)
{
map<string, string> attributes = defineNodes[n].getAttributes();
if (attributes["group"] == group && attributes["name"] == name)
{
return attributes["id"];
}
}
return "";
}
示例10: resolveNMTCommandId
int CanIdTranslator::resolveNMTCommandId(string commandName)
{
XmlNode commandsNode = xmlNode.findChild("nmt_messages");
vector<XmlNode> commandNodes = commandsNode.getChildren();
for (int n = 0; n < commandNodes.size(); n++)
{
map<string, string> attributes = commandNodes[n].getAttributes();
if (attributes["name"].compare(commandName) == 0)
{
return stoi(attributes["id"]);
}
}
return -1;
}
示例11: lookupNMTCommandName
string CanIdTranslator::lookupNMTCommandName(int commandId)
{
XmlNode commandsNode = xmlNode.findChild("nmt_messages");
vector<XmlNode> commandNodes = commandsNode.getChildren();
for (int n = 0; n < commandNodes.size(); n++)
{
map<string, string> attributes = commandNodes[n].getAttributes();
if (stoi(attributes["id"]) == commandId)
{
return attributes["name"];
}
}
return "";
}
示例12: makeNMTDataValid
void CanIdTranslator::makeNMTDataValid(string commandName, map<string, CanVariable> &data)
{
vector<XmlNode> commandNodes = xmlNode.findChild("nmt_messages").getChildren();
for (int n = 0; n < commandNodes.size(); n++)
{
map<string, string> attributes = commandNodes[n].getAttributes();
if (attributes["name"] == commandName)
{
XmlNode varablesNode = commandNodes[n].findChild("variables");
makeDataValid(varablesNode.getChildren(), data);
return;
}
}
}
示例13: translateData
map<string, CanVariable> CanIdTranslator::translateNMTData(int commandId, string dataHex)
{
vector<XmlNode> commandNodes = xmlNode.findChild("nmt_messages").getChildren();
for (int n = 0; n < commandNodes.size(); n++)
{
map<string, string> attributes = commandNodes[n].getAttributes();
if (stoi(attributes["id"]) == commandId)
{
XmlNode varablesNode = commandNodes[n].findChild("variables");
return translateData(varablesNode.getChildren(), dataHex);
}
}
map<string, CanVariable> variables;
return variables;
}
示例14: lookupCommandName
string CanIdTranslator::lookupCommandName(int commandId, string moduleName)
{
XmlNode commandsNode = xmlNode.findChild("commands");
vector<XmlNode> commandNodes = commandsNode.getChildren();
for (int n = 0; n < commandNodes.size(); n++)
{
map<string, string> attributes = commandNodes[n].getAttributes();
if (commandId >= 128)
{
if (stoi(attributes["id"]) == commandId && attributes["module"] == moduleName)
{
return attributes["name"];
}
}
else if (stoi(attributes["id"]) == commandId)
{
return attributes["name"];
}
}
return "";
}
示例15: handleSpecialCase
void plainconf::handleSpecialCase(XmlNode *pNode)
{
const XmlNodeList *pUnknownList = pNode->getChildren(UNKNOWN_KEYWORDS);
if (!pUnknownList)
return ;
int bModuleNode = (strcasecmp(pNode->getName(), "module") == 0);
XmlNodeList::const_iterator iter;
for (iter = pUnknownList->begin(); iter != pUnknownList->end(); ++iter)
{
const char *value = (*iter)->getValue();
if (bModuleNode)
appendModuleParam(pNode, value);
else
{
const char *p = strstr(value, "::");
//Only hanlde has :: case
if (p)
{
/**
* CASE such as cache::enablecache 1, will be treated as
* module chace {
* param enablecache 1
* }
*/
char newname[1024] = {0};
char newvalue[4096] = {0};
strncpy(newname, value, p - value);
strcpy(newvalue, p + 2);
XmlNode *pRootNode = pNode;
while (pRootNode->getParent())
pRootNode = pRootNode->getParent();
const XmlNodeList *pModuleList = pRootNode->getChildren("module");
if (pModuleList)
{
XmlNodeList::const_iterator iter2;
for (iter2 = pModuleList->begin(); iter2 != pModuleList->end(); ++iter2)
{
if (strcasecmp((*iter2)->getValue(), newname) == 0)
{
addModuleWithParam(pNode, newname, newvalue);
break;
}
}
if (iter2 == pModuleList->end())
logToMem(LOG_LEVEL_ERR,
"Module[%s] not defined in server leve while checking [%s].", newname,
value);
}
else
logToMem(LOG_LEVEL_ERR,
"No module defined in server leve while checking [%s].", value);
}
}
}
}