本文整理汇总了C++中CUtlVector::AddMultipleToTail方法的典型用法代码示例。如果您正苦于以下问题:C++ CUtlVector::AddMultipleToTail方法的具体用法?C++ CUtlVector::AddMultipleToTail怎么用?C++ CUtlVector::AddMultipleToTail使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CUtlVector
的用法示例。
在下文中一共展示了CUtlVector::AddMultipleToTail方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddString
//-----------------------------------------------------------------------------
// Finds and/or creates a symbol based on the string
//-----------------------------------------------------------------------------
void CLocalizedStringTable::AddString(char const *pString, wchar_t *pValue, const char *fileName)
{
if (!pString)
return;
wchar_t *str = Find(pString);
// it's already in the table
if (str)
return;
// didn't find, insert the string into the vector.
int len = strlen(pString) + 1;
int stridx = m_Names.AddMultipleToTail( len );
memcpy( &m_Names[stridx], pString, len * sizeof(char) );
len = wcslen(pValue) + 1;
int valueidx = m_Values.AddMultipleToTail( len );
memcpy( &m_Values[valueidx], pValue, len * sizeof(wchar_t) );
localizedstring_t stringMapItem;
stringMapItem.nameIndex = stridx;
stringMapItem.valueIndex = valueidx;
if (fileName)
{
stringMapItem.filename = fileName;
}
else
{
stringMapItem.filename = m_CurrentFile;
}
m_Lookup.Insert( stringMapItem );
}
示例2: SendCurStateTo
void CVMPIServiceConnMgr::SendCurStateTo( int id )
{
CUtlVector<char> data;
data.AddToTail( VMPI_SERVICE_UI_PROTOCOL_VERSION );
data.AddToTail( VMPI_SERVICE_TO_UI_STATE );
data.AddMultipleToTail( sizeof( g_iCurState ), (char*)&g_iCurState );
data.AddToTail( (char)g_bScreensaverMode );
if ( g_pPassword )
data.AddMultipleToTail( strlen( g_pPassword ) + 1, g_pPassword );
else
data.AddToTail( 0 );
SendPacket( -1, data.Base(), data.Count() );
}
示例3: GetCurrentWorkerText
bool CJobWatchDlg::GetCurrentWorkerText(
CUtlVector<char> &text,
unsigned long &curMessageIndex )
{
text.SetSize( 0 );
unsigned long jobWorkerID;
if ( !GetCurJobWorkerID( jobWorkerID ) )
return false;
// Now copy all the text out.
CMySQLQuery query;
if ( curMessageIndex == 0 )
query.Format( "select * from text_messages where JobWorkerID=%lu", jobWorkerID );
else
query.Format( "select * from text_messages where JobWorkerID=%lu and MessageIndex >= %lu", jobWorkerID, curMessageIndex );
GetMySQL()->Execute( query );
while ( GetMySQL()->NextRow() )
{
const char *pTextStr = GetMySQL()->GetColumnValue( "text" ).String();
int len = strlen( pTextStr );
text.AddMultipleToTail( len, pTextStr );
curMessageIndex = GetMySQL()->GetColumnValue( "MessageIndex" ).UInt32() + 1;
}
text.AddToTail( 0 );
return true;
}
示例4: VMPI_Stats_SpewHook
void VMPI_Stats_SpewHook( const char *pMsg )
{
CCriticalSectionLock csLock( &g_SpewTextCS );
csLock.Lock();
// Queue the text up so we can send it to the DB right away when we connect.
g_SpewText.AddMultipleToTail( strlen( pMsg ), pMsg );
}
示例5: CopyListPanelToClipboard
void CopyListPanelToClipboard( vgui::ListPanel *pListPanel )
{
CUtlVector<char> textBuf;
// Write the headers.
int nColumns = pListPanel->GetNumColumnHeaders();
for ( int i=0; i < nColumns; i++ )
{
if ( i != 0 )
textBuf.AddToTail( '\t' );
char tempText[512];
if ( !pListPanel->GetColumnHeaderText( i, tempText, sizeof( tempText ) ) )
Error( "GetColumHeaderText( %d ) failed", i );
textBuf.AddMultipleToTail( strlen( tempText ), tempText );
}
textBuf.AddToTail( '\n' );
// Now write the rows.
int iCur = pListPanel->FirstItem();
while ( iCur != pListPanel->InvalidItemID() )
{
// Write the columns for this row.
for ( int i=0; i < nColumns; i++ )
{
if ( i != 0 )
textBuf.AddToTail( '\t' );
wchar_t tempTextWC[512];
char tempText[512];
pListPanel->GetCellText( iCur, i, tempTextWC, sizeof( tempTextWC ) );
g_pVGuiLocalize->ConvertUnicodeToANSI( tempTextWC, tempText, sizeof( tempText ) );
textBuf.AddMultipleToTail( strlen( tempText ), tempText );
}
textBuf.AddToTail( '\n' );
iCur = pListPanel->NextItem( iCur );
}
textBuf.AddToTail( 0 );
// Set the clipboard text.
vgui::system()->SetClipboardText( textBuf.Base(), textBuf.Count() );
}
示例6: ResizeAnimationLayerCallback
void ResizeAnimationLayerCallback( void *pStruct, int offsetToUtlVector, int len )
{
C_BaseAnimatingOverlay *pEnt = (C_BaseAnimatingOverlay*)pStruct;
CUtlVector < CAnimationLayer > *pVec = &pEnt->m_AnimOverlay;
CUtlVector< CInterpolatedVar< CAnimationLayer > > *pVecIV = &pEnt->m_iv_AnimOverlay;
Assert( (char*)pVec - (char*)pEnt == offsetToUtlVector );
Assert( pVec->Count() == pVecIV->Count() );
Assert( pVec->Count() <= C_BaseAnimatingOverlay::MAX_OVERLAYS );
int diff = len - pVec->Count();
if ( diff != 0 )
{
// remove all entries
for ( int i=0; i < pVec->Count(); i++ )
{
pEnt->RemoveVar( &pVec->Element( i ) );
}
pEnt->InvalidatePhysicsRecursive( BOUNDS_CHANGED );
// adjust vector sizes
if ( diff > 0 )
{
for ( int i = 0; i < diff; ++i )
{
int j = pVec->AddToTail( );
(*pVec)[j].SetOwner( pEnt );
}
pVecIV->AddMultipleToTail( diff );
}
else
{
pVec->RemoveMultiple( len, -diff );
pVecIV->RemoveMultiple( len, -diff );
}
// Rebind all the variables in the ent's list.
for ( int i=0; i < len; i++ )
{
IInterpolatedVar *pWatcher = &pVecIV->Element( i );
pWatcher->SetDebugName( s_m_iv_AnimOverlayNames[i] );
pEnt->AddVar( &pVec->Element( i ), pWatcher, LATCH_ANIMATION_VAR, true );
}
}
// FIXME: need to set historical values of nOrder in pVecIV to MAX_OVERLAY
// Ensure capacity
pVec->EnsureCapacity( len );
int nNumAllocated = pVec->NumAllocated();
// This is important to do because EnsureCapacity doesn't actually call the constructors
// on the elements, but we need them to be initialized, otherwise it'll have out-of-range
// values which will piss off the datatable encoder.
UtlVector_InitializeAllocatedElements( pVec->Base() + pVec->Count(), nNumAllocated - pVec->Count() );
}
示例7: ResizeAnimationLayerCallback
void ResizeAnimationLayerCallback( void *pStruct, int offsetToUtlVector, int len )
{
C_BaseAnimatingOverlay *pEnt = (C_BaseAnimatingOverlay*)pStruct;
CUtlVector < C_AnimationLayer > *pVec = &pEnt->m_AnimOverlay;
CUtlVector< CInterpolatedVar< C_AnimationLayer > > *pVecIV = &pEnt->m_iv_AnimOverlay;
Assert( (char*)pVec - (char*)pEnt == offsetToUtlVector );
Assert( pVec->Count() == pVecIV->Count() );
Assert( pVec->Count() <= C_BaseAnimatingOverlay::MAX_OVERLAYS );
int diff = len - pVec->Count();
if ( diff == 0 )
return;
// remove all entries
for ( int i=0; i < pVec->Count(); i++ )
{
pEnt->RemoveVar( &pVec->Element( i ) );
}
// adjust vector sizes
if ( diff > 0 )
{
pVec->AddMultipleToTail( diff );
pVecIV->AddMultipleToTail( diff );
}
else
{
pVec->RemoveMultiple( len, -diff );
pVecIV->RemoveMultiple( len, -diff );
}
// Rebind all the variables in the ent's list.
for ( int i=0; i < len; i++ )
{
IInterpolatedVar *pWatcher = &pVecIV->Element( i );
pWatcher->SetDebugName( s_m_iv_AnimOverlayNames[i] );
pEnt->AddVar( &pVec->Element( i ), pWatcher, LATCH_ANIMATION_VAR, true );
}
// FIXME: need to set historical values of nOrder in pVecIV to MAX_OVERLAY
}
示例8: AddConsoleOutput
void CVMPIServiceConnMgr::AddConsoleOutput( const char *pMsg )
{
// Tell clients of the new text string.
CUtlVector<char> data;
data.AddToTail( VMPI_SERVICE_UI_PROTOCOL_VERSION );
data.AddToTail( VMPI_SERVICE_TO_UI_CONSOLE_TEXT );
data.AddMultipleToTail( strlen( pMsg ) + 1, pMsg );
SendPacket( -1, data.Base(), data.Count() );
}
示例9: UnserializeLeafList
void CStaticPropMgr::UnserializeLeafList( CUtlBuffer& buf )
{
int nCount = buf.GetInt();
m_StaticPropLeaves.Purge();
if ( nCount > 0 )
{
m_StaticPropLeaves.AddMultipleToTail( nCount );
buf.Get( m_StaticPropLeaves.Base(), nCount * sizeof(StaticPropLeafLump_t) );
}
}
示例10: SetPasswordDlgProc
int CALLBACK SetPasswordDlgProc(
HWND hwndDlg, // handle to dialog box
UINT uMsg, // message
WPARAM wParam, // first message parameter
LPARAM lParam // second message parameter
)
{
switch( uMsg )
{
case WM_INITDIALOG:
{
if ( g_pPassword )
{
HWND hWnd = GetDlgItem( hwndDlg, IDC_PASSWORD );
SetWindowText( hWnd, g_pPassword );
}
}
break;
case WM_COMMAND:
{
switch( wParam )
{
case IDOK:
{
// Set our new password.
HWND hWnd = GetDlgItem( hwndDlg, IDC_PASSWORD );
if ( hWnd )
{
char tempBuf[512];
GetWindowText( hWnd, tempBuf, sizeof( tempBuf ) );
// Send it to the service.
CUtlVector<char> data;
data.AddToTail( VMPI_SERVICE_UPDATE_PASSWORD );
data.AddMultipleToTail( strlen( tempBuf ) + 1, tempBuf );
g_ConnMgr.SendPacket( -1, data.Base(), data.Count() );
}
EndDialog( hwndDlg, 0 );
}
break;
case IDCANCEL:
{
EndDialog( hwndDlg, 0 );
}
break;
}
}
break;
}
return FALSE;
}
示例11: AddFuncInstance
static void AddFuncInstance( CSimpleMapFile *pInstanceMapFile, CInstanceSpawn *pInstanceSpawn, const Vector &vPosition )
{
CUtlVector< MapEntityKeyValuePair_t > replacePairs;
replacePairs.AddMultipleToTail( pInstanceSpawn->GetAdditionalKeyValueCount() );
for ( int i = 0; i < pInstanceSpawn->GetAdditionalKeyValueCount(); ++ i )
{
replacePairs[i].m_pKey = pInstanceSpawn->GetAdditionalKeyValues()[i].m_Key;
replacePairs[i].m_pValue = pInstanceSpawn->GetAdditionalKeyValues()[i].m_Value;
}
pInstanceMapFile->AddFuncInstance( pInstanceSpawn->GetInstanceFilename(), QAngle( 0, 0, 0 ), vPosition, replacePairs.Base(), replacePairs.Count() );
}
示例12: LoadModelLODSource
static void LoadModelLODSource( s_model_t *pSrcModel )
{
CUtlVector<s_source_t *> lods;
int numLODs = g_ScriptLODs.Size();
lods.AddMultipleToTail( numLODs );
if( stricmp( pSrcModel->name, "blank" ) == 0 )
{
return;
}
GetLODSources( lods, pSrcModel );
}
示例13: RecordArgument
void RecordArgument( void const* pMemory, int size )
{
if( !g_bDoRecord )
{
return;
}
Assert( g_ArgsRemaining > 0 );
int tail = g_pRecordingBuffer.Size();
g_pRecordingBuffer.AddMultipleToTail( size );
memcpy( &g_pRecordingBuffer[tail], pMemory, size );
if (--g_ArgsRemaining == 0)
WriteRecordingFile();
}
示例14: SendPatchCommandToUIs
void SendPatchCommandToUIs( DWORD dwInstallerProcessId )
{
Msg( "SendPatchCommandToUIs\n ");
CUtlVector<char> data;
data.AddToTail( VMPI_SERVICE_UI_PROTOCOL_VERSION );
data.AddToTail( VMPI_SERVICE_TO_UI_PATCHING );
// This arg tells the UI whether to exit after running the command or not.
data.AddToTail( 1 );
// First argument is the working directory, which is the cache path in this case.
data.AddMultipleToTail( V_strlen( g_FileCachePath ) + 1, g_FileCachePath );
// Second argument is the command line.
char waitAndRestartExe[MAX_PATH], serviceUIExe[MAX_PATH], commandLine[1024 * 8];
V_ComposeFileName( g_FileCachePath, "WaitAndRestart.exe", waitAndRestartExe, sizeof( waitAndRestartExe ) );
V_ComposeFileName( g_BaseAppPath, "vmpi_service_ui.exe", serviceUIExe, sizeof( serviceUIExe ) ); // We're running the UI from the same directory this exe is in.
char strSeconds[64];
V_snprintf( strSeconds, sizeof( strSeconds ), "*%lu", dwInstallerProcessId );
// IMPORTANT to use BuildCommandLineFromArgs here because it'll handle slashes and quotes correctly.
// If we don't do that, the command often won't work.
CUtlVector<char*> args;
args.AddToTail( waitAndRestartExe );
args.AddToTail( strSeconds );
args.AddToTail( g_BaseAppPath );
args.AddToTail( serviceUIExe );
BuildCommandLineFromArgs( args, commandLine, sizeof( commandLine ) );
data.AddMultipleToTail( V_strlen( commandLine ) + 1, commandLine );
if ( g_pConnMgr )
{
g_pConnMgr->SendPacket( -1, data.Base(), data.Count() );
Sleep( 1000 ); // Make sure this packet goes out.
}
}
示例15: FindFiles
//-----------------------------------------------------------------------------
// Purpose: Generate a list of file matching mask
//-----------------------------------------------------------------------------
int CScriptLib::FindFiles( char* pFileMask, bool bRecurse, CUtlVector<fileList_t> &fileList )
{
char dirPath[MAX_PATH];
char pattern[MAX_PATH];
char extension[MAX_PATH];
// get path only
strcpy( dirPath, pFileMask );
V_StripFilename( dirPath );
// get pattern only
V_FileBase( pFileMask, pattern, sizeof( pattern ) );
V_ExtractFileExtension( pFileMask, extension, sizeof( extension ) );
if ( extension[0] )
{
strcat( pattern, "." );
strcat( pattern, extension );
}
if ( !bRecurse )
{
GetFileList( dirPath, pattern, fileList );
}
else
{
// recurse and get the tree
CUtlVector< fileList_t > tempList;
CUtlVector< CUtlString > dirList;
RecurseFileTree_r( dirPath, 0, dirList );
for ( int i=0; i<dirList.Count(); i++ )
{
// iterate each directory found
tempList.Purge();
tempList.EnsureCapacity( dirList.Count() );
GetFileList( dirList[i].String(), pattern, tempList );
int start = fileList.AddMultipleToTail( tempList.Count() );
for ( int j=0; j<tempList.Count(); j++ )
{
fileList[start+j] = tempList[j];
}
}
}
return fileList.Count();
}