本文整理汇总了C++中CCodeChain::CreateTrue方法的典型用法代码示例。如果您正苦于以下问题:C++ CCodeChain::CreateTrue方法的具体用法?C++ CCodeChain::CreateTrue怎么用?C++ CCodeChain::CreateTrue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCodeChain
的用法示例。
在下文中一共展示了CCodeChain::CreateTrue方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CONSTLIT
ICCItem *fnVector (CEvalContext *pCtx, ICCItem *pArguments, DWORD dwData)
// fnVector
//
// Vector functions
//
// (vecSetElement vector index element)
{
CCodeChain *pCC = pCtx->pCC;
ICCItem *pArgs;
CCVector *pVector;
BOOL bOk;
// Evaluate the arguments
pArgs = pCC->EvaluateArgs(pCtx, pArguments, CONSTLIT("vii"));
if (pArgs->IsError())
return pArgs;
// Get the vector
pVector = dynamic_cast<CCVector *>(pArgs->GetElement(0));
if (pVector == NULL)
{
ICCItem *pError = pCC->CreateError(CONSTLIT("Vector expected:"), pArgs->GetElement(0));;
pArgs->Discard(pCC);
return pError;
}
// Set the element
bOk = pVector->SetElement(pArgs->GetElement(1)->GetIntegerValue(),
pArgs->GetElement(2)->GetIntegerValue());
if (!bOk)
{
pArgs->Discard(pCC);
return pCC->CreateError(CONSTLIT("Unable to set vector element"), NULL);
}
// Done
pArgs->Discard(pCC);
return pCC->CreateTrue();
}
示例2: if
ICCItem *fnLogical (CEvalContext *pCtx, ICCItem *pArguments, DWORD dwData)
// fnLogical
//
// Logical operators
//
// (and exp1 exp2 ... expn)
// (or exp1 exp2 ... expn)
{
CCodeChain *pCC = pCtx->pCC;
int i;
// Loop over all arguments
for (i = 0; i < pArguments->GetCount(); i++)
{
ICCItem *pResult;
ICCItem *pArg = pArguments->GetElement(i);
// Evaluate the item
if (pArg->IsQuoted())
pResult = pArg->Reference();
else
{
pResult = pCC->Eval(pCtx, pArg);
if (pResult->IsError())
return pResult;
}
// If we are evaluating NOT then reverse the value
if (dwData == FN_LOGICAL_NOT)
{
if (pResult->IsNil())
{
pResult->Discard(pCC);
return pCC->CreateTrue();
}
else
{
pResult->Discard(pCC);
return pCC->CreateNil();
}
}
// If we are evaluating AND and we've got Nil, then
// we can guarantee that the expression is Nil
else if (dwData == FN_LOGICAL_AND && pResult->IsNil())
return pResult;
// Otherwise, if we're evaluating OR and we've got non-Nil,
// then we can guarantee that the expression is True
else if (dwData == FN_LOGICAL_OR && !pResult->IsNil())
{
pResult->Discard(pCC);
return pCC->CreateTrue();
}
// Otherwise, we continue
pResult->Discard(pCC);
}
// If we get here then all the operands are the same (either all
// True or all Nil depending)
if (dwData == FN_LOGICAL_AND)
return pCC->CreateTrue();
else
return pCC->CreateNil();
}
示例3: GetCC
ICCItem *CLImageArea::SetData (ICCItem *pData)
// SetData
//
// Sets the data being displayed
{
ALERROR error;
CCodeChain *pCC = GetCC();
ICCItem *pItem;
CCVector *pBits;
HBITMAP hBitmap;
BOOL bOk;
RECT rcImage;
// Get the size
pItem = GetTF()->ObjMethod(pData, METHOD_IGetImageRect, NULL, NULL, NULL);
if (pItem->IsError())
return pItem;
bOk = CLSizeOptions::ConvertItemToRect(pItem, &rcImage);
pItem->Discard(pCC);
if (!bOk)
return pCC->CreateError(LITERAL("Invalid image size"), NULL);
// Get the actual bits
pItem = GetTF()->ObjMethod(pData, METHOD_IGetRawImage, NULL, NULL, NULL);
if (pItem->IsError())
return pItem;
// Convert to a vector
pBits = dynamic_cast<CCVector *>(pItem);
if (pBits == NULL)
{
pItem->Discard(pCC);
return pCC->CreateError(LITERAL("Invalid raw image"), NULL);
}
// Convert to a DDB
if (error = rawConvertToDDB(RectWidth(&rcImage),
RectHeight(&rcImage),
(RAWPIXEL *)pBits->GetArray(),
0,
NULL,
&hBitmap))
{
pBits->Discard(pCC);
return pCC->CreateSystemError(error);
}
// Free any old bitmaps
if (m_hImage)
DeleteObject(m_hImage);
// Remember the new data
m_hImage = hBitmap;
m_rcImage = rcImage;
// Repaint
m_pWindow->UpdateRect(&m_rcRect);
// Done
return pCC->CreateTrue();
}