本文整理汇总了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;
}
示例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;
}
示例3: GetHost
void CEntHost::Precache()
{
GetHost()->PrecacheModel( GetHostModel() );
GetHost()->PrecacheScriptSound( "Player.Death" );
GetHost()->PrecacheScriptSound( "Player.Pain" );
}
示例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;
}
示例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);
}
}
}
示例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;
}
示例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);
}
示例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
}
}
示例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);
}
示例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);
}
示例11: DzMilUnixTime
unsigned long long DzMilUnixTime()
{
DzHost* host = GetHost();
assert( host );
return (unsigned long long)MilUnixTime( host );
}
示例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)));*/
}
示例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;
}
示例14: DzFreeEx
void DzFreeEx( void* p )
{
DzHost* host = GetHost();
assert( host );
FreeEx( host, p );
}
示例15: DzLatestMilUnixTime
unsigned long long DzLatestMilUnixTime()
{
DzHost* host = GetHost();
assert( host );
return (unsigned long long)host->latestMilUnixTime;
}