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


C++ shared_ptr::isTagNode方法代码示例

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


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

示例1: vpath

bool
commit::isCommitPathEffective(Cstore& cs, const Cpath& pcomps,
                              tr1::shared_ptr<Ctemplate> def,
                              bool in_active, bool in_working)
{
  if (in_active && in_working) {
    // remain the same
    return true;
  }
  if (!in_active && !in_working) {
    // doesn't exist
    return false;
  }
  // at this point, in_active corresponds to "being deleted"

  if (def->isTagNode()) {
    // special handling for tag nodes, which are never marked
    vector<string> tvals;
    // get tag values from active or working config
    cs.cfgPathGetChildNodes(pcomps, tvals, in_active);
    Cpath vpath(pcomps);
    /* note that there should be at least 1 tag value since tag node
     * cannot exist without tag value.
     */
    for (size_t i = 0; i < tvals.size(); i++) {
      vpath.push(tvals[i]);
      if (in_active) {
        // being deleted => all tag values are being deleted
        if (!cs.cfgPathMarkedCommitted(vpath, true)) {
          /* a tag value is not marked committed
           * => a tag value has not been deleted
           * => tag node has not been deleted
           * => still effective
           */
          return true;
        }
      } else {
        // being added => all tag values are being added
        if (cs.cfgPathMarkedCommitted(vpath, false)) {
          /* a tag value is marked committed
           * => a tag value has been added
           * => tag node has been added
           * => already effective
           */
          return true;
        }
      }
      vpath.pop();
    }
    // not effective
    return false;
  }

  /* if not tag node, effectiveness corresponds to committed marking:
   *   if deleted (i.e., in_active), then !marked is effective
   *   otherwise (i.e., added), marked is effective
   */
  bool marked = cs.cfgPathMarkedCommitted(pcomps, in_active);
  return (in_active ? !marked : marked);
}
开发者ID:beamerblvd,项目名称:vyatta-cfg,代码行数:60,代码来源:commit-algorithm.cpp


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