本文整理汇总了C++中CBotVar::Or方法的典型用法代码示例。如果您正苦于以下问题:C++ CBotVar::Or方法的具体用法?C++ CBotVar::Or怎么用?C++ CBotVar::Or使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBotVar
的用法示例。
在下文中一共展示了CBotVar::Or方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Execute
//.........这里部分代码省略.........
{
left->Update(nullptr);
right->Update(nullptr);
}
if ( GetTokenType() == ID_ADD && type1.Eq(CBotTypString) )
{
TypeRes = CBotTypString;
}
CBotVar* temp;
if ( TypeRes == CBotTypPointer ) TypeRes = CBotTypNullPointer;
if ( TypeRes == CBotTypClass ) temp = CBotVar::Create("", CBotTypResult(CBotTypIntrinsic, type1.GetClass() ) );
else temp = CBotVar::Create("", TypeRes );
CBotError err = CBotNoErr;
// is a operation according to request
switch (GetTokenType())
{
case ID_ADD:
if ( !IsNan(left, right, &err) ) result->Add(left , right); // addition
break;
case ID_SUB:
if ( !IsNan(left, right, &err) ) result->Sub(left , right); // substraction
break;
case ID_MUL:
if ( !IsNan(left, right, &err) ) result->Mul(left , right); // multiplies
break;
case ID_POWER:
if ( !IsNan(left, right, &err) ) result->Power(left , right); // power
break;
case ID_DIV:
if ( !IsNan(left, right, &err) ) err = result->Div(left , right);// division
break;
case ID_MODULO:
if ( !IsNan(left, right, &err) ) err = result->Modulo(left , right);// remainder of division
break;
case ID_LO:
if ( !IsNan(left, right, &err) )
result->SetValInt(temp->Lo(left , right)); // lower
break;
case ID_HI:
if ( !IsNan(left, right, &err) )
result->SetValInt(temp->Hi(left , right)); // top
break;
case ID_LS:
if ( !IsNan(left, right, &err) )
result->SetValInt(temp->Ls(left , right)); // less than or equal
break;
case ID_HS:
if ( !IsNan(left, right, &err) )
result->SetValInt(temp->Hs(left , right)); // greater than or equal
break;
case ID_EQ:
if ( IsNan(left, right) )
result->SetValInt(left->GetInit() == right->GetInit()) ;
else
result->SetValInt(temp->Eq(left , right)); // equal
break;
case ID_NE:
if ( IsNan(left, right) )
result->SetValInt(left ->GetInit() != right->GetInit()) ;
else
result->SetValInt(temp->Ne(left , right)); // different
break;
case ID_TXT_AND:
case ID_LOG_AND:
case ID_AND:
if ( !IsNan(left, right, &err) ) result->And(left , right); // AND
break;
case ID_TXT_OR:
case ID_LOG_OR:
case ID_OR:
if ( !IsNan(left, right, &err) ) result->Or(left , right); // OR
break;
case ID_XOR:
if ( !IsNan(left, right, &err) ) result->XOr(left , right); // exclusive OR
break;
case ID_ASR:
if ( !IsNan(left, right, &err) ) result->ASR(left , right);
break;
case ID_SR:
if ( !IsNan(left, right, &err) ) result->SR(left , right);
break;
case ID_SL:
if ( !IsNan(left, right, &err) ) result->SL(left , right);
break;
default:
assert(0);
}
delete temp;
pStk2->SetVar(result); // puts the result on the stack
if ( err ) pStk2->SetError(err, &m_token); // and the possible error (division by zero)
// pStk1->Return(pStk2); // releases the stack
return pStack->Return(pStk2); // transmits the result
}