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

Method _SetAttribute

src/Base/Parameter.cpp:683–716  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

681}
682
683void ParameterGrp::_SetAttribute(ParamType T, const char* Name, const char* Value)
684{
685 const char* Type = TypeName(T);
686 if (!Type) {
687 return;
688 }
689 if (!_pGroupNode) {
690 if (FC_LOG_INSTANCE.isEnabled(FC_LOGLEVEL_LOG)) {
691 FC_WARN("Setting attribute " << Type << ":" << Name << " in an orphan group " << _cName);
692 }
693 return;
694 }
695 if (_Clearing) {
696 if (FC_LOG_INSTANCE.isEnabled(FC_LOGLEVEL_LOG)) {
697 FC_WARN("Adding attribute " << Type << ":" << Name << " while clearing " << GetPath());
698 }
699 return;
700 }
701
702 // find or create the Element
703 DOMElement* pcElem = FindOrCreateElement(_pGroupNode, Type, Name);
704 if (pcElem) {
705 XStr attr("Value");
706 // set the value only if different
707 if (strcmp(StrX(pcElem->getAttribute(attr.unicodeForm())).c_str(), Value) != 0) {
708 pcElem->setAttribute(attr.unicodeForm(), XStr(Value).unicodeForm());
709 // trigger observer
710 _Notify(T, Name, Value);
711 }
712 // For backward compatibility, old observer gets notified regardless of
713 // value changes or not.
714 Notify(Name);
715 }
716}
717
718bool ParameterGrp::GetBool(const char* Name, bool bPreset) const
719{

Callers

nothing calls this directly

Calls 7

StrXClass · 0.85
XStrClass · 0.85
unicodeFormMethod · 0.80
setAttributeMethod · 0.80
isEnabledMethod · 0.45
c_strMethod · 0.45
getAttributeMethod · 0.45

Tested by

no test coverage detected