本文整理汇总了C++中CGString::IsEmpty方法的典型用法代码示例。如果您正苦于以下问题:C++ CGString::IsEmpty方法的具体用法?C++ CGString::IsEmpty怎么用?C++ CGString::IsEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGString
的用法示例。
在下文中一共展示了CGString::IsEmpty方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnRxAxis
bool CClient::OnRxAxis( const BYTE * pData, size_t iLen )
{
ADDTOCALLSTACK("CClient::OnRxAxis");
if ( !iLen || ( GetConnectType() != CONNECT_AXIS ))
return false;
while ( iLen -- )
{
int iRet = OnConsoleKey( m_Targ_Text, *pData++, GetAccount() != NULL );
if ( ! iRet )
return( false );
if ( iRet == 2 )
{
if ( GetAccount() == NULL )
{
if ( !m_zLogin[0] )
{
if ( static_cast<unsigned int>(m_Targ_Text.GetLength()) <= (COUNTOF(m_zLogin) - 1) )
strcpy(m_zLogin, m_Targ_Text);
m_Targ_Text.Empty();
}
else
{
CGString sMsg;
CAccountRef pAccount = g_Accounts.Account_Find(m_zLogin);
if (( pAccount == NULL ) || ( pAccount->GetPrivLevel() < PLEVEL_Counsel ))
{
SysMessagef("\"MSG:%s\"", g_Cfg.GetDefaultMsg(DEFMSG_AXIS_NOT_PRIV));
m_Targ_Text.Empty();
return false;
}
if ( LogIn(m_zLogin, m_Targ_Text, sMsg ) == PacketLoginError::Success )
{
m_Targ_Text.Empty();
if ( GetPrivLevel() < PLEVEL_Counsel )
{
SysMessagef("\"MSG:%s\"", g_Cfg.GetDefaultMsg(DEFMSG_AXIS_NOT_PRIV));
return false;
}
if (GetPeer().IsValidAddr())
{
CScriptTriggerArgs Args;
Args.m_VarsLocal.SetStrNew("Account",GetName());
Args.m_VarsLocal.SetStrNew("IP",GetPeer().GetAddrStr());
TRIGRET_TYPE tRet = TRIGRET_RET_DEFAULT;
r_Call("f_axis_preload", this, &Args, NULL, &tRet);
if ( tRet == TRIGRET_RET_FALSE )
return false;
if ( tRet == TRIGRET_RET_TRUE )
{
SysMessagef("\"MSG:%s\"", g_Cfg.GetDefaultMsg(DEFMSG_AXIS_DENIED));
return false;
}
time_t dateChange;
DWORD dwSize;
if ( ! CFileList::ReadFileInfo( "Axis.db", dateChange, dwSize ))
{
SysMessagef("\"MSG:%s\"", g_Cfg.GetDefaultMsg(DEFMSG_AXIS_INFO_ERROR));
return false;
}
CGFile FileRead;
if ( ! FileRead.Open( "Axis.db", OF_READ|OF_BINARY ))
{
SysMessagef("\"MSG:%s\"", g_Cfg.GetDefaultMsg(DEFMSG_AXIS_FILE_ERROR));
return false;
}
TCHAR szTmp[8*1024];
PacketWeb packet;
for (;;)
{
size_t iLength = FileRead.Read( szTmp, sizeof( szTmp ) );
if ( iLength <= 0 )
break;
packet.setData((BYTE*)szTmp, iLength);
packet.send(this);
dwSize -= iLength;
if ( dwSize <= 0 )
break;
}
return true;
}
return false;
}
else if ( ! sMsg.IsEmpty())
{
SysMessagef("\"MSG:%s\"", (LPCTSTR)sMsg);
return false;
}
m_Targ_Text.Empty();
}
return true;
}
}
}
return true;
}
示例2: r_WriteVal
//.........这里部分代码省略.........
sVal = "0";
}
return true;
case SSC_DEF0:
fZero = true;
case SSC_DEF:
{
CVarDefBase * pVar = g_Exp.m_VarDefs.GetKey(pszKey);
if ( pVar )
sVal = pVar->GetValStr();
else if ( fZero )
sVal = "0";
}
return( true );
case SSC_EVAL:
sVal.FormatVal( Exp_GetVal( pszKey ));
return( true );
case SSC_FVAL:
{
int iVal = Exp_GetVal( pszKey );
sVal.Format( "%i.%i", iVal/10, abs(iVal%10) );
return true;
}
case SSC_HVAL:
sVal.FormatHex( Exp_GetVal( pszKey ));
return( true );
case SSC_QVAL:
{ // Do a switch ? type statement <QVAL conditional ? option1 : option2>
TCHAR * ppCmds[3];
ppCmds[0] = const_cast<TCHAR*>(pszKey);
Str_Parse( ppCmds[0], &(ppCmds[1]), "?" );
Str_Parse( ppCmds[1], &(ppCmds[2]), ":" );
sVal = ppCmds[ Exp_GetVal( ppCmds[0] ) ? 1 : 2 ];
if ( sVal.IsEmpty())
sVal = " ";
}
return( true );
case SSC_ISEMPTY:
sVal.FormatVal( IsStrEmpty( pszKey ) );
return true;
case SSC_ISNUM:
GETNONWHITESPACE( pszKey );
sVal.FormatVal( IsStrNumeric( pszKey ) );
return true;
case SSC_StrRev:
{
GETNONWHITESPACE( pszKey );
sVal = pszKey;
sVal.Reverse();
return true;
}
case SSC_StrPos:
{
GETNONWHITESPACE( pszKey );
int iPos = Exp_GetVal( pszKey );
TCHAR ch;
if ( isdigit( *pszKey) && isdigit( *(pszKey+1) ) )
ch = (TCHAR) Exp_GetVal( pszKey );
else
{
ch = *pszKey;
pszKey++;
}
GETNONWHITESPACE( pszKey );
int iLen = strlen( pszKey );
示例3: OnRxConsole
bool CClient::OnRxConsole( const BYTE * pData, size_t iLen )
{
ADDTOCALLSTACK("CClient::OnRxConsole");
// A special console version of the client. (Not game protocol)
if ( !iLen || ( GetConnectType() != CONNECT_TELNET ))
return false;
if ( IsSetEF( EF_AllowTelnetPacketFilter ) )
{
bool fFiltered = xPacketFilter(pData, iLen);
if ( fFiltered )
return fFiltered;
}
while ( iLen -- )
{
int iRet = OnConsoleKey( m_Targ_Text, *pData++, GetAccount() != NULL );
if ( ! iRet )
return( false );
if ( iRet == 2 )
{
if ( GetAccount() == NULL )
{
if ( !m_zLogin[0] )
{
if ( static_cast<unsigned int>(m_Targ_Text.GetLength()) > (COUNTOF(m_zLogin) - 1) )
{
SysMessage("Login?:\n");
}
else
{
strcpy(m_zLogin, m_Targ_Text);
SysMessage("Password?:\n");
}
m_Targ_Text.Empty();
}
else
{
CGString sMsg;
CAccountRef pAccount = g_Accounts.Account_Find(m_zLogin);
if (( pAccount == NULL ) || ( pAccount->GetPrivLevel() < PLEVEL_Admin ))
{
SysMessagef("%s\n", g_Cfg.GetDefaultMsg(DEFMSG_CONSOLE_NOT_PRIV));
m_Targ_Text.Empty();
return false;
}
if ( LogIn(m_zLogin, m_Targ_Text, sMsg ) == PacketLoginError::Success )
{
m_Targ_Text.Empty();
return OnRxConsoleLoginComplete();
}
else if ( ! sMsg.IsEmpty())
{
SysMessage( sMsg );
return false;
}
m_Targ_Text.Empty();
}
return true;
}
else
{
iRet = g_Serv.OnConsoleCmd( m_Targ_Text, this );
if (g_Cfg.m_fTelnetLog && GetPrivLevel() >= g_Cfg.m_iCommandLog)
g_Log.Event(LOGM_GM_CMDS, "%lx:'%s' commands '%s'=%d\n", GetSocketID(), static_cast<LPCTSTR>(GetName()), static_cast<LPCTSTR>(m_Targ_Text), iRet);
}
}
}
return true;
}
示例4: ParseText
//.........这里部分代码省略.........
continue;
iBegin = i;
sm_fBrackets = true;
}
continue;
}
if ( ch == '<' ) // recursive brackets
{
if ( !( isalnum( pszResponse[i+1] ) || pszResponse[i+1] == '<' ) ) // ignore this.
continue;
if (sm_iReentrant > 32 )
{
EXC_SET(m_ExcKeys[0]);
ASSERT( sm_iReentrant < 32 );
}
sm_iReentrant++;
sm_fBrackets = false;
int ilen = ParseText( pszResponse+i, pSrc, 2, pArgs );
sm_fBrackets = true;
sm_iReentrant--;
i += ilen;
// DEBUG_CHECK( ilen < 256 );
continue;
}
if ( ch == chEnd )
{
sm_fBrackets = false;
pszResponse[i] = '\0';
CGString sVal;
pszKey = (LPCTSTR) pszResponse+iBegin+1;
if ( !strnicmp( pszKey, "CALL", 4 ) && isspace(pszKey[4]) )
{
EXC_SET(m_ExcKeys[1]);
pszKey += 4;
GETNONWHITESPACE( pszKey );
LPCTSTR pszArgs = strchr( pszKey, ' ' );
if ( pszArgs )
GETNONWHITESPACE( pszArgs );
if ( !pszArgs || !*pszArgs )
{
fRes = this->r_Call( pszKey, pSrc, pArgs, &sVal );
}
else
{
CScriptTriggerArgs Args( pszArgs );
if ( pArgs )
Args.m_VarsLocal = pArgs->m_VarsLocal;
fRes = this->r_Call( pszKey, pSrc, &Args, &sVal );
if ( pArgs )
pArgs->m_VarsLocal = Args.m_VarsLocal;
}
}
else
{
if ( !strnicmp( pszKey, "SRC", 3 ) && pszKey[3] == '\0' )
{
pszKey = pszKey;
}
EXC_SET(m_ExcKeys[2]);
if ( !( fRes = r_WriteVal( pszKey, sVal, pSrc ) ) )
{
EXC_SET(m_ExcKeys[2]);
if ( pArgs && pArgs->r_WriteVal( pszKey, sVal, pSrc ) )
fRes = true;
}
}
if ( !fRes )
{
DEBUG_ERR(( "Can't resolve <%s>\n", pszKey ));
// Just in case this really is a <= operator ?
pszResponse[i] = chEnd;
// continue; // by Kell
}
resolved:
if ( sVal.IsEmpty() && fHTML )
{
sVal = " ";
}
int len = sVal.GetLength();
EXC_SET(m_ExcKeys[3]);
memmove( pszResponse+iBegin+len, pszResponse+i+1, strlen( pszResponse+i+1 ) + 1 );
EXC_SET(m_ExcKeys[3]);
memcpy( pszResponse+iBegin, (LPCTSTR) sVal, len );
i = iBegin+len-1;
if ( iFlags&2 ) // just do this one then bail out.
return( i );
}
}
EXC_CATCH("Script parse text");
return( i );
}