本文整理汇总了C++中CBuffer::Add方法的典型用法代码示例。如果您正苦于以下问题:C++ CBuffer::Add方法的具体用法?C++ CBuffer::Add怎么用?C++ CBuffer::Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBuffer
的用法示例。
在下文中一共展示了CBuffer::Add方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RecordWith
int CCircuitry::RecordWith(int nChan, BYTE* pBuffer, DWORD dwStopOffset)
{
if ( ! m_pChain || ! m_pChain->IsConnected() ) return -1;
if ( m_pRecIoOver->Offset >= MAX_RECLST ) return -1;
if ( ! HasOverlappedIoCompleted(m_pRecIoOver) ) return -1;
CBuffer* pOutput = m_pChain->m_pOutput;
if ( dwStopOffset ) pOutput->Add( pBuffer, dwStopOffset + 1 );
Neighbour.m_pWakeup.SetEvent();
if ( int nResult = SsmRecordMemBlock(nChan, 6, pBuffer, TEMP_BUFFER, OnRecMemBlockDone, m_pRecIoOver) )
{
#ifdef _DEBUG
CHAR sError[1024];
SsmGetLastErrMsg( sError );
theApp.Message( MSG_ERROR, sError );
#endif
return nResult;
}
m_pRecIoOver->Offset++;
ResetEvent( m_pRecIoOver->hEvent );
//TRACE("%i-> RecordWith in [%i]\n", GetTickCount(), m_pRecIoOver->Offset);
return 0;
}
示例2: AddHitDC
void CLocalSearch::AddHitDC(CDCPacket* pPacket, CSchemaMap& /*pSchemas*/, CLibraryFile* pFile, int /*nIndex*/)
{
// Active user:
// $SR Nick FileName<0x05>FileSize FreeSlots/TotalSlots<0x05>HubName (HubIP:HubPort)|
// Passive user:
// $SR Nick FileName<0x05>FileSize FreeSlots/TotalSlots<0x05>HubName (HubIP:HubPort)<0x05>User|
if ( ! m_pSearch )
return;
CUploadQueue* pQueue = UploadQueues.SelectQueue(
PROTOCOL_DC, NULL, 0, CUploadQueue::ulqBoth, NULL );
int nTotalSlots = pQueue ? pQueue->m_nMaxTransfers : 0;
int nActiveSlots = pQueue ? pQueue->GetActiveCount() : 0;
int nFreeSlots = nTotalSlots > nActiveSlots ? ( nTotalSlots - nActiveSlots ) : 0;
CString sHubName;
if ( pFile->m_oTiger )
// It's TTH search
sHubName = _T("TTH:") + pFile->m_oTiger.toString();
else
sHubName = m_pSearch->m_sMyHub;
CBuffer pAnswer;
pAnswer.Add( _P("$SR ") );
pAnswer.Print( m_pSearch->m_sMyNick );
pAnswer.Add( _P(" ") );
pAnswer.Print( pFile->m_sName );
pAnswer.Add( _P("\x05") );
CString strSize;
strSize.Format( _T("%I64u %d/%d"), pFile->m_nSize, nFreeSlots, nTotalSlots );
pAnswer.Print( strSize );
pAnswer.Add( _P("\x05") );
pAnswer.Print( sHubName );
pAnswer.Add( _P(" (") );
pAnswer.Print( HostToString( &m_pSearch->m_pMyHub ) );
pAnswer.Add( _P(")") );
if ( ! m_pSearch->m_bUDP )
{
pAnswer.Add( _P("\x05") );
pAnswer.Print( m_pSearch->m_sUserNick );
}
pAnswer.Add( _P("|") );
pPacket->Write( pAnswer.m_pBuffer, pAnswer.m_nLength );
}