本文整理汇总了C++中CVariable::toInt方法的典型用法代码示例。如果您正苦于以下问题:C++ CVariable::toInt方法的具体用法?C++ CVariable::toInt怎么用?C++ CVariable::toInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CVariable
的用法示例。
在下文中一共展示了CVariable::toInt方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CilPredicater
bool CArrayObject::CilPredicater( const CVariable& elem1,
const CVariable& elem2 )
{
assert( g_ridPredicater != RID_NULL );
assert( g_pVm != NULL );
//Invoke predicater
CVariable vars[ 3 ];
vars[ 1 ] = elem1;
vars[ 2 ] = elem2;
CVariable* pResult = g_pVm->invokeMethod( g_ridPredicater,
3,
vars );
bool bReturn = (pResult->toInt() < 0);
delete( pResult );
return bReturn;
}
示例2: anyAccessor
/***************************************************************************
* anyAccessor
***************************************************************************/
CVariable* CArrayObject::anyAccessor(CCilVm* const pVm,
CVmObject* const pObject,
const wstring* const pName,
CVariable* const pVar,
const bool bSet )
{
assert( pObject != NULL );
if( bSet )
{
//Getter implementation
return NULL;
}
else
{
pObject->setProperty( *pName, *pVar );
//Setter implementation
int32_t iLength = 0;
//Check existing length
CVariable* pCurrentLengthVar = pObject->lookupProperty( STRING_PROPERTY_INTERNAL_LENGTH );
if( pCurrentLengthVar != NULL )
{
iLength = pCurrentLengthVar->toInt();
}
int32_t iGivenIndex = _wtoi( pName->data() ) + 1;
if( iGivenIndex > iLength )
{
CVariable var( iGivenIndex, OPERAND_FLAG( OPERAND_FLAG_DONTDELETE | OPERAND_FLAG_DONTENUM ) );
pObject->setProperty( STRING_PROPERTY_INTERNAL_LENGTH, var );
}
return NULL;
}
}
示例3: lengthAccessor
/***************************************************************************
* lengthAccessor
* array object helper
***************************************************************************/
CVariable* CArrayObject::lengthAccessor(CCilVm* const pVm,
CVmObject* const pObject,
const wstring* const pName,
CVariable* const pVar,
const bool bSet )
{
assert( pObject != NULL );
if( bSet )
{
//Getter implementation
return pObject->lookupProperty( STRING_PROPERTY_INTERNAL_LENGTH );
}
else
{
//Setter implementation
int32_t iLength = 0;
//Check existing length
CVariable* pCurrentLengthVar = pObject->lookupProperty( STRING_PROPERTY_INTERNAL_LENGTH );
if( pCurrentLengthVar != NULL )
{
iLength = pCurrentLengthVar->toInt();
}
int32_t iGivenIndex = pVar->toInt();
//Just expanding the array, nothing to do
CVariable var( iGivenIndex,
OPERAND_FLAG( OPERAND_FLAG_DONTDELETE | OPERAND_FLAG_DONTENUM ) );
pObject->setProperty( STRING_PROPERTY_INTERNAL_LENGTH, var );
if( iGivenIndex < iLength )
{
//Reducing an array size, need to eliminate some entries
int32_t iNumToEliminate = iLength - iGivenIndex;
hash_map< wstring, CVariable >::iterator itStart =
pObject->getPropertyMap().begin();
hash_map< wstring, CVariable >::iterator itEnd =
pObject->getPropertyMap().end();
while( itStart != itEnd && iNumToEliminate )
{
if( itStart->second.iOperandFlag && OPERAND_FLAG_DONTENUM )
{
itStart++;
continue;
}
if( CheckArrayIndex( itStart->first ) )
{
const wstring& String = itStart->first;
itStart ++;
if( _wtoi( String.data() ) >= iGivenIndex )
{
pObject->removeProperty( String );
iNumToEliminate--;
}
}
else
itStart++;
}
}
return NULL;
}
}