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

Method WriteXML

cpp/src/Group.cpp:196–230  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

194// Write ourselves to an XML document
195//-----------------------------------------------------------------------------
196void Group::WriteXML
197(
198 TiXmlElement* _groupElement
199)
200{
201 char str[16];
202
203 snprintf( str, 16, "%d", m_groupIdx );
204 _groupElement->SetAttribute( "index", str );
205
206 snprintf( str, 16, "%d", m_maxAssociations );
207 _groupElement->SetAttribute( "max_associations", str );
208
209 _groupElement->SetAttribute( "label", m_label.c_str() );
210 _groupElement->SetAttribute( "auto", m_auto ? "true" : "false" );
211 if( m_multiInstance )
212 {
213 _groupElement->SetAttribute( "multiInstance", m_multiInstance ? "true" : "false" );
214 }
215
216 for( map<InstanceAssociation,AssociationCommandVec,classcomp>::iterator it = m_associations.begin(); it != m_associations.end(); ++it )
217 {
218 TiXmlElement* associationElement = new TiXmlElement( "Node" );
219
220 snprintf( str, 16, "%d", it->first.m_nodeId );
221 associationElement->SetAttribute( "id", str );
222 if (it->first.m_instance != 0)
223 {
224 snprintf( str, 16, "%d", it->first.m_instance );
225 associationElement->SetAttribute( "instance", str );
226 }
227
228 _groupElement->LinkEndChild( associationElement );
229 }
230}
231
232//-----------------------------------------------------------------------------
233// <Group::Contains>

Callers

nothing calls this directly

Calls 5

SetAttributeMethod · 0.80
LinkEndChildMethod · 0.80
c_strMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected