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


C++ HTList_addObject函数代码示例

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


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

示例1: HTLink_add

/*	Link me Anchor to another given one
**	-------------------------------------
*/
PUBLIC BOOL HTLink_add (HTAnchor *	source,
                        HTAnchor * 	destination,
                        HTLinkType	type,
                        HTMethod	method)
{
    if (source && destination) {
        HTTRACE(ANCH_TRACE, "Link create. from anchor %p to %p with type %s, method %s\n" _
                (void *) source _ (void *) destination _
                type ? HTAtom_name(type) : "NONE" _
                method != METHOD_INVALID ? HTMethod_name(method) : "NONE");
        if (!source->mainLink.dest) {
            source->mainLink.dest = destination;
            source->mainLink.type = type;
            source->mainLink.method = method;
        } else {
            HTLink * newLink = HTLink_new();
            newLink->dest = destination;
            newLink->type = type;
            newLink->method = method;
            if (!source->links) source->links = HTList_new();
            HTList_addObject (source->links, newLink);
        }
        if (!destination->parent->sources)
            destination->parent->sources = HTList_new();
        HTList_addObject (destination->parent->sources, source);
        return YES;
    } else
        HTTRACE(ANCH_TRACE, "Link........ Bad argument\n");
    return NO;
}
开发者ID:BackupTheBerlios,项目名称:texlive,代码行数:33,代码来源:HTLink.c

示例2: ARGS1

HTAnchor * HTHistory_moveBy
 ARGS1 (int,offset)
{
  HTAnchor * last = HTList_objectAt (history, 1);
  if (! last)
    return NULL;  /* No last visited node */
  if (last != (HTAnchor *) last->parent) {  /* Was a child */
    HTList * kids = last->parent->children;
    int i = HTList_indexOf (kids, last); 
    HTAnchor * nextOne = HTList_objectAt (kids, i - offset);
    if (nextOne) {
      HTAnchor * destination = HTAnchor_followMainLink (nextOne);
      if (destination) {
	HTList_removeLastObject (history);
	HTList_removeLastObject (history);
	HTList_addObject (history, nextOne);
	HTList_addObject (history, destination);
      }
      return destination;
    } else {
      if (TRACE) fprintf(stderr, 
      		"HTHistory_moveBy: offset by %+d goes out of list %p.\n",
		offset, kids);
      return NULL;
    }
  } else {  /* Was a parent */
    return NULL;  /* FIXME we could possibly follow the next link... */
  }
}
开发者ID:csev,项目名称:xmosaic-1.2,代码行数:29,代码来源:HTHistory.c

示例3: HTCookieHolder_addCookie

PRIVATE BOOL HTCookieHolder_addCookie (HTRequest * request, HTCookie * cookie)
{
    if (request && cookie) {
        HTList * cur = cookie_holder;
        HTCookieHolder * pres = NULL;

        /* Make sure that we have a cookie holder list */
        if (!cookie_holder) cookie_holder = HTList_new();

        /* See if we already have a cookie holder for this request */
        while ((pres = (HTCookieHolder *) HTList_nextObject(cur))) {
            if (pres->request == request) break;
        }

        /* If found then use existing cookie holder, otherwise create new one */
        if (!pres) {
            if ((pres = (HTCookieHolder *) HT_CALLOC(1, sizeof(HTCookieHolder))) == NULL)
                HT_OUTOFMEM("HTCookieHolder_newCookie");
            pres->request = request;
            pres->cookies = HTList_new();

            /* Add to cookie holder list */
            HTList_addObject(cookie_holder, pres);
        }

        /* Now add the cookie */
        HTList_addObject(pres->cookies, cookie);

        return YES;
    }
    return NO;
}
开发者ID:Rjoydip,项目名称:libwww,代码行数:32,代码来源:HTCookie.c

示例4: ParseGroup

/*	ParseGroup
**	----------
**	Extract the index number, subject etc, from a XOVER command. Expects
**	the following format of the line:
**
**		<index> <subject> <from> <data> <msgid> [*<thread>] ...
**
**	Returns YES if OK, NO on error
*/
PRIVATE BOOL ParseGroup (HTRequest * request, HTNewsDir *dir, char * line)
{
    int index;
    int refcnt=0;
    time_t t=0;
    char *subject = line;
    char *from;
    char *date;
    char *msgid;
    char *ptr=NULL;
    HTList* reflist = NULL;  /* Added by MP. */
    while (*subject && *subject != DELIMITER) subject++;
    *subject++ = '\0';					/* Index */
    index = atoi(line);
    from = subject;
    while (*from && *from != DELIMITER) from++;
    *from++ = '\0';					/* Subject */
    date = from;
    while (*date && *date != DELIMITER) {
	if (*date=='<' || *date=='(') {
	    ptr = date+1;
	    *date = '\0';
	}
	if (*date=='>' || *date==')') *date = '\0';
	date++;
    }
    *date++ = '\0';
    if (strchr(from, ATSIGN) && ptr) from = ptr;	/* From */
    msgid = date;
    while (*msgid && *msgid != DELIMITER) msgid++;
    *msgid++ = '\0';					/* Date */
    if (*msgid=='<') msgid++;
    t = HTParseTime(date,  HTRequest_userProfile(request), YES);
    ptr = msgid;
    while (*ptr && *ptr != DELIMITER) {
	if (*ptr=='>') *ptr = '\0';
	ptr++;
    }
    *ptr++ = '\0';					/* MsgId */
    while (ptr && *ptr && !isdigit((int) *ptr)) {
        char* refstart = ptr;       /* Added by MP. */
        char* refcopy = NULL;
	    char* refstop;
	    while (*ptr && *ptr != DELIMITER && *ptr != ' ') ptr++;
	    refstop = ptr - 1;
	    *ptr++ = '\0';
        if (strlen(refstart) > 0)  /* Added by MP. */
	    {
	        refcnt++;
            if (*refstart == '<')  refstart++;
            if (*refstop == '>')  *refstop = '\0';
            if (reflist == NULL)  reflist = HTList_new();
            StrAllocCopy (refcopy, refstart);
            HTList_addObject (reflist, (void*) refcopy);
        }
    }
    /* Changed by MP. */
    return (HTNewsDir_addElement(dir, index, subject, from, t, msgid, 
        refcnt, reflist) != NULL);
}
开发者ID:Hiroyuki-Nagata,项目名称:libwww,代码行数:69,代码来源:HTNewsLs.c

示例5: HText_beginAnchor

void HText_beginAnchor (HText * text, HTChildAnchor * anchor)
{
    TextAnchor * a;
    if (text && anchor) {
	Robot * mr = (Robot *) HTRequest_context(text->request);
	HTAnchor * dest = HTAnchor_followMainLink((HTAnchor *) anchor);
	HTParentAnchor * dest_parent = HTAnchor_parent(dest);
	char * uri = HTAnchor_address((HTAnchor *) dest_parent);

#if 0
	if (SHOW_MSG) HTTrace("Robot....... Found `%s\' \n", uri ? uri : "NULL");
#endif	
	if (uri) {
	    HTList_addObject(mr->urilist, (void *) uri);
	    mr->count++;
	}

	if ((a = (TextAnchor  *) HT_MALLOC(sizeof(*a))) == NULL)
	    HT_OUTOFMEM("HText_beginAnchor");
	if (text->last_anchor) {
	    text->last_anchor->next = a;
	} else {
	    text->first_anchor = a;
	}
	a->next = 0;
	a->anchor = anchor;
	text->last_anchor = a;
    
	if (HTAnchor_followMainLink((HTAnchor*)anchor)) {
	    a->number = ++(text->anchors);
	} else {
	    a->number = 0;
	}
    }
}
开发者ID:Hiroyuki-Nagata,项目名称:libwww,代码行数:35,代码来源:Tcl_Interface.c

示例6: HTProtocol_add

/*
**	Register a Protocol module as an active access method
*/
PUBLIC BOOL HTProtocol_add (const char *       	name,
			    const char *	transport,
			    HTProtocolId	protocolId,
			    BOOL		preemptive,
			    HTProtCallback *	client,
			    HTProtCallback *	server)
{
    if (name && (client || server)) {
	HTProtocol *newProt;
	if ((newProt=(HTProtocol *) HT_CALLOC(1, sizeof(HTProtocol))) == NULL)
	    HT_OUTOFMEM("HTProtocol_add");
	StrAllocCopy(newProt->name, name);
	{
	    char *ptr = newProt->name;
	    while ((*ptr = TOLOWER(*ptr))) ptr++;
	}
	StrAllocCopy(newProt->transport, transport);
	{
	    char *ptr = newProt->transport;
	    while ((*ptr = TOLOWER(*ptr))) ptr++;
	}
	newProt->id = protocolId;
	newProt->preemptive = preemptive;
	newProt->client = client;
	newProt->server = server;
	if (!protocols) protocols = HTList_new();
	else HTProtocol_delete(name); /* Ensure not listed twice */
	HTTRACE(CORE_TRACE, "Protocol.... Adding `%s'\n" _ name);
	return HTList_addObject(protocols, (void *) newProt);
    }
    return NO;
}
开发者ID:Hiroyuki-Nagata,项目名称:libwww,代码行数:35,代码来源:HTProt.c

示例7: HTPresentation_add

/*	Define a presentation system command for a content-type
**	-------------------------------------------------------
** INPUT:
**	conversions:	The list of conveters and presenters
**	representation:	the MIME-style format name
**	command:	the MAILCAP-style command template
**	quality:	A degradation faction [0..1]
**	maxbytes:	A limit on the length acceptable as input (0 infinite)
**	maxsecs:	A limit on the time user will wait (0 for infinity)
*/
PUBLIC void HTPresentation_add (HTList *	conversions,
				const char *	representation,
				const char *	command,
				const char *	test_command,
				double		quality,
				double		secs, 
				double		secs_per_byte)
{
    HTPresentation * pres;
    if (presentation_converter) {
	if ((pres = (HTPresentation  *) HT_CALLOC(1,sizeof(HTPresentation))) == NULL)
	    HT_OUTOFMEM("HTSetPresentation");
        pres->rep = HTAtom_for(representation);
	pres->rep_out = WWW_PRESENT;		/* Fixed for now ... :-) */
	pres->converter = presentation_converter;
	pres->quality = quality;
	pres->secs = secs;
	pres->secs_per_byte = secs_per_byte;
	pres->rep = HTAtom_for(representation);
	pres->command = NULL;
	StrAllocCopy(pres->command, command);
	pres->test_command = NULL;
	StrAllocCopy(pres->test_command, test_command);
	HTTRACE(CORE_TRACE, "Presentation Adding `%s\' with quality %.2f\n" _ 
		    command _ quality);
	HTList_addObject(conversions, pres);
    }
}
开发者ID:Hiroyuki-Nagata,项目名称:libwww,代码行数:38,代码来源:HTFormat.c

示例8: ARGS4

/*	Define the representation associated with a file suffix
**	-------------------------------------------------------
**
**	Calling this with suffix set to "*" will set the default
**	representation.
**	Calling this with suffix set to "*.*" will set the default
**	representation for unknown suffix files which contain a ".".
*/
PUBLIC void HTSetSuffix ARGS4(
	WWW_CONST char *,	suffix,
	WWW_CONST char *,	representation,
	WWW_CONST char *,	encoding,
	float,		value)
{
    
    HTSuffix * suff;
    
    if (strcmp(suffix, "*")==0) suff = &no_suffix;
    else if (strcmp(suffix, "*.*")==0) suff = &unknown_suffix;
    else {
	suff = (HTSuffix*) calloc(1, sizeof(HTSuffix));
	if (suff == NULL) outofmem(__FILE__, "HTSetSuffix");
	
	if (!HTSuffixes) HTSuffixes = HTList_new();
	HTList_addObject(HTSuffixes, suff);
	
	StrAllocCopy(suff->suffix, suffix);
    }

    suff->rep = HTAtom_for(representation);
    
    {
    	char *enc = NULL, *p;
	StrAllocCopy(enc, encoding);
	for (p=enc; *p; p++) *p = TOLOWER(*p);
	suff->encoding = HTAtom_for(enc);
        free (enc);
    }
    
    suff->quality = value;
}
开发者ID:thentenaar,项目名称:mosaic-ng,代码行数:41,代码来源:HTFile.c

示例9: HTAA_newModule

PUBLIC HTAAModule * HTAA_newModule (const char *	scheme,
				    HTNetBefore *	before,
				    HTNetAfter *	after,
				    HTNetAfter *	update,
				    HTUTree_gc *	gc)
{
    if (scheme) {
	HTAAModule * pres = find_module(scheme);

	/* If found then update entry - else create a new one */
	if (!pres) {
	    if (!(pres = (HTAAModule *) HT_CALLOC(1, sizeof(HTAAModule))))
		HT_OUTOFMEM("HTAA_newModule");
	    StrAllocCopy(pres->scheme, scheme);
	    pres->before = before;
	    pres->after = after;
	    pres->update = update;
	    pres->gc = gc;

	    /* Add the new AA Module to the list */
	    HTList_addObject(HTSchemes, (void *) pres);
	    HTTRACE(AUTH_TRACE, "Auth Engine. Created module %p\n" _ pres);
	} else {
	    HTTRACE(AUTH_TRACE, "Auth Engine. Found module %p\n" _ pres);
	}
	return pres;
    } else {
	HTTRACE(AUTH_TRACE, "Auth Engine. Bad argument\n");
	return NULL;
    }
}
开发者ID:stefanhusmann,项目名称:Amaya,代码行数:31,代码来源:HTAAUtil.c

示例10: HTMuxChannel_new

PUBLIC HTMuxChannel * HTMuxChannel_new (HTHost * host)
{
    if (host) {
	HTMuxChannel * me = NULL;

	/* Create new object */
	if ((me = (HTMuxChannel *) HT_CALLOC(1, sizeof(HTMuxChannel))) == NULL)
	    HT_OUTOFMEM("HTMuxChannel_new");
	me->hash = HTHost_hash(host);
	me->host = host;

	/*
	**  Make sure that we are in interleave mode
	*/
	HTHost_setMode(host, HT_TP_INTERLEAVE);

	/*
	**  Get a special MUX Net object that we keep to our selves. We don't
	**  associate a request object as the Net object lives longer.
	*/
	me->net = HTNet_new(NULL);
	HTNet_setReadStream(me->net, HTDemux_new(host, me));

	/* Insert into hash table */
	if (!muxchs) {
	    if ((muxchs=(HTList **) HT_CALLOC(HOST_HASH_SIZE, sizeof(HTList *))) == NULL)
		HT_OUTOFMEM("HTMuxChannel_new");
	}
	if (!muxchs[me->hash]) muxchs[me->hash] = HTList_new();
	HTList_addObject(muxchs[me->hash], (void *) me);
	HTTRACE(MUX_TRACE, "Mux Channel. %p created with hash %d\n" _ me _ me->hash);
	return me;
    }
    return NULL;
}
开发者ID:svagionitis,项目名称:libwww,代码行数:35,代码来源:HTMuxCh.c

示例11: add_hostname

/*	Add an entry to a list of host names
**	------------------------------------
**	Existing entries are replaced with new ones
*/
PRIVATE BOOL add_hostname (HTList * list, const char * host,
			   const char * access, unsigned port,
			   BOOL regex, int regex_flags)
{
    HTHostList *me;
    if (!list || !host || !*host)
	return NO;
    if ((me = (HTHostList *) HT_CALLOC(1, sizeof(HTHostList))) == NULL)
        HT_OUTOFMEM("add_hostname");
#ifdef HT_POSIX_REGEX
    if (regex)
	me->regex = get_regex_t(host,
				regex_flags < 0 ?
				W3C_DEFAULT_REGEX_FLAGS : regex_flags);
#endif

    if (access) {
	char *ptr;
	StrAllocCopy(me->access, access);      	     	    /* Access method */
	ptr = me->access;
	while ((*ptr = TOLOWER(*ptr))) ptr++;
    }
    StrAllocCopy(me->host, host);		     	    	/* Host name */
    {
	char *ptr = me->host;
	while ((*ptr = TOLOWER(*ptr))) ptr++;
    }
    me->port = port;					      /* Port number */
    HTTRACE(PROT_TRACE, "HTHostList.. adding `%s\' to list\n" _ me->host);
    HTList_addObject(list, (void *) me);
    return YES;
}
开发者ID:stefanhusmann,项目名称:Amaya,代码行数:36,代码来源:HTProxy.c

示例12: 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;
}
开发者ID:csev,项目名称:xmosaic-1.2,代码行数:32,代码来源:HTAnchor.c

示例13: HTDNS_add

/*	HTDNS_add
**	---------
**	Add an element to the cache of visited hosts. Note that this function
**	requires the system implemented structure hostent and not our own
**	host_info. The homes variable indicates the number of IP addresses 
**	found. A host name must NOT contain a port number.
**	Returns address of new HTdns object
*/
PUBLIC HTdns * HTDNS_add (HTList * list, struct hostent * element,
			  char *host, int *homes)
{
    HTdns *me;
    char *addr = NULL;
    char **index = element->h_addr_list;
    int cnt = 1;

    while(*index++) cnt++;
    if ((me = (HTdns *) HT_CALLOC(1, sizeof(HTdns))) == NULL ||
	(me->addrlist = (char **) HT_CALLOC(1, cnt*sizeof(char*))) == NULL ||
	(addr = (char *) HT_CALLOC(1, cnt*element->h_length)) == NULL)
	HT_OUTOFMEM("HTDNS_add");
    StrAllocCopy(me->hostname, host);
    me->ntime = time(NULL);
    index = element->h_addr_list;
    cnt = 0;
    while (*index) {
	*(me->addrlist+cnt) = addr+cnt*element->h_length;
	memcpy((void *) *(me->addrlist+cnt++), *index++, element->h_length);
    }
    me->homes = cnt;
    *homes = cnt;
    if ((me->weight = (double *) HT_CALLOC(me->homes, sizeof(double))) == NULL)
        HT_OUTOFMEM("HTDNS_add");
    me->addrlength = element->h_length;
    HTTRACE(PROT_TRACE, "DNS Add..... `%s\' with %d home(s) to %p\n" _ 
		host _ *homes _ list);
    HTList_addObject(list, (void *) me);
    return me;
}
开发者ID:BackupTheBerlios,项目名称:texlive,代码行数:39,代码来源:HTDNS.c

示例14: ARGS6

/*	Define a built-in function for a content-type
**	---------------------------------------------
*/
PUBLIC void HTSetConversion ARGS6(
	WWW_CONST char *, representation_in,
	WWW_CONST char *, representation_out,
	HTConverter*,	converter,
	float,	quality,
	float,	secs, 
	float,	secs_per_byte
){

    HTPresentation * pres = (HTPresentation *)malloc(sizeof(HTPresentation));
    
    pres->rep = HTAtom_for(representation_in);
    pres->rep_out = HTAtom_for(representation_out);
    pres->converter = converter;
    pres->command = NULL;		/* Fixed */
    pres->quality = quality;
    pres->secs = secs;
    pres->secs_per_byte = secs_per_byte;
    pres->command = 0;
    
    if (!HTPresentations) HTPresentations = HTList_new();
    
    if (strcmp(representation_in, "*")==0) {
        if (default_presentation) free(default_presentation);
	default_presentation = pres;
    } else {
        HTList_addObject(HTPresentations, pres);
    }
}
开发者ID:elgreg,项目名称:ncsa-mosaic,代码行数:32,代码来源:HTFormat.c

示例15: ARGS1

PRIVATE ItemList *parse_item_list ARGS1(FILE *, fp)
{
    ItemList *item_list = HTList_new();
    Item *item;
    LexItem lex_item;

    for(;;) {
	if (!(item = parse_item(fp))) {
	    HTList_delete(item_list);	/* @@@@ */
	    item_list = NULL;
	    return NULL;
	}
	HTList_addObject(item_list, (void*)item);
	lex_item = lex(fp);
	if (lex_item != LEX_ITEM_SEP) {
	    unlex(lex_item);
	    return item_list;
	}
	/*
	** Here lex_item == LEX_ITEM_SEP; after item separator it
	** is ok to have one or more newlines (LEX_REC_SEP) and
	** they are ignored (continuation line).
	*/
	do {
	    lex_item = lex(fp);
	} while (lex_item == LEX_REC_SEP);
	unlex(lex_item);
    }
}
开发者ID:OS2World,项目名称:APP-INTERNET-Lynx,代码行数:29,代码来源:HTGroup.c


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