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

Method GetAttributeMap

src/Base/Parameter.cpp:632–674  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

630}
631
632std::vector<std::pair<std::string, std::string>> ParameterGrp::GetAttributeMap(
633 ParamType Type,
634 const char* sFilter
635) const
636{
637 std::vector<std::pair<std::string, std::string>> res;
638 if (!_pGroupNode) {
639 return res;
640 }
641
642 const char* T = TypeName(Type);
643 if (!T) {
644 return res;
645 }
646
647 std::string Name;
648
649 DOMElement* pcTemp = FindElement(_pGroupNode, T);
650 while (pcTemp) {
651 Name = StrX(
652 static_cast<DOMElement*>(pcTemp)
653 ->getAttributes()
654 ->getNamedItem(XStrLiteral("Name").unicodeForm())
655 ->getNodeValue()
656 )
657 .c_str();
658 // check on filter condition
659 if (!sFilter || Name.find(sFilter) != std::string::npos) {
660 if (Type == ParamType::FCGroup) {
661 res.emplace_back(Name, std::string());
662 }
663 else {
664 res.emplace_back(
665 Name,
666 StrX(static_cast<DOMElement*>(pcTemp)->getAttribute(XStrLiteral("Value").unicodeForm()))
667 .c_str()
668 );
669 }
670 }
671 pcTemp = FindNextElement(pcTemp, T);
672 }
673 return res;
674}
675
676void ParameterGrp::_Notify(ParamType Type, const char* Name, const char* Value)
677{

Callers

nothing calls this directly

Calls 6

StrXClass · 0.85
getAttributesMethod · 0.80
unicodeFormMethod · 0.80
c_strMethod · 0.45
findMethod · 0.45
getAttributeMethod · 0.45

Tested by

no test coverage detected