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


C++ vector::numberOfChildren方法代码示例

本文整理汇总了C++中std::vector::numberOfChildren方法的典型用法代码示例。如果您正苦于以下问题:C++ vector::numberOfChildren方法的具体用法?C++ vector::numberOfChildren怎么用?C++ vector::numberOfChildren使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在std::vector的用法示例。


在下文中一共展示了vector::numberOfChildren方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: rollChildren

/**
 * Check if our children are unrolled and if so roll them back up.
 *
 * @param it :: iterator pointing to the item whose children will be rolled up.
 */
void HistoryView::rollChildren(std::vector<HistoryItem>::iterator it) {
  const size_t numChildren = it->numberOfChildren();
  ++it;
  for (size_t i = 0; i < numChildren; ++i) {
    if (it->isUnrolled())
      roll(it);
  }
}
开发者ID:mantidproject,项目名称:mantid,代码行数:13,代码来源:HistoryView.cpp

示例2: buildChildren

/**
 * Iterate over each of the items children and output them to the script.
 *
 * This moves the iterator forward over each of the child records and writes them to 
 * the stream.
 *
 * @param os :: output string stream to append algorithms to.
 * @param iter :: reference to the iterator pointing to the vector of history items
 * @param depth :: count of how far we've recursed into the history
 */
void ScriptBuilder::buildChildren(std::ostringstream& os, std::vector<HistoryItem>::const_iterator& iter, int depth)
{
  size_t numChildren = iter->numberOfChildren();
  ++iter; //move to first child
  for(size_t i = 0; i < numChildren && iter != m_historyItems.end(); ++i, ++iter)
  {
    writeHistoryToStream(os, iter, depth);
  }
  --iter;
}
开发者ID:jkrueger1,项目名称:mantid,代码行数:20,代码来源:ScriptBuilder.cpp

示例3: buildChildren

/**
 * Iterate over each of the items children and output them to the script.
 * This moves the iterator forward over each of the child records and writes
 * them to the stream.
 *
 * @param iter :: reference to the iterator pointing to the vector of history
 *items
 */
void NotebookBuilder::buildChildren(
    std::vector<HistoryItem>::const_iterator &iter) {
  size_t numChildren = iter->numberOfChildren();
  ++iter; // move to first child
  for (size_t i = 0; i < numChildren && iter != m_historyItems.end();
       ++i, ++iter) {
    writeHistoryToStream(iter);
  }
  --iter;
}
开发者ID:spaceyatom,项目名称:mantid,代码行数:18,代码来源:NotebookBuilder.cpp

示例4: roll

/**
 * Roll an unrolled algorithm history item and remove its children from the
 *view.
 *
 * This removes each of the child algorithm histories (if any) and marks
 * the parent as being "rolled up". Note that this will recursively "roll up"
 *any child
 * history objects that are also unrolled. This method does nothing if
 * the history object has no children.
 *
 * @param it :: iterator to the list of history item objects at the positon to
 *roll
 */
void HistoryView::roll(std::vector<HistoryItem>::iterator &it) {

  // the number of records after this position
  const size_t numChildren = it->numberOfChildren();
  if (it->isUnrolled() && numChildren > 0) {
    // mark this record as not being ignored by the script builder
    it->unrolled(false);
    this->rollChildren(it);
    // Then just remove the children from the list
    ++it;
    it = m_historyItems.erase(it, it + numChildren);
  } else
    ++it;
}
开发者ID:mantidproject,项目名称:mantid,代码行数:27,代码来源:HistoryView.cpp


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