本文整理汇总了C++中TCODList::pop方法的典型用法代码示例。如果您正苦于以下问题:C++ TCODList::pop方法的具体用法?C++ TCODList::pop怎么用?C++ TCODList::pop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TCODList
的用法示例。
在下文中一共展示了TCODList::pop方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: buildTree
//.........这里部分代码省略.........
sprintf(tmp,"%d",(*it)->order);
(*it)->pageNum=strdup(tmp);
sprintf(tmp,"doc/html2/%s.html",(*it)->name);
(*it)->url=strdup(tmp);
sprintf(tmp,"<a onclick=\"link('../index2.html')\">Index</a> > <a onclick=\"link('%s.html')\">%s. %s</a>",
(*it)->name,(*it)->pageNum,(*it)->title);
(*it)->breadCrumb=strdup(tmp);
rootPages.remove(*it);
}
}
categId++;
}
// pages with unknown categories
for ( PageData **it=rootPages.begin(); it != rootPages.end(); it++) {
printf ("ERROR : unknown category '%s' in page '%s'\n",(*it)->categoryName,(*it)->name);
pages.remove(*it);
}
// build the subpages tree
for (PageData **it=pages.begin();it!=pages.end();it++) {
if ( (*it)->fatherName != NULL ) {
// sub-page. find its daddy and order
(*it)->father=getPage((*it)->fatherName);
if ( ! (*it)->father ) {
printf ("ERROR : unknown father '%s' for page '%s'\n",
(*it)->fatherName,(*it)->name);
it=pages.remove(it);
continue;
}
(*it)->father->numKids++;
(*it)->order=(*it)->father->numKids;
}
}
// now compute sub-page numbers
TCODList<PageData *> hierarchy;
bool missing=true;
while ( missing ) {
missing=false;
for (PageData **it=pages.begin();it!=pages.end();it++) {
if ((*it)->pageNum == NULL ) {
PageData *page=*it;
if ( page->father->pageNum == NULL ) {
missing=true;
} else {
char tmp[256];
sprintf(tmp,"%s.%d", page->father->pageNum,page->order);
page->pageNum = strdup(tmp);
sprintf(tmp,"doc/html2/%s.html",page->name);
page->url=strdup(tmp);
}
}
}
}
// now compute prev/next links and breadcrumbs for sub pages
for (PageData **it=pages.begin();it!=pages.end();it++) {
PageData *page=*it;
page->prev=getPrev(page);
// prev link
if ( page->prev ) {
char tmp[1024];
sprintf (tmp,
"<a class=\"prev\" onclick=\"link('%s.html')\">%s. %s</a>",
page->prev->name,page->prev->pageNum,page->prev->title);
page->prevLink=strdup(tmp);
}
// next link
page->next=getNext(page);
if ( page->next ) {
char tmp[1024];
sprintf (tmp,
"%s<a class=\"next\" onclick=\"link('%s.html')\">%s. %s</a>",
page->prev ? "| " : "",
page->next->name,page->next->pageNum,page->next->title);
page->nextLink=strdup(tmp);
}
// breadCrumb
if (! page->breadCrumb ) {
char tmp[1024];
TCODList<PageData *> hierarchy;
PageData *curPage=page;
while ( curPage ) {
hierarchy.push(curPage);
curPage=curPage->father;
}
char *ptr=tmp;
ptr[0]=0;
while ( ! hierarchy.isEmpty() ) {
curPage=hierarchy.pop();
if ( curPage == root ) {
sprintf(ptr, "<a onclick=\"link('../%s.html')\">%s</a>",
curPage->name,curPage->title);
} else {
sprintf(ptr, " > <a onclick=\"link('%s.html')\">%s. %s</a>",
curPage->name,curPage->pageNum,curPage->title);
}
ptr += strlen(ptr);
}
page->breadCrumb =strdup(tmp);
}
}
}