本文整理汇总了C++中TimerList::setTotal方法的典型用法代码示例。如果您正苦于以下问题:C++ TimerList::setTotal方法的具体用法?C++ TimerList::setTotal怎么用?C++ TimerList::setTotal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TimerList
的用法示例。
在下文中一共展示了TimerList::setTotal方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: showTimers
void TimersResponder::showTimers(ostream& out, cxxtools::http::Request& request, cxxtools::http::Reply& reply)
{
QueryHandler q("/timers", request);
TimerList* timerList;
Timers.SetModified();
if ( q.isFormat(".json") ) {
reply.addHeader("Content-Type", "application/json; charset=utf-8");
timerList = (TimerList*)new JsonTimerList(&out);
} else if ( q.isFormat(".html") ) {
reply.addHeader("Content-Type", "text/html; charset=utf-8");
timerList = (TimerList*)new HtmlTimerList(&out);
} else if ( q.isFormat(".xml") ) {
reply.addHeader("Content-Type", "text/xml; charset=utf-8");
timerList = (TimerList*)new XmlTimerList(&out);
} else {
reply.httpReturn(404, "Resources are not available for the selected format. (Use: .json, .html or .xml)");
return;
}
int start_filter = q.getOptionAsInt("start");
int limit_filter = q.getOptionAsInt("limit");
string timer_id = q.getParamAsString(0);
if ( start_filter >= 0 && limit_filter >= 1 ) {
timerList->activateLimit(start_filter, limit_filter);
}
timerList->init();
vector< cTimer* > timers = VdrExtension::SortedTimers();
for (int i=0;i<(int)timers.size();i++)
{
if ( VdrExtension::getTimerID(timers[i]) == timer_id || timer_id.length() == 0 ) {
timerList->addTimer(timers[i]);
}
}
timerList->setTotal((int)timers.size());
timerList->finish();
delete timerList;
}
示例2: replyCreatedId
void TimersResponder::replyCreatedId(cTimer* timer, cxxtools::http::Request& request, cxxtools::http::Reply& reply, ostream& out)
{
QueryHandler q("/timers", request);
TimerList* timerList;
if ( q.isFormat(".html") ) {
reply.addHeader("Content-Type", "text/html; charset=utf-8");
timerList = (TimerList*)new HtmlTimerList(&out);
} else if ( q.isFormat(".xml") ) {
reply.addHeader("Content-Type", "text/xml; charset=utf-8");
timerList = (TimerList*)new XmlTimerList(&out);
} else {
reply.addHeader("Content-Type", "application/json; charset=utf-8");
timerList = (TimerList*)new JsonTimerList(&out);
}
timerList->init();
timerList->addTimer(timer);
timerList->setTotal(1);
timerList->finish();
delete timerList;
}