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

Method GetAttribute

src/Base/Parameter.cpp:602–630  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

600}
601
602const char* ParameterGrp::GetAttribute(
603 ParamType Type,
604 const char* Name,
605 std::string& Value,
606 const char* Default
607) const
608{
609 if (!_pGroupNode) {
610 return Default;
611 }
612
613 const char* T = TypeName(Type);
614 if (!T) {
615 return Default;
616 }
617
618 DOMElement* pcElem = FindElement(_pGroupNode, T, Name);
619 if (!pcElem) {
620 return Default;
621 }
622
623 if (Type == ParamType::FCText) {
624 Value = GetASCII(Name, Default);
625 }
626 else if (Type != ParamType::FCGroup) {
627 Value = StrX(pcElem->getAttribute(XStrLiteral("Value").unicodeForm())).c_str();
628 }
629 return Value.c_str();
630}
631
632std::vector<std::pair<std::string, std::string>> ParameterGrp::GetAttributeMap(
633 ParamType Type,

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected