Example #1
0
File: tnode.c Project: unxs0/unxsVZ
void DeletetNode(void)
{
#ifdef ISM3FIELDS
	sprintf(gcQuery,"DELETE FROM tNode WHERE uNode=%u AND ( uOwner=%u OR %u>9 )"
					,uNode,guLoginClient,guPermLevel);
#else
	sprintf(gcQuery,"DELETE FROM tNode WHERE uNode=%u"
					,uNode);
#endif
	MYSQL_RUN;
	//tNode("Record Deleted");
	if(mysql_affected_rows(&gMysql)>0)
	{
#ifdef ISM3FIELDS
		unxsVZLog(uNode,"tNode","Del");
#endif
		tNode(LANG_NBR_RECDELETED);
	}
	else
	{
#ifdef ISM3FIELDS
		unxsVZLog(uNode,"tNode","DelError");
#endif
		tNode(LANG_NBR_RECNOTDELETED);
	}

}//void DeletetNode(void)
Example #2
0
File: tnode.c Project: unxs0/unxsVZ
void NewtNode(unsigned uMode)
{
	register int i=0;
	MYSQL_RES *res;

	sprintf(gcQuery,"SELECT uNode FROM tNode\
				WHERE uNode=%u"
							,uNode);
	MYSQL_RUN_STORE(res);
	i=mysql_num_rows(res);

	if(i) 
		//tNode("<blink>Record already exists");
		tNode(LANG_NBR_RECEXISTS);

	//insert query
	Insert_tNode();
	if(mysql_errno(&gMysql)) htmlPlainTextError(mysql_error(&gMysql));
	//sprintf(gcQuery,"New record %u added");
	uNode=mysql_insert_id(&gMysql);
#ifdef ISM3FIELDS
	uCreatedDate=luGetCreatedDate("tNode",uNode);
	unxsVZLog(uNode,"tNode","New");
#endif

	if(!uMode)
	{
	sprintf(gcQuery,LANG_NBR_NEWRECADDED,uNode);
	tNode(gcQuery);
	}

}//NewtNode(unsigned uMode)
Example #3
0
int least_transfer(const int cur, const int target, const int n)
{
   std::queue<tNode> que;
   std::vector<tNode> path;
   que.push(tNode(cur, 0));
   path.push_back(tNode(cur, 0, -1));
   book[cur] = true;
   int flag  = false;
   while (!que.empty())
   {
      tNode head = que.front();
      for (int i = 1; i <= n; ++i)
      {
         if (e_graph[head.x][i] != -1 && !book[i])
         {
            que.push(tNode(i, head.s + 1));
            path.push_back(tNode(i, head.s + 1, head.x));
            book[i] = true;
         }
         if (que.back().x == target)
         {
            flag = true;
            break;
         }
      }

      if (flag)
         break;
      que.pop();
   }


   // 获取换乘路径
   int size = que.back().s + 1;
   std::vector<tNode> min_trans(size, tNode(-1, -1, -1));
   min_trans[size - 1] = path[path.size() - 1];
   for (int i = 1; i < size; ++i)
   {
      tNode pre = min_trans[size - i];
      bool flag = false;
      for (int j = 0; j < path.size(); ++j)
      {
         if (path[j].s + 1 == pre.s && pre.f == path[j].x)
         {
            min_trans[size - i - 1] = path[j];
            flag = true;
         }
      }
      assert(flag);
   }
   printf("translate airplane as:\n");
   for(int i = 0; i < size; ++i)
   {
      printf("cite%d -> ", min_trans[i].x);
   }
   printf("\n");
   return que.back().s;
}
Example #4
0
File: tnode.c Project: unxs0/unxsVZ
int tNodeCommands(pentry entries[], int x)
{
	ProcessControlVars(entries,x);

	ExttNodeCommands(entries,x);

	if(!strcmp(gcFunction,"tNodeTools"))
	{
		if(!strcmp(gcFind,LANG_NB_LIST))
		{
			tNodeList();
		}

		//Default
		ProcesstNodeVars(entries,x);
		tNode("");
	}
	else if(!strcmp(gcFunction,"tNodeList"))
	{
		ProcessControlVars(entries,x);
		ProcesstNodeListVars(entries,x);
		tNodeList();
	}

	return(0);

}//tNodeCommands()
Example #5
0
File: tnode.c Project: unxs0/unxsVZ
void ProcesstNodeListVars(pentry entries[], int x)
{
        register int i;

        for(i=0;i<x;i++)
        {
                if(!strncmp(entries[i].name,"ED",2))
                {
                        sscanf(entries[i].name+2,"%u",&uNode);
                        guMode=2002;
                        tNode("");
                }
        }
}//void ProcesstNodeListVars(pentry entries[], int x)
Example #6
0
/** This function must be called by the DOM _BEFORE_
*  a node is deleted, because at that time it is
*  connected in the DOM tree, which we depend on.
*/
void RangeImpl::updateRangeForDeletedNode(NodeImpl* node)
{

    if (node == null) return;
    if (fRemoveChild == node) return;

    DOM_Node tNode(node);

    if (node->getParentNode() == fStartContainer.fImpl) {
        unsigned short index = indexOf(tNode, fStartContainer);
        if ( fStartOffset > index) {
            fStartOffset--;
        }
    }

    if (node->getParentNode() == fEndContainer.fImpl) {
        unsigned short index = indexOf(tNode, fEndContainer);
        if ( fEndOffset > index) {
            fEndOffset--;
        }
    }

    if (node->getParentNode() != fStartContainer.fImpl
            ||  node->getParentNode() != fEndContainer.fImpl) {
        if (isAncestorOf(node, fStartContainer)) {
            DOM_Node tpNode(node->getParentNode());
            setStartContainer( tpNode );
            fStartOffset = indexOf( tNode, tpNode);
        }
        if (isAncestorOf(node, fEndContainer)) {
            DOM_Node tpNode(node->getParentNode());
            setEndContainer( tpNode );
            fEndOffset = indexOf( tNode, tpNode);
        }
    }

}