Extract the ProcessArbitraryContent method.
This commit is contained in:
parent
05bf9721e4
commit
dc742fe4be
|
@ -992,6 +992,57 @@ std::string GeneratorExpressionContent::GetOriginalExpression() const
|
|||
return std::string(this->StartContent, this->ContentLength);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
std::string GeneratorExpressionContent::ProcessArbitraryContent(
|
||||
const cmGeneratorExpressionNode *node,
|
||||
const std::string &identifier,
|
||||
cmGeneratorExpressionContext *context,
|
||||
cmGeneratorExpressionDAGChecker *dagChecker,
|
||||
std::vector<std::vector<cmGeneratorExpressionEvaluator*> >::const_iterator
|
||||
pit) const
|
||||
{
|
||||
std::string result;
|
||||
|
||||
const
|
||||
std::vector<std::vector<cmGeneratorExpressionEvaluator*> >::const_iterator
|
||||
pend = this->ParamChildren.end();
|
||||
for ( ; pit != pend; ++pit)
|
||||
{
|
||||
std::vector<cmGeneratorExpressionEvaluator*>::const_iterator it
|
||||
= pit->begin();
|
||||
const std::vector<cmGeneratorExpressionEvaluator*>::const_iterator end
|
||||
= pit->end();
|
||||
for ( ; it != end; ++it)
|
||||
{
|
||||
if (node->RequiresLiteralInput())
|
||||
{
|
||||
if ((*it)->GetType() != cmGeneratorExpressionEvaluator::Text)
|
||||
{
|
||||
reportError(context, this->GetOriginalExpression(),
|
||||
"$<" + identifier + "> expression requires literal input.");
|
||||
return std::string();
|
||||
}
|
||||
}
|
||||
result += (*it)->Evaluate(context, dagChecker);
|
||||
if (context->HadError)
|
||||
{
|
||||
return std::string();
|
||||
}
|
||||
}
|
||||
if ((pit + 1) != pend)
|
||||
{
|
||||
result += ",";
|
||||
}
|
||||
}
|
||||
if (node->RequiresLiteralInput())
|
||||
{
|
||||
std::vector<std::string> parameters;
|
||||
parameters.push_back(result);
|
||||
return node->Evaluate(parameters, context, this, dagChecker);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
std::string GeneratorExpressionContent::Evaluate(
|
||||
cmGeneratorExpressionContext *context,
|
||||
|
@ -1043,47 +1094,9 @@ std::string GeneratorExpressionContent::Evaluate(
|
|||
|
||||
if (node->AcceptsSingleArbitraryContentParameter())
|
||||
{
|
||||
std::string result;
|
||||
std::vector<std::vector<cmGeneratorExpressionEvaluator*> >::const_iterator
|
||||
pit = this->ParamChildren.begin();
|
||||
const
|
||||
std::vector<std::vector<cmGeneratorExpressionEvaluator*> >::const_iterator
|
||||
pend = this->ParamChildren.end();
|
||||
for ( ; pit != pend; ++pit)
|
||||
{
|
||||
std::vector<cmGeneratorExpressionEvaluator*>::const_iterator it
|
||||
= pit->begin();
|
||||
const std::vector<cmGeneratorExpressionEvaluator*>::const_iterator end
|
||||
= pit->end();
|
||||
for ( ; it != end; ++it)
|
||||
{
|
||||
if (node->RequiresLiteralInput())
|
||||
{
|
||||
if ((*it)->GetType() != cmGeneratorExpressionEvaluator::Text)
|
||||
{
|
||||
reportError(context, this->GetOriginalExpression(),
|
||||
"$<" + identifier + "> expression requires literal input.");
|
||||
return std::string();
|
||||
}
|
||||
}
|
||||
result += (*it)->Evaluate(context, dagChecker);
|
||||
if (context->HadError)
|
||||
{
|
||||
return std::string();
|
||||
}
|
||||
}
|
||||
if ((pit + 1) != pend)
|
||||
{
|
||||
result += ",";
|
||||
}
|
||||
}
|
||||
if (node->RequiresLiteralInput())
|
||||
{
|
||||
std::vector<std::string> parameters;
|
||||
parameters.push_back(result);
|
||||
return node->Evaluate(parameters, context, this, dagChecker);
|
||||
}
|
||||
return result;
|
||||
return this->ProcessArbitraryContent(node, identifier, context,
|
||||
dagChecker,
|
||||
this->ParamChildren.begin());
|
||||
}
|
||||
|
||||
std::vector<std::string> parameters;
|
||||
|
|
|
@ -129,6 +129,14 @@ private:
|
|||
cmGeneratorExpressionDAGChecker *dagChecker,
|
||||
std::vector<std::string> ¶meters) const;
|
||||
|
||||
std::string ProcessArbitraryContent(
|
||||
const cmGeneratorExpressionNode *node,
|
||||
const std::string &identifier,
|
||||
cmGeneratorExpressionContext *context,
|
||||
cmGeneratorExpressionDAGChecker *dagChecker,
|
||||
std::vector<std::vector<cmGeneratorExpressionEvaluator*> >::const_iterator
|
||||
pit) const;
|
||||
|
||||
private:
|
||||
std::vector<cmGeneratorExpressionEvaluator*> IdentifierChildren;
|
||||
std::vector<std::vector<cmGeneratorExpressionEvaluator*> > ParamChildren;
|
||||
|
|
Loading…
Reference in New Issue