本文整理汇总了C++中CCString::SetValue方法的典型用法代码示例。如果您正苦于以下问题:C++ CCString::SetValue方法的具体用法?C++ CCString::SetValue怎么用?C++ CCString::SetValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCString
的用法示例。
在下文中一共展示了CCString::SetValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
ICCItem *CCodeChain::CreateString (const CString &sString)
// CreateString
//
// Creates an item
{
ICCItem *pItem;
CCString *pString;
pItem = m_StringPool.CreateItem(this);
if (pItem->IsError())
return pItem;
pString = dynamic_cast<CCString *>(pItem);
pString->Reset();
pString->SetValue(sString);
return pString->Reference();
}
示例2: EvalLiteralStruct
//.........这里部分代码省略.........
// mody a copy instead of the original.
else
{
ICCItem *pResult = pItem->Clone(this);
pResult->ClearQuoted();
return pResult;
}
}
// Evaluate differently depending on whether or not
// this is an atom or a list. If it is an atom, either return
// the value or look up the atom in a symbol table. If the item
// is a list, try to evaluate as a function
else if (pItem->IsIdentifier())
return Lookup(pEvalCtx, pItem);
// If this is an expression (a list with multiple terms) then we
// try to evaluate it.
else if (pItem->IsExpression())
{
ICCItem *pFunctionName;
ICCItem *pFunction;
ICCItem *pArgs;
ICCItem *pResult;
// The first element of the list is the function
pFunctionName = pItem->Head(this);
// We must have a first element since this is a list (but not Nil)
ASSERT(pFunctionName);
// If this is an identifier, then look up the function
// in the global symbols
if (pFunctionName->IsIdentifier())
pFunction = LookupFunction(pEvalCtx, pFunctionName);
// Otherwise, evaluate it
else
pFunction = Eval(pEvalCtx, pFunctionName);
// If we get an error, return it
if (pFunction->IsError())
return pFunction;
// Make sure this is a function
if (!pFunction->IsFunction())
{
pFunction->Discard(this);
return CreateError(LITERAL("Function name expected"), pFunctionName);
}
// Get the arguments
pArgs = pItem->Tail(this);
// Do it
pResult = pFunction->Execute(pEvalCtx, pArgs);
// Handle error by appending the function call that failed
if (pResult->IsError())
{
CCString *pError = dynamic_cast<CCString *>(pResult);
if (pError)
{
CString sError = pError->GetValue();
if (!sError.IsBlank())
{
char *pPos = sError.GetASCIIZPointer() + sError.GetLength() - 1;
if (*pPos != '#')
{
sError.Append(strPatternSubst(CONSTLIT(" ### %s ###"), pItem->Print(this)));
pError->SetValue(sError);
}
}
}
}
// Done
pFunction->Discard(this);
pArgs->Discard(this);
return pResult;
}
// Anything else is a literal so we return it.
else
return pItem->Reference();
}