void FarHrcSettings::UpdatePrototype(xercesc::DOMElement* elem, bool userValue) { const XMLCh* tagProtoAttrParamName = L"name"; const XMLCh* tagParam = L"param"; const XMLCh* tagParamAttrParamName = L"name"; const XMLCh* tagParamAttrParamValue = L"value"; const XMLCh* tagParamAttrParamDescription = L"description"; const XMLCh* typeName = elem->getAttribute(tagProtoAttrParamName); if (typeName == nullptr) { return; } HRCParser* hrcParser = parserFactory->getHRCParser(); DString typenamed = DString(typeName); FileTypeImpl* type = static_cast<FileTypeImpl*>(hrcParser->getFileType(&typenamed)); if (type == nullptr) { return; } for (xercesc::DOMNode* node = elem->getFirstChild(); node != nullptr; node = node->getNextSibling()) { if (node->getNodeType() == xercesc::DOMNode::ELEMENT_NODE) { xercesc::DOMElement* subelem = static_cast<xercesc::DOMElement*>(node); if (xercesc::XMLString::equals(subelem->getNodeName(), tagParam)) { const XMLCh* name = subelem->getAttribute(tagParamAttrParamName); const XMLCh* value = subelem->getAttribute(tagParamAttrParamValue); const XMLCh* descr = subelem->getAttribute(tagParamAttrParamDescription); if (*name == '\0' || *value == '\0') { continue; } if (type->getParamValue(DString(name)) == nullptr) { type->addParam(new SString(DString(name))); } if (descr != nullptr) { type->setParamDescription(DString(name), new SString(DString(descr))); } if (userValue) { type->setParamValue(DString(name), new SString(DString(value))); } else { delete type->getParamDefaultValue(DString(name)); type->setParamDefaultValue(DString(name), new SString(DString(value))); } } } } }
void FarHrcSettings::UpdatePrototype(Element *elem, bool userValue) { const String *typeName = elem->getAttribute(DString("name")); if (typeName == null){ return; } HRCParser *hrcParser = parserFactory->getHRCParser(); FileTypeImpl *type = (FileTypeImpl *)hrcParser->getFileType(typeName); if (type== null){ return; }; for(Node *content = elem->getFirstChild(); content != null; content = content->getNextSibling()){ if (*content->getNodeName() == "param"){ const String *name = ((Element*)content)->getAttribute(DString("name")); const String *value = ((Element*)content)->getAttribute(DString("value")); const String *descr = ((Element*)content)->getAttribute(DString("description")); if (name == null || value == null){ continue; }; if (type->getParamValue(SString(name))==null){ type->addParam(name); } if (descr != null){ type->setParamDescription(SString(name), descr); } if (userValue){ delete type->getParamNotDefaultValue(DString(name)); type->setParamValue(SString(name), value); } else{ delete type->getParamDefaultValue(DString(name)); type->setParamDefaultValue(SString(name), value); } }; }; }