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


C++ removeNode函数代码示例

本文整理汇总了C++中removeNode函数的典型用法代码示例。如果您正苦于以下问题:C++ removeNode函数的具体用法?C++ removeNode怎么用?C++ removeNode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: removeNodeAllTest

/**
* Runs tests on the removeNode function by removing all the nodes in the list
**/
void removeNodeAllTest(ListPtr list, int count)
{
	int i;
	int testSize = count;
	for(i = 0; i < count; i++)
	{
		testSize--;
		NodePtr node = removeNode(list, search(list, testSize));
		if(node == NULL) {printf("Node is NULL"); continue;}
		//printf("i: %d jobid: %d size: %d testSize: %d tail: %d", i, node->data->jobid, list->size, testSize, list->tail->data->jobid );
		//printf("1: %d 2: %d 3: %d 4: %d", node->data->jobid != testSize, list->size != testSize, (list->head != NULL && list->head->data->jobid != 0), (list->tail != NULL && list->tail->data->jobid != testSize - 1));
		if(node->data->jobid != testSize
			|| list->size != testSize
			|| (list->head != NULL && list->head->data->jobid != 0)
			|| (list->tail != NULL && list->tail->data->jobid != testSize - 1)
		)
		{
			printf("\n%s\n%s\n", sep, "Error: removeNodeAll invalid");
			break;
		}
		freeNode(node);
	}
	if(DEBUG > 0)
		verifyRearAll(list, count);
}
开发者ID:thomascampbelladams,项目名称:dash,代码行数:28,代码来源:TestList.c

示例2: mergeNodes

void mergeNodes(pugi::xml_node toNode, pugi::xml_node& fromNode)
{
  // Base case = both nodes are text nodes
  pugi::xml_text fromNodeText = fromNode.text();
  pugi::xml_text toNodeText = toNode.text();
  if (fromNodeText && toNodeText) {
    SBLog::info() << "Overwriting template value of \"" << toNode.name() << "\" from \"" << toNodeText.get() << "\" to \"" << fromNodeText.get() << "\"." << std::endl;
    toNodeText.set(fromNodeText.get());
    return;
  }

  // Calculate number of children in toNode
  unsigned maxDistance = std::distance(toNode.begin(), toNode.end());

  // Merge children
  for (pugi::xml_node fromNodeChild = fromNode.first_child(); fromNodeChild; fromNodeChild = fromNodeChild.next_sibling()) {
    // Find appropriate merge point
    pugi::xml_node toNodeChild = findSimilarNode(fromNodeChild, toNode, maxDistance);
    if (toNodeChild) {
      mergeNodes(toNodeChild, fromNodeChild);
    } else {
      toNode.append_copy(fromNodeChild);
    }
  }

  // Erase fromNode
  removeNode(fromNode);
}
开发者ID:netroby,项目名称:WinObjC,代码行数:28,代码来源:vshelpers.cpp

示例3: insertSiblingNodeRangeBefore

void DecreaseSelectionListLevelCommand::doApply()
{
    Node* startListChild;
    Node* endListChild;
    if (!canDecreaseListLevel(endingSelection(), startListChild, endListChild))
        return;

    Node* previousItem = startListChild->renderer()->previousSibling() ? startListChild->renderer()->previousSibling()->element() : 0;
    Node* nextItem = endListChild->renderer()->nextSibling() ? endListChild->renderer()->nextSibling()->element() : 0;
    Element* listNode = startListChild->parentElement();

    if (!previousItem) {
        // at start of sublist, move the child(ren) to before the sublist
        insertSiblingNodeRangeBefore(startListChild, endListChild, listNode);
        // if that was the whole sublist we moved, remove the sublist node
        if (!nextItem)
            removeNode(listNode);
    } else if (!nextItem) {
        // at end of list, move the child(ren) to after the sublist
        insertSiblingNodeRangeAfter(startListChild, endListChild, listNode);    
    } else if (listNode) {
        // in the middle of list, split the list and move the children to the divide
        splitElement(listNode, startListChild);
        insertSiblingNodeRangeBefore(startListChild, endListChild, listNode);
    }
}
开发者ID:Fale,项目名称:qtmoko,代码行数:26,代码来源:ModifySelectionListLevel.cpp

示例4: deleteNode

bst deleteNode( bst b, int x,int y , bst father ) {
  if ( b == NULL ) return b;
  if ( is_lower_than(x,y,b->x,b->y ) < 0 ) b->sx = deleteNode( b->sx, x,y, b );
  if ( is_lower_than(x,y,b->x,b->y ) > 0) b->dx = deleteNode( b->dx, x,y, b );
  if ( is_lower_than(x,y,b->x,b->y ) == 0) {
    if ( ( b->sx == NULL ) || ( b->dx == NULL ) ) b = removeNode( b, father );
    else {
      bst m = b->sx, f = b;
      while ( m->dx ) { f = m; m = m->dx; }
      b->x = m->x;
	  b->y = m->y;
      m = removeNode( m, f );
    }
  }
  return b;
}
开发者ID:bimbomix1,项目名称:monnalisaico,代码行数:16,代码来源:base.c

示例5: setlocale

void GVSkeletonGraph::clearNodes(){
    setlocale(LC_NUMERIC,"en_US.UTF-8"); // Débug séparateur de décimales en version française
	QList<QString> keys = _nodes.keys();
	for(int i=0;i<keys.size();++i){
		removeNode(keys.at(i));
	}
}
开发者ID:EmnaBenAbdallah,项目名称:pgrou,代码行数:7,代码来源:GVSkeletonGraph.cpp

示例6: removeNode

/* 
*  Internal function to remove a node from a tree - used by assert() method
*
*  Returns:
*    0 - don't remove the parent node
*    1 - consider removing the parent node (if no value or root)
*    2 - remove the parent node (even if it has a value and/or root)
*/
static int removeNode(nbCELL context,BTree *tree,BTreeNode **nodeP,nbSET *argSetP){
  NB_TreePath path;
  BTreeNode *node=*nodeP;
  nbCELL argCell;
  int code=1;

  argCell=nbListGetCellValue(context,argSetP);
  if(argCell==NULL){
    if(node==NULL) return(3);  // the perfect match - nothing to nothing
    code=2; 
    return(2);                   //
    }
  else{
    if(node==NULL) return(0);  // can't match to empty tree
    if(tree->options&BTREE_OPTION_ORDER) 
      node=(BTreeNode *)nbTreeLocateValue(&path,argCell,(NB_TreeNode **)nodeP,treeCompare,context);
    else node=nbTreeLocate(&path,argCell,(NB_TreeNode **)nodeP);   
    nbCellDrop(context,argCell);
    if(node==NULL) return(0);          // didn't find argument
    switch(removeNode(context,tree,&node->root,argSetP)){
      case 0: return(0);
      case 1:
        if(node->root!=NULL) return(0);  // still need this node
        break;
      // For case 2 we just fall thru to unlink the node
      }
    }
  if(node->root!=NULL) return(0);  
  nbTreeRemove(&path);  // Remove node from binary search tree
  if(node->bnode.key!=NULL) node->bnode.key=nbCellDrop(context,(nbCELL)node->bnode.key);  // release key
  //if(node->root!=NULL) node->root =removeTree(context,tree,node->root);
  nbFree(node,sizeof(BTreeNode));
  return(code);
  }
开发者ID:michaelxu1107,项目名称:nodebrain-nb,代码行数:42,代码来源:nb_baseline.c

示例7: S_removeUnusedVariables

int S_removeUnusedVariables(struct Node *t) {
  if (t == NULL)
    return 0;
  
  if (t->tag == TASSIGN) {
    char *name = t->children->iname;
    if (variableIsUsed(name) == 0) {
      fprintf(warn, "Removing Variable Assignment: %s\n", name);
      if (t->parent != NULL) {
        if (t->parent->children == t) {
          t->parent->children = t->next;
        }
      }
      removeNode(t);
      return 1;
    } else {
      registerAllUsedVariables(t->children->next);
      return 0;
    }
  }else if (t->tag == TCOMBINE) {
    struct Node *pntr = t->children;
    struct Node *tmp = NULL;
    if (pntr == NULL) {
      return 0;
    }
    while (pntr->next != NULL) {
      pntr = pntr->next;
    }
    while (pntr != NULL) {
      tmp = pntr;
      pntr = pntr->previous;
      S_removeUnusedVariables(tmp);
    }
    if (t->children == NULL) {
      removeNode(t);
      return 1;
    }
  } else {
    struct Node *tmp = t->children;
    while (tmp != NULL) {
      registerAllUsedVariables(tmp);
      tmp = tmp->next;
    }
    return 0;
  }
  return 0;
}
开发者ID:pascalaldo,项目名称:PPODESUITE,代码行数:47,代码来源:simplify.c

示例8: main

void main()
{
	cout<<"请输入有向图的节点,以-1,-1结束:"<<endl;
	int i,j;
	while(true)
	{
		cin>>i>>j;
		if(i==-1 && j==-1) break;
		if(i<0  || j<0)
		{
			cout<<"输入错误"<<endl;
			exit(1);
		}
		arc[i][j] = 1;
		cout<<endl;
	}
	cout<<"节点数(1~"<<MAX_NODE<<"):"<<endl;
	cin>>n;
	if(n<1 || n>MAX_NODE)
	{
		cout<<"错误,节点数必须是在1到"<<MAX_NODE<<"之间的数"<<endl;
		exit(1);
	}

	cout<<"输出邻接矩阵如下:"<<endl;
	showMGraph();

	//进行拓扑排序
	while(true)
	{
		//假设所有剩余的节点都没有入度
		bool flag = true;

		for(int i=0; i<n; i++)
		{
			//如果是已被移除或者存在入度的节点
			if((arc[i][i] == -1) || hasInRoad(i)) continue;

			//发现了一个入度,假设不成立
			flag = false;

			//该节点没有入度
			list[index++] = i;
			removeNode(i);

			//所有节点都已经排序
			if(index>=n)
			{
				showList();
				return;
			}
		}
		if(flag)
		{
			cout<<"该有向图含有环."<<endl;
			exit(2);
		}
	}
}
开发者ID:cqiyi,项目名称:kaoshi,代码行数:59,代码来源:test02.cpp

示例9: ASSERT

ScrollingNodeID ScrollingStateTree::attachNode(ScrollingNodeType nodeType, ScrollingNodeID newNodeID, ScrollingNodeID parentID)
{
    ASSERT(newNodeID);

    if (ScrollingStateNode* node = stateNodeForID(newNodeID)) {
        ScrollingStateNode* parent = stateNodeForID(parentID);
        if (!parent)
            return newNodeID;
        if (node->parent() == parent)
            return newNodeID;

        // The node is being re-parented. To do that, we'll remove it, and then re-create a new node.
        removeNode(node);
    }

    ScrollingStateNode* newNode = 0;
    if (!parentID) {
        // If we're resetting the root node, we should clear the HashMap and destroy the current children.
        clear();

        setRootStateNode(ScrollingStateFrameScrollingNode::create(*this, newNodeID));
        newNode = rootStateNode();
        m_hasNewRootStateNode = true;
    } else {
        ScrollingStateNode* parent = stateNodeForID(parentID);
        if (!parent)
            return 0;

        switch (nodeType) {
        case FixedNode: {
            OwnPtr<ScrollingStateFixedNode> fixedNode = ScrollingStateFixedNode::create(*this, newNodeID);
            newNode = fixedNode.get();
            parent->appendChild(fixedNode.release());
            break;
        }
        case StickyNode: {
            OwnPtr<ScrollingStateStickyNode> stickyNode = ScrollingStateStickyNode::create(*this, newNodeID);
            newNode = stickyNode.get();
            parent->appendChild(stickyNode.release());
            break;
        }
        case FrameScrollingNode: {
            OwnPtr<ScrollingStateFrameScrollingNode> scrollingNode = ScrollingStateFrameScrollingNode::create(*this, newNodeID);
            newNode = scrollingNode.get();
            parent->appendChild(scrollingNode.release());
            break;
        }
        case OverflowScrollingNode: {
            OwnPtr<ScrollingStateOverflowScrollingNode> scrollingNode = ScrollingStateOverflowScrollingNode::create(*this, newNodeID);
            newNode = scrollingNode.get();
            parent->appendChild(scrollingNode.release());
            break;
        }
        }
    }

    m_stateNodeMap.set(newNodeID, newNode);
    return newNodeID;
}
开发者ID:Wrichik1999,项目名称:webkit,代码行数:59,代码来源:ScrollingStateTree.cpp

示例10: Cut

static void Cut(PQueue *h, PQueueElement *x, PQueueElement *y)
{
    removeNode(x);
    y->degree--;
    insertrootlist(h, x);
    x->Parent = NULL;
    x->Mark = 0;
}
开发者ID:HunterPlus,项目名称:ccl,代码行数:8,代码来源:priorityqueue.c

示例11: removeEdgeFromVertices

/*
 * updates the vertex list when and edge is removed so that
 * the vertex list contains the proper new edges for the 
 * corresponding vertices
 */
void removeEdgeFromVertices(vertexSet * head, int id)
{
  while(head!=NULL)
  {
    removeNode(&head->edges, id);
    head = head->nextVertex;
  }
}
开发者ID:csgrad,项目名称:crin-paper,代码行数:13,代码来源:hypergraph.c

示例12: while

void CDoubleLinkedList::removeAllNodes()
{	
  while ( NULL != m_pHead ) {
    removeNode( m_pTail );
  }	
  
  Init();
};
开发者ID:davidluca3000,项目名称:vscp_software,代码行数:8,代码来源:node.cpp

示例13: setlocale

void GVSkeletonGraph::clearNodes(){
    	setlocale(LC_NUMERIC,"en_US.UTF-8");
	
	QList<QString> keys = _nodes.keys();
	for(int i=0;i<keys.size();++i){
		removeNode(keys.at(i));
	}
}
开发者ID:AurelienHP,项目名称:pgrou,代码行数:8,代码来源:GVSkeletonGraph.cpp

示例14: while

void SwitchNode::clearNodes() {
	while (nodes->size() > 0) {
		removeNode( nodes->size() - 1 );
	}
	setDefaultNode( NULL );
	clearAnchors();
	clearPorts();
}
开发者ID:jgrande,项目名称:ginga,代码行数:8,代码来源:SwitchNode.cpp

示例15: test__remove_node_not_present

void 
test__remove_node_not_present(void **state)
{   
    initializeHashTable(100);
	int result = removeNode(101);
    assert_true(result == -1);
	cleanUpTable();
}
开发者ID:50wu,项目名称:gpdb,代码行数:8,代码来源:cdb_dump_util_test.c


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