本文整理汇总了C++中xml::Node::add方法的典型用法代码示例。如果您正苦于以下问题:C++ Node::add方法的具体用法?C++ Node::add怎么用?C++ Node::add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xml::Node
的用法示例。
在下文中一共展示了Node::add方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: readChanAtoms
// ------------------------------------------
void PCPStream::readChanAtoms(AtomStream &atom, int numc, BroadcastState &bcs) {
/* Channel *ch=NULL;
ChanHitList *chl=NULL;
ChanInfo newInfo;
ch = chanMgr->findChannelByID(bcs.chanID);
chl = chanMgr->findHitListByID(bcs.chanID);
if (ch)
newInfo = ch->info;
else if (chl)
newInfo = chl->info;*/
Channel *ch = NULL;
ChanHitList *chl = NULL;
ChanInfo newInfo, chaInfo;
ch = this->parent;
if (ch) {
newInfo = ch->info;
chaInfo = ch->info;
}
for (int i = 0; i < numc; i++) {
int c, d;
ID4 id = atom.read(c, d);
if ((id == PCP_CHAN_PKT) && (ch)) {
readPktAtoms(ch, atom, c, bcs);
} else if (id == PCP_CHAN_INFO) {
newInfo.readInfoAtoms(atom, c);
} else if (id == PCP_CHAN_TRACK) {
newInfo.readTrackAtoms(atom, c);
} else if (id == PCP_CHAN_BCID) {
atom.readBytes(newInfo.bcID.id, 16);
} else if (id == PCP_CHAN_KEY) // depreciated
{
atom.readBytes(newInfo.bcID.id, 16);
newInfo.bcID.id[0] = 0; // clear flags
} else if (id == PCP_CHAN_ID) {
atom.readBytes(newInfo.id.id, 16);
ch = chanMgr->findChannelByID(newInfo.id);
chl = chanMgr->findHitListByID(newInfo.id);
} else {
LOG_DEBUG("PCP skip: %s,%d,%d", id.getString().str(), c, d);
atom.skip(c, d);
}
}
chl = chanMgr->findHitList(newInfo);
if (!chl)
chl = chanMgr->addHitList(newInfo);
if (chl) {
chl->info.update(newInfo);
if (!servMgr->chanLog.isEmpty()) {
//if (chl->numListeners())
{
try {
FileStream file;
file.openWriteAppend(servMgr->chanLog.cstr());
XML::Node *rn = new XML::Node("update time=\"%d\"", sys->getTime());
XML::Node *n = chl->info.createChannelXML();
n->add(chl->createXML(false));
n->add(chl->info.createTrackXML());
rn->add(n);
rn->write(file, 0);
delete rn;
file.close();
} catch (StreamException &e) {
LOG_ERROR("Unable to update channel log: %s", e.msg);
}
}
}
}
if (ch && !ch->isBroadcasting())
ch->updateInfo(newInfo);
}