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

Method findFiles

src/App/ProjectFile.cpp:587–619  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

585}
586
587void ProjectFile::findFiles(XERCES_CPP_NAMESPACE::DOMNode* node,
588 std::list<ProjectFile::PropertyFile>& files) const
589{
590 if (node->hasAttributes()) {
591 ProjectFile::PropertyFile prop;
592 DOMNode* fileAttr = node->getAttributes()->getNamedItem(XStrLiteral("file").unicodeForm());
593 if (fileAttr) {
594 DOMNode* parentNode = node->getParentNode();
595 if (parentNode) {
596 DOMNode* nameAttr =
597 parentNode->getAttributes()->getNamedItem(XStrLiteral("name").unicodeForm());
598 if (nameAttr) {
599 prop.name = StrX(nameAttr->getNodeValue()).c_str();
600 }
601
602 DOMNode* typeAttr =
603 parentNode->getAttributes()->getNamedItem(XStrLiteral("type").unicodeForm());
604 if (typeAttr) {
605 prop.type = Base::Type::fromName(StrX(typeAttr->getNodeValue()).c_str());
606 }
607 }
608
609 prop.file = StrX(fileAttr->getNodeValue()).c_str();
610 files.push_back(prop);
611 }
612 }
613
614 DOMNodeList* subNodes = node->getChildNodes();
615 for (XMLSize_t i = 0; i < subNodes->getLength(); i++) {
616 DOMNode* child = subNodes->item(i);
617 findFiles(child, files);
618 }
619}
620
621bool ProjectFile::containsFile(const std::string& name) const
622{

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected