当前位置: 首页>>代码示例>>C++>>正文


C++ Children::front方法代码示例

本文整理汇总了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;
  }
开发者ID:gideonmay,项目名称:minervagis,代码行数:55,代码来源:GeoRSSLayer.cpp


注:本文中的Children::front方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。