本文整理汇总了C++中HTList_nextObject函数的典型用法代码示例。如果您正苦于以下问题:C++ HTList_nextObject函数的具体用法?C++ HTList_nextObject怎么用?C++ HTList_nextObject使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了HTList_nextObject函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HTTimer_next
PUBLIC int HTTimer_next (ms_t * pSoonest)
{
HTList * cur = Timers;
HTList * last = Timers;
HTTimer * pres;
ms_t now = HTGetTimeInMillis();
int ret = HT_OK;
/*
** Dispatch all timers that have expired
*/
while (Timers && (pres = (HTTimer *) HTList_nextObject(cur))) {
if (pres->expires <= now) {
if ((ret = Timer_dispatch(cur, last)) != HT_OK) break;
cur = last = Timers;
} else {
last = cur;
}
}
if (pSoonest) {
/*
** First element in Timers is the next to expire.
*/
HTList * cur = Timers; /* for now */
pres = (HTTimer *) HTList_nextObject(cur);
*pSoonest = pres ? pres->expires - now : 0;
}
return ret;
}
示例2: HTHashtable_walk
PUBLIC BOOL HTHashtable_walk (HTHashtable *me,
int (*walkFunc)(HTHashtable *,char *, void *))
{
if(me) {
int i, j;
for(i = 0; i< me->size; i++) {
HTList *l = (HTList *)me->table[i];
if(l) {
HTList *cur = l;
keynode *kn, *nextkn;
for(kn = (keynode *)HTList_nextObject(cur); kn; kn = nextkn) {
j = walkFunc(me, kn->key, kn->object);
if(j == 0)
return YES;
nextkn = (keynode *)HTList_nextObject(cur);
if (j < 0) {
HTList_removeObject(l, kn);
me->count--;
}
}
}
}
return YES;
}
return NO;
}
示例3: ARGS1
PRIVATE void print_item ARGS1(Item *, item)
{
if (!item)
fprintf(tfp, "\tNULL-ITEM\n");
else {
UserDefList *cur1 = item->user_def_list;
AddressDefList *cur2 = item->address_def_list;
Ref *user_ref = (Ref*)HTList_nextObject(cur1);
Ref *addr_ref = (Ref*)HTList_nextObject(cur2);
if (user_ref) {
fprintf(tfp, "\t[%s%s", user_ref->name,
(user_ref->translation ? "*REF*" : ""));
while (NULL != (user_ref = (Ref*)HTList_nextObject(cur1)))
fprintf(tfp, "; %s%s", user_ref->name,
(user_ref->translation ? "*REF*" : ""));
fprintf(tfp, "] ");
} else fprintf(tfp, "\tANYBODY ");
if (addr_ref) {
fprintf(tfp, "@ [%s", addr_ref->name);
while (NULL != (addr_ref = (Ref*)HTList_nextObject(cur2)))
fprintf(tfp, "; %s", addr_ref->name);
fprintf(tfp, "]\n");
} else fprintf(tfp, "@ ANYADDRESS\n");
}
}
示例4: HTTimer_expireAll
/* JK: used by Amaya */
PUBLIC BOOL HTTimer_expireAll (void)
{
HTList * cur;
HTTimer * timer;
if (Timers) {
/*
** first delete all plattform specific timers to
** avoid having a concurrent callback
*/
cur = Timers;
while ((timer = (HTTimer *) HTList_nextObject(cur))) {
if (DeletePlatformTimer) DeletePlatformTimer(timer);
}
/*
** simulate a timer timeout thru timer_dispatch
** to kill its context
*/
cur = Timers;
while ((timer = (HTTimer *) HTList_nextObject(cur))) {
/* avoid having it being refreshed */
timer->repetitive = NO;
HTTimer_dispatch (timer);
/* as the timer is erased, we start again from the top of the list */
cur = Timers;
}
return YES;
}
return NO;
}
示例5: HTBind_getSuffix
/* Determine a suitable suffix
** ---------------------------
** Use the set of bindings to find a suitable suffix (or index)
** for a certain combination of language, media type and encoding
** given in the anchor.
**
** Returns a pointer to a suitable suffix string that must be freed
** by the caller. If more than one suffix is found they are all
** concatenated using the first delimiter in HTDelimiters.
** If no suffix is found, NULL is returned.
*/
PUBLIC char * HTBind_getSuffix (HTParentAnchor * anchor)
{
int cnt;
HTList * cur;
HTChunk * suffix = HTChunk_new(48);
char delimiter = *HTDelimiters;
char * ct=NULL, * ce=NULL, * cl=NULL;
HTFormat format = HTAnchor_format(anchor);
HTList * encoding = HTAnchor_encoding(anchor);
HTList * language = HTAnchor_language(anchor);
if (!HTBindings) HTBind_init();
if (anchor) {
for (cnt=0; cnt<HT_L_HASH_SIZE; cnt++) {
if ((cur = HTBindings[cnt])) {
HTBind *pres;
while ((pres = (HTBind *) HTList_nextObject(cur))) {
if (!ct && (pres->type && pres->type == format)){
ct = pres->suffix;
} else if (!ce && pres->encoding && encoding) {
HTList * cur_enc = encoding;
HTEncoding pres_enc;
while ((pres_enc = (HTEncoding) HTList_nextObject(cur_enc))) {
if (pres_enc == pres->encoding) {
ce = pres->suffix;
break;
}
}
} else if (!cl && pres->language && language) {
HTList * cur_lang = language;
HTLanguage pres_lang;
while ((pres_lang = (HTLanguage) HTList_nextObject(cur_lang))) {
if (pres_lang == pres->language) {
cl = pres->suffix;
break;
}
}
}
}
}
}
/* Put the found suffixes together */
if (ct) {
HTChunk_putc(suffix, delimiter);
HTChunk_puts(suffix, ct);
}
if (ce) {
HTChunk_putc(suffix, delimiter);
HTChunk_puts(suffix, ce);
}
if (cl) {
HTChunk_putc(suffix, delimiter);
HTChunk_puts(suffix, cl);
}
}
return HTChunk_toCString(suffix);
}
示例6: HTNewsNode_setRefInfo_pass2
/* Added by MP. */
PRIVATE void HTNewsNode_setRefInfo_pass2 (HTNewsDir* dir, HTNewsNode* node)
{
HTNewsNode* maxParent = NULL;
HTList* ptr = node->refObjects;
HTNewsNode* parent = NULL;
if (node->fake)
return;
if (ptr != NULL)
parent = (HTNewsNode*) HTList_nextObject(ptr);
while (ptr != NULL)
{
if (!maxParent || maxParent->date < parent->date)
maxParent = parent;
parent = (HTNewsNode*) HTList_nextObject(ptr);
}
if (maxParent)
{
if (!HTNewsNode_isAncestor(node, maxParent)) /* better be careful */
HTNewsNode_linkRef (maxParent, node);
}
else
{
char* refSubject;
BOOL re;
/* Here is the only place we REALLY have to check for circular */
/* references. It is normally possible that a node refers to */
/* orphan node and both have the same subject. In this situation */
/* we can't make the orphan to refer to it's child. Without checking */
/* for circular references this is likely to happen here. */
refSubject = UnReSubject(node->subject);
re = (strcasecomp(refSubject, node->subject) != 0);
if (re)
parent = HTNewsDir_findNodeWithSubject(dir, refSubject,
FNWS_MIN | FNWS_NOTFAKE, node);
if (!parent || HTNewsNode_isAncestor(node, parent))
parent = HTNewsDir_findNodeWithSubject(dir, refSubject,
FNWS_MIN | FNWS_ONLYFAKE, node);
if (!parent && re)
{
parent = HTNewsDir_findNodeWithSubject(dir, node->subject,
FNWS_MIN | FNWS_ONLYFAKE, node);
}
if (!parent) parent = HTNewsDir_addFakeElement (dir, refSubject, NULL);
if (parent) {
HTNewsNode_linkRef (parent, node);
if (parent->refChildren > 1) /* Multi-children fake node visible */
parent->show = YES;
}
}
}
示例7: HTEventList_unregisterAll
/*
** Unregister all sockets
** N.B. we just remove them for our internal data structures: it is up to the
** application to actually close the socket.
*/
PUBLIC int HTEventList_unregisterAll (void)
{
int i;
HTTRACE(THD_TRACE, "Unregister.. all sockets\n");
for (i = 0 ; i < HT_M_HASH_SIZE; i++) {
HTList * cur = HashTable[i];
SockEvents * pres;
while ((pres = (SockEvents *) HTList_nextObject(cur))) {
#ifdef WWW_WIN_ASYNC
WSAAsyncSelect(pres->s, HTSocketWin, HTwinMsg, 0);
#endif /* WWW_WIN_ASYNC */
HT_FREE(pres);
}
HTList_delete(HashTable[i]);
HashTable[i] = NULL;
}
#ifndef WWW_WIN_ASYNC
MaxSock = 0 ;
HTTRACE(THD_TRACE, "Event....... New value for MaxSock is %d\n" _ MaxSock);
FD_ZERO(FdArray+HTEvent_INDEX(HTEvent_READ));
FD_ZERO(FdArray+HTEvent_INDEX(HTEvent_WRITE));
FD_ZERO(FdArray+HTEvent_INDEX(HTEvent_OOB));
#endif /* !WWW_WIN_ASYNC */
EventOrder_deleteAll();
return 0;
}
示例8: malloc
char *Reference_List (Robot *mr)
{
HTList *copy = mr->urilist;
char *output = NULL;
char *number = malloc(sizeof("9999 :"));
char *index = malloc(1000);
int i = 1;
int refs = HText_sourceAnchors(mr->htext);
if (refs <= 0) {
return("\n\nThere are no references from this document.\n\n");
} else {
StrAllocCat(output, "List of references: \n");
sprintf(number, "%d total references\n", mr->count);
while ((index = (char *) HTList_nextObject(copy))) {
sprintf(number, "[%d] : ", i++);
StrAllocCat(output, number);
StrAllocCat(output, index);
StrAllocCat(output, "\n");
HT_FREE(index);
}
HTList_delete(copy);
return(output);
}
}
示例9: Robot_delete
/* Delete a Command Line Object
** ----------------------------
*/
PRIVATE BOOL Robot_delete (Robot * me)
{
if (me) {
if (me->urilist) {
HTList *cur = me->urilist;
char *temp;
while ((temp = (char *) HTList_nextObject(cur))) {
HT_FREE(temp);
}
HTList_delete(cur);
}
if (me->htext) {
HText_free(me->htext);
}
if (me->output && me->output != STDOUT) fclose(me->output);
HT_FREE(me->cwd);
HT_FREE(me->tv);
/* Delete the profile */
#if 0
HTProfile_delete();
#endif
HT_FREE(me);
return YES;
}
return NO;
}
示例10: HTLink_remove
/*
** Removes link information from one anchor to another.
** Returns YES if OK, else NO
*/
PUBLIC BOOL HTLink_remove (HTAnchor * source, HTAnchor * destination)
{
if (!source || !destination) return NO;
HTTRACE(ANCH_TRACE, "Link delete. from anchor %p to anchor %p\n" _
(void *) source _ (void *) destination);
/* Remove if dest is the main link */
if (source->mainLink.dest == destination) {
source->mainLink.dest = NULL;
source->mainLink.type = NULL;
source->mainLink.method = METHOD_INVALID;
source->mainLink.result = HT_LINK_INVALID;
return YES;
}
/* Remove link information for other links */
if (source->links) {
HTList *cur = source->links;
HTLink *pres;
while ((pres = (HTLink *) HTList_nextObject(cur))) {
if (pres->dest == destination) {
HTList_removeObject(source->links, pres);
HT_FREE(pres);
return YES;
}
}
}
return NO;
}
示例11: HTAnchor_getArray
/* FLATTEN ALL ANCHORS
** -------------------
** Flattens the anchor web structure into an array.
** This is useful for calculating statistics, sorting
** the parent anchors etc.
**
** The caller can indicate the size of the array (total
** number of anchors if known - otherwise 0).
**
** Return an array that must be freed by the caller or
** NULL if no anchors.
*/
PUBLIC HTArray * HTAnchor_getArray (int growby)
{
int cnt;
HTArray * array = NULL;
HTList * cur = NULL;
if (!adult_table) return NULL;
/* Allocate an array for the anchors */
if (growby <= 0) growby = PARENT_HASH_SIZE;
array = HTArray_new(growby);
/* Traverse anchor structure */
for (cnt=0; cnt<PARENT_HASH_SIZE; cnt++) {
if ((cur = adult_table[cnt])) {
HTParentAnchor * pres = NULL;
while ((pres = (HTParentAnchor *) HTList_nextObject(cur)) != NULL) {
if (HTArray_addObject(array, pres) == NO) {
HTTRACE(ANCH_TRACE, "Anchor...... Can't add object %p to array %p\n" _
pres _ array);
break;
}
}
}
}
return array;
}
示例12: delete_parent
/* Deletes all the memory allocated in a parent anchor and returns any
** hyperdoc object hanging of this anchor
*/
PRIVATE void * delete_parent (HTParentAnchor * me)
{
void * doc = me->document;
/* Remove link and address information */
if (me->links) {
HTList *cur = me->links;
HTLink *pres;
while ((pres = (HTLink *) HTList_nextObject(cur)))
HTLink_delete(pres);
HTList_delete(me->links);
}
/* Remove children */
if (me->children) {
int cnt = 0;
for (; cnt<CHILD_HASH_SIZE; cnt++) {
if (me->children[cnt]) HTList_delete(me->children[cnt]);
}
HT_FREE(me->children);
}
HTList_delete (me->sources);
HTList_delete (me->variants);
HT_FREE(me->physical);
HT_FREE(me->address);
/* Then remove entity header information (metainformation) */
HTAnchor_clearHeader(me);
HT_FREE(me);
return doc;
}
示例13: HTStackValue
/* Find the cost of a filter stack
** -------------------------------
**
** Must return the cost of the same stack which StreamStack would set up.
**
** On entry,
** length The size of the data to be converted
*/
PUBLIC double HTStackValue (HTList * theseConversions,
HTFormat rep_in,
HTFormat rep_out,
double initial_value,
long int length)
{
int which_list;
HTList* conversion[2];
HTTRACE(CORE_TRACE, "StackValue.. Evaluating stream stack for %s worth %.3f to %s\n" _
HTAtom_name(rep_in) _ initial_value _ HTAtom_name(rep_out));
if (rep_out == WWW_SOURCE || rep_out == rep_in) return 0.0;
conversion[0] = theseConversions;
conversion[1] = HTConversions;
for(which_list = 0; which_list<2; which_list++)
if (conversion[which_list]) {
HTList * cur = conversion[which_list];
HTPresentation * pres;
while ((pres = (HTPresentation*)HTList_nextObject(cur))) {
if (pres->rep == rep_in &&
(pres->rep_out == rep_out || HTMIMEMatch(pres->rep_out, rep_out))) {
double value = initial_value * pres->quality;
if (HTMaxSecs != 0.0)
value = value - (length*pres->secs_per_byte + pres->secs)
/HTMaxSecs;
return value;
}
}
}
return NO_VALUE_FOUND; /* Really bad */
}
示例14: ARGS2
PRIVATE HTChildAnchor * HTAnchor_findChild
ARGS2 (HTParentAnchor *,parent, CONST char *,tag)
{
HTChildAnchor *child;
HTList *kids;
if (! parent) {
if (TRACE) printf ("HTAnchor_findChild called with NULL parent.\n");
return NULL;
}
if (kids = parent->children) { /* parent has children : search them */
if (tag && *tag) { /* TBL */
while (child = HTList_nextObject (kids)) {
if (equivalent(child->tag, tag)) { /* Case sensitive 920226 */
if (TRACE) printf (
"Child anchor %p of parent %p with name `%s' already exists.\n",
child, parent, tag);
return child;
}
}
} /* end if tag is void */
} else /* parent doesn't have any children yet : create family */
parent->children = HTList_new ();
child = HTChildAnchor_new ();
if (TRACE) fprintf(stderr, "new Anchor %p named `%s' is child of %p\n",
child, (int)tag ? tag : (CONST char *)"" , parent); /* int for apollo */
HTList_addObject (parent->children, child);
child->parent = parent;
StrAllocCopy(child->tag, tag);
return child;
}
示例15: ARGS3
/* HTGetIcon()
** returns the icon corresponding to content_type or content_encoding.
*/
PUBLIC HTIconNode * HTGetIcon ARGS3(mode_t, mode,
HTFormat, content_type,
HTFormat, content_encoding)
{
if (!icon_unknown) icon_unknown = icon_blank;
if ((mode & S_IFMT) == S_IFREG) {
char * ct = content_type ? HTAtom_name(content_type) : NULL;
char * ce = content_encoding ? HTAtom_name(content_encoding) : NULL;
HTList * cur = icons;
HTIconNode * node;
while ((node = (HTIconNode*)HTList_nextObject(cur))) {
char * slash = strchr(node->type_templ,'/');
if ((ct && slash && match(node->type_templ,ct)) ||
(ce && !slash && HTAA_templateMatch(node->type_templ,ce))) {
return node;
}
}
} else if ((mode & S_IFMT) == S_IFDIR) {
return icon_dir ? icon_dir : icon_unknown;
} else if ((mode & S_IFMT) == S_IFLNK) {
return icon_dir ? icon_dir : icon_unknown; /* @@ */
}
return icon_unknown;
}