本文整理汇总了C++中KeyedVector::replaceValueFor方法的典型用法代码示例。如果您正苦于以下问题:C++ KeyedVector::replaceValueFor方法的具体用法?C++ KeyedVector::replaceValueFor怎么用?C++ KeyedVector::replaceValueFor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KeyedVector
的用法示例。
在下文中一共展示了KeyedVector::replaceValueFor方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
argv++;
if (argc < 1) {
fprintf(stderr, "error: missing parameter for --base.\n");
usage();
return 1;
}
if (baseApkPath.size() > 0) {
fprintf(stderr, "error: multiple --base flags not allowed.\n");
usage();
return 1;
}
baseApkPath.setTo(*argv);
} else if (arg == "--generate") {
generateFlag = true;
} else if (arg == "--help") {
help();
return 0;
} else {
fprintf(stderr, "error: unknown argument '%s'.\n", arg.string());
usage();
return 1;
}
argc--;
argv++;
}
if (!generateFlag && targetConfigStr == "") {
usage();
return 1;
}
if (baseApkPath.size() == 0) {
fprintf(stderr, "error: missing --base argument.\n");
usage();
return 1;
}
// Find out some details about the base APK.
AppInfo baseAppInfo;
if (!getAppInfo(baseApkPath, baseAppInfo)) {
fprintf(stderr, "error: unable to read base APK: '%s'.\n", baseApkPath.string());
return 1;
}
SplitDescription targetSplit;
if (!generateFlag) {
if (!SplitDescription::parse(targetConfigStr, &targetSplit)) {
fprintf(stderr, "error: invalid --target config: '%s'.\n",
targetConfigStr.string());
usage();
return 1;
}
// We don't want to match on things that will change at run-time
// (orientation, w/h, etc.).
removeRuntimeQualifiers(&targetSplit.config);
}
splitApkPaths.add(baseApkPath);
KeyedVector<String8, Vector<SplitDescription> > apkPathSplitMap;
KeyedVector<SplitDescription, String8> splitApkPathMap;
Vector<SplitDescription> splitConfigs;
const size_t splitCount = splitApkPaths.size();
for (size_t i = 0; i < splitCount; i++) {
Vector<SplitDescription> splits = extractSplitDescriptionsFromApk(splitApkPaths[i]);
if (splits.isEmpty()) {
fprintf(stderr, "error: invalid --split path: '%s'. No splits found.\n",
splitApkPaths[i].string());
usage();
return 1;
}
apkPathSplitMap.replaceValueFor(splitApkPaths[i], splits);
const size_t apkSplitDescriptionCount = splits.size();
for (size_t j = 0; j < apkSplitDescriptionCount; j++) {
splitApkPathMap.replaceValueFor(splits[j], splitApkPaths[i]);
}
splitConfigs.appendVector(splits);
}
if (!generateFlag) {
Vector<SplitDescription> matchingConfigs = select(targetSplit, splitConfigs);
const size_t matchingConfigCount = matchingConfigs.size();
SortedVector<String8> matchingSplitPaths;
for (size_t i = 0; i < matchingConfigCount; i++) {
matchingSplitPaths.add(splitApkPathMap.valueFor(matchingConfigs[i]));
}
const size_t matchingSplitApkPathCount = matchingSplitPaths.size();
for (size_t i = 0; i < matchingSplitApkPathCount; i++) {
if (matchingSplitPaths[i] != baseApkPath) {
fprintf(stdout, "%s\n", matchingSplitPaths[i].string());
}
}
} else {
generate(apkPathSplitMap, baseApkPath);
}
return 0;
}