| 681 | } |
| 682 | |
| 683 | void 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 | |
| 718 | bool ParameterGrp::GetBool(const char* Name, bool bPreset) const |
| 719 | { |
nothing calls this directly
no test coverage detected