本文整理汇总了C++中BYTEARRAY::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ BYTEARRAY::empty方法的具体用法?C++ BYTEARRAY::empty怎么用?C++ BYTEARRAY::empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BYTEARRAY
的用法示例。
在下文中一共展示了BYTEARRAY::empty方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CIncomingJoinPlayer
CIncomingJoinPlayer *CGameProtocol :: RECEIVE_W3GS_REQJOIN( BYTEARRAY data )
{
// DEBUG_Print( "RECEIVED W3GS_REQJOIN" );
// DEBUG_Print( data );
// 2 bytes -> Header
// 2 bytes -> Length
// 4 bytes -> Host Counter (Game ID)
// 4 bytes -> Entry Key (used in LAN)
// 1 byte -> ???
// 2 bytes -> Listen Port
// 4 bytes -> Peer Key
// null terminated string -> Name
// 4 bytes -> ???
// 2 bytes -> InternalPort (???)
// 4 bytes -> InternalIP
if( ValidateLength( data ) && data.size( ) >= 20 )
{
uint32_t HostCounter = UTIL_ByteArrayToUInt32( data, false, 4 );
uint32_t nEntryKey = UTIL_ByteArrayToUInt32( data, false, 8 );
BYTEARRAY Name = UTIL_ExtractCString( data, 19 );
if( !Name.empty( ) && data.size( ) >= Name.size( ) + 30 )
{
BYTEARRAY InternalIP = BYTEARRAY( data.begin( ) + Name.size( ) + 26, data.begin( ) + Name.size( ) + 30 );
return new CIncomingJoinPlayer( HostCounter, nEntryKey, string( Name.begin( ), Name.end( ) ), InternalIP );
}
}
return NULL;
}
示例2:
BYTEARRAY CGameProtocol :: SEND_W3GS_CHAT_FROM_HOST( unsigned char fromPID, BYTEARRAY toPIDs, unsigned char flag, BYTEARRAY flagExtra, string message )
{
BYTEARRAY packet;
if( !toPIDs.empty( ) && !message.empty( ) && message.size( ) < 255 )
{
packet.push_back( W3GS_HEADER_CONSTANT ); // W3GS header constant
packet.push_back( W3GS_CHAT_FROM_HOST ); // W3GS_CHAT_FROM_HOST
packet.push_back( 0 ); // packet length will be assigned later
packet.push_back( 0 ); // packet length will be assigned later
packet.push_back( toPIDs.size( ) ); // number of receivers
UTIL_AppendByteArrayFast( packet, toPIDs ); // receivers
packet.push_back( fromPID ); // sender
packet.push_back( flag ); // flag
UTIL_AppendByteArrayFast( packet, flagExtra ); // extra flag
UTIL_AppendByteArrayFast( packet, message ); // message
AssignLength( packet );
}
else
CONSOLE_Print( "[GAMEPROTO] invalid parameters passed to SEND_W3GS_CHAT_FROM_HOST" );
// DEBUG_Print( "SENT W3GS_CHAT_FROM_HOST" );
// DEBUG_Print( packet );
return packet;
}
示例3: ProcessPackets
void CBNLSClient :: ProcessPackets( )
{
while( !m_Packets.empty( ) )
{
CCommandPacket *Packet = m_Packets.front( );
m_Packets.pop( );
if( Packet->GetID( ) == CBNLSProtocol :: BNLS_WARDEN )
{
BYTEARRAY WardenResponse = m_Protocol->RECEIVE_BNLS_WARDEN( Packet->GetData( ) );
if( !WardenResponse.empty( ) )
m_WardenResponses.push( WardenResponse );
}
delete Packet;
}
}