MCPcopy Create free account
hub / github.com/FreeCAD/FreeCAD / getInputFiles

Method getInputFiles

src/App/ProjectFile.cpp:635–671  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

633}
634
635std::list<std::string> ProjectFile::getInputFiles(const std::string& name) const
636{
637 // <ObjectData Count="1">
638 // <Object name="Mesh">
639 // <Properties Count="1">
640 // <Property name="Mesh" type="Mesh::PropertyMeshKernel">
641 // <Mesh file="MeshKernel.bms"/>
642 // <Property/>
643 // <Properties/>
644 // <Object/>
645 // <ObjectData/>
646 if (!xmlDocument) {
647 return {};
648 }
649
650 std::list<std::string> files;
651 DOMNodeList* nodes = xmlDocument->getElementsByTagName(XStrLiteral("ObjectData").unicodeForm());
652 for (XMLSize_t i = 0; i < nodes->getLength(); i++) {
653 DOMNode* node = nodes->item(i);
654 if (node->getNodeType() == DOMNode::ELEMENT_NODE) {
655 DOMNodeList* objectList = static_cast<DOMElement*>(node)->getElementsByTagName(
656 XStrLiteral("Object").unicodeForm()); // NOLINT
657 for (XMLSize_t j = 0; j < objectList->getLength(); j++) {
658 DOMNode* objectNode = objectList->item(j);
659 DOMNode* nameAttr =
660 objectNode->getAttributes()->getNamedItem(XStrLiteral("name").unicodeForm());
661 if (nameAttr && strcmp(name.c_str(), StrX(nameAttr->getNodeValue()).c_str()) == 0) {
662 // now go recursively through the sub-tree (i.e. the properties) and collect
663 // every file attribute
664 findFiles(objectNode, files);
665 break;
666 }
667 }
668 }
669 }
670 return files;
671}
672
673void ProjectFile::findFiles(XERCES_CPP_NAMESPACE::DOMNode* node,
674 std::list<std::string>& files) const

Callers

nothing calls this directly

Calls 6

StrXClass · 0.85
unicodeFormMethod · 0.80
itemMethod · 0.80
getAttributesMethod · 0.80
getLengthMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected