本文整理汇总了C++中CArray::GetIterator方法的典型用法代码示例。如果您正苦于以下问题:C++ CArray::GetIterator方法的具体用法?C++ CArray::GetIterator怎么用?C++ CArray::GetIterator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CArray
的用法示例。
在下文中一共展示了CArray::GetIterator方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
~CInstructions()
{
for(CArray<CInstruction *>::CIterator i = m_apList.GetIterator(); i.Exists(); i.Next())
MEM_DELETE(i.Get());
}
示例2: ExecInstructions
void CElement::ExecInstructions(const CArray<CInstruction *> *papInstructions, const CParameters *paParameters,
bool *pReturned, int *pReturnValue)
{
*pReturned = false;
for(CArray<CInstruction *>::CIterator i = papInstructions->GetIterator(); i.Exists(); i.Next())
{
if(m_Removed)
break;
CInstruction *pBaseInstr = i.Get();
m_pDatabase->SetCurrentInstruction(pBaseInstr->m_LineCount, pBaseInstr->m_Filename);
if(pBaseInstr->m_Type == INSTRUCTION_TYPE_SET_ATTRIBUTE)
{
CSetAttributeInstruction *pInstr = (CSetAttributeInstruction *)pBaseInstr;
CAttribute *pAttribute = FindAttribute(pInstr->m_AttributeName);
if(!pAttribute)
{
printf("error: unknown attribute '%s'\n", pInstr->m_AttributeName.GetString());
m_pDatabase->PrintCallstack();
continue;
}
if(pAttribute->m_Const && pAttribute->m_Defined)
{
printf("error: attribute const '%s' is already defined\n", pAttribute->m_pName);
m_pDatabase->PrintCallstack();
}
else
{
pAttribute->m_Value = ComputeValue(pInstr->m_Value, paParameters);
pAttribute->m_Defined = true;
#ifdef SPB_DEBUG
printf("success: attribute '%s' set to %d\n", pAttribute->m_pName, pAttribute->m_Value);
#endif
}
}
else if(pBaseInstr->m_Type == INSTRUCTION_TYPE_RETURN)
{
CReturnInstruction *pInstr = (CReturnInstruction *)pBaseInstr;
*pReturned = true;
*pReturnValue = ComputeValue(pInstr->m_Value, paParameters);
#ifdef SPB_DEBUG
printf("success: returned %d\n", *pReturnValue);
#endif
return;
}
else if(pBaseInstr->m_Type == INSTRUCTION_TYPE_IF)
{
CIfInstruction *pInstr = (CIfInstruction *)pBaseInstr;
bool True = CheckIf(&pInstr->m_IfData, paParameters);
if(True)
ExecInstructions(&pInstr->m_IfData.m_Instructions.m_apList, paParameters, pReturned, pReturnValue);
else
{
for(CArray<CIfData>::CIterator i = pInstr->m_aElsifDatas.GetIterator(); i.Exists(); i.Next())
{
CIfData *pElsifData = &i.Get();
m_pDatabase->SetCurrentInstruction(pElsifData->m_LineCount, pBaseInstr->m_Filename);
True = CheckIf(pElsifData, paParameters);
if(True)
{
ExecInstructions(&pElsifData->m_Instructions.m_apList, paParameters, pReturned, pReturnValue);
break;
}
}
if(!True)
ExecInstructions(&pInstr->m_InstructionsElse.m_apList, paParameters, pReturned, pReturnValue);
}
if(*pReturned)
return;
}
else if(pBaseInstr->m_Type == INSTRUCTION_TYPE_FROM)
{
CFromInstruction *pInstr = (CFromInstruction *)pBaseInstr;
int StartVal = ComputeValue(pInstr->m_StartValue, paParameters);
int EndVal = ComputeValue(pInstr->m_EndValue, paParameters);
#ifdef SPB_DEBUG
printf("success: from %d to %d (reverse %d)\n", StartVal, EndVal, pInstr->m_Reverse);
#endif
CParameters aFromParameters;
paParameters->GetCopy(&aFromParameters);
int *pNewParameter = &aFromParameters.Add();
if(pInstr->m_Reverse)
{
for(int v = StartVal; v >= EndVal; v--)
{
*pNewParameter = v;
ExecInstructions(&pInstr->m_Instructions.m_apList, &aFromParameters, pReturned, pReturnValue);
if(*pReturned)
return;
}
}
else
{
for(int v = StartVal; v <= EndVal; v++)
{
*pNewParameter = v;
ExecInstructions(&pInstr->m_Instructions.m_apList, &aFromParameters, pReturned, pReturnValue);
if(*pReturned)
return;
//.........这里部分代码省略.........