diff options
author | Adam Lesinski <adamlesinski@google.com> | 2014-11-03 12:05:15 -0800 |
---|---|---|
committer | Adam Lesinski <adamlesinski@google.com> | 2014-11-03 12:09:58 -0800 |
commit | c3dc0b57b8d0b3875f868788e110aa67fb032b4a (patch) | |
tree | d29bf5702b81c4f283ae5e463af00c1e9327d459 /tools/aapt | |
parent | 425b1dc88c47e0e9d3a653ad902a69f3ec09b966 (diff) | |
download | frameworks_base-c3dc0b57b8d0b3875f868788e110aa67fb032b4a.zip frameworks_base-c3dc0b57b8d0b3875f868788e110aa67fb032b4a.tar.gz frameworks_base-c3dc0b57b8d0b3875f868788e110aa67fb032b4a.tar.bz2 |
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
Diffstat (limited to 'tools/aapt')
-rw-r--r-- | tools/aapt/AaptUtil.h | 40 |
1 files changed, 37 insertions, 3 deletions
diff --git a/tools/aapt/AaptUtil.h b/tools/aapt/AaptUtil.h index 47a704a..89e1ee8 100644 --- a/tools/aapt/AaptUtil.h +++ b/tools/aapt/AaptUtil.h @@ -14,9 +14,11 @@ * limitations under the License. */ -#ifndef __AAPT_UTIL_H -#define __AAPT_UTIL_H +#ifndef H_AAPT_UTIL +#define H_AAPT_UTIL +#include <utils/KeyedVector.h> +#include <utils/SortedVector.h> #include <utils/String8.h> #include <utils/Vector.h> @@ -25,6 +27,38 @@ namespace AaptUtil { android::Vector<android::String8> split(const android::String8& str, const char sep); android::Vector<android::String8> splitAndLowerCase(const android::String8& str, const char sep); +template <typename KEY, typename VALUE> +void appendValue(android::KeyedVector<KEY, android::Vector<VALUE> >& keyedVector, + const KEY& key, const VALUE& value); + +template <typename KEY, typename VALUE> +void appendValue(android::KeyedVector<KEY, android::SortedVector<VALUE> >& keyedVector, + const KEY& key, const VALUE& value); + +// +// Implementations +// + +template <typename KEY, typename VALUE> +void appendValue(android::KeyedVector<KEY, android::Vector<VALUE> >& keyedVector, + const KEY& key, const VALUE& value) { + ssize_t idx = keyedVector.indexOfKey(key); + if (idx < 0) { + idx = keyedVector.add(key, android::Vector<VALUE>()); + } + keyedVector.editValueAt(idx).add(value); +} + +template <typename KEY, typename VALUE> +void appendValue(android::KeyedVector<KEY, android::SortedVector<VALUE> >& keyedVector, + const KEY& key, const VALUE& value) { + ssize_t idx = keyedVector.indexOfKey(key); + if (idx < 0) { + idx = keyedVector.add(key, android::SortedVector<VALUE>()); + } + keyedVector.editValueAt(idx).add(value); +} + } // namespace AaptUtil -#endif // __AAPT_UTIL_H +#endif // H_AAPT_UTIL |