本文整理汇总了C++中ArtifactSet::size方法的典型用法代码示例。如果您正苦于以下问题:C++ ArtifactSet::size方法的具体用法?C++ ArtifactSet::size怎么用?C++ ArtifactSet::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArtifactSet
的用法示例。
在下文中一共展示了ArtifactSet::size方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: translateInOutputs
QScriptValue Transformer::translateInOutputs(ScriptEngine *scriptEngine,
const ArtifactSet &artifacts,
const QString &defaultModuleName)
{
using TagArtifactsMap = QMap<QString, QList<Artifact*>>;
TagArtifactsMap tagArtifactsMap;
for (Artifact *artifact : artifacts)
for (const FileTag &fileTag : artifact->fileTags())
tagArtifactsMap[fileTag.toString()].push_back(artifact);
for (TagArtifactsMap::Iterator it = tagArtifactsMap.begin(); it != tagArtifactsMap.end(); ++it)
std::sort(it.value().begin(), it.value().end(), compareByFilePath);
QScriptValue jsTagFiles = scriptEngine->newObject();
for (TagArtifactsMap::const_iterator tag = tagArtifactsMap.constBegin(); tag != tagArtifactsMap.constEnd(); ++tag) {
const QList<Artifact*> &artifacts = tag.value();
QScriptValue jsFileConfig = scriptEngine->newArray(artifacts.size());
int i = 0;
for (Artifact * const artifact : artifacts) {
jsFileConfig.setProperty(i++, translateFileConfig(scriptEngine, artifact,
defaultModuleName));
}
jsTagFiles.setProperty(tag.key(), jsFileConfig);
}
return jsTagFiles;
}
示例2: setupInputs
void Transformer::setupInputs(QScriptValue targetScriptValue, const ArtifactSet &inputs,
const QString &defaultModuleName)
{
const auto scriptEngine = static_cast<ScriptEngine *>(targetScriptValue.engine());
QScriptValue scriptValue = translateInOutputs(scriptEngine, inputs, defaultModuleName);
targetScriptValue.setProperty(StringConstants::inputsVar(), scriptValue);
QScriptValue inputScriptValue;
if (inputs.size() == 1) {
Artifact *input = *inputs.cbegin();
const FileTags &fileTags = input->fileTags();
QBS_ASSERT(!fileTags.empty(), return);
QScriptValue inputsForFileTag = scriptValue.property(fileTags.cbegin()->toString());
inputScriptValue = inputsForFileTag.property(0);
}