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

Method getTypeId

src/App/ProjectFile.cpp:515–547  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

513}
514
515Base::Type ProjectFile::getTypeId(const std::string& name) const
516{
517 // <Objects Count="1">
518 // <Object type="Mesh::MeshFeature" name="Mesh" />
519 // <Objects/>
520 if (!xmlDocument) {
521 return Base::Type::BadType;
522 }
523
524 DOMNodeList* nodes = xmlDocument->getElementsByTagName(XStrLiteral("Objects").unicodeForm());
525 for (XMLSize_t i = 0; i < nodes->getLength(); i++) {
526 DOMNode* node = nodes->item(i);
527 if (node->getNodeType() == DOMNode::ELEMENT_NODE) {
528 DOMNodeList* objectList = static_cast<DOMElement*>(node)->getElementsByTagName(
529 XStrLiteral("Object").unicodeForm()); // NOLINT
530 for (XMLSize_t j = 0; j < objectList->getLength(); j++) {
531 DOMNode* objectNode = objectList->item(j);
532 DOMNode* typeAttr =
533 objectNode->getAttributes()->getNamedItem(XStrLiteral("type").unicodeForm());
534 DOMNode* nameAttr =
535 objectNode->getAttributes()->getNamedItem(XStrLiteral("name").unicodeForm());
536 if (typeAttr && nameAttr) {
537 if (strcmp(name.c_str(), StrX(nameAttr->getNodeValue()).c_str()) == 0) {
538 std::string typeId = StrX(typeAttr->getNodeValue()).c_str();
539 return Base::Type::fromName(typeId.c_str());
540 }
541 }
542 }
543 }
544 }
545
546 return Base::Type::BadType;
547}
548
549std::list<ProjectFile::PropertyFile> ProjectFile::getPropertyFiles(const std::string& name) const
550{

Callers 15

getMeasureHandlerMethod · 0.45
isSameMethod · 0.45
representationMethod · 0.45
syncCopyOnChangeMethod · 0.45
setupCopyOnChangeMethod · 0.45
checkCopyOnChangeMethod · 0.45
isSameFunction · 0.45
writeObjectTypeMethod · 0.45
_addObjectMethod · 0.45
changePropertyMethod · 0.45
addObjectNewMethod · 0.45
addObjectDelMethod · 0.45

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