當前位置: 首頁>>代碼示例>>C++>>正文


C++ GetHost函數代碼示例

本文整理匯總了C++中GetHost函數的典型用法代碼示例。如果您正苦於以下問題:C++ GetHost函數的具體用法?C++ GetHost怎麽用?C++ GetHost使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了GetHost函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: CreateEntityByName

CBaseEntity * CEntHost::GiveNamedItem( const char * szName, int iSubType, bool removeIfNotCarried )
{
    // If I already own this type don't create one
    if ( GetHost()->Weapon_OwnsThisType( szName, iSubType ) )
        return NULL;

    CBaseEntity *pEntity = CreateEntityByName( szName );

    if ( !pEntity ) {
        Msg( "NULL Ent in GiveNamedItem!\n" );
        return NULL;
    }

    pEntity->SetLocalOrigin( GetLocalOrigin() );
    pEntity->AddSpawnFlags( SF_NORESPAWN );

    CBaseCombatWeapon *pWeapon = dynamic_cast<CBaseCombatWeapon *>(pEntity);

    DispatchSpawn( pEntity );

    if ( pWeapon ) {
        pWeapon->SetSubType( iSubType );
        GetHost()->Weapon_Equip( pWeapon );
    }
    else {
        if ( pEntity && !(pEntity->IsMarkedForDeletion()) ) {
            pEntity->Touch( GetHost() );
        }
    }

    return pEntity;
}
開發者ID:WootsMX,項目名稱:InSource,代碼行數:32,代碼來源:ent_host.cpp

示例2: strcpy

const char* NNTPConnection::JoinGroup(const char* grp)
{
	if (m_szActiveGroup && !strcmp(m_szActiveGroup, grp))
	{
		// already in group
		strcpy(m_szLineBuf, "211 ");
		return m_szLineBuf;
	}

	char tmp[1024];
	snprintf(tmp, 1024, "GROUP %s\r\n", grp);
	tmp[1024-1] = '\0';

	const char* answer = Request(tmp);

	if (answer && !strncmp(answer, "2", 1))
	{
		debug("Changed group to %s on %s", grp, GetHost());

		if (m_szActiveGroup)
		{
			free(m_szActiveGroup);
		}
		m_szActiveGroup = strdup(grp);
	}
	else
	{
		debug("Error changing group on %s to %s: %s.", GetHost(), grp, answer);
	}

	return answer;
}
開發者ID:Bootz,項目名稱:nzbget,代碼行數:32,代碼來源:NNTPConnection.cpp

示例3: GetHost

void CEntHost::Precache()
{
    GetHost()->PrecacheModel( GetHostModel() );

    GetHost()->PrecacheScriptSound( "Player.Death" );
    GetHost()->PrecacheScriptSound( "Player.Pain" );
}
開發者ID:WootsMX,項目名稱:InSource,代碼行數:7,代碼來源:ent_host.cpp

示例4: GetUser

bool
PeerIdentity::Equals(const nsAString& aOtherString) const
{
  nsString user;
  GetUser(mPeerIdentity, user);
  nsString otherUser;
  GetUser(aOtherString, otherUser);
  if (user != otherUser) {
    return false;
  }

  nsString host;
  GetHost(mPeerIdentity, host);
  nsString otherHost;
  GetHost(aOtherString, otherHost);

  nsresult rv;
  nsCOMPtr<nsIIDNService> idnService
    = do_GetService("@mozilla.org/network/idn-service;1", &rv);
  if (NS_WARN_IF(NS_FAILED(rv))) {
    return host == otherHost;
  }

  nsCString normHost;
  GetNormalizedHost(idnService, host, normHost);
  nsCString normOtherHost;
  GetNormalizedHost(idnService, otherHost, normOtherHost);
  return normHost == normOtherHost;
}
開發者ID:MichaelKohler,項目名稱:gecko-dev,代碼行數:29,代碼來源:PeerIdentity.cpp

示例5: f_part_insecure_users

// Parts all insecure users on a +z channel (NOT KICK)
void f_part_insecure_users (aChannel *chptr)
{
	Member *member, *mb2;
	aClient *cptr;
	char *comment = "Insecure user not allowed on secure channel (+z)";
	for (member = chptr->members; member; member = mb2)
	{
		mb2 = member->next;
		cptr = member->cptr;
		if (MyClient(cptr) && !IsSecureConnect(cptr) && !IsULine(cptr))
		{
			RunHook4(HOOKTYPE_LOCAL_PART, cptr, &me, chptr, comment);
			if ((chptr->mode.mode & MODE_AUDITORIUM) && is_chanownprotop(cptr, chptr))
			{
				sendto_chanops_butone(cptr, chptr, ":%s!%[email protected]%s PART %s :%s",
					cptr->name, cptr->user->username, GetHost(cptr), chptr->chname, comment);
				sendto_prefix_one(cptr, &me, ":%s!%[email protected]%s PART %s :%s",
					cptr->name, cptr->user->username, GetHost(cptr), chptr->chname, comment);
			} 
			else
			{
				sendto_channel_butserv(chptr, &me, ":%s!%[email protected]%s PART %s :%s",
					cptr->name, cptr->user->username, GetHost(cptr), chptr->chname, comment);
			}
			sendto_one(cptr, err_str(ERR_SECUREONLYCHAN), me.name, cptr->name, chptr->chname);
			sendto_serv_butone_token(&me, cptr->name, MSG_PART, TOK_PART, "%s :%s", chptr->chname, comment);
			remove_user_from_channel(cptr, chptr);
		}
	}
}
開發者ID:wirelesspt,項目名稱:unreal,代碼行數:31,代碼來源:f_ulinessl.c

示例6: SetLastError

int CService::GetStatus () {
	SC_HANDLE hSCM = NULL;
	SC_HANDLE hService = NULL;
	SERVICE_STATUS ss;
	int nResult;
	do {
		if (!GetServiceName () || !GetHost () || !GetPort ()) {
			nResult = SERVICE_STATUS_BAD_CONFIG;
			break;
		}
		if (m_nWinsock) {
			nResult = SERVICE_STATUS_BAD_WINSOCK;
			SetLastError (m_nWinsock);
			break;
		}
		hSCM = OpenSCManager (_scmHost (GetHost ()), NULL, GENERIC_READ);
		if (!hSCM) {
			nResult = SERVICE_STATUS_BAD_SCM;
			break;
		}
		hService = OpenService (hSCM, GetServiceName (), SERVICE_INTERROGATE);
		if (!hService) {
			DWORD dwError = GetLastError ();
			switch (dwError) {
			case ERROR_SERVICE_DOES_NOT_EXIST :
				nResult = SERVICE_STATUS_NOT_INSTALLED;
				break;
			default :
				nResult = SERVICE_STATUS_CONNECTOR_ERROR;
				break;
			}
			break;
		}
		if (!ControlService (hService, SERVICE_CONTROL_INTERROGATE, &ss)) {
			DWORD dwError = GetLastError ();
			switch (dwError) {
			case ERROR_SERVICE_NEVER_STARTED :
			case ERROR_SERVICE_NOT_ACTIVE :
				nResult = SERVICE_STATUS_STOPPED;
				break;
			case ERROR_SERVICE_CANNOT_ACCEPT_CTRL :
				nResult = SERVICE_STATUS_BUSY;
				break;
			default :
				nResult = SERVICE_STATUS_QUERY_ERROR;
				break;
			}
			break;
		}
		if (ss.dwCurrentState != SERVICE_RUNNING) {
			nResult = SERVICE_STATUS_BUSY;
			break;
		}
		nResult = _socketConnect (GetHost (), GetPort ()) ? SERVICE_STATUS_OK : SERVICE_STATUS_STARTING;
	} while (FALSE);
	if (hSCM) CloseServiceHandle (hSCM);
	if (hService) CloseServiceHandle (hService);
	return nResult;
}
開發者ID:Vineeth-Mohan,項目名稱:OG-Platform,代碼行數:59,代碼來源:service.cpp

示例7: OnInit

void BaseAnimation::OnInit(void)
{
	m_transform = (Transform*)GetHost()->FindComponent(CRC(0xF543030E, "Transform"));
	if (!m_transform)
	{
		m_transform = (Transform*)GetHost()->FindComponentByType(CRC(0xF543030E, "Transform"));
	}
	Dbg_Assert(m_transform != NULL);
}
開發者ID:rickjuang,項目名稱:helium,代碼行數:9,代碼來源:base_animation.cpp

示例8: GetSocket

void ChatServerConnection::OnReceive(const char *pBuffer, uint32 nSize)
{
	if (pBuffer) {
		// Compose server message (we use the string copy constructor to ensure that there's a correct terminating zero)
		const String sMessage = GetSocket().GetSocketAddress().GetHost() + ": '" + String(pBuffer, true, nSize-1) + '\''; // -1 = excluding the terminating zero

		// Write the message into the log and start a new line
		System::GetInstance()->GetConsole().Print(sMessage + '\n');

		// Send message to all clients
		for (uint32 i=0; i<GetHost().GetConnections().GetNumOfElements(); i++)
			GetHost().GetConnections().Get(i)->Send(sMessage.GetASCII(), sMessage.GetLength()+1);	// +1 so we also send the terminating zero
	}
}
開發者ID:Tank-D,項目名稱:potential-octo-dubstep,代碼行數:14,代碼來源:ChatServerConnection.cpp

示例9: send_who_reply

static void send_who_reply(aClient *sptr, aClient *acptr, 
			   char *channel, char *status, char *xstat)
{
	char *stat;
	char *host;
	int flat = (FLAT_MAP && !IsAnOper(sptr)) ? 1 : 0;

	stat = malloc(strlen(status) + strlen(xstat) + 1);
	sprintf(stat, "%s%s", status, xstat);

	if (IsAnOper(sptr))
	{
		if (who_flags & WF_REALHOST)
			host = acptr->user->realhost;
		else if (who_flags & WF_IP)
			host = (acptr->user->ip_str ? acptr->user->ip_str : 
			        acptr->user->realhost);
		else
			host = GetHost(acptr);
	}
	else
		host = GetHost(acptr);
					

	if (IsULine(acptr) && !IsOper(sptr) && HIDE_ULINES)
	        sendto_one(sptr, getreply(RPL_WHOREPLY), me.name, sptr->name,
        	     channel,       /* channel name */
	             acptr->user->username, /* user name */
        	     host,		    /* hostname */
	             "hidden",              /* let's hide the server from normal users if the server is a uline and HIDE_ULINES is on */
        	     acptr->name,           /* nick */
	             stat,                  /* status */
        	     0,                     /* hops (hidden) */
	             acptr->info            /* realname */
             	);

	else
		sendto_one(sptr, getreply(RPL_WHOREPLY), me.name, sptr->name,      
		     channel,       /* channel name */
		     acptr->user->username,      /* user name */
		     host,		         /* hostname */
		     acptr->user->server,        /* server name */
		     acptr->name,                /* nick */
		     stat,                       /* status */
		     flat ? 0 : acptr->hopcount, /* hops */ 
		     acptr->info                 /* realname */
		     );
	free(stat);
}
開發者ID:Adam-,項目名稱:unrealircd,代碼行數:49,代碼來源:m_who.c

示例10: GetHost

void MultiViewerConnectDlg::OnOKButtonClick( wxCommandEvent& event )
{
	wxString wxstrHost = GetHost();
	if(wxstrHost.IsEmpty())
	{
		SQLUtil::AlertDlg(_T("No Host"));
		return;
	}

	//wxString wxstrPort = GetPort();
	//if(wxstrPort.IsEmpty())
	//{
	//	SQLUtil::AlertDlg(_T("No Port"));
	//	return;
	//}

	//wxString wxstrName = GetName();
	//if(wxstrName.IsEmpty())
	//{
	//	SQLUtil::AlertDlg(_T("No ID"));
	//	return;
	//}

	//wxString wxstrPassword = GetPassword();
	//if(wxstrPassword.IsEmpty())
	//{
	//	SQLUtil::AlertDlg(_T("No Password"));
	//	return;
	//}

	EndModal(wxID_OK);
}
開發者ID:yiunsr,項目名稱:multidbviewer,代碼行數:32,代碼來源:MultiViewerConnectDlg.cpp

示例11: DzMilUnixTime

unsigned long long DzMilUnixTime()
{
    DzHost* host = GetHost();
    assert( host );

    return (unsigned long long)MilUnixTime( host );
}
開發者ID:Foreverflying,項目名稱:DzCot,代碼行數:7,代碼來源:DzCot.c

示例12: GetHost

void RawFormatWidget::showEvent( QShowEvent *event )
{
	if (!m_Format)
	{
		m_Format = GetHost()->NewFormat();
	}

	SourceInfo info;
	rawSource->GetInfo(info);

	ui.Title->setText(rawSource->GetPath());
	ui.Width->setText(QString::number(info.format->Width()));
	ui.Height->setText(QString::number(info.format->Height()));
	
	int idx = 0;
	for (int j=0; j<COLOR_COUNT; j++)
	{
		if (colors[j] == info.format->Color())
		{
			idx = j;
		}
	}
	ui.Color->setCurrentIndex(idx);
	ui.FPS->setValue(info.maxFps);
	/*ui.Stride0->setText(QString::number(info.format->Stride(0)));
	ui.Stride1->setText(QString::number(info.format->Stride(1)));
	ui.Stride2->setText(QString::number(info.format->Stride(2)));
	ui.Stride3->setText(QString::number(info.format->Stride(3)));*/
}
開發者ID:Gamaru,項目名稱:yuvtoolkit,代碼行數:29,代碼來源:RawFormatWidget.cpp

示例13: WriteLine

const char* NntpConnection::Request(const char* req)
{
    if (!req)
    {
        return nullptr;
    }

    m_authError = false;

    WriteLine(req);

    char* answer = ReadLine(m_lineBuf, m_lineBuf.Size(), nullptr);

    if (!answer)
    {
        return nullptr;
    }

    if (!strncmp(answer, "480", 3))
    {
        debug("%s requested authorization", GetHost());

        if (!Authenticate())
        {
            return nullptr;
        }

        //try again
        WriteLine(req);
        answer = ReadLine(m_lineBuf, m_lineBuf.Size(), nullptr);
    }

    return answer;
}
開發者ID:ta264,項目名稱:nzbget,代碼行數:34,代碼來源:NntpConnection.cpp

示例14: DzFreeEx

void DzFreeEx( void* p )
{
    DzHost* host = GetHost();
    assert( host );

    FreeEx( host, p );
}
開發者ID:Foreverflying,項目名稱:DzCot,代碼行數:7,代碼來源:DzCot.c

示例15: DzLatestMilUnixTime

unsigned long long DzLatestMilUnixTime()
{
    DzHost* host = GetHost();
    assert( host );

    return (unsigned long long)host->latestMilUnixTime;
}
開發者ID:Foreverflying,項目名稱:DzCot,代碼行數:7,代碼來源:DzCot.c


注:本文中的GetHost函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。