Build the split-select tool without C++11 support
It was complicated to get the tool building on Windows, Linux,
and OSX with C++11 support.
OSX uses Clang to build C++11 binaries, which requires the libc++
standard library. Since most of the dependencies of this program
are built against libstdc++, this was difficult to resolve.
Now we build without C++11 support.
Change-Id: I4e537c113734508a8f480a1c402ed237de4f0e60
diff --git a/tools/split-select/Grouper.cpp b/tools/split-select/Grouper.cpp
index 15edf89..22685cd 100644
--- a/tools/split-select/Grouper.cpp
+++ b/tools/split-select/Grouper.cpp
@@ -16,25 +16,17 @@
#include "Grouper.h"
+#include "aapt/AaptUtil.h"
#include "SplitDescription.h"
#include <utils/KeyedVector.h>
#include <utils/Vector.h>
using namespace android;
+using AaptUtil::appendValue;
namespace split {
-template <typename Key, typename Value>
-static void addToVector(KeyedVector<Key, SortedVector<Value> >& group,
- const Key& key, const Value& value) {
- ssize_t idx = group.indexOfKey(key);
- if (idx < 0) {
- idx = group.add(key, SortedVector<Value>());
- }
- group.editValueAt(idx).add(value);
-}
-
Vector<SortedVector<SplitDescription> >
groupByMutualExclusivity(const Vector<SplitDescription>& splits) {
Vector<SortedVector<SplitDescription> > groups;
@@ -43,20 +35,22 @@
KeyedVector<SplitDescription, SortedVector<SplitDescription> > densityGroups;
KeyedVector<SplitDescription, SortedVector<SplitDescription> > abiGroups;
KeyedVector<SplitDescription, SortedVector<SplitDescription> > localeGroups;
- for (const SplitDescription& split : splits) {
+ const size_t splitCount = splits.size();
+ for (size_t i = 0; i < splitCount; i++) {
+ const SplitDescription& split = splits[i];
if (split.config.density != 0) {
SplitDescription key(split);
key.config.density = 0;
key.config.sdkVersion = 0; // Ignore density so we can support anydpi.
- addToVector(densityGroups, key, split);
- } else if (split.abi != abi::Variant::none) {
+ appendValue(densityGroups, key, split);
+ } else if (split.abi != abi::Variant_none) {
SplitDescription key(split);
- key.abi = abi::Variant::none;
- addToVector(abiGroups, key, split);
+ key.abi = abi::Variant_none;
+ appendValue(abiGroups, key, split);
} else if (split.config.locale != 0) {
SplitDescription key(split);
key.config.clearLocale();
- addToVector(localeGroups, key, split);
+ appendValue(localeGroups, key, split);
} else {
groups.add();
groups.editTop().add(split);