本文整理汇总了C++中Children::front方法的典型用法代码示例。如果您正苦于以下问题:C++ Children::front方法的具体用法?C++ Children::front怎么用?C++ Children::front使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Children
的用法示例。
在下文中一共展示了Children::front方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _read
void GeoRSSLayer::_read ( const std::string &filename, Usul::Interfaces::IUnknown *caller, Usul::Interfaces::IUnknown *progress )
{
// Make sure the file exists before reading.
if ( false == boost::filesystem::exists ( filename ) )
return;
// Set the name.
if ( true == this->name().empty() )
this->name ( this->url() );
// Scope the reading flag.
Usul::Scope::Caller::RefPtr scope ( Usul::Scope::makeCaller ( boost::bind ( &GeoRSSLayer::reading, this, true ),
boost::bind ( &GeoRSSLayer::reading, this, false ) ) );
// TODO: I think a SAX parser is more appropraite here, because we can stop the parsing if there isn't new data.
XmlTree::Document::RefPtr doc ( new XmlTree::Document );
doc->load ( filename );
// Get the date the stream was modified.
Children lastPubDateNode ( doc->find ( "lastBuildDate", true ) );
const std::string date ( false == lastPubDateNode.empty() ? lastPubDateNode.front()->value() : "" );
boost::posix_time::ptime utcTime ( Minerva::Core::Data::Date::createFromRSS ( date ) );
boost::posix_time::ptime lastDataUpdate ( Usul::Threads::Safe::get ( this->mutex(), _lastDataUpdate ) );
std::cout << "Last data update: " << lastDataUpdate << std::endl;
std::cout << "Last feed update: " << utcTime << std::endl;
// Check the date against the time time we updated.
if ( false == this->dirtyData() && false == lastDataUpdate.is_not_a_date_time() && false == utcTime.is_not_a_date_time() )
{
// Return now if the feed has not been updated.
if ( lastDataUpdate >= utcTime )
{
// Our data doesn't need to be updated.
this->dirtyData ( false );
return;
}
}
// Clear what we have.
this->clear();
unsigned int i ( 0 );
// Get all the items.
Children children ( doc->find ( "item", true ) );
BOOST_FOREACH ( XmlTree::Node::ValidRefPtr node, children )
{
std::cout << "Adding item " << ++i << " of " << children.size() << std::endl;
this->_parseItem( *node );
if ( this->size() >= this->maximumItems() )
break;
}