7 #include "tinyxml/tinyxml.h"
9 #include "libwfut/ChannelIO.h"
13 static int writeChannel(TiXmlElement *element,
const ChannelObject &channel) {
16 TiXmlElement name(TAG_name);
17 name.InsertEndChild(TiXmlText(channel.name));
18 element->InsertEndChild(name);
20 TiXmlElement description(TAG_description);
21 description.InsertEndChild(TiXmlText(channel.description));
22 element->InsertEndChild(description);
24 TiXmlElement url(TAG_url);
25 url.InsertEndChild(TiXmlText(channel.url));
26 element->InsertEndChild(url);
28 TiXmlElement email(TAG_email);
29 email.InsertEndChild(TiXmlText(channel.email));
30 element->InsertEndChild(email);
32 TiXmlElement logo(TAG_logo);
33 logo.InsertEndChild(TiXmlText(channel.logo));
34 element->InsertEndChild(logo);
39 int writeChannelList(
const std::string &filename,
const ChannelList &channels) {
41 doc.InsertEndChild(TiXmlDeclaration(
"1.0",
"",
""));
43 TiXmlElement clist(TAG_channellist);
45 ChannelList::const_iterator itr = channels.begin();
46 while (itr != channels.end()) {
47 TiXmlElement channel(TAG_channel);
48 writeChannel(&channel, *itr);
49 clist.InsertEndChild(channel);
53 doc.InsertEndChild(clist);
54 if (!doc.SaveFile(filename)) {