MCPcopy Create free account
hub / github.com/OpenZWave/open-zwave / WriteXML

Method WriteXML

cpp/src/value_classes/ValueBitSet.cpp:195–232  ·  view source on GitHub ↗

----------------------------------------------------------------------------- Write ourselves to an XML document -----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

193// Write ourselves to an XML document
194//-----------------------------------------------------------------------------
195void ValueBitSet::WriteXML
196(
197 TiXmlElement* _valueElement
198)
199{
200 Value::WriteXML( _valueElement );
201 char str[16];
202
203 snprintf(str, sizeof(str), "%d", m_BitMask);
204 _valueElement->SetAttribute( "bitmask", str);
205
206 snprintf( str, sizeof(str), "%d", m_value.GetValue() );
207 _valueElement->SetAttribute( "value", str );
208
209 snprintf( str, sizeof(str), "%d", m_size );
210 _valueElement->SetAttribute( "size", str );
211
212 TiXmlElement *helpElement = _valueElement->FirstChildElement("Help");
213 if (!helpElement) {
214 helpElement = new TiXmlElement( "Help" );
215 _valueElement->LinkEndChild( helpElement );
216 }
217 for (std::vector<int32>::iterator it = m_bits.begin(); it != m_bits.end(); ++it) {
218 TiXmlElement* BitSetElement = new TiXmlElement( "BitSet" );
219 BitSetElement->SetAttribute("id", *it);
220 _valueElement->LinkEndChild( BitSetElement );
221
222 TiXmlElement* BitSetLabelElement = new TiXmlElement( "Label" );
223 TiXmlText* labeltextElement = new TiXmlText(Localization::Get()->GetValueItemLabel(m_id.GetCommandClassId(), m_id.GetIndex(), -1, *it).c_str());
224 BitSetLabelElement->LinkEndChild( labeltextElement );
225 BitSetElement->LinkEndChild( BitSetLabelElement );
226
227 TiXmlElement* BitSetHelpElement = new TiXmlElement( "Help" );
228 TiXmlText* helptextElement = new TiXmlText(Localization::Get()->GetValueItemHelp(m_id.GetCommandClassId(), m_id.GetIndex(), -1, *it).c_str());
229 BitSetHelpElement->LinkEndChild( helptextElement );
230 BitSetElement->LinkEndChild( BitSetHelpElement );
231 }
232}
233
234//-----------------------------------------------------------------------------
235// <ValueBitSet::Set>

Callers

nothing calls this directly

Calls 11

SetAttributeMethod · 0.80
LinkEndChildMethod · 0.80
GetValueItemLabelMethod · 0.80
GetValueItemHelpMethod · 0.80
GetFunction · 0.50
GetValueMethod · 0.45
FirstChildElementMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
c_strMethod · 0.45
GetCommandClassIdMethod · 0.45

Tested by

no test coverage detected