本文整理汇总了C++中CVariable::convertToString方法的典型用法代码示例。如果您正苦于以下问题:C++ CVariable::convertToString方法的具体用法?C++ CVariable::convertToString怎么用?C++ CVariable::convertToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CVariable
的用法示例。
在下文中一共展示了CVariable::convertToString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: join
/***************************************************************************
* join property
***************************************************************************/
void CArrayObject::join( CCilVm* const pVm,
const int32_t iNumArguments,
CVariable* pArguments )
{
assert( iNumArguments >= 1 );
CVariable& varThis = *pArguments;
wstring sSeparator = wstring( STRING_INTERNAL_JOIN_DEFAULT_SEPARATOR );
//Set up separator string
if( iNumArguments > 1 )
{
//Set new separator
pArguments ++;
sSeparator = *pArguments->toString( pVm );
}
//Initialize destination variable in the eval stack
pVm->pushEvalStackUndefined();
CVariable& var = pVm->getEvalStackFirstEntry();
var.iOperandType = OPERAND_STRING;
var.pString = new wstring(L"");
uint32_t iIndex = 0;
uint32_t iLength = 0;
hash_map< wstring, CVariable >::iterator itStart = varThis.refObject->getPropertyMap().begin();
hash_map< wstring, CVariable >::iterator itEnd = varThis.refObject->getPropertyMap().end();
while( itStart != itEnd )
{
bool bDigit = CheckArrayIndex( itStart->first );
if( bDigit )
iLength ++;
itStart++;
}
wchar_t strIndex[ 16 ];
while( iLength )
{
swprintf( strIndex, 16, L"%d", iIndex );
CVariable* pvar;
pvar = varThis.refObject->lookupProperty( strIndex );
if( iIndex )
var.pString->append( sSeparator );
iIndex++;
if( pvar )
{
CVariable varTmp = *pvar;
//To eliminate recursive death
if( varThis.refObject != varTmp.refObject ||
varTmp.iOperandType != OPERAND_OBJECTREF )
{
varTmp.convertToString( pVm );
var.pString->append( *varTmp.pString );
}
iLength--;
}
}
return;
}