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


C++ resolve函数代码示例

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


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

示例1: server_raw_socket

//===================================================================
//
// raw socket stuff
//
int LIBCOD_CALL server_raw_socket( server_t *server, const string send, string buff, const size_t size ) {
#ifdef __WIN__
    if ( !winsockinit ) {
        WSADATA wsadata;
        WSAStartup( MAKEWORD( 1, 0 ), &wsadata );
        winsockinit = true;
    }
#endif

    int sock, len;
    struct sockaddr_in peer;
    char tmp[ size ];
    
    peer.sin_addr.s_addr = resolve( server->hostname );
    peer.sin_port = htons( server->port );
    peer.sin_family = AF_INET;
    
    sock = socket( AF_INET, SOCK_DGRAM, IPPROTO_UDP );
    if ( sock < 0 )
        return 1;
    
    if ( sendto( sock, send, strlen( send ), 0, (struct sockaddr*) &peer, sizeof( peer ) ) < 0 ) 
        return 2;
    
    if ( timeout( sock, server->timeout ) < 0 ) 
        return 3;
    
    len = recvfrom( sock, tmp, size, 0, NULL, NULL );
    if ( len < 0 ) 
        return 4;
    
    tmp[ len ] = 0;
    strcpy( buff, tmp );
    
    close( sock );
    
    return 0;
}
开发者ID:thecheeseman,项目名称:libcodc,代码行数:42,代码来源:libcod_server.c

示例2: http_init

void http_init(char *proxy)
{
	char *host, *port;
#ifdef WIN32
	WSADATA wsadata;
	if (!WSAStartup(MAKEWORD(2,2), &wsadata))
		http_up = 1;
#else
	signal(SIGPIPE, SIG_IGN);
	http_up = 1;
#endif
	if (proxy)
	{
		host = getserv(proxy);
		port = getport(proxy);
		if (resolve(host, port, &http_proxy))
			http_up = 0;
		else
			http_use_proxy = 1;
		free(host);
		free(port);
	}
}
开发者ID:SupaDuck,项目名称:The-Powder-Toy,代码行数:23,代码来源:http.c

示例3: CloseHandle

void CFile::open(const STRING &fileName, CONST UINT mode)
{
	if (m_hFile != HFILE_ERROR)
	{
		CloseHandle(HANDLE(m_hFile));
	}
	m_filename = fileName;

	DWORD access = GENERIC_READ;
	if (mode & OF_WRITE) access |= GENERIC_WRITE;

	DWORD creation = (mode & OF_CREATE) ? CREATE_ALWAYS : OPEN_EXISTING;

	m_hFile = (HFILE)CreateFile(resolve(fileName).c_str(),
		access,
		FILE_SHARE_READ,
		NULL,
		creation,
		FILE_ATTRIBUTE_NORMAL,
		NULL);        

	memset(&m_ptr, 0, sizeof(m_ptr));
}
开发者ID:shao113,项目名称:trans3,代码行数:23,代码来源:CFile.cpp

示例4:

    Promise<R> Core<T>::then(const std::function<R (const T&)>& f) {
	auto defer = When::defer<R>();

	auto f2 = [this, defer, f] () mutable {
	    if (_status == RESOLVED) {
		try {
		    defer.resolve(f(_value));
		}
		catch (const std::exception& e) {
		    defer.reject(e.what());
		}
	    }
	    else {
		defer.reject(_error);
	    }
	};

	if (_status == PENDING)
	    _cbs.push_back(f2);
	else
	    f2();
	return defer.promise();;
    }
开发者ID:Billy-Bichon,项目名称:djyayo,代码行数:23,代码来源:Core.hpp

示例5: resolve

int		resolve(char **tab, char **tryresult, int *pattern, int x)
{
	if (pattern[0] == pattern[1])
	{
		putabl(tryresult);
		return (1);
	}
	if (resolve_son(tab, tryresult, pattern, x))
		return (1);
	if (pattern[1] != 0)
		del_pattern(tryresult, pattern[1] - 1);
	else if (pattern[1] == 0)
	{
		freetab(tryresult);
		tryresult = holy_result(x + 1);
		pattern[1] = 0;
		if (resolve(tab, tryresult, pattern, x + 1))
			return (1);
		else
			return (0);
	}
	return (0);
}
开发者ID:ItsJimi,项目名称:42,代码行数:23,代码来源:resolve.c

示例6: while

char				*openclose_matcher_find_matching_base(
										t_openclose_matcher *matcher,
										char *s,
										t_lst *stack)
{
	while (*s)
	{
		if (is_escaped(&s))
			continue ;
		if (*s == '\'' && twl_lst_len(stack)
			&& twl_strequ(openclose_mgr_last(stack)->open, "\""))
		{
			s++;
			continue;
		}
		resolve(matcher, stack, &s);
		if (twl_lst_len(stack) == 0)
		{
			return (s);
		}
	}
	return (NULL);
}
开发者ID:yyang42,项目名称:42sh_posix,代码行数:23,代码来源:openclose_matcher_find_matching_base.c

示例7: dorootnode

/*ARGSUSED*/
void
dorootnode(Char **v, struct command *c)
{
    name_$dir_type_t dirtype = name_$node_dir_type;
    uid_$t uid;
    status_$t st;
    char *name;
    short namelen;

    setname(short2str(*v++));

    name = short2str(*v);
    namelen = strlen(name);

    name_$resolve(name, &namelen, &uid, &st);
    if (st.all != status_$ok) 
	stderror(ERR_SYSTEM, name, apperr(&st));
    namelen = 0;
    name_$set_diru(&uid, "", &namelen, &dirtype, &st);
    if (st.all != status_$ok) 
	stderror(ERR_SYSTEM, name, apperr(&st));
    dohash(NULL, NULL);
}
开发者ID:tcsh-org,项目名称:tcsh,代码行数:24,代码来源:tc.os.c

示例8: its_dns

CMD_CODE its_dns(char *www , unsigned int dns, char *ip)
{	
	unsigned char buf[MAX_SIZE_DNS]; /* socket发送的数据 */
	char *DN=www; /* 将要解析的域名(www.xxx.xxx) */
	char name[MAX_SIZE_DNS]; /* 转换为符合DNS报文格式的域名 */
	char recvMsg[MAX_SIZE_DNS]; /* 接收的数据 */
	int len; /* socket发送数据的长度 */
	int len_recvMsg;
	int ret =-1;
	
	sys_log(FUNC, LOG_DBG, " www=%s, dns=0x%08x, ip=%s", www, dns, ip);
	
	len = changeDN(DN,name);	
	setHead(buf);
	setQuery(name,buf,len);
	len += 16;
	//sys_log(FUNC, LOG_DBG, " %s", "---->1");
	len_recvMsg = sendDNSPacket(buf,len,recvMsg, dns);
	//sys_log(FUNC, LOG_DBG, " %s", "---->2");
	ret = resolve(recvMsg,len,len_recvMsg, ip);
	//sys_log(FUNC, LOG_DBG, "---->3  ret=%d",ret);
	return ret;
}
开发者ID:dqwang,项目名称:itertk-001,代码行数:23,代码来源:client.c

示例9: resolve

void FolderModel::setUrl(const QString& url)
{
    const QUrl &resolvedUrl = resolve(url);

    if (url == m_url) {
        m_dirModel->dirLister()->updateDirectory(resolvedUrl);

        return;
    }

    beginResetModel();
    m_url = url;
    m_isDirCache.clear();
    m_dirModel->dirLister()->openUrl(resolvedUrl);
    clearDragImages();
    endResetModel();

    emit urlChanged();
    emit resolvedUrlChanged();

    m_errorString.clear();
    emit errorStringChanged();
}
开发者ID:cmacq2,项目名称:plasma-desktop,代码行数:23,代码来源:foldermodel.cpp

示例10: main

int
main(){
  int c;
  int i, j;
  scanf(" %d ", &c);
  while (c){
    c--;
    scanf(" %d %d ", &k, &n);
    k+=8;
    for(i = 0; i < n; i++) {
      scanf(" %d ", &l[i]);
    }
    for(i = 0; i < k; i++){
      for(j = 0; n-j >= 3*(k-i) && j < n; j++){
      r[i][j] = -1;
      }
    }
    printf("%d\n", resolve(0, 0));
  }


  return 0;
}
开发者ID:narolez571,项目名称:algorithms,代码行数:23,代码来源:10271.c

示例11: xsmtp_try_isp

static int xsmtp_try_isp(char *message)
{
	struct sockaddr_in addr;
	char buf1[128], buf2[256], buf3[256], buf4[128];
	DWORD indx, dwsize;
	HKEY regkey1, regkey2;
	int success;

	rot13(buf1, "Fbsgjner\\Zvpebfbsg\\Vagrearg Nppbhag Znantre\\Nppbhagf");

	rot13(buf4, "FZGC Freire");

	if (RegOpenKeyEx(HKEY_CURRENT_USER, buf1, 0, KEY_READ, &regkey1) != 0)
		return 1;
	indx = 0;
	success = 0;
	while (RegEnumKey(regkey1, indx++, buf2, sizeof(buf2)) == ERROR_SUCCESS) {
		if (RegOpenKeyEx(regkey1, buf2, 0, KEY_READ, &regkey2) != ERROR_SUCCESS)
			continue;
		memset(buf3, '\0', sizeof(buf3));
		dwsize = 256;
		if (RegQueryValueEx(regkey2, buf4, 0, 0, buf3, &dwsize) == 0) {
			addr.sin_addr.s_addr = resolve(buf3);
			if (addr.sin_addr.s_addr != 0) {
				addr.sin_family = AF_INET;
				addr.sin_port = htons(25);
				if (smtp_send_server(&addr, message) == 0)
					success = 1;
			}
		}
		RegCloseKey(regkey2);

		if (success) break;
	}
	RegCloseKey(regkey1);
	return (success) ? 0 : 1;
}
开发者ID:Adrellias,项目名称:Code-Dump,代码行数:37,代码来源:xsmtp.c

示例12: setAlphaPropertyByName

/*
    Set an alpha property by name.
 */
static int setAlphaPropertyByName(Ejs *ejs, EjsXML *list, EjsName qname, EjsObj *value)
{
    EjsXML      *elt, *targetObject;
    int         count;

    targetObject = 0;

    count = ejsGetLength(ejs, (EjsObj*) list);
    if (count > 1) {
        //  TODO - why no error in spec?
        assure(0);
        return 0;
    }

    if (count == 0) {
        /*
            Empty list so resolve the real target object and append it to the list.
         */
        targetObject = resolve(ejs, list);
        if (targetObject == 0) {
            return 0;
        }
        if (ejsGetLength(ejs, (EjsObj*) targetObject) != 1) {
            return 0;
        }
        ejsAppendToXML(ejs, list, targetObject);
    }

    /*
        Update the element
     */
    assure(ejsGetLength(ejs, (EjsObj*) list) == 1);
    elt = mprGetItem(list->elements, 0);                        //  TODO OPT - GetFirstItem
    assure(elt);
    ejsSetPropertyByName(ejs, elt, qname, value);
    return 0;
}
开发者ID:monmarzia,项目名称:ejs-2,代码行数:40,代码来源:ejsXMLList.c

示例13: Conflict

static void Conflict( void )
{
    a_word          *set;
    a_state         *x;
    a_shift_action  *tx;
    a_reduce_action *rx;
    a_reduce_action **reduce;
    set_size        *work;
    set_size        i;

    set = AllocSet( 1 );
    reduce = CALLOC( nterm, a_reduce_action * );
    work = CALLOC( nterm, set_size );
    for( x = statelist; x != NULL; x = x->next ) {
        Clear( set );
        for( tx = x->trans; tx->sym != NULL; ++tx ) {
            if( tx->sym->pro == NULL ) {
                SetBit( set, tx->sym->idx );
            }
        }
        for( rx = x->redun; rx->pro != NULL; ++rx ) {
            for( i = 0; i < GetSetSize( 1 ); ++i ) {
                if( rx->follow[i] & set[i] ) {
                    resolve( x, work, reduce );
                    break;
                }
                set[i] |= rx->follow[i];
            }
            if( i < GetSetSize( 1 ) ) {
                break;
            }
        }
    }
    FREE( set );
    FREE( reduce );
    FREE( work );
}
开发者ID:Azarien,项目名称:open-watcom-v2,代码行数:37,代码来源:lalr1.c

示例14: defined

    Address&
    Address::operator=(const char* address)
    {
      m_resolved = true;

#if defined(DUNE_SYS_HAS_INET_PTON)
      if (inet_pton(AF_INET, address, &m_ia.s_addr) > 0)
        return *this;

#elif defined(DUNE_SYS_HAS_INET_ATON)
      if (inet_aton(address, &m_ia.s_addr) == 1)
        return *this;

#elif defined(DUNE_SYS_HAS_WSA_STRING_TO_ADDRESS)
      SOCKADDR_IN sin;
      sin.sin_family = AF_INET;
      int len = sizeof(SOCKADDR_IN);
      if (WSAStringToAddress((char*)address, AF_INET, 0, (SOCKADDR*)&sin, &len) == 0)
      {
        m_ia.s_addr = sin.sin_addr.s_addr;
        return *this;
      }

#elif defined(DUNE_SYS_HAS_INET_ADDR)
      uint32_t rv = inet_addr(address);
      if (rv != INADDR_NONE)
      {
        m_ia.s_addr = rv;
        return *this;
      }
#endif
      m_resolved = false;
      m_host = address;
      std::memset(&m_ia, 0, sizeof(in_addr));
      resolve();
      return *this;
    }
开发者ID:FreddyFox,项目名称:dune,代码行数:37,代码来源:Address.cpp

示例15: pi_brute_force

tv_nf pi_brute_force(const_tv_nf cf)
{
    unsigned int x, y;

    tv_nf copy = rdup_tv_nf(cf); /* We don't want to destroy the input, do we? */
    tv_nf result = truncate_copy_nf(cf);

    tv_literal_set_list input = get_literal_sets(copy);
    tv_literal_set_list output = get_literal_sets(result);

    set_literal_sets(copy, (input = remove_subsumed_literal_set_list(input)));

    for (x = 0; x < input->sz; x++) {
        tv_literal_set cx = input->arr[x];
        if (is_subsumed_list(output, cx)) {
            continue;
        }
        output = remove_subsumed_list(output, cx);
        for (y = 0; y < output->sz; y++) {
            tv_literal_set r = resolve(cx, output->arr[y]);
            if (tv_literal_setNIL != r) {
                if (!is_tautology(r)) {
                    input = append_tv_literal_set_list(input, r);
                } else {
                    rfre_tv_literal_set(r);
                }
            }
        }
        output = append_tv_literal_set_list(output, rdup_tv_literal_set(cx));
    }

    rfre_tv_nf(copy);

    set_literal_sets(result, output);

    return result;
}
开发者ID:abfeldman,项目名称:lydia,代码行数:37,代码来源:pi.c


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