本文整理汇总了C++中SendProp::GetDataTable方法的典型用法代码示例。如果您正苦于以下问题:C++ SendProp::GetDataTable方法的具体用法?C++ SendProp::GetDataTable怎么用?C++ SendProp::GetDataTable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SendProp
的用法示例。
在下文中一共展示了SendProp::GetDataTable方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UTIL_FindInSendTable
bool UTIL_FindInSendTable(SendTable *pTable,
const char *name,
sm_sendprop_info_t *info,
unsigned int offset)
{
const char *pname;
int props = pTable->GetNumProps();
SendProp *prop;
for (int i=0; i<props; i++)
{
prop = pTable->GetProp(i);
pname = prop->GetName();
if (pname && strcmp(name, pname) == 0)
{
info->prop = prop;
info->actual_offset = offset + info->prop->GetOffset();
return true;
}
if (prop->GetDataTable())
{
if (UTIL_FindInSendTable(prop->GetDataTable(),
name,
info,
offset + prop->GetOffset())
)
{
return true;
}
}
}
return false;
}
示例2:
SendProp *UTIL_FindSendProp(SendTable *pTable, const char *name)
{
int count = pTable->GetNumProps();
//SendTable *pTable;
SendProp *pProp;
for (int i=0; i<count; i++)
{
pProp = pTable->GetProp(i);
if ( g_PrintProps )
Msg("%s\n",pProp->GetName());
if (strcmp(pProp->GetName(), name) == 0)
{
return pProp;
}
if (pProp->GetDataTable())
{
if ((pProp=UTIL_FindSendProp(pProp->GetDataTable(), name)) != NULL)
{
return pProp;
}
}
}
return NULL;
}
示例3: AddSendTable
void AddSendTable(SendTable* pTable, OffsetsMap& offsets, int offset=0, const char* baseName=NULL)
{
for (int i=0; i < pTable->GetNumProps(); ++i)
{
SendProp* pProp = pTable->GetProp(i);
if (strcmp(pProp->GetName(), "baseclass") == 0)
continue;
int currentOffset = offset + pProp->GetOffset();
char* currentName = NULL;
if (baseName == NULL) {
currentName = (char*) pProp->GetName();
}
else {
char tempName[256];
sprintf(tempName, "%s.%s", baseName, pProp->GetName());
currentName = strdup(tempName);
}
if (pProp->GetType() == DPT_DataTable)
{
AddSendTable(pProp->GetDataTable(), offsets, currentOffset, currentName);
}
else
{
offsets.insert(std::make_pair(currentName, currentOffset));
}
}
}
示例4: WriteSendTable_R
bool WriteSendTable_R( SendTable *pTable, bf_write &bfWrite, bool bNeedsDecoder )
{
if( pTable->GetWriteFlag() )
return true;
pTable->SetWriteFlag( true );
// Send the version with the exclude props.
bfWrite.WriteOneBit( 1 );
bfWrite.WriteOneBit( bNeedsDecoder?1:0 );
if( !SendTable_WriteInfos( pTable, &bfWrite ) )
return false;
for( int i=0; i < pTable->m_nProps; i++ )
{
SendProp *pProp = &pTable->m_pProps[i];
if( pProp->m_Type == DPT_DataTable )
if( !WriteSendTable_R( pProp->GetDataTable(), bfWrite, false ) )
return false;
}
return true;
}
示例5: UTIL_ContainsDataTable
bool UTIL_ContainsDataTable(SendTable *pTable, const char *name)
{
const char *pname = pTable->GetName();
int props = pTable->GetNumProps();
SendProp *prop;
SendTable *table;
if (pname && strcmp(name, pname) == 0)
return true;
for (int i=0; i<props; i++)
{
prop = pTable->GetProp(i);
if ((table = prop->GetDataTable()) != NULL)
{
pname = table->GetName();
if (pname && strcmp(name, pname) == 0)
{
return true;
}
if (UTIL_ContainsDataTable(table, name))
{
return true;
}
}
}
return false;
}
示例6: UTIL_DrawSendTable
void UTIL_DrawSendTable(FILE *fp, SendTable *pTable, int level = 1)
{
SendProp *pProp;
const char *type;
for (int i = 0; i < pTable->GetNumProps(); i++)
{
pProp = pTable->GetProp(i);
if (pProp->GetDataTable())
{
fprintf(fp, "%*sTable: %s (offset %d) (type %s)\n",
level, "",
pProp->GetName(),
pProp->GetOffset(),
pProp->GetDataTable()->GetName());
UTIL_DrawSendTable(fp, pProp->GetDataTable(), level + 1);
}
else
{
type = GetDTTypeName(pProp->GetType());
if (type != NULL)
{
fprintf(fp,
"%*sMember: %s (offset %d) (type %s) (bits %d) (%s)\n",
level, "",
pProp->GetName(),
pProp->GetOffset(),
type,
pProp->m_nBits,
UTIL_SendFlagsToString(pProp->GetFlags(), pProp->GetType()));
}
else
{
fprintf(fp,
"%*sMember: %s (offset %d) (type %d) (bits %d) (%s)\n",
level, "",
pProp->GetName(),
pProp->GetOffset(),
pProp->GetType(),
pProp->m_nBits,
UTIL_SendFlagsToString(pProp->GetFlags(), pProp->GetType()));
}
}
}
}
示例7: UTIL_DrawSendTable
void UTIL_DrawSendTable(FILE *fp, SendTable *pTable, int level)
{
char spaces[255];
for (int i=0; i<level; i++)
spaces[i] = ' ';
spaces[level] = '\0';
const char *name, *type;
SendProp *pProp;
fprintf(fp, "%sSub-Class Table (%d Deep): %s\n", spaces, level, pTable->GetName());
for (int i=0; i<pTable->GetNumProps(); i++)
{
pProp = pTable->GetProp(i);
name = pProp->GetName();
if (pProp->GetDataTable())
{
UTIL_DrawSendTable(fp, pProp->GetDataTable(), level + 1);
}
else
{
type = GetDTTypeName(pProp->GetType());
if (type != NULL)
{
fprintf(fp,
"%s-Member: %s (offset %d) (type %s) (bits %d)\n",
spaces,
pProp->GetName(),
pProp->GetOffset(),
type,
pProp->m_nBits);
}
else
{
fprintf(fp,
"%s-Member: %s (offset %d) (type %d) (bits %d)\n",
spaces,
pProp->GetName(),
pProp->GetOffset(),
pProp->GetType(),
pProp->m_nBits);
}
}
}
}
示例8: GetNextSendTable
// ============================================================================
// >> HELPER FUNCTIONS
// ============================================================================
SendTable* GetNextSendTable(SendTable* pTable)
{
for (int i=0; i < pTable->GetNumProps(); ++i)
{
SendProp* pProp = pTable->GetProp(i);
if (strcmp(pProp->GetName(), "baseclass") != 0)
continue;
return pProp->GetDataTable();
}
return NULL;
}
示例9: UTIL_FindInSendTable
bool UTIL_FindInSendTable(SendTable *pTable,
const char *name,
sm_sendprop_info_t *info,
unsigned int offset)
{
const char *pname;
int props = pTable->GetNumProps();
SendProp *prop;
for (int i=0; i<props; i++)
{
prop = pTable->GetProp(i);
pname = prop->GetName();
if ( g_PrintProps )
Msg("%d : %s\n",offset + prop->GetOffset(),pname);
if (pname && strcmp(name, pname) == 0)
{
info->prop = prop;
// for some reason offset is sometimes negative when it shouldn't be
// so take the absolute value
info->actual_offset = offset + abs(info->prop->GetOffset());
return true;
}
if (prop->GetDataTable())
{
if (UTIL_FindInSendTable(prop->GetDataTable(),
name,
info,
offset + prop->GetOffset())
)
{
return true;
}
}
}
return false;
}
示例10: DataTable_ClearWriteFlags_R
void DataTable_ClearWriteFlags_R( SendTable *pTable )
{
pTable->SetWriteFlag( false );
for(int i=0; i < pTable->m_nProps; i++)
{
SendProp *pProp = &pTable->m_pProps[i];
if( pProp->m_Type == DPT_DataTable )
{
DataTable_ClearWriteFlags_R( pProp->GetDataTable() );
}
}
}
示例11: FindNestedDataTable
bool FindNestedDataTable(SendTable *pTable, const char *name)
{
if (strcmp(pTable->GetName(), name) == 0)
{
return true;
}
int props = pTable->GetNumProps();
SendProp *prop;
for (int i=0; i<props; i++)
{
prop = pTable->GetProp(i);
if (prop->GetDataTable())
{
if (FindNestedDataTable(prop->GetDataTable(), name))
{
return true;
}
}
}
return false;
}
示例12: DataTable_MaybeWriteSendTableBuffer_R
// Calls DataTable_MaybeWriteSendTable recursively.
void DataTable_MaybeWriteSendTableBuffer_R( SendTable *pTable, bf_write *pBuf )
{
DataTable_MaybeWriteSendTableBuffer( pTable, pBuf, false );
// Make sure we send child send tables..
for(int i=0; i < pTable->m_nProps; i++)
{
SendProp *pProp = &pTable->m_pProps[i];
if( pProp->m_Type == DPT_DataTable )
{
DataTable_MaybeWriteSendTableBuffer_R( pProp->GetDataTable(), pBuf );
}
}
}
示例13: DataTable_MaybeCreateReceiveTable_R
void DataTable_MaybeCreateReceiveTable_R( CUtlVector< SendTable * >& visited, SendTable *pTable )
{
DataTable_MaybeCreateReceiveTable( visited, pTable, false );
// Make sure we send child send tables..
for(int i=0; i < pTable->m_nProps; i++)
{
SendProp *pProp = &pTable->m_pProps[i];
if( pProp->m_Type == DPT_DataTable )
{
DataTable_MaybeCreateReceiveTable_R( visited, pProp->GetDataTable() );
}
}
}
示例14: SendTable_CalcNextVectorElems
static void SendTable_CalcNextVectorElems( SendTable *pTable )
{
for ( int i=0; i < pTable->GetNumProps(); i++ )
{
SendProp *pProp = pTable->GetProp( i );
if ( pProp->GetType() == DPT_DataTable )
{
SendTable_CalcNextVectorElems( pProp->GetDataTable() );
}
else if ( pProp->GetOffset() < 0 )
{
pProp->SetOffset( -pProp->GetOffset() );
pProp->SetFlags( pProp->GetFlags() | SPROP_IS_A_VECTOR_ELEM );
}
}
}
示例15: GetDataTable
cell_t GetDataTable(IPluginContext *pContext, const cell_t *params) {
Handle_t hndl = static_cast<Handle_t>(params[1]);
HandleError err;
HandleSecurity sec;
sec.pOwner = NULL;
sec.pIdentity = myself->GetIdentity();
SendProp *pProp;
if ((err=g_pHandleSys->ReadHandle(hndl, g_SendTableHandle, &sec, (void **)&pProp)) != HandleError_None)
{
return pContext->ThrowNativeError("Invalid SendProp handle %x (error %d)", hndl, err);
}
return g_pHandleSys->CreateHandle(g_SendTableHandle,
pProp->GetDataTable(),
pContext->GetIdentity(),
myself->GetIdentity(),
NULL);
}